-
Notifications
You must be signed in to change notification settings - Fork 791
[SYCL][clang] Implement merging of add_ir_attributes_* attributes #20419
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
base: sycl
Are you sure you want to change the base?
[SYCL][clang] Implement merging of add_ir_attributes_* attributes #20419
Conversation
This commit adds the implementation logic for merging __sycl_detail__::add_ir_attributes_* attributes, which will enable the ability to apply multiple of the same attribute to the same declaration/definition, as long as the values associated to the same names in the attributes do not conflict. This is needed for SYCL free function support as the way SYCL properties are applied are through macros expanding to __sycl_detail__::add_ir_attributes_* with a single name-value-pair. Signed-off-by: Larsen, Steffen <[email protected]>
| if (checkSYCLAddIRAttributesMergeability(A, *ExistingAttr, *this)) | ||
| return nullptr; | ||
|
|
||
| D->dropAttr<SYCLAddIRAttributesFunctionAttr>(); |
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 don't fully recall how this code works but are you required to drop here if you're dropping in the add function?
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 point! Since merge is used in multiple places, it makes the most sense to me to remove the attribute dropping in the add function.
| // CHECK-NEXT: ConstantExpr {{.*}} 'bool' | ||
| // CHECK-NEXT: value: Int 1 | ||
| // CHECK-NEXT: CXXBoolLiteralExpr {{.*}} 'bool' true | ||
| [[__sycl_detail__::add_ir_attributes_function({"Attr1", "Attr3"}, "Attr1", "Attr2", 1, true)]] |
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.
Can you remind me how filters work again?
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.
The filters mean that only the attributes with the names in the filter will get a corresponding IR attribute.
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
This commit adds the implementation logic for merging sycl_detail::add_ir_attributes_* attributes, which will enable the ability to apply multiple of the same attribute to the same declaration/definition, as long as the values associated to the same names in the attributes do not conflict.
This is needed for SYCL free function support as the way SYCL properties are applied are through macros expanding to
sycl_detail::add_ir_attributes_* with a single name-value-pair.