-
Notifications
You must be signed in to change notification settings - Fork 80
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
Fix incorrect all_of validation when sub-group size is 1 #795
Conversation
This problem technically also applies to the corresponding work-group tests, but I'm assuming we'll never run those tests with a work-group size of 1. |
38cb9f0
to
5569ee0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
I'm assuming we'll never run those tests with a work-group size of 1.
Probably it's worth adding an assertion for that + a comment which of existing checks not work for a work-group size of 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Could you add a comment in front of all your changes explaining the problem?
Thanks for comments, will address later in the day. I have another question, though. I was looking at this again with your feedback in mind, but is it valid for the I ask because I thought it was invalid to make assumptions about the mapping of work-items to sub-group items. The But also (noticed while writing this comment) is the |
5569ee0
to
5c072c5
Compare
I've updated with the comments requested. |
@frasercrmck do you plan to dive into your discoveries in your last comment? |
If you agree they're real issues, yeah I can certainly take a look. I would prefer to keep that to a separate task/PR though if that's alright; I might need some guidance and a bit more back-and-forth as I'm not actually very that used to writing SYCL. Is that okay? |
When the sub-group size is 1, the 'one_true' and 'some_true' predicates return true, so we should instead be checking that all_of returns true.
5c072c5
to
c45df61
Compare
sub-groups are very confusing to me. After looking at the SYCL specification, I have the feeling that the problem you expose is real. |
As discovered/discussed in KhronosGroup#795, the `predicate_function_of_sub_group` test was using the global linear ID to perform sub-group 'of' checks. The checks were only being run on the first sub-group (with ID 0). This was implicitly relying on the first sub-group containing the work-items with IDs from 0 up to the sub-group size, as the checks included conditions like exactly one ID being 1. This is not correct in general, as the mapping between work-items and sub-group items is not defined. In addition, this commit also enhances the sub-group tests to check that *all* sub-groups in the work-group return the correct result. Before we were either checking only the *first* sub-group (`predicate_function_of_sub_group`) or checking all sub-groups but overwriting the results each time, so in effect only checking the *last* sub-group. Now the results are initialized to 'true' and each sub-group is run and its results are merged with all of the other results.
When the sub-group size is 1, the 'one_true' and 'some_true' predicates return true, so we should instead be checking that
all_of
returns true.