From 2a94ecd682d43376e419ebe38d6c181f8e7fdaf5 Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Wed, 19 Jan 2022 11:34:11 +0300 Subject: [PATCH 1/3] [SYCL] Update LIT to support the latest BEs - 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. --- SYCL/CMakeLists.txt | 6 +++++- SYCL/README.md | 18 +++++++++++------- SYCL/lit.cfg.py | 33 +++++++++++++++++++++++---------- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/SYCL/CMakeLists.txt b/SYCL/CMakeLists.txt index d105896287..7b9d4ee628 100644 --- a/SYCL/CMakeLists.txt +++ b/SYCL/CMakeLists.txt @@ -19,8 +19,12 @@ if(CHECK_SYCL_ALL) string(REPLACE "," "_" TARGET check-sycl-${TARGET_BE}-${TARGET_DEVICES}) + set(TEST_DIR ".") + if(${TARGET_BE} MATCHES "esimd_emulator") + set(TEST_DIR "./ESIMD/") + endif() add_custom_target(${TARGET} - COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} . + COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} ${TEST_DIR} COMMENT "Running the SYCL tests for ${TARGET} backend" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${TEST_SUITE_TARGETS} diff --git a/SYCL/README.md b/SYCL/README.md index 00024576ec..7568771bc4 100644 --- a/SYCL/README.md +++ b/SYCL/README.md @@ -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: @@ -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; @@ -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 @@ -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 ``` diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 2defe79da2..45a99756ca 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -176,10 +176,22 @@ config.sycl_be = config.sycl_be[3:] config.sycl_be = config.sycl_be.lower() +# Use old names for LIT rules +config.available_features.add(config.sycl_be) + +# 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: @@ -187,9 +199,10 @@ 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 '" + @@ -203,10 +216,10 @@ 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: @@ -300,7 +313,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) @@ -310,7 +323,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: @@ -335,9 +348,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" ) ) From 7b9e261632649208e0277cacc113d39375e8f41e Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Wed, 19 Jan 2022 13:49:52 +0300 Subject: [PATCH 2/3] Move limitation of test from CMake to LIT For ESIMD emulator backend only tests from SYCL/ESIMD are run. --- SYCL/CMakeLists.txt | 6 +----- SYCL/lit.cfg.py | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/SYCL/CMakeLists.txt b/SYCL/CMakeLists.txt index 7b9d4ee628..d105896287 100644 --- a/SYCL/CMakeLists.txt +++ b/SYCL/CMakeLists.txt @@ -19,12 +19,8 @@ if(CHECK_SYCL_ALL) string(REPLACE "," "_" TARGET check-sycl-${TARGET_BE}-${TARGET_DEVICES}) - set(TEST_DIR ".") - if(${TARGET_BE} MATCHES "esimd_emulator") - set(TEST_DIR "./ESIMD/") - endif() add_custom_target(${TARGET} - COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} ${TEST_DIR} + COMMAND python3 ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} --param sycl_be=${TARGET_BE} --param target_devices=${TARGET_DEVICES} . COMMENT "Running the SYCL tests for ${TARGET} backend" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${TEST_SUITE_TARGETS} diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 45a99756ca..38981c4eaf 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -209,6 +209,11 @@ 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 == "": From 2b6944ad35d230670b5138526f4ed03fc0175356 Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Wed, 19 Jan 2022 13:52:57 +0300 Subject: [PATCH 3/3] Remove obsolete code --- SYCL/lit.cfg.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 38981c4eaf..6ef4686d08 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -176,9 +176,6 @@ config.sycl_be = config.sycl_be[3:] config.sycl_be = config.sycl_be.lower() -# Use old names for LIT rules -config.available_features.add(config.sycl_be) - # Replace deprecated backend names deprecated_names_mapping = {'cuda' : 'ext_oneapi_cuda', 'hip' : 'ext_oneapi_hip',