diff --git a/SYCL/AOT/gpu.cpp b/SYCL/AOT/gpu.cpp index 8bf9a07886..587afecc99 100644 --- a/SYCL/AOT/gpu.cpp +++ b/SYCL/AOT/gpu.cpp @@ -10,5 +10,5 @@ // UNSUPPORTED: cuda // CUDA is not compatible with SPIR. // -// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/aot.cpp -o %t.out +// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %S/Inputs/aot.cpp -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index 90667ceea1..fd36cd030c 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -12,7 +12,7 @@ // 1-command compilation case // Targeting CPU, GPU, FPGA -// 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 +// 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 // RUN: %HOST_RUN_PLACEHOLDER %t_all.out // RUN: %CPU_RUN_PLACEHOLDER %t_all.out // RUN: %GPU_RUN_PLACEHOLDER %t_all.out diff --git a/SYCL/DeviceCodeSplit/aot-gpu.cpp b/SYCL/DeviceCodeSplit/aot-gpu.cpp index f11a4ce7c9..0364ed88de 100644 --- a/SYCL/DeviceCodeSplit/aot-gpu.cpp +++ b/SYCL/DeviceCodeSplit/aot-gpu.cpp @@ -5,7 +5,7 @@ // RUN: %clangxx -fsycl -fsycl-device-code-split=per_source \ // RUN: -fsycl-targets=spir64_gen \ // RUN: -Xsycl-target-backend=spir64_gen \ -// RUN: "-device *" -I %S/Inputs -o %t.out \ +// RUN: %gpu_aot_target_opts -I %S/Inputs -o %t.out \ // RUN: %S/split-per-source-main.cpp \ // RUN: %S/Inputs/split-per-source-second-file.cpp \ // RUN: -fsycl-dead-args-optimization diff --git a/SYCL/ESIMD/aot_mixed.cpp b/SYCL/ESIMD/aot_mixed.cpp index 0a4079209e..3fe0013a0a 100644 --- a/SYCL/ESIMD/aot_mixed.cpp +++ b/SYCL/ESIMD/aot_mixed.cpp @@ -13,9 +13,9 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // XFAIL: * // TODO: remove XFAIL once ocloc support for automatic scalar/vector SPIRV -// module dispatching is available in public drivers. Also change 'gen9' (safe -// variant to reliably get unexpected PASS when ocloc is fixed) to '*' (which -// stresses ocloc). +// module dispatching is available in public drivers. Also change '-device gen9' +// (safe variant to reliably get unexpected PASS when ocloc is fixed) to +// %gpu_aot_target_opts aka '-device *' (which stresses ocloc). // This test checks ESIMD ahead-of-time compilation scenarios: // 1) When the application contains both SYCL and ESIMD kernel, thus requiring diff --git a/SYCL/README.md b/SYCL/README.md index 8bab44e134..22ed8d159a 100644 --- a/SYCL/README.md +++ b/SYCL/README.md @@ -62,20 +62,20 @@ ninja check-sycl-all These parameters can be used to configure tests: -***CMAKE_CXX_COMPILER*** path DPCPP compiler +***CMAKE_CXX_COMPILER*** - path to DPCPP compiler -***TEST_SUITE_LLVM_SIZE*** path to llvm-size tool, required for code size +***TEST_SUITE_LLVM_SIZE*** - path to llvm-size tool, required for code size collection -***TEST_SUITE_COLLECT_COMPILE_TIME=OFF*** can be used to turn off compile time -collection +***TEST_SUITE_COLLECT_COMPILE_TIME=OFF*** - can be used to turn off compile +time collection -***TEST_SUITE_COLLECT_CODE_SIZE=OFF*** can be used to turn off code size +***TEST_SUITE_COLLECT_CODE_SIZE=OFF*** - can be used to turn off code size collection -***TEST_SUITE_LIT*** path to llvm-lit tool +***TEST_SUITE_LIT*** - path to llvm-lit tool -***CHECK_SYCL_ALL*** defines selection of multiple SYCL backends with set of +***CHECK_SYCL_ALL*** - defines selection of multiple SYCL backends with set of target devices per each to be tested iteratively. Value is semicolon-separated list of configurations. Each configuration includes backend separated from comma-separated list of target devices with colon. Example: @@ -84,36 +84,39 @@ from comma-separated list of target devices with colon. Example: -DCHECK_SYCL_ALL="opencl:cpu,host;level_zero:gpu,host;cuda:gpu;hip:gpu" ``` -***SYCL_BE*** SYCL backend to be used for testing. Supported values are: +***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. -***SYCL_TARGET_DEVICES*** comma separated list of target devices for testing. +***SYCL_TARGET_DEVICES*** - comma separated list of target devices for testing. Default value is cpu,gpu,acc,host. Supported values are: - **cpu** - CPU device available in OpenCL backend only; - **gpu** - GPU device available in OpenCL, Level Zero, CUDA, and HIP backends; - **acc** - FPGA emulator device available in OpenCL backend only; - **host** - SYCL Host device available with all backends. -***OpenCL_LIBRARY*** path to OpenCL ICD loader library. OpenCL interoperability -tests require OpenCL ICD loader to be linked with. For such tests OpenCL ICD -loader library should be installed in the system or available at the full path -specified by this variable. +***OpenCL_LIBRARY*** - path to OpenCL ICD loader library. OpenCL +interoperability tests require OpenCL ICD loader to be linked with. For such +tests OpenCL ICD loader library should be installed in the system or available +at the full path specified by this variable. -***LEVEL_ZERO_INCLUDE*** path to Level Zero headers. +***LEVEL_ZERO_INCLUDE*** - path to Level Zero headers. -***LEVEL_ZERO_LIBS_DIR*** path to Level Zero libraries. +***LEVEL_ZERO_LIBS_DIR*** - path to Level Zero libraries. -***HIP_PLATFORM*** platform selection for HIP targeted devices. +***HIP_PLATFORM*** - platform selection for HIP targeted devices. Defaults to AMD if no value is given. Supported values are: - **AMD** - for HIP to target AMD GPUs - **NVIDIA** - for HIP to target NVIDIA GPUs - ***AMD_ARCH*** Flag must be set for when using HIP AMD triple. + ***AMD_ARCH*** - flag must be set for when using HIP AMD triple. For example it may be set to "gfx906". +***GPU_AOT_TARGET_OPTS*** - defines additional options which are passed to AOT +compilation command line for GPU device. If not specified "-device *" value +is used. # Special test categories @@ -154,6 +157,9 @@ configure specific single test execution in the command line: host); * **sycl_be** - SYCL backend to be used (opencl, level_zero, cuda, hip); * **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 + GPU_AOT_TARGET_OPTS. If not specified "-device *" value is used. * **gpu-intel-dg1** - tells LIT infra that Intel GPU DG1 is present in the system. It is developer / CI infra responsibility to make sure that the device is available in the system. Tests requiring DG1 to run must use proper diff --git a/SYCL/SpecConstants/2020/non_native/gpu.cpp b/SYCL/SpecConstants/2020/non_native/gpu.cpp index e45431ca55..27a2911b88 100644 --- a/SYCL/SpecConstants/2020/non_native/gpu.cpp +++ b/SYCL/SpecConstants/2020/non_native/gpu.cpp @@ -5,7 +5,7 @@ // UNSUPPORTED: hip // HIP is not compatible with SPIR. -// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/common.cpp -o %t.out -fsycl-dead-args-optimization +// 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 // RUN: %GPU_RUN_PLACEHOLDER %t.out // This test checks correctness of SYCL2020 non-native specialization constants diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 4e28715879..1a51880d0c 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -149,6 +149,11 @@ config.substitutions.append( ('%debug_option', '-g' ) ) config.substitutions.append( ('%cxx_std_option', '-std=' ) ) +if not config.gpu_aot_target_opts: + config.gpu_aot_target_opts = '"-device *"' + +config.substitutions.append( ('%gpu_aot_target_opts', config.gpu_aot_target_opts ) ) + if not config.sycl_be: lit_config.error("SYCL backend is not specified") diff --git a/SYCL/lit.site.cfg.py.in b/SYCL/lit.site.cfg.py.in index b0ee4db3ed..bd85b79b0a 100644 --- a/SYCL/lit.site.cfg.py.in +++ b/SYCL/lit.site.cfg.py.in @@ -30,6 +30,7 @@ config.cxx_flags = "@CMAKE_CXX_FLAGS@" config.c_flags = "@CMAKE_C_FLAGS@" config.external_tests = "@SYCL_EXTERNAL_TESTS@" config.extra_include = "@CMAKE_CURRENT_SOURCE_DIR@/include" +config.gpu_aot_target_opts = lit_config.params.get("gpu_aot_target_opts", "@GPU_AOT_TARGET_OPTS@") import lit.llvm lit.llvm.initialize(lit_config, config)