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

Commit 1349fce

Browse files
authored
[SYCL] Update LIT to support the latest BEs (#752)
- add support for ext_intel_esimd_emulator BE. Only SYCL/ESIMD test should be run for this BE; - switch to use actual BE names to avoid runtime warning; - updated documentation accordingly.
1 parent 376e8b1 commit 1349fce

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

SYCL/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ list of configurations. Each configuration includes backend separated
8181
from comma-separated list of target devices with colon. Example:
8282

8383
```
84-
-DCHECK_SYCL_ALL="opencl:cpu,host;level_zero:gpu,host;cuda:gpu;hip:gpu"
84+
-DCHECK_SYCL_ALL="opencl:cpu,host;ext_oneapi_level_zero:gpu,host;ext_oneapi_cuda:gpu;ext_oneapi_hip:gpu;ext_intel_esimd_emulator:gpu"
8585
```
8686

8787
***SYCL_BE*** - SYCL backend to be used for testing. Supported values are:
8888
- **opencl** - for OpenCL backend;
89-
- **cuda** - for CUDA backend;
90-
- **hip** - for HIP backend;
91-
- **level_zero** - Level Zero backend.
89+
- **ext_oneapi_cuda** - for CUDA backend;
90+
- **ext_oneapi_hip** - for HIP backend;
91+
- **ext_oneapi_level_zero** - Level Zero backend;
92+
- **ext_intel_esimd_emulator** - ESIMD emulator backend;
93+
9294

9395
***SYCL_TARGET_DEVICES*** - comma separated list of target devices for testing.
9496
Default value is cpu,gpu,acc,host. Supported values are:
@@ -137,7 +139,8 @@ unavailable.
137139

138140
* **windows**, **linux** - host OS;
139141
* **cpu**, **gpu**, **host**, **accelerator** - target device;
140-
* **cuda**, **hip**, **opencl**, **level_zero** - target backend;
142+
* **cuda**, **hip**, **opencl**, **level_zero**, **esimd_emulator** - target
143+
backend;
141144
* **sycl-ls** - sycl-ls tool availability;
142145
* **cm-compiler** - C for Metal compiler availability;
143146
* **cl_options** - CL command line options recognized (or not) by compiler;
@@ -156,7 +159,8 @@ configure specific single test execution in the command line:
156159
* **dpcpp_compiler** - full path to dpcpp compiler;
157160
* **target_device** - comma-separated list of target devices (cpu, gpu, acc,
158161
host);
159-
* **sycl_be** - SYCL backend to be used (opencl, level_zero, cuda, hip);
162+
* **sycl_be** - SYCL backend to be used (opencl, ext_oneapi_level_zero,
163+
ext_oneapi_cuda, ext_oneapi_hip, ext_oneapi_intel_emulator);
160164
* **dump_ir** - if IR dumping is supported for compiler (True, False);
161165
* **gpu_aot_target_opts** - defines additional options which are passed to AOT
162166
compilation command line for GPU device. It can be also set by CMake variable
@@ -178,7 +182,7 @@ configure specific single test execution in the command line:
178182
Example:
179183

180184
```
181-
llvm-lit --param target_devices=host,gpu --param sycl_be=level_zero \
185+
llvm-lit --param target_devices=host,gpu --param sycl_be=ext_oneapi_level_zero \
182186
--param dpcpp_compiler=path/to/clang++ --param dump_ir=True \
183187
SYCL/External/RSBench
184188
```

SYCL/lit.cfg.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,37 +176,52 @@
176176
config.sycl_be = config.sycl_be[3:]
177177
config.sycl_be = config.sycl_be.lower()
178178

179+
# Replace deprecated backend names
180+
deprecated_names_mapping = {'cuda' : 'ext_oneapi_cuda',
181+
'hip' : 'ext_oneapi_hip',
182+
'level_zero' : 'ext_oneapi_level_zero',
183+
'esimd_cpu' : 'ext_intel_esimd_emulator'}
184+
if config.sycl_be in deprecated_names_mapping.keys():
185+
config.sycl_be = deprecated_names_mapping[config.sycl_be]
186+
179187
lit_config.note("Backend: {BACKEND}".format(BACKEND=config.sycl_be))
180188

181189
config.substitutions.append( ('%sycl_be', config.sycl_be) )
182-
config.available_features.add(config.sycl_be)
190+
# Use short names for LIT rules
191+
config.available_features.add(config.sycl_be.replace('ext_intel_', '').replace('ext_oneapi_', ''))
183192
config.substitutions.append( ('%BE_RUN_PLACEHOLDER', "env SYCL_DEVICE_FILTER={SYCL_PLUGIN} ".format(SYCL_PLUGIN=config.sycl_be)) )
184193

185194
if config.dump_ir_supported:
186195
config.available_features.add('dump_ir')
187196

188197
supported_sycl_be = ['host',
189198
'opencl',
190-
'cuda',
191-
'hip',
192-
'level_zero']
199+
'ext_oneapi_cuda',
200+
'ext_oneapi_hip',
201+
'ext_oneapi_level_zero',
202+
'ext_intel_esimd_emulator']
193203

194204
if config.sycl_be not in supported_sycl_be:
195205
lit_config.error("Unknown SYCL BE specified '" +
196206
config.sycl_be +
197207
"'. Supported values are {}".format(', '.join(supported_sycl_be)))
198208

209+
# Run only tests in ESIMD subforlder for the ext_intel_esimd_emulator
210+
if config.sycl_be == 'ext_intel_esimd_emulator':
211+
config.test_source_root += "/ESIMD"
212+
config.test_exec_root += "/ESIMD"
213+
199214
# If HIP_PLATFORM flag is not set, default to AMD, and check if HIP platform is supported
200215
supported_hip_platforms=["AMD", "NVIDIA"]
201216
if config.hip_platform == "":
202217
config.hip_platform = "AMD"
203218
if config.hip_platform not in supported_hip_platforms:
204219
lit_config.error("Unknown HIP platform '" + config.hip_platform + "' supported platforms are " + ', '.join(supported_hip_platforms))
205220

206-
if config.sycl_be == "hip" and config.hip_platform == "AMD":
221+
if config.sycl_be == "ext_oneapi_hip" and config.hip_platform == "AMD":
207222
config.available_features.add('hip_amd')
208223
arch_flag = '-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=' + config.amd_arch
209-
elif config.sycl_be == "hip" and config.hip_platform == "NVIDIA":
224+
elif config.sycl_be == "ext_oneapi_hip" and config.hip_platform == "NVIDIA":
210225
config.available_features.add('hip_nvidia')
211226
arch_flag = ""
212227
else:
@@ -300,7 +315,7 @@
300315
gpu_check_substitute = "| FileCheck %s"
301316
config.available_features.add('gpu')
302317

303-
if config.sycl_be == "level_zero":
318+
if config.sycl_be == "ext_oneapi_level_zero":
304319
gpu_l0_check_substitute = "| FileCheck %s"
305320
if lit_config.params.get('ze_debug'):
306321
gpu_run_substitute = " env ZE_DEBUG={ZE_DEBUG} SYCL_DEVICE_FILTER=level_zero:gpu,host ".format(ZE_DEBUG=config.ze_debug)
@@ -310,7 +325,7 @@
310325
gpu_run_on_linux_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:gpu,host ".format(SYCL_PLUGIN=config.sycl_be)
311326
gpu_check_on_linux_substitute = "| FileCheck %s"
312327

313-
if config.sycl_be == "cuda":
328+
if config.sycl_be == "ext_oneapi_cuda":
314329
gpu_run_substitute += "SYCL_PI_CUDA_ENABLE_IMAGE_SUPPORT=1 "
315330

316331
else:
@@ -335,9 +350,9 @@
335350
config.substitutions.append( ('%ACC_RUN_PLACEHOLDER', acc_run_substitute) )
336351
config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) )
337352

338-
if config.sycl_be == 'cuda' or (config.sycl_be == 'hip' and config.hip_platform == 'NVIDIA'):
353+
if config.sycl_be == 'ext_oneapi_cuda' or (config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'NVIDIA'):
339354
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda" ) )
340-
elif config.sycl_be == 'hip' and config.hip_platform == 'AMD':
355+
elif config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'AMD':
341356
config.substitutions.append( ('%sycl_triple', "amdgcn-amd-amdhsa" ) )
342357
else:
343358
config.substitutions.append( ('%sycl_triple', "spir64" ) )

0 commit comments

Comments
 (0)