-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HIP] Fix -mllvm option for device lld linker
currently clang passes -mllvm options to the device lld linker plugin when compiling HIP. This is against default clang behavior which is only passing -mllvm options to linker plugin specified through -Wl options. This patch lets clang only pass -Xoffload-linker -mllvm= options to device lld linker plugin. Fixes: #63604 Reviewed by: Joseph Huber, Matt Arsenault Differential Revision: https://reviews.llvm.org/D154145
- Loading branch information
Showing
2 changed files
with
37 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,47 @@ | ||
// REQUIRES: x86-registered-target | ||
// REQUIRES: amdgpu-registered-target | ||
|
||
// Check only -Xoffload-linker -mllvm=* options are passed | ||
// to device lld linker. | ||
// -mllvm options are passed to clang only. | ||
|
||
// RUN: %clang -### --target=x86_64-linux-gnu \ | ||
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ | ||
// RUN: -mllvm -amdgpu-function-calls=0 \ | ||
// RUN: -mllvm -unroll-count=10 \ | ||
// RUN: -Xoffload-linker -mllvm=-inline-threshold=100 \ | ||
// RUN: %s 2>&1 | FileCheck %s | ||
|
||
// RUN: %clang -### --target=x86_64-linux-gnu \ | ||
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ | ||
// RUN: -fgpu-rdc -mllvm -amdgpu-function-calls=0 \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefixes=CHECK,RDC %s | ||
// RUN: -mllvm -unroll-count=10 \ | ||
// RUN: -Xoffload-linker -mllvm=-inline-threshold=100 \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=NEG %s | ||
|
||
// RUN: %clang -### --target=x86_64-linux-gnu \ | ||
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ | ||
// RUN: -fgpu-rdc -mllvm -unroll-count=10 \ | ||
// RUN: -Xoffload-linker -mllvm=-inline-threshold=100 \ | ||
// RUN: %s 2>&1 | FileCheck %s | ||
|
||
// RUN: %clang -### --target=x86_64-linux-gnu \ | ||
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ | ||
// RUN: -fgpu-rdc -mllvm -unroll-count=10 \ | ||
// RUN: -Xoffload-linker -mllvm=-inline-threshold=100 \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=NEG %s | ||
|
||
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" | ||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" | ||
// CHECK-SAME: {{.*}} "-target-cpu" "gfx803" | ||
// CHECK-SAME: {{.*}} "-mllvm" "-amdgpu-function-calls=0" {{.*}} | ||
|
||
// CHECK-NOT: {{".*opt"}} | ||
// CHECK-NOT: {{".*llc"}} | ||
// RDC: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-amdgpu-function-calls=0" | ||
// CHECK-SAME: {{.*}} "-mllvm" "-unroll-count=10" {{.*}} | ||
// CHECK: [[LLD:".*lld.*"]] {{.*}}"-m" "elf64_amdgpu"{{.*}} "-plugin-opt=-inline-threshold=100" | ||
|
||
// CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" | ||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" | ||
// CHECK-SAME: {{.*}} "-target-cpu" "gfx900" | ||
// CHECK-SAME: {{.*}} "-mllvm" "-amdgpu-function-calls=0" {{.*}} | ||
// CHECK-SAME: {{.*}} "-mllvm" "-unroll-count=10" {{.*}} | ||
// CHECK: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-inline-threshold=100" | ||
|
||
// CHECK-NOT: {{".*opt"}} | ||
// CHECK-NOT: {{".*llc"}} | ||
// RDC: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-amdgpu-function-calls=0" | ||
// NEG-NOT: {{".*opt"}} | ||
// NEG-NOT: {{".*llc"}} | ||
// NEG-NOT: "-plugin-opt=-unroll-count=10" | ||
// NEG-NOT: "-m" "elf_x86_64"{{.*}} "-plugin-opt=-inline-threshold=100" |