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

[SYCL] Update LIT to support the latest BEs #752

Merged
merged 3 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions SYCL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ list of configurations. Each configuration includes backend separated
from comma-separated list of target devices with colon. Example:

```
-DCHECK_SYCL_ALL="opencl:cpu,host;level_zero:gpu,host;cuda:gpu;hip:gpu"
-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"
```

***SYCL_BE*** - SYCL backend to be used for testing. Supported values are:
- **opencl** - for OpenCL backend;
- **cuda** - for CUDA backend;
- **hip** - for HIP backend;
- **level_zero** - Level Zero backend.
- **ext_oneapi_cuda** - for CUDA backend;
- **ext_oneapi_hip** - for HIP backend;
- **ext_oneapi_level_zero** - Level Zero backend;
- **ext_intel_esimd_emulator** - ESIMD emulator backend;


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

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

```
llvm-lit --param target_devices=host,gpu --param sycl_be=level_zero \
llvm-lit --param target_devices=host,gpu --param sycl_be=ext_oneapi_level_zero \
--param dpcpp_compiler=path/to/clang++ --param dump_ir=True \
SYCL/External/RSBench
```
Expand Down
35 changes: 25 additions & 10 deletions SYCL/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,37 +176,52 @@
config.sycl_be = config.sycl_be[3:]
config.sycl_be = config.sycl_be.lower()

# Replace deprecated backend names
deprecated_names_mapping = {'cuda' : 'ext_oneapi_cuda',
'hip' : 'ext_oneapi_hip',
'level_zero' : 'ext_oneapi_level_zero',
'esimd_cpu' : 'ext_intel_esimd_emulator'}
if config.sycl_be in deprecated_names_mapping.keys():
config.sycl_be = deprecated_names_mapping[config.sycl_be]

lit_config.note("Backend: {BACKEND}".format(BACKEND=config.sycl_be))

config.substitutions.append( ('%sycl_be', config.sycl_be) )
config.available_features.add(config.sycl_be)
# Use short names for LIT rules
config.available_features.add(config.sycl_be.replace('ext_intel_', '').replace('ext_oneapi_', ''))
config.substitutions.append( ('%BE_RUN_PLACEHOLDER', "env SYCL_DEVICE_FILTER={SYCL_PLUGIN} ".format(SYCL_PLUGIN=config.sycl_be)) )

if config.dump_ir_supported:
config.available_features.add('dump_ir')

supported_sycl_be = ['host',
'opencl',
'cuda',
'hip',
'level_zero']
'ext_oneapi_cuda',
'ext_oneapi_hip',
'ext_oneapi_level_zero',
'ext_intel_esimd_emulator']

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

# Run only tests in ESIMD subforlder for the ext_intel_esimd_emulator
if config.sycl_be == 'ext_intel_esimd_emulator':
config.test_source_root += "/ESIMD"
config.test_exec_root += "/ESIMD"

# If HIP_PLATFORM flag is not set, default to AMD, and check if HIP platform is supported
supported_hip_platforms=["AMD", "NVIDIA"]
if config.hip_platform == "":
config.hip_platform = "AMD"
if config.hip_platform not in supported_hip_platforms:
lit_config.error("Unknown HIP platform '" + config.hip_platform + "' supported platforms are " + ', '.join(supported_hip_platforms))

if config.sycl_be == "hip" and config.hip_platform == "AMD":
if config.sycl_be == "ext_oneapi_hip" and config.hip_platform == "AMD":
config.available_features.add('hip_amd')
arch_flag = '-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=' + config.amd_arch
elif config.sycl_be == "hip" and config.hip_platform == "NVIDIA":
elif config.sycl_be == "ext_oneapi_hip" and config.hip_platform == "NVIDIA":
config.available_features.add('hip_nvidia')
arch_flag = ""
else:
Expand Down Expand Up @@ -300,7 +315,7 @@
gpu_check_substitute = "| FileCheck %s"
config.available_features.add('gpu')

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

if config.sycl_be == "cuda":
if config.sycl_be == "ext_oneapi_cuda":
gpu_run_substitute += "SYCL_PI_CUDA_ENABLE_IMAGE_SUPPORT=1 "

else:
Expand All @@ -335,9 +350,9 @@
config.substitutions.append( ('%ACC_RUN_PLACEHOLDER', acc_run_substitute) )
config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) )

if config.sycl_be == 'cuda' or (config.sycl_be == 'hip' and config.hip_platform == 'NVIDIA'):
if config.sycl_be == 'ext_oneapi_cuda' or (config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'NVIDIA'):
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda" ) )
elif config.sycl_be == 'hip' and config.hip_platform == 'AMD':
elif config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'AMD':
config.substitutions.append( ('%sycl_triple', "amdgcn-amd-amdhsa" ) )
else:
config.substitutions.append( ('%sycl_triple', "spir64" ) )
Expand Down