-
Notifications
You must be signed in to change notification settings - Fork 801
[SYCL][NFC] Refactor addSYCLDefaultTriple #20938
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?
Conversation
This patch merges two loops traversing SYCL triples into one. Also optimizes the usage of addSYCLDefaultTriple inside CreateOffloadingDeviceToolChains. The default triple is guranted to be added at the beginning of the list. Instead of building the default triple again in CreateOffloadingDeviceToolChains, we re-use the value added by addSYCLDefaultTriple to the list of the triples.
clang/lib/Driver/Driver.cpp
Outdated
| // Check current set of triples to see if the default has already been set. | ||
| for (const auto &SYCLTriple : SYCLTriples) { | ||
| // TODO: Do we need this check? Don't we already detect the default triple | ||
| // in the previous condition? |
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.
Since we allow for spir64 or spirv64, this checks for the latter. Perhaps we can just use this check and not have the one above?
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. I forgot that we have two spellings to produce SPIR-V binaries. I'll try to avoid unnecessary checks.
clang/lib/Driver/Driver.cpp
Outdated
| if (SYCLTriple.isNVPTX() || SYCLTriple.isAMDGCN()) | ||
| return false; | ||
| } | ||
| // TODO: Why do we insert at the beginning? This is expensive operation. |
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.
insert at the beginning isn't required. Just need to be sure that the use knows where the triple is added (there is one more use in Driver.cpp). It may also impact toolchain ordering which will require test updates.
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.
It would be great if we can add at the end of the container. If it doesn't require a ton of work to update the test, I'll do that.
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.
All tests pass unmodified. 😲
|
NOTE: 75c6eb0 is probably a functional change, but I hope this fixes a bug not caught by testing. |
This patch merges two loops traversing SYCL triples into one.
Also optimizes the usage of addSYCLDefaultTriple inside
CreateOffloadingDeviceToolChains. The default triple is guranted to be
added at the beginning of the list. Instead of building the default
triple again in CreateOffloadingDeviceToolChains, we re-use the value
added by addSYCLDefaultTriple to the list of the triples.