-
Notifications
You must be signed in to change notification settings - Fork 798
[SYCL] Add sycl-single-task implict property on single_task #8190
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] Add sycl-single-task implict property on single_task #8190
Conversation
This commit adds the "sycl-single-task" LLVM IR attribute to all SYCL kernels originating from single_task calls. Leveraging the existing mechanism for creating attributes for the SYCL kernel compile-time properties extension, applying the add_ir_attributes_function to SYCL kernel wrappers, this new attribute acts like a kernel compile-time property. To avoid this implicit attribute from causing property/attribute conflict warnings, a special rule is made in the frontend to skip the conflict check if it is the only value in the add_ir_attributes_function attribute. Additionally, this commit adds special handling of "sycl-single-task" when targeting "spir64_fpga", in which case it will cause a "max_global_work_dim" metadata node to be created with value "0" on functions where it is present. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.
I just have a request for adding comments, but otherwise, FE changes look okay to me.
@@ -8007,10 +8007,23 @@ static bool checkSYCLAddIRAttributesMergeability(const AddIRAttrT &NewAttr, | |||
|
|||
void Sema::CheckSYCLAddIRAttributesFunctionAttrConflicts(Decl *D) { | |||
const auto *AddIRFuncAttr = D->getAttr<SYCLAddIRAttributesFunctionAttr>(); | |||
if (!AddIRFuncAttr || AddIRFuncAttr->args_size() == 0 || | |||
if (!AddIRFuncAttr || | |||
hasDependentExpr(AddIRFuncAttr->args_begin(), AddIRFuncAttr->args_size())) | |||
return; | |||
|
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.
Could you please add a comment here about what this computation does?
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 shout. I have added some comments to the skip criteria.
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.
Sorry for silly comments, I still don't fully understand the whole "comple time properties" thing.
clang/lib/Sema/SemaDeclAttr.cpp
Outdated
if (NumArgsWithoutFilter == 0) | ||
return; | ||
|
||
// "sycl-single-task" is an implicitly used name which is present on all |
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.
Did I get it right that here under "implicit" actually meant "explicit" (i.e. written in code explicitly) but it happens in SYCL implementation code, so for an end user this is still "implicit"?
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.
Right! Implicit from the perspective of the user, but explicit inside the SYCL headers. I have clarified this in the comment.
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
clang/test/SemaSYCL/attr-add-ir-attributes-function-conflict.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.
Removing approval till questions are clarified.
@intel/llvm-reviewers-runtime & @intel/dpcpp-tools-reviewers - Friendly ping. |
@intel/llvm-reviewers-runtime - Friendly ping. |
1 similar comment
@intel/llvm-reviewers-runtime - Friendly ping. |
This commit adds the "sycl-single-task" LLVM IR attribute to all SYCL kernels originating from single_task calls. Leveraging the existing mechanism for creating attributes for the SYCL kernel compile-time properties extension, applying the add_ir_attributes_function to SYCL kernel wrappers, this new attribute acts like a kernel compile-time property.
To avoid this implicit attribute from causing property/attribute conflict warnings, a special rule is made in the frontend to skip the conflict check if it is the only value in the add_ir_attributes_function attribute.
Additionally, this commit adds special handling of "sycl-single-task" when targeting "spir64_fpga", in which case it will cause a "max_global_work_dim" metadata node to be created with value "0" on functions where it is present.