[PATCH] D138598: [OpenMP] Do not add wrapper headers if using '-nogpuinc'

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 08:20:51 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG37edd910478d: [OpenMP] Do not add wrapper headers if using '-nogpuinc' (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138598/new/

https://reviews.llvm.org/D138598

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-headers.c


Index: clang/test/Driver/openmp-offload-headers.c
===================================================================
--- /dev/null
+++ clang/test/Driver/openmp-offload-headers.c
@@ -0,0 +1,26 @@
+// REQUIRES: nvptx-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_70 \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx908  \
+// RUN:     -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-HEADERS
+// CHECK-HEADERS: "-cc1"{{.*}}"-internal-isystem" "{{.*}}openmp_wrappers" "-include" "__clang_openmp_device_functions.h"
+// CHECK-HEADERS: "-cc1"{{.*}}"-internal-isystem" "{{.*}}openmp_wrappers" "-include" "__clang_openmp_device_functions.h"
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -nobuiltininc \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_70 \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx908  \
+// RUN:     -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-HEADERS-BUILTIN
+// CHECK-HEADERS-BUILTIN: "-cc1"{{.*}}"-include" "__clang_openmp_device_functions.h"
+// CHECK-HEADERS-BUILTIN: "-cc1"{{.*}}"-include" "__clang_openmp_device_functions.h"
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -nostdinc \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_70 \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx908  \
+// RUN:     -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-HEADERS-DISABLED
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -nogpuinc \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_70 \
+// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx908  \
+// RUN:     -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-HEADERS-DISABLED
+// CHECK-HEADERS-DISABLED-NOT: "-cc1"{{.*}}"__clang_openmp_device_functions.h"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -1282,6 +1282,7 @@
   // openmp_wrappers folder which contains alternative system headers.
   if (JA.isDeviceOffloading(Action::OFK_OpenMP) &&
       !Args.hasArg(options::OPT_nostdinc) &&
+      !Args.hasArg(options::OPT_nogpuinc) &&
       (getToolChain().getTriple().isNVPTX() ||
        getToolChain().getTriple().isAMDGCN())) {
     if (!Args.hasArg(options::OPT_nobuiltininc)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138598.478250.patch
Type: text/x-patch
Size: 3008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221128/53bbcbdc/attachment.bin>


More information about the cfe-commits mailing list