================
@@ -540,40 +540,51 @@ StringRef object::getImageKindName(ImageKind Kind) {
bool object::areTargetsEquivalent(const OffloadFile::TargetID &LHS,
const OffloadFile::TargetID &RHS) {
- llvm::Triple LHSTT(LHS.first);
- llvm::Triple RHSTT(RHS.first);
+ if (LHS.Code != RHS.Code)
+ return false;
+
+ llvm::Triple LHSTT(LHS.Triple);
+ llvm::Triple RHSTT(RHS.Triple);
// Check for logical AMDGPU target-id equivalence.
if (LHSTT.isAMDGPU()) {
- AMDGPU::TargetID LHSID(LHSTT, LHS.second);
- AMDGPU::TargetID RHSID(RHSTT, RHS.second);
+ AMDGPU::TargetID LHSID(LHSTT, LHS.Arch);
+ AMDGPU::TargetID RHSID(RHSTT, RHS.Arch);
return LHSID.isEquivalent(RHSID);
}
// For other targets the triples must be compatible and the arch must match.
- return LHSTT.isCompatibleWith(RHSTT) && LHS.second == RHS.second;
+ return LHSTT.isCompatibleWith(RHSTT) && LHS.Arch == RHS.Arch;
}
bool object::areTargetsCompatible(const OffloadFile::TargetID &Provided,
const OffloadFile::TargetID &Requested) {
- llvm::Triple ProvidedTT(Provided.first);
- llvm::Triple RequestedTT(Requested.first);
+ llvm::Triple ProvidedTT(Provided.Triple);
+ llvm::Triple RequestedTT(Requested.Triple);
// The AMDGPU target requires target-id aware checks (base processor plus
// xnack/sramecc features).
if (ProvidedTT.isAMDGPU()) {
- AMDGPU::TargetID ProvidedID(ProvidedTT, Provided.second);
- AMDGPU::TargetID RequestedID(RequestedTT, Requested.second);
- return ProvidedID.providesFor(RequestedID);
+ AMDGPU::TargetID ProvidedID(ProvidedTT, Provided.Arch);
+ AMDGPU::TargetID RequestedID(RequestedTT, Requested.Arch);
+ return Provided.Code == Requested.Code &&
----------------
YuriPlyakhin wrote:
The "code" rule doesn't depend on the target, but it's checked in two places
here (in the AMDGPU branch and again after the generic check), which also
splits up the original non-AMDGPU logic.
Could it be a single check at the top, as in areTargetsEquivalent, so the rest
of the function stays as it was?
```
// Unless the image is generic, the "code" lists must be identical.
if (Provided.Arch != "generic" && Provided.Code != Requested.Code)
return false;
```
Then the AMDGPU branch is `return ProvidedID.providesFor(RequestedID);` again,
and the non-AMDGPU part can keep the original `if (Provided.Arch == "generic"
|| Requested.Arch == "generic") return true;`.
https://github.com/llvm/llvm-project/pull/239010
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits