Skip to content

Commit d366fa8

Browse files
authored
[NFC][Driver][HIP] Fix mixing amdgcnspirv and gfxXXX via --offload-arch (llvm#133024) (llvm#2087)
Auto-submit by Jenkins
2 parents b551901 + 1ba2e5e commit d366fa8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,9 +3527,12 @@ class OffloadingActionBuilder final {
35273527
// compiler phases, including backend and assemble phases.
35283528
ActionList AL;
35293529
Action *BackendAction = nullptr;
3530-
if (ToolChains.front()->getTriple().isSPIRV()) {
3530+
if (ToolChains.front()->getTriple().isSPIRV() ||
3531+
(ToolChains.front()->getTriple().isAMDGCN() &&
3532+
GpuArchList[I] == StringRef("amdgcnspirv"))) {
35313533
// Emit LLVM bitcode for SPIR-V targets. SPIR-V device tool chain
3532-
// (HIPSPVToolChain) runs post-link LLVM IR passes.
3534+
// (HIPSPVToolChain or HIPAMDToolChain) runs post-link LLVM IR
3535+
// passes.
35333536
types::ID Output = Args.hasArg(options::OPT_S)
35343537
? types::TY_LLVM_IR
35353538
: types::TY_LLVM_BC;

clang/test/Driver/hip-toolchain-no-rdc.hip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@
187187
// Check mixed AMDGCNSPIRV and concrete GPU arch.
188188
//
189189

190-
// AMDGCNSPIRV: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-obj" {{.*}} "-o" "[[AMDGCNSPV_OBJ:.*o]]"
191-
// AMDGCNSPIRV: {{".*llvm-link.*"}} "-o" "[[AMDGCNSPV_TMP:.*out]]" "[[AMDGCNSPV_OBJ]]"
190+
// AMDGCNSPIRV: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-llvm-bc" {{.*}} "-o" "[[AMDGCNSPV_BC:.*bc]]"
191+
// AMDGCNSPIRV: {{".*llvm-link.*"}} "-o" "[[AMDGCNSPV_TMP:.*out]]" "[[AMDGCNSPV_BC]]"
192192
// AMDGCNSPIRV: {{".*llvm-spirv.*"}} "--spirv-max-version=1.6" "--spirv-ext=+all" {{.*}} "[[AMDGCNSPV_TMP]]" {{.*}}"-o" "[[AMDGCNSPV_CO:.*out]]"
193193
// AMDGCNSPIRV: "-cc1" "-triple" "amdgcn-amd-amdhsa" {{.*}}"-emit-obj" {{.*}}"-target-cpu" "gfx900"{{.*}} "-o" "[[GFX900_OBJ:.*o]]"
194194
// AMDGCNSPIRV: {{".*lld.*"}} {{.*}}"-plugin-opt=mcpu=gfx900" {{.*}} "-o" "[[GFX900_CO:.*out]]" {{.*}}"[[GFX900_OBJ]]"

0 commit comments

Comments
 (0)