[clang] [llvm] [Clang][SYCL] Compile device code once per IGCA target (PR #239010)

Yury Plyakhin via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 18:10:33 PST 2026


================
@@ -1444,16 +1550,25 @@ getDeviceInput(const ArgList &Args) {
                              B.getBinary()->getArch().count(':');
                     });
 
+  // A SYCL image can list Intel GPUs in "code", e.g. "code=xe-mtl-h,xe-mtl-u".
+  // Images with different lists are linked separately, so the key of an image
+  // is its target and its "code".
+  using ImageID = std::pair<OffloadFile::TargetID, StringRef>;
----------------
YuriPlyakhin wrote:

@jhuber6,

I'd like your opinion on where this belongs.

With this PR, `code` (the list of real devices to compile a virtual arch for) is part of what decides whether two images link together, so it is checked inline here through a local `ImageID` wrapper, next to `areTargetsEquivalent` / `areTargetsCompatible`.

Would you prefer `code` to be part of `OffloadFile::TargetID` instead, so that those two functions hold the whole rule (`triple`, `arch`, `code`, and the `generic` exception) for every offload kind?

The wrapper is their only user, so the change should be small.

https://github.com/llvm/llvm-project/pull/239010


More information about the cfe-commits mailing list