brintos

brintos / llvm-project-archived public Read only

0
0
Text · 27.6 KiB · edce14e Raw
407 lines · c
1///2/// Perform several driver tests for OpenMP offloading3///4 5/// ###########################################################################6 7/// Check -Xopenmp-target uses one of the archs provided when several archs are used.8// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -nogpulib -nogpuinc \9// RUN:          -Xopenmp-target -march=sm_52 -Xopenmp-target -march=sm_60 %s 2>&1 \10// RUN:   | FileCheck -check-prefix=CHK-FOPENMP-TARGET-ARCHS %s11 12// CHK-FOPENMP-TARGET-ARCHS: ptxas{{.*}}" "--gpu-name" "sm_60"13 14/// ###########################################################################15 16/// Check -Xopenmp-target -march=sm_52 works as expected when two triples are present.17// RUN:   %clang -### -fopenmp=libomp \18// RUN:          -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda \19// RUN:          -nogpulib -nogpuinc -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 %s 2>&1 \20// RUN:   | FileCheck -check-prefix=CHK-FOPENMP-TARGET-COMPILATION %s21 22// CHK-FOPENMP-TARGET-COMPILATION: ptxas{{.*}}" "--gpu-name" "sm_52"23 24/// Check PTXAS is passed -c flag when offloading to an NVIDIA device using OpenMP.25// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 \26// RUN:          -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 | FileCheck -check-prefix=CHK-PTXAS-DEFAULT %s27 28// CHK-PTXAS-DEFAULT: ptxas{{.*}}" "-c"29 30/// ###########################################################################31 32/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP - disable it.33// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fnoopenmp-relocatable-target \34// RUN:         -nogpulib -nogpuinc --offload-arch=sm_52  -save-temps %s 2>&1 \35// RUN:   | FileCheck -check-prefix=CHK-PTXAS-NORELO %s36 37// CHK-PTXAS-NORELO-NOT: ptxas{{.*}}" "-c"38 39/// ###########################################################################40 41/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP42/// Check that the flag is passed when -fopenmp-relocatable-target is used.43// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-relocatable-target \44// RUN:          -nogpulib -nogpuinc --offload-arch=sm_52 -save-temps %s 2>&1 \45// RUN:   | FileCheck -check-prefix=CHK-PTXAS-RELO %s46 47// CHK-PTXAS-RELO: ptxas{{.*}}" "-c"48 49/// ###########################################################################50 51/// Check that error is not thrown by toolchain when no cuda lib flag is used.52/// Check that the flag is passed when -fopenmp-relocatable-target is used.53// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 \54// RUN:   -nogpulib -nogpuinc -fopenmp-relocatable-target -save-temps %s 2>&1 \55// RUN:   | FileCheck -check-prefix=CHK-FLAG-NOLIBDEVICE %s56 57// CHK-FLAG-NOLIBDEVICE-NOT: error:{{.*}}sm_6058 59/// ###########################################################################60 61/// Check that error is not thrown by toolchain when no cuda lib device is found when using -S.62/// Check that the flag is passed when -fopenmp-relocatable-target is used.63// RUN:   %clang -### -S -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 \64// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \65// RUN:   | FileCheck -check-prefix=CHK-NOLIBDEVICE %s66 67// CHK-NOLIBDEVICE-NOT: error:{{.*}}sm_6068 69/// ###########################################################################70 71/// Check that the runtime bitcode library is part of the compile line.72/// Create a bogus bitcode library and specify it with libomptarget-nvptx-bc-path73// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \74// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc \75// RUN:   -Xopenmp-target -march=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \76// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \77// RUN:   | FileCheck -check-prefix=CHK-BCLIB %s78 79/// Specify the directory containing the bitcode lib, check clang picks the right one80// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \81// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \82// RUN:   -Xopenmp-target -march=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \83// RUN:   -fopenmp-relocatable-target -save-temps \84// RUN:   %s 2>&1 | FileCheck -check-prefix=CHK-BCLIB-DIR %s85 86/// Create a bogus bitcode library and find it with LIBRARY_PATH87// RUN:   env LIBRARY_PATH=%S/Inputs/libomptarget/subdir %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \88// RUN:   -Xopenmp-target -march=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \89// RUN:   -fopenmp-relocatable-target -save-temps \90// RUN:   %s 2>&1 | FileCheck -check-prefix=CHK-ENV-BCLIB %s91 92// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc93// CHK-BCLIB-DIR: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget{{/|\\\\}}libomptarget-nvptx.bc94// CHK-ENV-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}subdir{{/|\\\\}}libomptarget-nvptx.bc95// CHK-BCLIB-NOT: {{error:|warning:}}96 97/// ###########################################################################98 99/// Check that the error is thrown when the libomptarget bitcode library does not exist.100// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \101// RUN:   -Xopenmp-target -march=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \102// RUN:   --libomptarget-nvptx-bc-path=not-exist.bc \103// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \104// RUN:   | FileCheck -check-prefix=CHK-BCLIB-ERROR %s105 106// CHK-BCLIB-ERROR: bitcode library 'not-exist.bc' does not exist107 108/// ###########################################################################109 110/// Check that the error is thrown when CUDA 9.1 or lower version is used.111// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \112// RUN:   -Xopenmp-target -march=sm_52 --cuda-path=%S/Inputs/CUDA_90/usr/local/cuda \113// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \114// RUN:   | FileCheck -check-prefix=CHK-CUDA-VERSION-ERROR %s115 116// CHK-CUDA-VERSION-ERROR: NVPTX target requires CUDA 9.2 or above; CUDA 9.0 detected117 118/// Check that debug info is emitted in dwarf-2119// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \120// RUN:   | FileCheck -check-prefix=DEBUG_DIRECTIVES %s121// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 2>&1 \122// RUN:   | FileCheck -check-prefix=DEBUG_DIRECTIVES %s123// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 \124// RUN:   | FileCheck -check-prefix=DEBUG_DIRECTIVES %s125// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g0 2>&1 \126// RUN:   | FileCheck -check-prefix=NO_DEBUG %s127// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 \128// RUN:   | FileCheck -check-prefix=NO_DEBUG %s129// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-directives-only 2>&1 \130// RUN:   | FileCheck -check-prefix=DEBUG_DIRECTIVES %s131 132// DEBUG_DIRECTIVES-NOT: warning: debug133// NO_DEBUG-NOT: warning: debug134// NO_DEBUG: "-fopenmp-is-target-device"135// NO_DEBUG-NOT: "-debug-info-kind=136// NO_DEBUG: ptxas137// DEBUG_DIRECTIVES: "-triple" "nvptx64-nvidia-cuda"138// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only"139// DEBUG_DIRECTIVES-SAME: "-fopenmp-is-target-device"140// DEBUG_DIRECTIVES: ptxas141// DEBUG_DIRECTIVES: "-lineinfo"142 143// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \144// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s145// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g 2>&1 \146// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s147// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --cuda-noopt-device-debug 2>&1 \148// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s149// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --cuda-noopt-device-debug 2>&1 \150// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s151// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g2 2>&1 \152// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s153// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb2 -O0 --cuda-noopt-device-debug 2>&1 \154// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s155// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g3 -O3 --cuda-noopt-device-debug 2>&1 \156// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s157// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \158// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s159// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \160// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s161// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \162// RUN:   | FileCheck -check-prefix=HAS_DEBUG %s163 164// HAS_DEBUG-NOT: warning: debug165// HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda"166// HAS_DEBUG-SAME: "-debug-info-kind={{constructor|line-tables-only}}"167// HAS_DEBUG-SAME: "-dwarf-version=2"168// HAS_DEBUG-SAME: "-fopenmp-is-target-device"169// HAS_DEBUG: ptxas170// HAS_DEBUG-SAME: "-g"171// HAS_DEBUG-SAME: "--dont-merge-basicblocks"172// HAS_DEBUG-SAME: "--return-at-end"173 174// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-mode 2>&1 \175// RUN:   | FileCheck -check-prefix=CUDA_MODE %s176// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fno-openmp-cuda-mode -fopenmp-cuda-mode 2>&1 \177// RUN:   | FileCheck -check-prefix=CUDA_MODE %s178// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target -march=gfx906 %s -fopenmp-cuda-mode 2>&1 \179// RUN:   | FileCheck -check-prefix=CUDA_MODE %s180// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target -march=gfx906 %s -fno-openmp-cuda-mode -fopenmp-cuda-mode 2>&1 \181// RUN:   | FileCheck -check-prefix=CUDA_MODE %s182// CUDA_MODE: "-cc1"{{.*}}"-triple" "{{nvptx64-nvidia-cuda|amdgcn-amd-amdhsa}}"183// CUDA_MODE-SAME: "-fopenmp-cuda-mode"184// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fno-openmp-cuda-mode 2>&1 \185// RUN:   | FileCheck -check-prefix=NO_CUDA_MODE %s186// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-mode -fno-openmp-cuda-mode 2>&1 \187// RUN:   | FileCheck -check-prefix=NO_CUDA_MODE %s188// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target -march=gfx906 %s -fno-openmp-cuda-mode 2>&1 \189// RUN:   | FileCheck -check-prefix=NO_CUDA_MODE %s190// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target -march=gfx906 %s -fopenmp-cuda-mode -fno-openmp-cuda-mode 2>&1 \191// RUN:   | FileCheck -check-prefix=NO_CUDA_MODE %s192// NO_CUDA_MODE-NOT: "-{{fno-|f}}openmp-cuda-mode"193 194// RUN:   %clang -### -nogpulib -nogpuinc -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -fopenmp-cuda-teams-reduction-recs-num=2048 2>&1 \195// RUN:   | FileCheck -check-prefix=CUDA_RED_RECS %s196// CUDA_RED_RECS: "-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"197// CUDA_RED_RECS-SAME: "-fopenmp-cuda-teams-reduction-recs-num=2048"198 199// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \200// RUN:          --offload-arch=sm_52 --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc %s 2>&1 \201// RUN:   | FileCheck -check-prefix=OPENMP_NVPTX_WRAPPERS %s202// OPENMP_NVPTX_WRAPPERS: "-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"203// OPENMP_NVPTX_WRAPPERS-SAME: "-internal-isystem" "{{.*}}openmp_wrappers"204 205// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -nogpulib -nogpuinc \206// RUN:          --offload-arch=sm_52 -save-temps -ccc-print-bindings %s -o openmp-offload-gpu 2>&1 \207// RUN:   | FileCheck -check-prefix=SAVE_TEMPS_NAMES %s208 209// SAVE_TEMPS_NAMES-NOT: "GNU::Linker"{{.*}}["[[SAVE_TEMPS_INPUT1:.*\.o]]", "[[SAVE_TEMPS_INPUT1]]"]210 211// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64 -Xopenmp-target=nvptx64 -march=sm_52 \212// RUN:          -nogpulib -nogpuinc -save-temps %s -o openmp-offload-gpu 2>&1 \213// RUN:   | FileCheck -check-prefix=TRIPLE %s214 215// TRIPLE: "-triple" "nvptx64-nvidia-cuda"216// TRIPLE: "-target-cpu" "sm_52"217 218// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \219// RUN:          -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \220// RUN:          --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc %s 2>&1 \221// RUN:   | FileCheck %s222// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \223// RUN:          --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \224// RUN:          --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc %s 2>&1 \225// RUN:   | FileCheck %s226 227// verify the tools invocations228// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-llvm-bc"{{.*}}"-x" "c"229// CHECK: "-cc1" "-triple" "nvptx64-nvidia-cuda" "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}}"-target-cpu" "sm_52"230// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-obj"231// CHECK: clang-linker-wrapper{{.*}} "-o" "a.out"232 233// RUN:   %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 %s 2>&1 \234// RUN:   | FileCheck --check-prefix=CHECK-PHASES %s235// CHECK-PHASES: 0: input, "[[INPUT:.+]]", c, (host-openmp)236// CHECK-PHASES: 1: preprocessor, {0}, cpp-output, (host-openmp)237// CHECK-PHASES: 2: compiler, {1}, ir, (host-openmp)238// CHECK-PHASES: 3: input, "[[INPUT]]", c, (device-openmp, sm_52)239// CHECK-PHASES: 4: preprocessor, {3}, cpp-output, (device-openmp, sm_52)240// CHECK-PHASES: 5: compiler, {4}, ir, (device-openmp, sm_52)241// CHECK-PHASES: 6: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (nvptx64-nvidia-cuda:sm_52)" {5}, ir242// CHECK-PHASES: 7: backend, {6}, assembler, (device-openmp, sm_52)243// CHECK-PHASES: 8: assembler, {7}, object, (device-openmp, sm_52)244// CHECK-PHASES: 9: offload, "device-openmp (nvptx64-nvidia-cuda:sm_52)" {8}, object245// CHECK-PHASES: 10: llvm-offload-binary, {9}, image246// CHECK-PHASES: 11: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (x86_64-unknown-linux-gnu)" {10}, ir247// CHECK-PHASES: 12: backend, {11}, assembler, (host-openmp)248// CHECK-PHASES: 13: assembler, {12}, object, (host-openmp)249// CHECK-PHASES: 14: clang-linker-wrapper, {13}, image, (host-openmp)250 251// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-BINDINGS252// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[HOST_BC:.+]]"253// CHECK-BINDINGS: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[DEVICE_BC:.+]]"254// CHECK-BINDINGS: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[DEVICE_BC]]"], output: "[[DEVICE_OBJ:.+]]"255// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Packager", inputs: ["[[DEVICE_OBJ]]"], output: "[[BINARY:.+.out]]"256// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_BC]]", "[[BINARY]]"], output: "[[HOST_OBJ:.+]]"257// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[HOST_OBJ]]"], output: "a.out"258 259// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 -nogpulib -save-temps %s 2>&1 | FileCheck %s --check-prefix=CHECK-TEMP-BINDINGS260// CHECK-TEMP-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Packager", inputs: ["[[DEVICE_OBJ:.+]]"], output: "[[BINARY:.+.out]]"261 262// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --offload-arch=sm_52 --offload-arch=sm_70 -nogpuinc -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-ARCH-BINDINGS263// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --offload-arch=sm_52,sm_70 -nogpuinc -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-ARCH-BINDINGS264// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --offload-arch=sm_52,sm_60,sm_70,sm_80 --no-offload-arch=sm_60,sm_80 -nogpuinc -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-ARCH-BINDINGS265// CHECK-ARCH-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.*]]"], output: "[[HOST_BC:.*]]"266// CHECK-ARCH-BINDINGS: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[DEVICE_BC_SM_52:.*]]"267// CHECK-ARCH-BINDINGS: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[DEVICE_BC_SM_52]]"], output: "[[DEVICE_OBJ_SM_52:.*]]"268// CHECK-ARCH-BINDINGS: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[DEVICE_BC_SM_70:.*]]"269// CHECK-ARCH-BINDINGS: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[DEVICE_BC_SM_70]]"], output: "[[DEVICE_OBJ_SM_70:.*]]"270// CHECK-ARCH-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Packager", inputs: ["[[DEVICE_OBJ_SM_52]]", "[[DEVICE_OBJ_SM_70]]"], output: "[[BINARY:.*]]"271// CHECK-ARCH-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_BC]]", "[[BINARY]]"], output: "[[HOST_OBJ:.*]]"272// CHECK-ARCH-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[HOST_OBJ]]"], output: "a.out"273 274// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp \275// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_70 \276// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx908  \277// RUN:     -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-NVIDIA-AMDGPU278 279// CHECK-NVIDIA-AMDGPU: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[HOST_BC:.+]]"280// CHECK-NVIDIA-AMDGPU: "amdgcn-amd-amdhsa" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[AMD_BC:.+]]"281// CHECK-NVIDIA-AMDGPU: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[NVIDIA_PTX:.+]]"282// CHECK-NVIDIA-AMDGPU: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[NVIDIA_PTX]]"], output: "[[NVIDIA_CUBIN:.+]]"283// CHECK-NVIDIA-AMDGPU: "x86_64-unknown-linux-gnu" - "Offload::Packager", inputs: ["[[AMD_BC]]", "[[NVIDIA_CUBIN]]"], output: "[[BINARY:.*]]"284// CHECK-NVIDIA-AMDGPU: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_BC]]", "[[BINARY]]"], output: "[[HOST_OBJ:.+]]"285// CHECK-NVIDIA-AMDGPU: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[HOST_OBJ]]"], output: "a.out"286 287// RUN:   %clang -x ir -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp --offload-arch=sm_52 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-IR288 289// CHECK-IR: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT_IR:.+]]"], output: "[[OBJECT:.+]]"290// CHECK-IR: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[OBJECT]]"], output: "a.out"291 292// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp=libomp --offload-device-only \293// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 -nogpulib %s 2>&1 \294// RUN:   | FileCheck %s --check-prefix=CHECK-EMIT-LLVM-IR295// CHECK-EMIT-LLVM-IR: "-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"{{.*}}"-emit-llvm"296 297// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp=libomp \298// RUN:     -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 -nogpulib %s 2>&1 \299// RUN:   | FileCheck %s --check-prefix=CHECK-EMIT-LLVM-IR-BC300// CHECK-EMIT-LLVM-IR-BC: "-cc1"{{.*}}"-triple" "nvptx64-nvidia-cuda"{{.*}}"-emit-llvm-bc"301 302// RUN:   %clang -### -fopenmp=libomp --offload-arch=sm_89 \303// RUN:          --no-cuda-version-check \304// RUN:          -nogpulib %s -o openmp-offload-gpu 2>&1 \305// RUN:   | FileCheck -check-prefix=DRIVER_EMBEDDING %s306 307// DRIVER_EMBEDDING: -fembed-offload-object={{.*}}.out308 309// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \310// RUN:     -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 --offload-host-only -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-HOST-ONLY311// CHECK-HOST-ONLY: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.*]]"], output: "[[OUTPUT:.*]]"312// CHECK-HOST-ONLY: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[OUTPUT]]"], output: "a.out"313 314// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \315// RUN:     -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 --offload-device-only -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-ONLY316// CHECK-DEVICE-ONLY: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.*]]"], output: "[[HOST_BC:.*]]"317// CHECK-DEVICE-ONLY: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[DEVICE_ASM:.*]]"318// CHECK-DEVICE-ONLY: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[DEVICE_ASM]]"], output: "{{.*}}-openmp-nvptx64-nvidia-cuda-sm_52.o"319 320// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \321// RUN:     -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_52 --offload-device-only -E -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-ONLY-PP322// CHECK-DEVICE-ONLY-PP: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT:.*]]"], output: "-"323 324// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \325// RUN:     -foffload-lto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBRARY %s326 327// CHECK-LTO-LIBRARY: --device-linker={{.*}}=-lomp{{.*}}-lomptarget{{.*}}328 329// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \330// RUN:     --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc %s 2>&1 \331// RUN:   | FileCheck --check-prefix=CHECK-NO-LTO-LIBRARY %s332 333// CHECK-NO-LTO-LIBRARY: --device-linker={{.*}}=-lomp{{.*}}-lomptarget{{.*}}334 335// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=sm_52 -nogpulib \336// RUN:     -foffload-lto %s 2>&1 | FileCheck --check-prefix=CHECK-NO-LIBRARY %s337 338// CHECK-NO-LIBRARY-NOT: --device-linker={{.*}}=-lomp{{.*}}-lomptarget{{.*}}339 340// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=sm_52 -nogpulib \341// RUN:     -Xoffload-linker a -Xoffload-linker-nvptx64-nvidia-cuda b -Xoffload-linker-nvptx64 c \342// RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-XLINKER %s343 344// CHECK-XLINKER: -device-linker=a{{.*}}-device-linker=nvptx64-nvidia-cuda=b{{.*}}-device-linker=nvptx64-nvidia-cuda=c{{.*}}--345 346// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=sm_52 -nogpulib \347// RUN:     -foffload-lto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-FEATURES %s348 349// CHECK-LTO-FEATURES: llvm-offload-binary{{.*}}--image={{.*}}feature=+ptx{{[0-9]+}}350 351// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=sm_52 -nogpulib \352// RUN:     -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx64 -foffload-lto %s 2>&1 \353// RUN:    | FileCheck --check-prefix=CHECK-SET-FEATURES %s354 355// CHECK-SET-FEATURES: llvm-offload-binary{{.*}}--image={{.*}}feature=+ptx64356 357//358// Check that `-Xarch_host` works for OpenMP offloading.359//360// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \361// RUN:     --offload-arch=sm_52 -nogpulib -nogpuinc -Xarch_host -O3 %s 2>&1 \362// RUN:   | FileCheck --check-prefix=XARCH-HOST %s363// XARCH-HOST: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"364// XARCH-HOST-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"365 366//367// Check that `-Xarch_device` works for OpenMP offloading.368//369// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \370// RUN:     --offload-arch=sm_52 -nogpulib -nogpuinc -Xarch_device -O3 %s 2>&1 \371// RUN:   | FileCheck --check-prefix=XARCH-DEVICE %s372// XARCH-DEVICE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"373// XARCH-DEVICE-NOT: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"374 375// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \376// RUN:      --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc \377// RUN:      --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \378// RUN:      --offload-arch=sm_52 -nogpulibc -nogpuinc %s 2>&1 \379// RUN:   | FileCheck --check-prefix=LIBC-GPU %s380// LIBC-GPU-NOT: clang-linker-wrapper{{.*}}"--device-linker"381 382//383// Check that ThinLTO works for OpenMP offloading.384//385// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \386// RUN:     --offload-arch=gfx906 -foffload-lto=thin -nogpulib -nogpuinc %s 2>&1 \387// RUN:   | FileCheck --check-prefix=THINLTO-GFX906 %s388// THINLTO-GFX906: --device-compiler=amdgcn-amd-amdhsa=-flto=thin389// THINLTO-GFX906-SAME: --device-linker=amdgcn-amd-amdhsa=-plugin-opt=-force-import-all390// THINLTO-GFX906-SAME: --device-linker=amdgcn-amd-amdhsa=-plugin-opt=-avail-extern-to-local391// THINLTO-GFX906-SAME: --device-linker=amdgcn-amd-amdhsa=-plugin-opt=-avail-extern-gv-in-addrspace-to-local=3392// THINLTO-GFX906-SAME: --device-linker=amdgcn-amd-amdhsa=-plugin-opt=-amdgpu-internalize-symbols393//394// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \395// RUN:     --offload-arch=sm_52 -foffload-lto=thin -nogpulib -nogpuinc %s 2>&1 \396// RUN:   | FileCheck --check-prefix=THINLTO-SM52 %s397// THINLTO-SM52: --device-compiler=nvptx64-nvidia-cuda=-flto=thin398 399//400// Check the requested architecture is passed if provided.401//402// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \403// RUN:     --offload-arch=gfx906 -foffload-lto=thin -nogpulib -nogpuinc %s 2>&1 \404// RUN:   | FileCheck --check-prefix=SHOULD-EXTRACT %s405//406// SHOULD-EXTRACT: clang-linker-wrapper{{.*}}"--should-extract=gfx906"407