Skip to content

Commit b13faa4

Browse files
authored
[SYCL][Driver] Split sycl-oneapi-gpu tests by vendors (#12349)
1. Split the test into intel/nvidia/amd 2. Added fsycl-libspirv-path so that the test can also be run in different systems.
1 parent 5e9564d commit b13faa4

File tree

4 files changed

+496
-454
lines changed

4 files changed

+496
-454
lines changed
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/// Tests the behaviors of using -fsycl-targets=amd_gpu*
2+
3+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx700 \
4+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
5+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx700 -DMAC_STR=GFX700
6+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx701 \
7+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
8+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx701 -DMAC_STR=GFX701
9+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx702 \
10+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
11+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx702 -DMAC_STR=GFX702
12+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx801 \
13+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
14+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx801 -DMAC_STR=GFX801
15+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx802 \
16+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
17+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx802 -DMAC_STR=GFX802
18+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx803 \
19+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
20+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx803 -DMAC_STR=GFX803
21+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx805 \
22+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
23+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx805 -DMAC_STR=GFX805
24+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx810 \
25+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
26+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx810 -DMAC_STR=GFX810
27+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx900 \
28+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
29+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx900 -DMAC_STR=GFX900
30+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx902 \
31+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
32+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx902 -DMAC_STR=GFX902
33+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx904 \
34+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
35+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx904 -DMAC_STR=GFX904
36+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx906 \
37+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
38+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx906 -DMAC_STR=GFX906
39+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx908 \
40+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
41+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx908 -DMAC_STR=GFX908
42+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx909 \
43+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
44+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx909 -DMAC_STR=GFX909
45+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx90a \
46+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
47+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx90a -DMAC_STR=GFX90A
48+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx90c \
49+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
50+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx90c -DMAC_STR=GFX90C
51+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx940 \
52+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
53+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx940 -DMAC_STR=GFX940
54+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx941 \
55+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
56+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx941 -DMAC_STR=GFX941
57+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx942 \
58+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
59+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx942 -DMAC_STR=GFX942
60+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1010 \
61+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
62+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1010 -DMAC_STR=GFX1010
63+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1011 \
64+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
65+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1011 -DMAC_STR=GFX1011
66+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1012 \
67+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
68+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1012 -DMAC_STR=GFX1012
69+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1013 \
70+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
71+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1013 -DMAC_STR=GFX1013
72+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1030 \
73+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
74+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1030 -DMAC_STR=GFX1030
75+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1031 \
76+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
77+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1031 -DMAC_STR=GFX1031
78+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1032 \
79+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
80+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1032 -DMAC_STR=GFX1032
81+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1033 \
82+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
83+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1033 -DMAC_STR=GFX1033
84+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1034 \
85+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
86+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1034 -DMAC_STR=GFX1034
87+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1035 \
88+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
89+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1035 -DMAC_STR=GFX1035
90+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1036 \
91+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
92+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1036 -DMAC_STR=GFX1036
93+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1100 \
94+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
95+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1100 -DMAC_STR=GFX1100
96+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1101 \
97+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
98+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1101 -DMAC_STR=GFX1101
99+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1102 \
100+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
101+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1102 -DMAC_STR=GFX1102
102+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1103 \
103+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
104+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1103 -DMAC_STR=GFX1103
105+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1150 \
106+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
107+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1150 -DMAC_STR=GFX1150
108+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1151 \
109+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
110+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1151 -DMAC_STR=GFX1151
111+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1200 \
112+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
113+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1200 -DMAC_STR=GFX1200
114+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1201 \
115+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | \
116+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1201 -DMAC_STR=GFX1201
117+
// MACRO_AMD: clang{{.*}} "-triple" "amdgcn-amd-amdhsa"
118+
// MACRO_AMD: "-D__SYCL_TARGET_AMD_GPU_[[MAC_STR]]__"
119+
// DEVICE_AMD: clang-offload-wrapper{{.*}} "-compile-opts=--offload-arch=[[DEV_STR]]{{.*}}"
120+
// MACRO_AMD: clang{{.*}} "-fsycl-is-host"
121+
// MACRO_AMD: "-D__SYCL_TARGET_AMD_GPU_[[MAC_STR]]__"
122+
123+
/// test for invalid amd arch
124+
// RUN: not %clangxx -c -fsycl -fsycl-targets=amd_gpu_bad -### %s 2>&1 | \
125+
// RUN: FileCheck %s --check-prefix=BAD_AMD_INPUT
126+
// RUN: not %clang_cl -c -fsycl -fsycl-targets=amd_gpu_bad -### %s 2>&1 | \
127+
// RUN: FileCheck %s --check-prefix=BAD_AMD_INPUT
128+
// BAD_AMD_INPUT: error: SYCL target is invalid: 'amd_gpu_bad'
129+
130+
/// Test for proper creation of fat object
131+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx700 \
132+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc \
133+
// RUN: -target x86_64-unknown-linux-gnu -### %s 2>&1 | \
134+
// RUN: FileCheck %s --check-prefix=AMD_FATO
135+
// AMD_FATO: clang-offload-bundler{{.*}} "-type=o"
136+
// AMD_FATO: "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx700"
137+
138+
/// Test for proper consumption of fat object
139+
// RUN: touch %t.o
140+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx700 \
141+
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc \
142+
// RUN: -target x86_64-unknown-linux-gnu -### %t.o 2>&1 | \
143+
// RUN: FileCheck %s --check-prefix=AMD_CONSUME_FAT
144+
// AMD_CONSUME_FAT: clang-offload-bundler{{.*}} "-type=o"
145+
// AMD_CONSUME_FAT: "-targets=host-x86_64-unknown-linux-gnu,sycl-amdgcn-amd-amdhsa-gfx700"
146+
// AMD_CONSUME_FAT: "-unbundle" "-allow-missing-bundles"
147+
148+
/// AMD Test phases, BoundArch settings used for -device target. Additional
149+
/// offload action used for compilation and backend compilation.
150+
// RUN: %clangxx -fsycl -fsycl-targets=amd_gpu_gfx700 -fno-sycl-device-lib=all \
151+
// RUN: -fno-sycl-instrument-device-code \
152+
// RUN: -target x86_64-unknown-linux-gnu -ccc-print-phases %s 2>&1 | \
153+
// RUN: FileCheck %s --check-prefix=AMD_CHECK_PHASES
154+
// AMD_CHECK_PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
155+
// AMD_CHECK_PHASES: 1: append-footer, {0}, c++, (host-sycl)
156+
// AMD_CHECK_PHASES: 2: preprocessor, {1}, c++-cpp-output, (host-sycl)
157+
// AMD_CHECK_PHASES: 3: input, "[[INPUT]]", c++, (device-sycl, gfx700)
158+
// AMD_CHECK_PHASES: 4: preprocessor, {3}, c++-cpp-output, (device-sycl, gfx700)
159+
// AMD_CHECK_PHASES: 5: compiler, {4}, ir, (device-sycl, gfx700)
160+
// AMD_CHECK_PHASES: 6: offload, "host-sycl (x86_64-unknown-linux-gnu)" {2}, "device-sycl (amdgcn-amd-amdhsa:gfx700)" {5}, c++-cpp-output
161+
// AMD_CHECK_PHASES: 7: compiler, {6}, ir, (host-sycl)
162+
// AMD_CHECK_PHASES: 8: backend, {7}, assembler, (host-sycl)
163+
// AMD_CHECK_PHASES: 9: assembler, {8}, object, (host-sycl)
164+
// AMD_CHECK_PHASES: 10: linker, {9}, image, (host-sycl)
165+
// AMD_CHECK_PHASES: 11: linker, {5}, ir, (device-sycl, gfx700)
166+
// AMD_CHECK_PHASES: 12: sycl-post-link, {11}, ir, (device-sycl, gfx700)
167+
// AMD_CHECK_PHASES: 13: file-table-tform, {12}, ir, (device-sycl, gfx700)
168+
// AMD_CHECK_PHASES: 14: backend, {13}, assembler, (device-sycl, gfx700)
169+
// AMD_CHECK_PHASES: 15: assembler, {14}, object, (device-sycl, gfx700)
170+
// AMD_CHECK_PHASES: 16: linker, {15}, image, (device-sycl, gfx700)
171+
// AMD_CHECK_PHASES: 17: linker, {16}, hip-fatbin, (device-sycl, gfx700)
172+
// AMD_CHECK_PHASES: 18: foreach, {13, 17}, hip-fatbin, (device-sycl, gfx700)
173+
// AMD_CHECK_PHASES: 19: file-table-tform, {12, 18}, tempfiletable, (device-sycl, gfx700)
174+
// AMD_CHECK_PHASES: 20: clang-offload-wrapper, {19}, object, (device-sycl, gfx700)
175+
// AMD_CHECK_PHASES: 21: offload, "host-sycl (x86_64-unknown-linux-gnu)" {10}, "device-sycl (amdgcn-amd-amdhsa:gfx700)" {20}, image
176+

0 commit comments

Comments
 (0)