diff options
author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-21 14:44:45 +0000 |
---|---|---|
committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-21 14:44:45 +0000 |
commit | 7c78cc52739c3d29589025c130c450a0b349bf7a (patch) | |
tree | df6adc689e08bea23f1980769ea9a719cd813113 /clang/test | |
parent | c27e3b6f032e49e464706b69effdf50805a5308b (diff) | |
download | bcm5719-llvm-7c78cc52739c3d29589025c130c450a0b349bf7a.tar.gz bcm5719-llvm-7c78cc52739c3d29589025c130c450a0b349bf7a.zip |
[OpenMP] Consistently use cubin extension for nvlink
This was previously done in some places, but for example not for
bundling so that single object compilation with -c failed. In
addition cubin was used for all file types during unbundling which
is incorrect for assembly files that are passed to ptxas.
Tighten up the tests so that we can't regress in that area.
Differential Revision: https://reviews.llvm.org/D40250
llvm-svn: 318763
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Driver/openmp-offload-gpu.c | 79 |
1 files changed, 54 insertions, 25 deletions
diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c index abef552a6e6..ad53f96112a 100644 --- a/clang/test/Driver/openmp-offload-gpu.c +++ b/clang/test/Driver/openmp-offload-gpu.c @@ -10,7 +10,8 @@ /// ########################################################################### /// 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: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \ +// RUN: -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" @@ -19,7 +20,9 @@ /// ########################################################################### /// 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: %clang -### -no-canonical-prefixes -fopenmp=libomp \ +// RUN: -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda \ +// RUN: -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" @@ -28,43 +31,67 @@ /// ########################################################################### /// 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 +// RUN: %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \ +// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-CUBIN-NVLINK %s +/// 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 \ +// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-CUBIN-NVLINK %s + +// CHK-CUBIN-NVLINK: clang{{.*}}" "-o" "[[PTX:.*\.s]]" +// CHK-CUBIN-NVLINK-NEXT: ptxas{{.*}}" "--output-file" "[[CUBIN:.*\.cubin]]" {{.*}}"[[PTX]]" +// CHK-CUBIN-NVLINK-NEXT: nvlink{{.*}}" {{.*}}"[[CUBIN]]" + +/// ########################################################################### -// CHK-CUBIN: clang{{.*}}" "-o" "{{.*}}.s" -// CHK-CUBIN-NEXT: ptxas{{.*}}" "--output-file" {{.*}}.cubin" {{.*}}.s" -// CHK-CUBIN-NEXT: nvlink" {{.*}}.cubin" +/// Check unbundlink of assembly file, cubin file generation and usage by nvlink +// RUN: touch %t.s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %t.s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK %s +/// Use DAG to ensure that assembly file has been unbundled. +// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG: ptxas{{.*}}" "--output-file" "[[CUBIN:.*\.cubin]]" {{.*}}"[[PTX:.*\.s]]" +// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG: clang-offload-bundler{{.*}}" "-type=s" {{.*}}"-outputs={{.*}}[[PTX]] +// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG-SAME: "-unbundle" +// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK: 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 +/// Check cubin file generation and bundling +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-PTXAS-CUBIN-BUNDLING %s -// CHK-CUBIN-DARWIN: clang{{.*}}" "-o" "{{.*}}.s" -// CHK-CUBIN-DARWIN-NEXT: ptxas{{.*}}" "--output-file" {{.*}}.cubin" {{.*}}.s" -// CHK-CUBIN-DARWIN-NEXT: nvlink" {{.*}}.cubin" +// CHK-PTXAS-CUBIN-BUNDLING: clang{{.*}}" "-o" "[[PTX:.*\.s]]" +// CHK-PTXAS-CUBIN-BUNDLING-NEXT: ptxas{{.*}}" "--output-file" "[[CUBIN:.*\.cubin]]" {{.*}}"[[PTX]]" +// CHK-PTXAS-CUBIN-BUNDLING: clang-offload-bundler{{.*}}" "-type=o" {{.*}}"-inputs={{.*}}[[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 +/// Check cubin file unbundling and usage by nvlink +// RUN: touch %t.o +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-CUBIN-UNBUNDLING-NVLINK %s -// CHK-TWOCUBIN: nvlink{{.*}}openmp-offload-{{.*}}.cubin" "{{.*}}openmp-offload-{{.*}}.cubin" +/// Use DAG to ensure that cubin file has been unbundled. +// CHK-CUBIN-UNBUNDLING-NVLINK-DAG: nvlink{{.*}}" {{.*}}"[[CUBIN:.*\.cubin]]" +// CHK-CUBIN-UNBUNDLING-NVLINK-DAG: clang-offload-bundler{{.*}}" "-type=o" {{.*}}"-outputs={{.*}}[[CUBIN]] +// CHK-CUBIN-UNBUNDLING-NVLINK-DAG-SAME: "-unbundle" /// ########################################################################### -/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction +/// Check cubin file generation and usage by nvlink // 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 +// RUN: %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \ +// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s +/// 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 \ +// RUN: -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s -// CHK-TWOCUBIN-DARWIN: nvlink{{.*}}openmp-offload-{{.*}}.cubin" "{{.*}}openmp-offload-{{.*}}.cubin" +// CHK-TWOCUBIN: nvlink{{.*}}openmp-offload-{{.*}}.cubin" "{{.*}}openmp-offload-{{.*}}.cubin" /// ########################################################################### @@ -77,7 +104,8 @@ /// ########################################################################### /// 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: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fnoopenmp-relocatable-target \ +// RUN: -save-temps -no-canonical-prefixes %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHK-PTXAS-NORELO %s // CHK-PTXAS-NORELO-NOT: ptxas{{.*}}" "-c" @@ -86,7 +114,8 @@ /// 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: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-relocatable-target \ +// RUN: -save-temps -no-canonical-prefixes %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHK-PTXAS-RELO %s // CHK-PTXAS-RELO: ptxas{{.*}}" "-c" |