-
Notifications
You must be signed in to change notification settings - Fork 768
[SYCL] Refactor reqd_work_group_size attribute implementation #5782
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
[SYCL] Refactor reqd_work_group_size attribute implementation #5782
Conversation
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
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.
Looks like it's heading in the right direction at a high level. One thing that would be nice (but perhaps not easy to do) would be to see how much attribute checking code can be refactored to share between the Add and Merge functions here. They're doing the same things notionally (as best I saw), so it'd be nice to only write that logic once if possible. However, that might require more refactoring that's better left until later.
Signed-off-by: Soumi Manna <[email protected]>
…ad of the SExtValue Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Agreed. Existing implementation of "reqd_work_group_size" is very messy condition. This refactorization will fix several missing diagnostics and compilation crashes. I would like to do this (refactor the login once) in a separate PR. Not easy way to do this. @AaronBallman, would it be OK ? |
Signed-off-by: Soumi Manna <[email protected]>
Sorry for the force push. I was having issues to push my changes due to recent pulldown. |
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
clang/test/SemaSYCL/intel-reqd-work-group-size-device-direct-prop.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
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.
LGTM. Thanks!
Just wanted to point out that #3175 might still need more work. I see tests with FIXME for default value still. So we probably should not close this bug till we're sure of optional argument behavior.
// Same for the default values.
// FIXME: This turns out to be wrong as there aren't really default values
// (that is an implementation detail we use but shouldn't expose to the user).
// Instead, the dimensionality of the attribute needs to match that of the
// kernel, so the one, two, and three arg forms of the attribute are actually
// *different* attributes. This means that you should not be able to redeclare
// the function with a different dimensionality.
[[sycl::reqd_work_group_size(4)]] void four_again();
[[sycl::reqd_work_group_size(4)]] void four_again(); // OK
[[sycl::reqd_work_group_size(4, 1)]] void four_again(); // OK
[[sycl::reqd_work_group_size(4, 1)]] void four_again(); // OK
[[sycl::reqd_work_group_size(4, 1, 1)]] void four_again(); // OK
[[sycl::reqd_work_group_size(4, 1, 1)]] void four_again(); // OK
Thanks for the reviews!
This is related to NULL value check issue and assertion, so this is covered by current patch. |
ping @premanandrao and @AaronBallman |
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.
All minor nits. Changes are getting way better @smanna12!
@AaronBallman, are you OK with the patch? Do you have any more concerns? Thank you |
Nope, this LGTM (I didn't spot anything with my quick once over from today). |
Thank you everyone for the reviews! |
@@ -84,3 +84,18 @@ int check() { | |||
// CHECK-NEXT: SubstNonTypeTemplateParmExpr {{.*}} | |||
// CHECK-NEXT: NonTypeTemplateParmDecl {{.*}} | |||
// CHECK-NEXT: IntegerLiteral{{.*}}8{{$}} | |||
|
|||
// No diagnostic is emitted because the arguments match. Duplicate attribute is silently ignored. | |||
[[sycl::reqd_work_group_size(4, 4, 4)]] [[sycl::reqd_work_group_size(4, 4, 4)]] void func4() {} |
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.
We should not push new symmetrical examples/test like this.
Any mixing X, Y and Z would just pass the test.
This patch
refactors SYCL kernel function attribute reqd_work_group_size to better fit for community standards.
refactors the way we handled duplicate attributes logic with when present on a given declaration.
refactors the way we handled mutually exclusive attributes logic with when present on a given declaration with
reqd_work_group_size, max_work_group_size, max_global_work_dim, and num_simd_work_items attributes.
handles redeclarations or template instantiations properly.
stores ConstantExpr into the semantic attribute rather than calling getIntegerConstantExpr() for attribute dimension values.
fixes crash with optional arguments on ReqdWorkGroupAttr and adds missing diagnostics for merging cases when present
on a given declaration with reqd_work_group_size, max_work_group_size, max_global_work_dim, and num_simd_work_items
attributes.
updates clang-tidy build after reqd_work_group_size attribute changes.
adds tests.
This patch fixes
#5736, #5735, #5734, #5732, #5731, #3223, #3361, #3175, #3742, and #5733
Signed-off-by: Soumi Manna [email protected]