-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang] Fix name conflict with sys/mac.h
on AIX
#88644
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Ugh. What could possibly go wrong, if someone who needed the original definition of SM_32 ends up transitively including this header and losing the macro definition?
A better way to handle it as a workaround would be to push the macro definition, undef it, and then pop it back at the end of the header.
Even better would be to add prefixes to the macros and/or the enum here to disambiguate them
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 already do that, the problem is that
CudaArch::SM_32
will still invoke the preprocessorr, see https://godbolt.org/z/84xKej5K9. We can't do this from a header level, we'd need to do it around every single use as far as I know, which might be doable?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 could always just make all of these lower case instead?
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.
That would be odd. LLVM style wants them to be CamelCased.
This enum is rarely used, so renaming them to something more CUDA/NVPTXspecific would be best, IMO.
E.g
NVSM_32
Or we could rename only
SM_32
. The constant is rather inconsequential and is used in a few places only. Renaming it to_SM_32
with a comment that AIX headers haveSM_32
defined.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 mean, modern CUDA installations don't even allow you to build for anything older than
sm_52
now. We could also just delete those enums entirely.Uh oh!
There was an error while loading. Please reload this page.
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.
Just naming it like
_SM_32
works for me, with a note that they'll get removed in the future. I can make the PR if you want.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.
_SM_32
is a reserved identifier so we should not use that as a name.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, totally forgot that
_<uppercase>
was reserved (Would've been nice if the AIX headers followed that rule).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.
SGTM. Thank you for taking care of this issue.
On a side note, do we know if there's a way to file a bug for AIX? They should not be setting macros with names that could conceivably be defined by a user. In theory. I think normally they should be double-underscore-prefixed.
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.
Done in #88779