-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Add an attr tablegen feature for checking langopts #3234
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 an attr tablegen feature for checking langopts #3234
Conversation
For SYCL, we want some attributes to be ignored in host mode, but without diagnosing the attribute as being ignored. This adds a bit to the tablegen emitter to specify that a given language option opts into this behavior. This allows us to more naturally specify that an attribute is a device-only attribute from Attr.td without adding logic in SemaDeclAttr.cpp to bail out in host mode (which looks like a bug due to the lack of an ignored attribute warning). As a drive-by, this also corrects a think-o with the [[intel::reqd_sub_group_size]] attribute in OpenCL mode, which was always being silently dropped.
I should note: there are more attributes in Attr.td that should be investigated. I hit all the ones that should be an NFC change (aside from the OpenCL-related fix). We have some attributes that have no spellings (those don't need any LangOpts) and we have a bunch that have no checking for them in SemaDeclAttr.cpp but specify both device and host in Attr.td. |
inside SemaStmtAttr.cpp, i see checking for all loop attributes. I think they all will be removed as well. |
Good call, I'll work on those for this patch as well. |
We still want to list explicitly that the attribute is accepted in host mode, otherwise there's no good way to see that the attribute is silently being accepted there. This complicates the tablegen slightly, but also makes for a more obvious feature.
(Statement attributes do not currently utilize the tablegen functionality for checking things like language options and subjects.)
I've added the right definitions to Attr.td, but that's as far as I think I'll go with that in this patch. Statement attributes do not have the same common attribute handling code as declaration attributes, so we don't take advantage of much of the tablegen goodies for those. I need to work on a patch to improve that, but that'll be an upstream patch first most likely. |
Thanks for the update and explanation. |
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.
Change looks ok to me but I am not familiar with TableGen code. So @erichkeane @premanandrao could you also please take a look?
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
d4994cb
95ee4e6
For SYCL, we want some attributes to be ignored in host mode, but
without diagnosing the attribute as being ignored. This adds a bit to
the tablegen emitter to specify that a given language option opts into
this behavior. This allows us to more naturally specify that an
attribute is a device-only attribute from Attr.td without adding logic
in SemaDeclAttr.cpp to bail out in host mode (which looks like a bug
due to the lack of an ignored attribute warning).
As a drive-by, this also corrects a think-o with the
[[intel::reqd_sub_group_size]] attribute in OpenCL mode, which was
always being silently dropped.