Skip to content

Commit bd380c9

Browse files
yxsamliuCarlos Gálvez
authored and
Carlos Gálvez
committed
Partial revert "[HIP] Fix -mllvm option for device lld linker" (llvm#80202)
This partially reverts commit aa964f1 because it caused perf regressions in rccl due to drop of -mllvm -amgpu-kernarg-preload-count=16 from the linker step. Potentially it could cause similar regressions for other HIP apps using -mllvm options with -fgpu-rdc. Fixes: SWDEV-443345
1 parent 789df89 commit bd380c9

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

clang/lib/Driver/ToolChains/HIPAMD.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
142142
if (IsThinLTO)
143143
LldArgs.push_back(Args.MakeArgString("-plugin-opt=-force-import-all"));
144144

145+
for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
146+
LldArgs.push_back(
147+
Args.MakeArgString(Twine("-plugin-opt=") + A->getValue(0)));
148+
}
149+
145150
if (C.getDriver().isSaveTempsEnabled())
146151
LldArgs.push_back("-save-temps");
147152

clang/test/Driver/hip-toolchain-mllvm.hip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// REQUIRES: x86-registered-target
22
// REQUIRES: amdgpu-registered-target
33

4-
// Check only -Xoffload-linker -mllvm=* options are passed
5-
// to device lld linker.
6-
// -mllvm options are passed to clang only.
4+
// Check -Xoffload-linker -mllvm=* options are passed
5+
// to device lld linker only.
6+
// -mllvm options are passed to clang and device lld linker.
77

88
// RUN: %clang -### --target=x86_64-linux-gnu \
99
// RUN: --offload-arch=gfx803 --offload-arch=gfx900 \
@@ -33,15 +33,15 @@
3333
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
3434
// CHECK-SAME: {{.*}} "-target-cpu" "gfx803"
3535
// CHECK-SAME: {{.*}} "-mllvm" "-unroll-count=10" {{.*}}
36-
// CHECK: [[LLD:".*lld.*"]] {{.*}}"-m" "elf64_amdgpu"{{.*}} "-plugin-opt=-inline-threshold=100"
36+
// CHECK: [[LLD:".*lld.*"]] {{.*}}"-m" "elf64_amdgpu"{{.*}} "-plugin-opt=-unroll-count=10"{{.*}} "-plugin-opt=-inline-threshold=100"
3737

3838
// CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
3939
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
4040
// CHECK-SAME: {{.*}} "-target-cpu" "gfx900"
4141
// CHECK-SAME: {{.*}} "-mllvm" "-unroll-count=10" {{.*}}
42-
// CHECK: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-inline-threshold=100"
42+
// CHECK: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-unroll-count=10"{{.*}} "-plugin-opt=-inline-threshold=100"
4343

4444
// NEG-NOT: {{".*opt"}}
4545
// NEG-NOT: {{".*llc"}}
46-
// NEG-NOT: "-plugin-opt=-unroll-count=10"
46+
// NEG-NOT: "-m" "elf_x86_64"{{.*}} "-plugin-opt=-unroll-count=10"
4747
// NEG-NOT: "-m" "elf_x86_64"{{.*}} "-plugin-opt=-inline-threshold=100"

0 commit comments

Comments
 (0)