Skip to content

Commit e39d0c1

Browse files
authored
[SYCL] Support -f[no-]sycl-rdc in clang-cl, add Windows lit tests (#7748)
The cause of the windows test failures in my previous change was 1) Expected linux host triple in a few places 2) Did not account for different number of device libraries for windows I also added support for -f[no-]sycl-rdc in clang-cl I tested these manually on Windows Signed-off-by: Sarnie, Nick <[email protected]>
1 parent cc59d77 commit e39d0c1

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,8 +2998,8 @@ def fsycl_max_parallel_jobs_EQ : Joined<["-"], "fsycl-max-parallel-link-jobs=">,
29982998
HelpText<"Experimental feature: Controls the maximum parallelism of actions performed "
29992999
"on SYCL device code post-link, i.e. the generation of SPIR-V device images "
30003000
"or AOT compilation of each device image.">;
3001-
def : Flag<["-"], "fsycl-rdc">, Alias<fgpu_rdc>;
3002-
def : Flag<["-"], "fno-sycl-rdc">, Alias<fno_gpu_rdc>;
3001+
def : Flag<["-"], "fsycl-rdc">, Flags<[CoreOption]>, Alias<fgpu_rdc>;
3002+
def : Flag<["-"], "fno-sycl-rdc">, Flags<[CoreOption]>, Alias<fno_gpu_rdc>;
30033003
def fsyntax_only : Flag<["-"], "fsyntax-only">,
30043004
Flags<[NoXarchOption,CoreOption,CC1Option,FC1Option,FlangOption]>, Group<Action_Group>,
30053005
HelpText<"Run the preprocessor, parser and semantic analysis stages">;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// test behaviors of passing a fat static lib with -fno-sycl-rdc on Windows
2+
// REQUIRES: system-windows
3+
4+
// Build a fat static lib that will be used for all tests
5+
// RUN: echo "void foo(void) {}" > %t1.cpp
6+
// RUN: %clangxx -target x86_64-pc-windows-msvc -fsycl %t1.cpp -c -o %t1_bundle.o
7+
// RUN: llvm-ar cr %t_lib.a %t1_bundle.o
8+
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=off --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
9+
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=auto --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
10+
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=per_kernel --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
11+
// RUN: %clang -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=per_source --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
12+
// RUN: %clang_cl -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=off --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
13+
// RUN: %clang_cl -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=auto --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
14+
// RUN: %clang_cl -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=per_kernel --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
15+
// RUN: %clang_cl -### -fsycl -fno-sycl-rdc -fsycl-device-code-split=per_source --sysroot=%S/Inputs/SYCL %t_lib.a 2>&1 -ccc-print-phases | FileCheck %s
16+
// CHECK: 2: input, "{{.*}}_lib.a", archive
17+
// CHECK: 3: clang-offload-unbundler, {2}, tempfilelist
18+
// CHECK: 4: spirv-to-ir-wrapper, {3}, tempfilelist, (device-sycl)
19+
// CHECK: 5: input, "{{.*}}libsycl-crt{{.*}}", object
20+
// CHECK: 6: clang-offload-unbundler, {5}, object
21+
// CHECK: 7: offload, " (spir64-unknown-unknown)" {6}, object
22+
// CHECK: 68: linker, {7, {{.*}}}, ir, (device-sycl)
23+
// CHECK: 69: linker, {4, 68}, ir, (device-sycl)
24+
// CHECK: 70: foreach, {4, 69}, ir, (device-sycl)
25+
// CHECK: 71: file-table-tform, {4, 70}, tempfilelist, (device-sycl)
26+
// CHECK: 72: sycl-post-link, {71}, tempfiletable, (device-sycl)
27+
// CHECK: 73: foreach, {71, 72}, tempfiletable, (device-sycl)
28+
// CHECK: 74: file-table-tform, {73}, tempfilelist, (device-sycl)
29+
// CHECK: 75: file-table-tform, {73}, tempfilelist, (device-sycl)
30+
// CHECK: 76: foreach, {71, 75}, tempfilelist, (device-sycl)
31+
// CHECK: 77: file-table-tform, {76}, tempfilelist, (device-sycl)
32+
// CHECK: 78: llvm-spirv, {77}, tempfilelist, (device-sycl)
33+
// CHECK: 79: file-table-tform, {74, 78}, tempfiletable, (device-sycl)
34+
// CHECK: 80: clang-offload-wrapper, {79}, object, (device-sycl)
35+
// CHECK: 81: offload, "host-sycl (x86_64-pc-windows-msvc)" {1}, "device-sycl (spir64-unknown-unknown)" {80}, image

clang/test/Driver/sycl-no-rdc-win.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/// Tests for -fno-sycl-rdc on Windows
2+
// REQUIRES: system-windows
3+
4+
// RUN: touch %t1.cpp
5+
// RUN: touch %t2.cpp
6+
// RUN: %clang -### -fsycl -fno-sycl-rdc --sysroot=%S/Inputs/SYCL %t1.cpp %t2.cpp 2>&1 -ccc-print-phases | FileCheck %s
7+
// RUN: %clang_cl -### -fsycl -fno-sycl-rdc --sysroot=%S/Inputs/SYCL %t1.cpp %t2.cpp 2>&1 -ccc-print-phases | FileCheck %s
8+
9+
// CHECK: 3: input, "{{.*}}1.cpp", c++, (device-sycl)
10+
// CHECK: 4: preprocessor, {3}, c++-cpp-output, (device-sycl)
11+
// CHECK: 5: compiler, {4}, ir, (device-sycl)
12+
// CHECK: 13: input, "{{.*}}2.cpp", c++, (device-sycl)
13+
// CHECK: 14: preprocessor, {13}, c++-cpp-output, (device-sycl)
14+
// CHECK: 15: compiler, {14}, ir, (device-sycl)
15+
16+
// CHECK: 21: input, {{.*}}libsycl-crt{{.*}}, object
17+
// CHECK: 22: clang-offload-unbundler, {21}, object
18+
// CHECK: 23: offload, " (spir64-unknown-unknown)" {22}, object
19+
// CHECK: 84: linker, {23, {{.*}}}, ir, (device-sycl)
20+
// CHECK: 85: linker, {5, 84}, ir, (device-sycl)
21+
// CHECK: 86: sycl-post-link, {85}, tempfiletable, (device-sycl)
22+
// CHECK: 87: file-table-tform, {86}, tempfilelist, (device-sycl)
23+
// CHECK: 88: llvm-spirv, {87}, tempfilelist, (device-sycl)
24+
// CHECK: 89: file-table-tform, {86, 88}, tempfiletable, (device-sycl)
25+
// CHECK: 90: clang-offload-wrapper, {89}, object, (device-sycl)
26+
27+
// CHECK: 91: linker, {15, 84}, ir, (device-sycl)
28+
// CHECK: 92: sycl-post-link, {91}, tempfiletable, (device-sycl)
29+
// CHECK: 93: file-table-tform, {92}, tempfilelist, (device-sycl)
30+
// CHECK: 94: llvm-spirv, {93}, tempfilelist, (device-sycl)
31+
// CHECK: 95: file-table-tform, {92, 94}, tempfiletable, (device-sycl)
32+
// CHECK: 96: clang-offload-wrapper, {95}, object, (device-sycl)
33+
34+
// CHECK: 97: offload, "host-sycl (x86_64-pc-windows-msvc)" {{{.*}}}, "device-sycl (spir64-unknown-unknown)" {90}, "device-sycl (spir64-unknown-unknown)" {96}, image

0 commit comments

Comments
 (0)