================
@@ -1480,16 +1595,20 @@ getDeviceInput(const ArgList &Args) {
if (!Binary.getBinary())
continue;
- SmallVector<OffloadFile::TargetID> CompatibleTargets = {Binary};
+ // A generic member can still be linked into any compatible image; other
+ // members only into images with the same "code".
+ ImageID Target = GetImageID(Binary);
+ bool IsGeneric = Target.first.second == "generic";
+ SmallVector<ImageID> CompatibleTargets = {Target};
for (const auto &[ID, Input] : InputFiles)
- if (OffloadFile::TargetID(Binary) != ID &&
- object::areTargetsCompatible(Binary, ID))
+ if (Target != ID && (IsGeneric || Target.second == ID.second) &&
+ object::areTargetsCompatible(Target.first, ID.first))
----------------
srividya-sundaram wrote:
Yes, this is expected in the IGCA design, which only links device code with the
same IGCA target and the same GPUs (From the design doc: "we identify all
modules with exactly the same IGCA target and exactly the same AOT compilation
target, and only link these modules together").
Each IGCA target gets its own device image, which lists only its own GPUs.
So with `--offload-arch=xe-mtl-u,xe-bmg-g21`, the application has an `igca_30r`
image for `xe-mtl-u` and a separate `igca_40r` image for `xe-bmg-g21`, and a
library built for `xe-mtl-u` matches the first one and links into it.
With `xe-mtl-u,xe-mtl-h`, both GPUs are `igca_30r`, so the application's
`igca_30r` image lists both, and the library built for `xe-mtl-u` alone doesn't
match it.
https://github.com/llvm/llvm-project/pull/239010
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits