================
@@ -1018,6 +1103,15 @@ DerivedArgList getLinkerArgs(ArrayRef<OffloadFile> Input,
DAL.AddJoinedArg(nullptr, Tbl.getOption(OPT_triple_EQ),
Args.MakeArgString(Input.front().getBinary()->getTriple()));
+ // Get the real devices that a SYCL image lists in "code". clang-sycl-linker
+ // compiles the image ahead of time for them.
+ const OffloadBinary &Binary = *Input.front().getBinary();
+ if (Binary.getOffloadKind() == OFK_SYCL)
+ for (StringRef Device : llvm::split(Binary.getString("code"), ','))
+ if (!Device.empty())
+ DAL.AddJoinedArg(nullptr, Tbl.getOption(OPT_code_EQ),
+ Args.MakeArgString(Device));
+
----------------
YuriPlyakhin wrote:
I'd suggest making it generic. It is up to producer to decide if to add "code"
metadata, but clang-linker-wrapper should be able to handle such cases
independent of offload kind.
```suggestion
// Get the real devices that an image lists in "code".
const OffloadBinary &Binary = *Input.front().getBinary();
for (StringRef Device : llvm::split(Binary.getString("code"), ','))
if (!Device.empty())
DAL.AddJoinedArg(nullptr, Tbl.getOption(OPT_code_EQ),
Args.MakeArgString(Device));
```
https://github.com/llvm/llvm-project/pull/239010
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits