Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 68295c0

Browse files
vladimirlazbader
andauthored
[SYCL] Add gpu_aot_target_opts parameter (#590)
* [SYCL] Add gpu_aot_target_opts parameter The gpu_aot_target_opts LIT parameter and the GPU_AOT_TARGET_OPTS CMake variable is introduced to allow customization of the target device for AOT compilation on GPU. Co-authored-by: Alexey Bader <[email protected]>
1 parent eef10f9 commit 68295c0

File tree

8 files changed

+36
-24
lines changed

8 files changed

+36
-24
lines changed

SYCL/AOT/gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
// UNSUPPORTED: cuda
1111
// CUDA is not compatible with SPIR.
1212
//
13-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/aot.cpp -o %t.out
13+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %S/Inputs/aot.cpp -o %t.out
1414
// RUN: %GPU_RUN_PLACEHOLDER %t.out

SYCL/AOT/multiple-devices.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// 1-command compilation case
1414
// Targeting CPU, GPU, FPGA
15-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/aot.cpp -o %t_all.out
15+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %S/Inputs/aot.cpp -o %t_all.out
1616
// RUN: %HOST_RUN_PLACEHOLDER %t_all.out
1717
// RUN: %CPU_RUN_PLACEHOLDER %t_all.out
1818
// RUN: %GPU_RUN_PLACEHOLDER %t_all.out

SYCL/DeviceCodeSplit/aot-gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_source \
66
// RUN: -fsycl-targets=spir64_gen \
77
// RUN: -Xsycl-target-backend=spir64_gen \
8-
// RUN: "-device *" -I %S/Inputs -o %t.out \
8+
// RUN: %gpu_aot_target_opts -I %S/Inputs -o %t.out \
99
// RUN: %S/split-per-source-main.cpp \
1010
// RUN: %S/Inputs/split-per-source-second-file.cpp \
1111
// RUN: -fsycl-dead-args-optimization

SYCL/ESIMD/aot_mixed.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// RUN: %GPU_RUN_PLACEHOLDER %t.out
1414
// XFAIL: *
1515
// TODO: remove XFAIL once ocloc support for automatic scalar/vector SPIRV
16-
// module dispatching is available in public drivers. Also change 'gen9' (safe
17-
// variant to reliably get unexpected PASS when ocloc is fixed) to '*' (which
18-
// stresses ocloc).
16+
// module dispatching is available in public drivers. Also change '-device gen9'
17+
// (safe variant to reliably get unexpected PASS when ocloc is fixed) to
18+
// %gpu_aot_target_opts aka '-device *' (which stresses ocloc).
1919

2020
// This test checks ESIMD ahead-of-time compilation scenarios:
2121
// 1) When the application contains both SYCL and ESIMD kernel, thus requiring

SYCL/README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ ninja check-sycl-all
6262

6363
These parameters can be used to configure tests:
6464

65-
***CMAKE_CXX_COMPILER*** path DPCPP compiler
65+
***CMAKE_CXX_COMPILER*** - path to DPCPP compiler
6666

67-
***TEST_SUITE_LLVM_SIZE*** path to llvm-size tool, required for code size
67+
***TEST_SUITE_LLVM_SIZE*** - path to llvm-size tool, required for code size
6868
collection
6969

70-
***TEST_SUITE_COLLECT_COMPILE_TIME=OFF*** can be used to turn off compile time
71-
collection
70+
***TEST_SUITE_COLLECT_COMPILE_TIME=OFF*** - can be used to turn off compile
71+
time collection
7272

73-
***TEST_SUITE_COLLECT_CODE_SIZE=OFF*** can be used to turn off code size
73+
***TEST_SUITE_COLLECT_CODE_SIZE=OFF*** - can be used to turn off code size
7474
collection
7575

76-
***TEST_SUITE_LIT*** path to llvm-lit tool
76+
***TEST_SUITE_LIT*** - path to llvm-lit tool
7777

78-
***CHECK_SYCL_ALL*** defines selection of multiple SYCL backends with set of
78+
***CHECK_SYCL_ALL*** - defines selection of multiple SYCL backends with set of
7979
target devices per each to be tested iteratively. Value is semicolon-separated
8080
list of configurations. Each configuration includes backend separated
8181
from comma-separated list of target devices with colon. Example:
@@ -84,36 +84,39 @@ from comma-separated list of target devices with colon. Example:
8484
-DCHECK_SYCL_ALL="opencl:cpu,host;level_zero:gpu,host;cuda:gpu;hip:gpu"
8585
```
8686

87-
***SYCL_BE*** SYCL backend to be used for testing. Supported values are:
87+
***SYCL_BE*** - SYCL backend to be used for testing. Supported values are:
8888
- **opencl** - for OpenCL backend;
8989
- **cuda** - for CUDA backend;
9090
- **hip** - for HIP backend;
9191
- **level_zero** - Level Zero backend.
9292

93-
***SYCL_TARGET_DEVICES*** comma separated list of target devices for testing.
93+
***SYCL_TARGET_DEVICES*** - comma separated list of target devices for testing.
9494
Default value is cpu,gpu,acc,host. Supported values are:
9595
- **cpu** - CPU device available in OpenCL backend only;
9696
- **gpu** - GPU device available in OpenCL, Level Zero, CUDA, and HIP backends;
9797
- **acc** - FPGA emulator device available in OpenCL backend only;
9898
- **host** - SYCL Host device available with all backends.
9999

100-
***OpenCL_LIBRARY*** path to OpenCL ICD loader library. OpenCL interoperability
101-
tests require OpenCL ICD loader to be linked with. For such tests OpenCL ICD
102-
loader library should be installed in the system or available at the full path
103-
specified by this variable.
100+
***OpenCL_LIBRARY*** - path to OpenCL ICD loader library. OpenCL
101+
interoperability tests require OpenCL ICD loader to be linked with. For such
102+
tests OpenCL ICD loader library should be installed in the system or available
103+
at the full path specified by this variable.
104104

105-
***LEVEL_ZERO_INCLUDE*** path to Level Zero headers.
105+
***LEVEL_ZERO_INCLUDE*** - path to Level Zero headers.
106106

107-
***LEVEL_ZERO_LIBS_DIR*** path to Level Zero libraries.
107+
***LEVEL_ZERO_LIBS_DIR*** - path to Level Zero libraries.
108108

109-
***HIP_PLATFORM*** platform selection for HIP targeted devices.
109+
***HIP_PLATFORM*** - platform selection for HIP targeted devices.
110110
Defaults to AMD if no value is given. Supported values are:
111111
- **AMD** - for HIP to target AMD GPUs
112112
- **NVIDIA** - for HIP to target NVIDIA GPUs
113113

114-
***AMD_ARCH*** Flag must be set for when using HIP AMD triple.
114+
***AMD_ARCH*** - flag must be set for when using HIP AMD triple.
115115
For example it may be set to "gfx906".
116116

117+
***GPU_AOT_TARGET_OPTS*** - defines additional options which are passed to AOT
118+
compilation command line for GPU device. If not specified "-device *" value
119+
is used.
117120

118121
# Special test categories
119122

@@ -154,6 +157,9 @@ configure specific single test execution in the command line:
154157
host);
155158
* **sycl_be** - SYCL backend to be used (opencl, level_zero, cuda, hip);
156159
* **dump_ir** - if IR dumping is supported for compiler (True, False);
160+
* **gpu_aot_target_opts** - defines additional options which are passed to AOT
161+
compilation command line for GPU device. It can be also set by CMake variable
162+
GPU_AOT_TARGET_OPTS. If not specified "-device *" value is used.
157163
* **gpu-intel-dg1** - tells LIT infra that Intel GPU DG1 is present in the
158164
system. It is developer / CI infra responsibility to make sure that the
159165
device is available in the system. Tests requiring DG1 to run must use proper

SYCL/SpecConstants/2020/non_native/gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: hip
66
// HIP is not compatible with SPIR.
77

8-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/common.cpp -o %t.out -fsycl-dead-args-optimization
8+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %S/Inputs/common.cpp -o %t.out -fsycl-dead-args-optimization
99
// RUN: %GPU_RUN_PLACEHOLDER %t.out
1010

1111
// This test checks correctness of SYCL2020 non-native specialization constants

SYCL/lit.cfg.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@
149149
config.substitutions.append( ('%debug_option', '-g' ) )
150150
config.substitutions.append( ('%cxx_std_option', '-std=' ) )
151151

152+
if not config.gpu_aot_target_opts:
153+
config.gpu_aot_target_opts = '"-device *"'
154+
155+
config.substitutions.append( ('%gpu_aot_target_opts', config.gpu_aot_target_opts ) )
156+
152157
if not config.sycl_be:
153158
lit_config.error("SYCL backend is not specified")
154159

SYCL/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ config.cxx_flags = "@CMAKE_CXX_FLAGS@"
3030
config.c_flags = "@CMAKE_C_FLAGS@"
3131
config.external_tests = "@SYCL_EXTERNAL_TESTS@"
3232
config.extra_include = "@CMAKE_CURRENT_SOURCE_DIR@/include"
33+
config.gpu_aot_target_opts = lit_config.params.get("gpu_aot_target_opts", "@GPU_AOT_TARGET_OPTS@")
3334

3435
import lit.llvm
3536
lit.llvm.initialize(lit_config, config)

0 commit comments

Comments
 (0)