[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:31 PST 2026


================
@@ -1331,6 +1427,16 @@ Error emitExtractCommands(
               .str();
       if (!Binary.getArch().empty())
         ImageArg += (",arch=" + Binary.getArch()).str();
+      // Filter SYCL images on "code", including an empty one, so that an
+      // image without "code" does not also match one with it.
+      if (Binary.getOffloadKind() == OFK_SYCL) {
+        StringRef Code = Binary.getString("code");
+        if (Code.empty())
+          ImageArg += ",code=";
+        for (StringRef Device : llvm::split(Code, ','))
+          if (!Device.empty())
+            ImageArg += (",code=" + Device).str();
+      }
----------------
YuriPlyakhin wrote:

I think images should be grouped on code for every offload kind, it should not be SYCL-specific.
And it is up to offload kind to use "code" or not.
Could we drop the OFK_SYCL check?

```suggestion
       // Filter on "code", including an empty one, so that an image without
       // "code" does not also match one with it for the same architecture.
       StringRef Code = Binary.getString("code");
       if (Code.empty())
         ImageArg += ",code=";
       for (StringRef Device : llvm::split(Code, ','))
         if (!Device.empty())
           ImageArg += (",code=" + Device).str();
```

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


More information about the cfe-commits mailing list