Skip to content

Conversation

@bader
Copy link
Contributor

@bader bader commented Dec 18, 2025

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.

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.
@bader bader requested a review from a team as a code owner December 18, 2025 18:18
// 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?
Copy link
Contributor

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?

Copy link
Contributor Author

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.

if (SYCLTriple.isNVPTX() || SYCLTriple.isAMDGCN())
return false;
}
// TODO: Why do we insert at the beginning? This is expensive operation.
Copy link
Contributor

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.

Copy link
Contributor Author

@bader bader Dec 18, 2025

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests pass unmodified. 😲

@bader
Copy link
Contributor Author

bader commented Dec 19, 2025

NOTE: 75c6eb0 is probably a functional change, but I hope this fixes a bug not caught by testing.
@mdtoguchi, please, check that it's a reasonable change. It drops adding default SYCL target when only native_cpu target is specified. Is that okay?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants