diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Driver/openmp-offload-gpu.c | 95 | ||||
| -rw-r--r-- | clang/test/Driver/openmp-offload.c | 21 |
2 files changed, 95 insertions, 21 deletions
diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c new file mode 100644 index 00000000000..ba1aa2a3605 --- /dev/null +++ b/clang/test/Driver/openmp-offload-gpu.c @@ -0,0 +1,95 @@ +/// +/// Perform several driver tests for OpenMP offloading +/// + +// Until this test is stabilized on all local configurations. +// UNSUPPORTED: linux + +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: powerpc-registered-target +// REQUIRES: nvptx-registered-target + +/// ########################################################################### + +/// Check -Xopenmp-target uses one of the archs provided when several archs are used. +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_35 -Xopenmp-target -march=sm_60 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-ARCHS %s + +// CHK-FOPENMP-TARGET-ARCHS: ptxas{{.*}}" "--gpu-name" "sm_60" +// CHK-FOPENMP-TARGET-ARCHS: nvlink{{.*}}" "-arch" "sm_60" + +/// ########################################################################### + +/// Check -Xopenmp-target -march=sm_35 works as expected when two triples are present. +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_35 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-COMPILATION %s + +// CHK-FOPENMP-TARGET-COMPILATION: ptxas{{.*}}" "--gpu-name" "sm_35" +// CHK-FOPENMP-TARGET-COMPILATION: nvlink{{.*}}" "-arch" "sm_35" + +/// ########################################################################### + +/// Check cubin file generation and usage by nvlink +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-CUBIN %s + +// CHK-CUBIN: clang{{.*}}" "-o" "{{.*}}.s" +// CHK-CUBIN-NEXT: ptxas{{.*}}" "--output-file" {{.*}}.cubin" {{.*}}.s" +// CHK-CUBIN-NEXT: nvlink" {{.*}}.cubin" + + +/// ########################################################################### + +/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction +// RUN: %clang -### -no-canonical-prefixes -target x86_64-apple-darwin17.0.0 -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-CUBIN-DARWIN %s + +// CHK-CUBIN-DARWIN: clang{{.*}}" "-o" "{{.*}}.s" +// CHK-CUBIN-DARWIN-NEXT: ptxas{{.*}}" "--output-file" {{.*}}.cubin" {{.*}}.s" +// CHK-CUBIN-DARWIN-NEXT: nvlink" {{.*}}.cubin" + +/// ########################################################################### + +/// Check cubin file generation and usage by nvlink +// RUN: touch %t1.o +// RUN: touch %t2.o +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s + +// CHK-TWOCUBIN: nvlink"{{.*}}"openmp-offload-{{.*}}.cubin" "openmp-offload-{{.*}}.cubin" + +/// ########################################################################### + +/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction +// RUN: touch %t1.o +// RUN: touch %t2.o +// RUN: %clang -### -no-canonical-prefixes -target x86_64-apple-darwin17.0.0 -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN-DARWIN %s + +// CHK-TWOCUBIN-DARWIN: nvlink"{{.*}}"openmp-offload-{{.*}}.cubin" "openmp-offload-{{.*}}.cubin" + +/// ########################################################################### + +/// Check PTXAS is passed -c flag when offloading to an NVIDIA device using OpenMP. +// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -no-canonical-prefixes %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-PTXAS-DEFAULT %s + +// CHK-PTXAS-DEFAULT: ptxas{{.*}}" "-c" + +/// ########################################################################### + +/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP - disable it. +// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fnoopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-PTXAS-NORELO %s + +// CHK-PTXAS-NORELO-NOT: ptxas{{.*}}" "-c" + +/// ########################################################################### + +/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP +/// Check that the flag is passed when -fopenmp-relocatable-target is used. +// RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-PTXAS-RELO %s + +// CHK-PTXAS-RELO: ptxas{{.*}}" "-c" diff --git a/clang/test/Driver/openmp-offload.c b/clang/test/Driver/openmp-offload.c index c546f0ec6bd..92f6014d932 100644 --- a/clang/test/Driver/openmp-offload.c +++ b/clang/test/Driver/openmp-offload.c @@ -2,9 +2,6 @@ /// Perform several driver tests for OpenMP offloading /// -// Until this test is stabilized on all local configurations. -// UNSUPPORTED: linux - // REQUIRES: clang-driver // REQUIRES: x86-registered-target // REQUIRES: powerpc-registered-target @@ -632,21 +629,3 @@ // RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-NESTED-ERROR %s // CHK-FOPENMP-TARGET-NESTED-ERROR: clang{{.*}} error: invalid -Xopenmp-target argument: '-Xopenmp-target -Xopenmp-target', options requiring arguments are unsupported - -/// ########################################################################### - -/// Check -Xopenmp-target uses one of the archs provided when several archs are used. -// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_35 -Xopenmp-target -march=sm_60 %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-ARCHS %s - -// CHK-FOPENMP-TARGET-ARCHS: ptxas{{.*}}" "--gpu-name" "sm_60" -// CHK-FOPENMP-TARGET-ARCHS: nvlink{{.*}}" "-arch" "sm_60" - -/// ########################################################################### - -/// Check -Xopenmp-target -march=sm_35 works as expected when two triples are present. -// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_35 %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-COMPILATION %s - -// CHK-FOPENMP-TARGET-COMPILATION: ptxas{{.*}}" "--gpu-name" "sm_35" -// CHK-FOPENMP-TARGET-COMPILATION: nvlink{{.*}}" "-arch" "sm_35" |

