Skip to content

Commit d18bc8f

Browse files
jhuber6ronlieb
authored andcommitted
[OpenMP] Fix passing target id features to AMDGPU offloading (llvm#94765)
Summary: AMDGPU supports a `target-id` feature which is used to qualify targets with different incompatible features. These are both rules and target features. Currently, we pass `-target-cpu` twice when offloading to OpenMP, and do not pass the target-id features at all. The effect was that passing something like `--offload-arch=gfx90a:xnack+` would show up as `-target-cpu=gfx90a:xnack+ -target-cpu=gfx90a`. Thus ignoring the xnack completely and passing it twice. This patch fixes that to pass it once and then separate it like how HIP does. Change-Id: Ib8d9299326bdececd1de331395e4f3ae9dbea596
1 parent efb561c commit d18bc8f

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

clang/test/Driver/amdgpu-openmp-toolchain.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// verify the tools invocations
99
// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-llvm-bc"{{.*}}"-x" "c"
10-
// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}}"-target-cpu" "gfx906"{{.*}}"-fcuda-is-device"{{.*}}
10+
// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}}"-fcuda-is-device"{{.*}}"-target-cpu" "gfx906"
1111
// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-obj"
1212
// CHECK: clang-linker-wrapper{{.*}} "-o" "a.out"
1313

@@ -94,6 +94,7 @@
9494

9595
// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a:sramecc-:xnack+ \
9696
// RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID
97+
// CHECK-TARGET-ID: "-cc1" "-triple" "amdgcn-amd-amdhsa" {{.*}} "-target-cpu" "gfx90a:sramecc-:xnack+" "-target-feature" "-sramecc" "-target-feature" "+xnack"
9798
// CHECK-TARGET-ID: clang-offload-packager{{.*}}arch=gfx90a:sramecc-:xnack+,kind=openmp,feature=-sramecc,feature=+xnack
9899

99100
// RUN: not %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a,gfx90a:xnack+ \

revert_patches.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ Revert: Breaks check-clang test 'clang/test/Modules/pr60085.cppm'
7676
99873b35da7e [NFC] [AST] Introduce Decl::isInAnotherModuleUnit and Decl::shouldEmitInExternalSource
7777
contact : mhalk (Michael Halkenhaeuser)
7878
---
79-
greaks aomp build of openmp
80-
688ffd0b405] Revert "[OpenMP][NFC] Fix warning for OpenMP standalone build (#93463)"
81-
contact: ethan stewart
82-
---
83-
breaks targetid_multi_image
84-
374f6554c3e4 [OpenMP] Fix passing target id features to AMDGPU offloading (#94765)
85-
contact: ronl
86-
---
8779
revert for now , need lldb person
8880
6d01a350ce9 [lldb] Encode operands and arity in Dwarf.def and use them in LLDB. (#94679)
8981
contact: scott

0 commit comments

Comments
 (0)