Skip to content

[SYCL] Fix method definition of sub_group_mask::group_ballot #8212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

haroon26
Copy link
Contributor

@haroon26 haroon26 commented Feb 6, 2023

Closes #8201
provided default value for predicate argument in sub_group_mask::group_ballot definition

@haroon26 haroon26 requested a review from a team as a code owner February 6, 2023 15:22
@haroon26 haroon26 temporarily deployed to aws February 6, 2023 15:26 — with GitHub Actions Inactive
@haroon26
Copy link
Contributor Author

haroon26 commented Feb 6, 2023

I have checked the issue and found that there will be error to provide default argument to group_ballot definition.
If I just provide default argument to declaration of the method, another error generates which force to define method right after declaration.
Here, I want the opinion if we should go with finding a way to provide default argument to group_ballot, or should change the documentation accordingly?

@bader bader changed the title [SYCL][FIX] Fixed method definition of sub_group_mask::group_ballot [SYCL] Fix method definition of sub_group_mask::group_ballot Feb 6, 2023
@sergey-semenov
Copy link
Contributor

@haroon26 If I understand correctly, the reason you get an error is because you're adding a default argument to a friend declaration. Adding a non-friend declaration earlier, outside sub_group_mask, and specifying the default argument there should do the trick.

@haroon26 haroon26 temporarily deployed to aws February 7, 2023 14:26 — with GitHub Actions Inactive
@haroon26
Copy link
Contributor Author

haroon26 commented Feb 7, 2023

Hello @sergey-semenov! Thanks for your suggestion. But again there is a problem if we define the method before class. The defintion says:

template <typename Group>
detail::enable_if_t<std::is_same<std::decay_t<Group>, sub_group>::value,
                    sub_group_mask>
group_ballot(Group g, bool predicate = true);

And you can see that in the return type, we are actually using sub_group, which will be not declared at that point. So this will also cause error.

@sergey-semenov
Copy link
Contributor

That can be resolved by adding a forward declaration of sub_group_mask as well.

@AlexeySachkov
Copy link
Contributor

@haroon26, could you please also add a test for the change? Just a simple -fsyntax-only test which checks compilation would be enough

@haroon26 haroon26 temporarily deployed to aws February 8, 2023 15:24 — with GitHub Actions Inactive
@haroon26 haroon26 temporarily deployed to aws February 8, 2023 16:17 — with GitHub Actions Inactive
@AlexeySachkov AlexeySachkov temporarily deployed to aws March 8, 2023 10:58 — with GitHub Actions Inactive
@AlexeySachkov AlexeySachkov temporarily deployed to aws March 8, 2023 12:27 — with GitHub Actions Inactive
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you, @haroon26 !

@steffenlarsen steffenlarsen merged commit e4024d7 into intel:sycl Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

group_ballot predicate argument should be defaulted
4 participants