Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[clang][X86] Support __attribute__((model("small"/"large"))) #124834
[clang][X86] Support __attribute__((model("small"/"large"))) #124834
Changes from 4 commits
7c40169
8aa6b3f
2fdf2ee
1a32c31
7ce06bd
526e8c3
6779705
2263db1
bf8f7d4
d314c8e
1729029
c664880
f3ecb7b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
If the test passes this way (I.e. you do see complaints about the attributes) that means that the change will break CUDA.
Considering that we will see these attributes in the host code and that NVPTX itself can't do anything useful with them, NVPTX compilation should continue to work and ignore those attributes.
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 attribute is technically is ignored, with a warning, but the warning is likely non-actionable as it would be issues for a perfectly correct host code which just happens to be seen by a GPU compilation.
I think the correct way to handle it would be to issue a deferred diagnostic which will fire only if we end up code-gen-ing something that uses the attribute.
@yxsamliu Sam, does that make sense?
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 see, although it seems pretty annoying to have to special case NVPTX compilations. Is there a previous example of having done something like this, or should I just ad-hoc skip the Sema code for NVPTX compilations?
(oops comment race)
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.
is it common to define a global in a TU that's shared between the host and device?
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.
Yes. global scope is implicitly considered to belong to host. Data that's supposed to reside on the device must be explicitly annotated with appropriate attributes.
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'm tempted to keep things as is since it seems like this is not the only issue that can come up with nvptx compiles. For example, the
thread_local
global in the variable has the same issue where nvptx doesn't support thread local globals, which clang complains about, and I don't really see a difference between__attribute__((model()))
andthread_local
in that they can both be used on arbitrary globals.Do you think it's reasonable to postpone this suggestion until people actually hit it? For example, if people aren't hitting the
thread_local
issue, then perhaps people won't hit a warning with this attribute.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.
Up to you.
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.
My understanding is that deferred diagnostics only works in a function, but this diagnostic happens outside functions.