[clang] [HIP] Fix OffloadBundler triple when using extra 'llvm' environment (PR #214841)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 8 11:42:40 PDT 2026


jhuber6 wrote:

```
  std::string OffloadTargetInfo::str() const {
    std::string NormalizedTriple;
    // Unfortunately we need some special sauce for AMDHSA because all the runtime
    // assumes the triple to be "amdgcn/spirv64-amd-amdhsa-" (empty environment)
    // instead of "amdgcn/spirv64-amd-amdhsa-unknown". It's gonna be very tricky
    // to patch different layers of runtime.
    if (Triple.getOS() == Triple::OSType::AMDHSA) {
      NormalizedTriple = Triple.normalize(Triple::CanonicalForm::THREE_IDENT);
      NormalizedTriple.push_back('-');
    } else {
      NormalizedTriple = Triple.normalize(Triple::CanonicalForm::FOUR_IDENT);
    }
    return Twine(OffloadKind + "-" + NormalizedTriple + "-" + TargetID).str();
  }
```
We already hack around this non-stop. I honestly think the proper solution is to start deprecating offload bundles wholesale. I'd prefer not to need to work around what our toolchain already hacks around to get the same effect, the `-llvm` triple is meaningless to the runtime.

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


More information about the cfe-commits mailing list