|
1 | 1 | /// Test that SYCL bitcode device libraries are properly separated for NVIDIA and AMD targets. |
2 | 2 |
|
3 | | -/// Check devicelib and libspirv are linked for nvptx. |
| 3 | +/// Check devicelib are linked for nvptx. |
4 | 4 | // RUN: %clang -### -fsycl --offload-new-driver \ |
| 5 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
5 | 6 | // RUN: -fsycl-targets=nvptx64-nvidia-cuda \ |
6 | 7 | // RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \ |
7 | 8 | // RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-NVPTX-BC %s |
8 | 9 |
|
9 | 10 | // RUN: %clang_cl -### -fsycl --offload-new-driver \ |
| 11 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
10 | 12 | // RUN: -fsycl-targets=nvptx64-nvidia-cuda \ |
11 | 13 | // RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \ |
12 | 14 | // RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-NVPTX-BC %s |
13 | 15 |
|
14 | 16 | // CHECK-NVPTX-BC: clang-linker-wrapper |
15 | | -// CHECK-NVPTX-BC-SAME: "--bitcode-library=nvptx64-nvidia-cuda={{.*}}devicelib-nvptx64-nvidia-cuda.bc" "--bitcode-library=nvptx64-nvidia-cuda={{.*}}libspirv-nvptx64-nvidia-cuda.bc" |
| 17 | +// CHECK-NVPTX-BC-SAME: "--bitcode-library=nvptx64-nvidia-cuda={{.*}}devicelib-nvptx64-nvidia-cuda.bc" |
16 | 18 |
|
17 | 19 | /// Check devicelib is linked for amdgcn. |
18 | 20 | // RUN: %clang -### -fsycl --offload-new-driver \ |
| 21 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
19 | 22 | // RUN: -fsycl-targets=amdgcn-amd-amdhsa \ |
20 | 23 | // RUN: -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 \ |
21 | 24 | // RUN: --rocm-path=%S/Inputs/rocm \ |
22 | 25 | // RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-AMD-BC %s |
23 | 26 |
|
24 | 27 | // RUN: %clang_cl -### -fsycl --offload-new-driver \ |
| 28 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
25 | 29 | // RUN: -fsycl-targets=amdgcn-amd-amdhsa \ |
26 | 30 | // RUN: -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 \ |
27 | 31 | // RUN: --rocm-path=%S/Inputs/rocm \ |
|
32 | 36 |
|
33 | 37 | /// Check linking with multiple targets. |
34 | 38 | // RUN: %clang -### -fsycl --offload-new-driver \ |
| 39 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
35 | 40 | // RUN: -fsycl-targets=amdgcn-amd-amdhsa,nvptx64-nvidia-cuda \ |
36 | 41 | // RUN: -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 \ |
37 | 42 | // RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \ |
38 | 43 | // RUN: --rocm-path=%S/Inputs/rocm \ |
39 | 44 | // RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-MULTI-TARGET %s |
40 | 45 |
|
41 | 46 | // RUN: %clang_cl -### -fsycl --offload-new-driver \ |
| 47 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
42 | 48 | // RUN: -fsycl-targets=amdgcn-amd-amdhsa,nvptx64-nvidia-cuda \ |
43 | 49 | // RUN: -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 \ |
44 | 50 | // RUN: --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \ |
45 | 51 | // RUN: --rocm-path=%S/Inputs/rocm \ |
46 | 52 | // RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-MULTI-TARGET %s |
47 | 53 |
|
48 | 54 | // CHECK-MULTI-TARGET: clang-linker-wrapper |
49 | | -// CHECK-MULTI-TARGET-SAME: "--bitcode-library=amdgcn-amd-amdhsa={{.*}}devicelib-amdgcn-amd-amdhsa.bc" "--bitcode-library=nvptx64-nvidia-cuda={{.*}}devicelib-nvptx64-nvidia-cuda.bc" "--bitcode-library=nvptx64-nvidia-cuda={{.*}}libspirv-nvptx64-nvidia-cuda.bc" |
| 55 | +// CHECK-MULTI-TARGET-SAME: "--bitcode-library=amdgcn-amd-amdhsa={{.*}}devicelib-amdgcn-amd-amdhsa.bc" "--bitcode-library=nvptx64-nvidia-cuda={{.*}}devicelib-nvptx64-nvidia-cuda.bc" |
50 | 56 |
|
51 | 57 | /// Test --bitcode-library with nvptx dummy libraries. |
52 | 58 | // RUN: %clang -cc1 %s -triple nvptx64-nvidia-cuda -emit-llvm-bc -o %t.nvptx.devicelib.bc |
53 | | -// RUN: %clang -cc1 %s -triple nvptx64-nvidia-cuda -emit-llvm-bc -o %t.nvptx.libspirv.bc |
54 | | -// RUN: %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda --offload-new-driver -c %s -o %t.nvptx.o -nocudalib |
55 | | -// RUN: clang-linker-wrapper --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.devicelib.bc --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.libspirv.bc \ |
| 59 | +// RUN: %clang -cc1 %s -triple nvptx64-nvidia-cuda -emit-llvm-bc -o %t.nvptx.libdummy.bc |
| 60 | +// RUN: %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda \ |
| 61 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
| 62 | +// RUN: --offload-new-driver -c %s -o %t.nvptx.o -nocudalib |
| 63 | +// RUN: clang-linker-wrapper --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.devicelib.bc --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.libdummy.bc \ |
56 | 64 | // RUN: --host-triple=x86_64-unknown-linux-gnu --dry-run \ |
57 | 65 | // RUN: --linker-path=/usr/bin/ld %t.nvptx.o -o a.out 2>&1 | FileCheck -check-prefix=CHECK-WRAPPER-NVPTX %s |
58 | 66 |
|
59 | | -// CHECK-WRAPPER-NVPTX: llvm-link{{.*}} {{.*}}.nvptx.devicelib.bc {{.*}}.nvptx.libspirv.bc |
| 67 | +// CHECK-WRAPPER-NVPTX: llvm-link{{.*}} {{.*}}.nvptx.devicelib.bc {{.*}}.nvptx.libdummy.bc |
60 | 68 |
|
61 | 69 | /// Test --bitcode-library with amdgcn dummy library. |
62 | 70 | // RUN: %clang -cc1 %s -triple amdgcn-amd-amdhsa -emit-llvm-bc -o %t.amd.devicelib.bc |
63 | | -// RUN: %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 --offload-new-driver -c %s -o %t.amd.o -nogpulib |
| 71 | +// RUN: %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa \ |
| 72 | +// RUN: -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 \ |
| 73 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
| 74 | +// RUN: --offload-new-driver -c %s -o %t.amd.o -nogpulib -fgpu-rdc |
64 | 75 | // RUN: clang-linker-wrapper --bitcode-library=amdgcn-amd-amdhsa=%t.amd.devicelib.bc \ |
65 | 76 | // RUN: --host-triple=x86_64-unknown-linux-gnu --dry-run \ |
66 | 77 | // RUN: --linker-path=/usr/bin/ld %t.amd.o -o a.out 2>&1 | FileCheck -check-prefix=CHECK-WRAPPER-AMD %s |
|
70 | 81 | /// Test --bitcode-library with multi-target bc libraries. |
71 | 82 | // RUN: %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa,nvptx64-nvidia-cuda \ |
72 | 83 | // RUN: -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx900 \ |
73 | | -// RUN: --offload-new-driver -c %s -o %t.multi.o -nocudalib -nogpulib |
74 | | -// RUN: clang-linker-wrapper --bitcode-library=amdgcn-amd-amdhsa=%t.amd.devicelib.bc --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.devicelib.bc --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.libspirv.bc \ |
| 84 | +// RUN: -fno-sycl-libspirv -Wno-unsafe-libspirv-not-linked \ |
| 85 | +// RUN: --offload-new-driver -c %s -o %t.multi.o -nocudalib -nogpulib -fgpu-rdc |
| 86 | +// RUN: clang-linker-wrapper --bitcode-library=amdgcn-amd-amdhsa=%t.amd.devicelib.bc --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.devicelib.bc --bitcode-library=nvptx64-nvidia-cuda=%t.nvptx.libdummy.bc \ |
75 | 87 | // RUN: --host-triple=x86_64-unknown-linux-gnu --dry-run \ |
76 | 88 | // RUN: --linker-path=/usr/bin/ld %t.multi.o -o a.out 2>&1 | FileCheck -check-prefix=CHECK-WRAPPER-MULTI %s |
77 | 89 |
|
78 | 90 | // CHECK-WRAPPER-MULTI: llvm-link{{.*}} {{.*}}.amd.devicelib.bc |
79 | | -// CHECK-WRAPPER-MULTI: llvm-link{{.*}} {{.*}}.nvptx.devicelib.bc {{.*}}.nvptx.libspirv.bc |
| 91 | +// CHECK-WRAPPER-MULTI: llvm-link{{.*}} {{.*}}.nvptx.devicelib.bc {{.*}}.nvptx.libdummy.bc |
0 commit comments