================
@@ -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>;
+ auto GetImageID = [](const OffloadFile &Binary) -> ImageID {
+ return {Binary, Binary.getBinary()->getString("code")};
+ };
+
// Link all standard input files and update the list of symbols.
- MapVector<OffloadFile::TargetID, SmallVector<OffloadFile, 0>> InputFiles;
+ MapVector<ImageID, SmallVector<OffloadFile, 0>> InputFiles;
for (OffloadFile &Binary : ObjectFilesToExtract) {
if (!Binary.getBinary())
continue;
- OffloadFile::TargetID Target = Binary;
- SmallVector<OffloadFile::TargetID> CompatibleTargets;
+ ImageID Target = GetImageID(Binary);
+ SmallVector<ImageID> CompatibleTargets;
for (const auto &[ID, Input] : InputFiles)
- if (object::areTargetsEquivalent(Target, ID))
+ if (Target.second == ID.second &&
+ object::areTargetsEquivalent(Target.first, ID.first))
----------------
YuriPlyakhin wrote:
Should we raise an error when all object files are not compiled with the same
set of ARCH and CODE names?
https://github.com/llvm/llvm-project/pull/239010
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits