[llvm-branch-commits] [clang] clang: Use the effective triple string for offload jobs (PR #205065)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jun 22 02:05:13 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/205065
Track the future effective triple for the job, rather than
the toolchain's default triple. In the future this will
change the result when amdgpu starts adjusting the triples
to contain subarches.
>From 78fc1680b167d477936b72203d1db046ddfac6b2 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 22 Jun 2026 11:00:18 +0200
Subject: [PATCH] clang: Use the effective triple string for offload jobs
Track the future effective triple for the job, rather than
the toolchain's default triple. In the future this will
change the result when amdgpu starts adjusting the triples
to contain subarches.
---
clang/lib/Driver/ToolChains/Clang.cpp | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 75b98b89a6546..eda3081e55c8e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9388,9 +9388,11 @@ void OffloadBundler::ConstructJob(Compilation &C, const JobAction &JA,
}
Triples += Action::GetOffloadKindName(CurKind);
Triples += '-';
- Triples +=
- CurTC->getTriple().normalize(llvm::Triple::CanonicalForm::FOUR_IDENT);
- if (CurKind != Action::OFK_Host &&
+ Triples += llvm::Triple(CurTC->ComputeEffectiveClangTriple(
+ TCArgs, CurDep->getOffloadingArch()))
+ .normalize(llvm::Triple::CanonicalForm::FOUR_IDENT);
+
+ if ((CurKind != Action::OFK_Host) &&
!StringRef(CurDep->getOffloadingArch()).empty()) {
Triples += '-';
Triples += CurDep->getOffloadingArch();
@@ -9466,9 +9468,12 @@ void OffloadBundler::ConstructJobMultipleOutputs(
auto &Dep = DepInfo[I];
Triples += Action::GetOffloadKindName(Dep.DependentOffloadKind);
Triples += '-';
- Triples += Dep.DependentToolChain->getTriple().normalize(
- llvm::Triple::CanonicalForm::FOUR_IDENT);
- if (Dep.DependentOffloadKind != Action::OFK_Host &&
+ Triples += llvm::Triple(Dep.DependentToolChain->ComputeEffectiveClangTriple(
+ TCArgs, Dep.DependentBoundArch))
+ .normalize(llvm::Triple::CanonicalForm::FOUR_IDENT);
+
+ if ((Dep.DependentOffloadKind == Action::OFK_HIP ||
+ Dep.DependentOffloadKind == Action::OFK_Cuda) &&
!Dep.DependentBoundArch.empty()) {
Triples += '-';
Triples += Dep.DependentBoundArch;
@@ -9537,7 +9542,7 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
// linker wrapper.
SmallVector<std::string> Parts{
"file=" + File.str(),
- "triple=" + TC->getTripleString().str(),
+ "triple=" + TC->ComputeEffectiveClangTriple(TCArgs, Arch),
"arch=" + (Arch.empty() ? "generic" : Arch.str()),
"kind=" + Kind.str(),
};
More information about the llvm-branch-commits
mailing list