From 123b4ac4dc5cb44825685b027d001d6c2b31fa40 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Tue, 21 Jan 2025 12:55:07 -0800 Subject: [PATCH 01/20] Add method to set triple + react to `REQUIRES` in build-only --- sycl/test-e2e/AOT/cpu.cpp | 1 - sycl/test-e2e/AOT/double.cpp | 1 - sycl/test-e2e/AOT/half.cpp | 1 - .../test-e2e/Adapters/cuda_queue_priority.cpp | 1 - sycl/test-e2e/Adapters/dll-detach-order.cpp | 1 - .../AmdNvidiaJIT/kernel_and_bundle.cpp | 3 +- .../BFloat16/bfloat16_example_aot.cpp | 1 - .../BFloat16/bfloat16_example_aot_cpu.cpp | 1 - .../windows_version_agnostic_sycl_lib.cpp | 1 - sycl/test-e2e/Compression/compression_aot.cpp | 1 - .../compression_separate_compile.cpp | 1 - sycl/test-e2e/Compression/no_zstd_warning.cpp | 1 - .../device_architecture_on_device_aot.cpp | 1 - sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp | 1 - sycl/test-e2e/DeviceLib/assert-aot.cpp | 1 - sycl/test-e2e/DeviceLib/cmath-aot.cpp | 1 - .../DeviceLib/math_fp64_windows_test.cpp | 1 - sycl/test-e2e/DeviceLib/math_windows_test.cpp | 1 - .../custom-command-cuda.cpp | 1 - .../custom-command-hip.cpp | 3 +- .../custom-command-multiple-dev-cuda.cpp | 1 - .../interop-task-cuda-buffer-migrate.cpp | 1 - .../HostInteropTask/interop-task-cuda.cpp | 1 - .../HostInteropTask/interop-task-hip.cpp | 3 +- .../Matrix/joint_matrix_hip_gfx90a.cpp | 1 - .../Matrix/joint_matrix_hip_half_gfx90a.cpp | 1 - .../Matrix/joint_matrix_tensorcores_sm70.cpp | 3 +- .../Matrix/runtime_query_hip_gfx90a.cpp | 1 - sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp | 1 - sycl/test-e2e/NewOffloadDriver/cpu.cpp | 1 - .../NonUniformGroups/ballot_group.cpp | 1 - .../ballot_group_algorithms.cpp | 1 - .../NonUniformGroups/fixed_size_group.cpp | 1 - .../fixed_size_group_algorithms.cpp | 1 - .../NonUniformGroups/opportunistic_group.cpp | 1 - .../opportunistic_group_algorithms.cpp | 1 - .../NonUniformGroups/tangle_group.cpp | 1 - .../tangle_group_algorithms.cpp | 1 - .../is_compatible/is_compatible_amdgcn.cpp | 1 - .../is_compatible/is_compatible_nvptx64.cpp | 1 - .../is_compatible_several_targets.cpp | 3 +- .../is_compatible/is_compatible_spir64.cpp | 1 - .../is_compatible_spir64_fpga.cpp | 1 - .../is_compatible_spir64_gen.cpp | 1 - .../is_compatible_spir64_x86_64.cpp | 1 - .../device_libs_and_caching.cpp | 1 - .../Regression/compile_on_win_with_mdd.cpp | 1 - .../Regression/fsycl-host-compiler-win.cpp | 1 - sycl/test-e2e/Regression/msvc_crt.cpp | 1 - sycl/test-e2e/Regression/multiple-targets.cpp | 3 +- .../2020/non_native/SpecConstBuffer.cpp | 1 - .../SpecConstants/2020/non_native/cpu.cpp | 1 - .../SpecConstants/2020/non_native/cuda.cpp | 1 - sycl/test-e2e/TriStateExpr.py | 176 ++++++++++++++++++ .../cubemap/cubemap_sampled.cpp | 3 +- .../dx12_interop/read_write_unsampled.cpp | 1 - .../examples/example_5_sample_cubemap.cpp | 3 +- .../vulkan_interop/mipmaps.cpp | 1 - .../vulkan_interop/sampled_images.cpp | 1 - .../vulkan_interop/sampled_images_USM.cpp | 1 - .../sampled_images_semaphore.cpp | 1 - .../vulkan_interop/unsampled_images.cpp | 1 - .../unsampled_images_semaphore.cpp | 1 - sycl/test-e2e/format.py | 105 +++++++---- sycl/test-e2e/lit.cfg.py | 26 +++ sycl/test-e2e/lit.site.cfg.py.in | 3 + .../test-e2e/syclcompat/kernel/kernel_win.cpp | 1 - .../memory/local_memory_ptr_to_integer.cpp | 3 +- 68 files changed, 283 insertions(+), 109 deletions(-) create mode 100644 sycl/test-e2e/TriStateExpr.py diff --git a/sycl/test-e2e/AOT/cpu.cpp b/sycl/test-e2e/AOT/cpu.cpp index e7bedc04b07ba..f0c71be2d481e 100644 --- a/sycl/test-e2e/AOT/cpu.cpp +++ b/sycl/test-e2e/AOT/cpu.cpp @@ -7,7 +7,6 @@ //===---------------------------------------------------------------------===// // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/aot.cpp -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/AOT/double.cpp b/sycl/test-e2e/AOT/double.cpp index 4d48f5c7b57ec..ead41bfc8c741 100644 --- a/sycl/test-e2e/AOT/double.cpp +++ b/sycl/test-e2e/AOT/double.cpp @@ -2,7 +2,6 @@ // using fp64 can be compiled AOT. // REQUIRES: ocloc, opencl-aot, any-device-is-cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_tgllp -o %t.tgllp.out %s // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s // RUN: %if cpu %{ %{run} %t.x86.out %} diff --git a/sycl/test-e2e/AOT/half.cpp b/sycl/test-e2e/AOT/half.cpp index 5711b21735f72..e843ee65bbeef 100644 --- a/sycl/test-e2e/AOT/half.cpp +++ b/sycl/test-e2e/AOT/half.cpp @@ -2,7 +2,6 @@ // using fp16 can be compiled AOT. // REQUIRES: ocloc, opencl-aot, any-device-is-cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_tgllp -o %t.tgllp.out %s // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s // RUN: %if cpu %{ %{run} %t.x86.out %} diff --git a/sycl/test-e2e/Adapters/cuda_queue_priority.cpp b/sycl/test-e2e/Adapters/cuda_queue_priority.cpp index 008637b91f3e2..031dc252c578f 100644 --- a/sycl/test-e2e/Adapters/cuda_queue_priority.cpp +++ b/sycl/test-e2e/Adapters/cuda_queue_priority.cpp @@ -1,5 +1,4 @@ // REQUIRES: gpu, cuda, cuda_dev_kit -// REQUIRES: build-and-run-mode // RUN: %{build} %cuda_options -o %t.out // RUN: %{run} %t.out // diff --git a/sycl/test-e2e/Adapters/dll-detach-order.cpp b/sycl/test-e2e/Adapters/dll-detach-order.cpp index 72d014eb066bb..c1cf32816a240 100644 --- a/sycl/test-e2e/Adapters/dll-detach-order.cpp +++ b/sycl/test-e2e/Adapters/dll-detach-order.cpp @@ -1,5 +1,4 @@ // REQUIRES: windows -// REQUIRES: build-and-run-mode // RUN: env SYCL_UR_TRACE=-1 sycl-ls | FileCheck %s // ensure that the adapters are detached AFTER urLoaderTearDown is done diff --git a/sycl/test-e2e/AmdNvidiaJIT/kernel_and_bundle.cpp b/sycl/test-e2e/AmdNvidiaJIT/kernel_and_bundle.cpp index c1e52d1d4fc4e..3927fb87ee85d 100644 --- a/sycl/test-e2e/AmdNvidiaJIT/kernel_and_bundle.cpp +++ b/sycl/test-e2e/AmdNvidiaJIT/kernel_and_bundle.cpp @@ -1,6 +1,5 @@ // UNSUPPORTED: windows -// REQUIRES: cuda || hip -// REQUIRES: build-and-run-mode +// REQUIRES: target-nvidia || target-amd // This test relies on debug output from a pass, make sure that the compiler // can generate it. diff --git a/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp b/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp index 32c6c3aae8f06..8337716c3191e 100644 --- a/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp +++ b/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp @@ -4,7 +4,6 @@ /// // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12, any-device-is-cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64 %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp b/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp index 9231a62428272..2f6d893768c4e 100644 --- a/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp +++ b/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp @@ -4,7 +4,6 @@ /// // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12, any-device-is-cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device dg1" %s -o %t.out // RUN: %if cpu %{ %{run} %t.out %} diff --git a/sycl/test-e2e/Basic/windows_version_agnostic_sycl_lib.cpp b/sycl/test-e2e/Basic/windows_version_agnostic_sycl_lib.cpp index c9487829314d8..cf7538ed495bc 100644 --- a/sycl/test-e2e/Basic/windows_version_agnostic_sycl_lib.cpp +++ b/sycl/test-e2e/Basic/windows_version_agnostic_sycl_lib.cpp @@ -1,5 +1,4 @@ // REQUIRES: windows -// REQUIRES: build-and-run-mode // RUN: %clangxx --driver-mode=cl /std:c++17 /EHsc %sycl_include -I%opencl_include_dir %s -o %t.out /link /defaultlib:%sycl_static_libs_dir/sycl.lib // RUN: %{run} %t.out diff --git a/sycl/test-e2e/Compression/compression_aot.cpp b/sycl/test-e2e/Compression/compression_aot.cpp index ba95974fde781..b8293f1c79351 100644 --- a/sycl/test-e2e/Compression/compression_aot.cpp +++ b/sycl/test-e2e/Compression/compression_aot.cpp @@ -1,6 +1,5 @@ // End-to-End test for testing device image compression in AOT. // REQUIRES: zstd, opencl-aot, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %O0 --offload-compress --offload-compression-level=3 %S/Inputs/single_kernel.cpp -o %t_compress.out // RUN: %{run} %t_compress.out diff --git a/sycl/test-e2e/Compression/compression_separate_compile.cpp b/sycl/test-e2e/Compression/compression_separate_compile.cpp index afbe442230e29..dab17e3506b4e 100644 --- a/sycl/test-e2e/Compression/compression_separate_compile.cpp +++ b/sycl/test-e2e/Compression/compression_separate_compile.cpp @@ -2,7 +2,6 @@ // seperatly compile and link device images. // REQUIRES: zstd, opencl-aot, cpu, linux -// REQUIRES: build-and-run-mode ////////////////////// Compile device images // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsycl-host-compiler=clang++ -fsycl-host-compiler-options='-std=c++17 -Wno-attributes -Wno-deprecated-declarations -fPIC -DENABLE_KERNEL1' -DENABLE_KERNEL1 -c %s -o %t_kernel1_aot.o diff --git a/sycl/test-e2e/Compression/no_zstd_warning.cpp b/sycl/test-e2e/Compression/no_zstd_warning.cpp index 4532f22b9845b..c87f2fe480096 100644 --- a/sycl/test-e2e/Compression/no_zstd_warning.cpp +++ b/sycl/test-e2e/Compression/no_zstd_warning.cpp @@ -1,5 +1,4 @@ // using --offload-compress without zstd should throw an error. // REQUIRES: !zstd -// REQUIRES: build-and-run-mode // RUN: not %{build} %O0 -g --offload-compress %S/Inputs/single_kernel.cpp -o %t_compress.out 2>&1 | FileCheck %s // CHECK: '--offload-compress' option is specified but zstd is not available. The device image will not be compressed. diff --git a/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp b/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp index 1d4c41f117136..a62ae965683ae 100644 --- a/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp +++ b/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp b/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp index 319c69af0faef..d2937b796fe63 100644 --- a/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp +++ b/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_x86_64 -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp \ // RUN: -fsycl-dead-args-optimization diff --git a/sycl/test-e2e/DeviceLib/assert-aot.cpp b/sycl/test-e2e/DeviceLib/assert-aot.cpp index f5c8c61f07d78..ccff887e80adf 100644 --- a/sycl/test-e2e/DeviceLib/assert-aot.cpp +++ b/sycl/test-e2e/DeviceLib/assert-aot.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu, linux -// REQUIRES: build-and-run-mode // RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=spir64_x86_64 %S/assert.cpp -o %t.aot.out // RUN: env EXPECTED_SIGNAL=SIGABRT SHOULD_CRASH=1 %{run} %t.aot.out 2>&1 | FileCheck %S/assert.cpp --check-prefixes=CHECK-MESSAGE diff --git a/sycl/test-e2e/DeviceLib/cmath-aot.cpp b/sycl/test-e2e/DeviceLib/cmath-aot.cpp index c9897f652f034..bb9e201de9282 100644 --- a/sycl/test-e2e/DeviceLib/cmath-aot.cpp +++ b/sycl/test-e2e/DeviceLib/cmath-aot.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // UNSUPPORTED: windows // DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%} diff --git a/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp b/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp index 2641408261426..71e8a43387093 100644 --- a/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp +++ b/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp @@ -1,5 +1,4 @@ // REQUIRES: aspect-fp64, windows -// REQUIRES: build-and-run-mode // DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%} diff --git a/sycl/test-e2e/DeviceLib/math_windows_test.cpp b/sycl/test-e2e/DeviceLib/math_windows_test.cpp index 645493c496ae1..ab18cf1abe254 100644 --- a/sycl/test-e2e/DeviceLib/math_windows_test.cpp +++ b/sycl/test-e2e/DeviceLib/math_windows_test.cpp @@ -1,5 +1,4 @@ // REQUIRES: windows -// REQUIRES: build-and-run-mode // TODO: Add hypotf case back when the missing symbol is fixed. diff --git a/sycl/test-e2e/EnqueueNativeCommand/custom-command-cuda.cpp b/sycl/test-e2e/EnqueueNativeCommand/custom-command-cuda.cpp index b777f314d2f92..7afbaf7cc14ed 100644 --- a/sycl/test-e2e/EnqueueNativeCommand/custom-command-cuda.cpp +++ b/sycl/test-e2e/EnqueueNativeCommand/custom-command-cuda.cpp @@ -1,7 +1,6 @@ // RUN: %{build} -Wno-error=deprecated-declarations -o %t.out %cuda_options // RUN: %{run} %t.out // REQUIRES: cuda, cuda_dev_kit -// REQUIRES: build-and-run-mode #include diff --git a/sycl/test-e2e/EnqueueNativeCommand/custom-command-hip.cpp b/sycl/test-e2e/EnqueueNativeCommand/custom-command-hip.cpp index 47bf42eee8158..00aafba08fc4a 100644 --- a/sycl/test-e2e/EnqueueNativeCommand/custom-command-hip.cpp +++ b/sycl/test-e2e/EnqueueNativeCommand/custom-command-hip.cpp @@ -2,8 +2,7 @@ // we should set this with some variable instead. // RUN: %{build} -Wno-error=deprecated-pragma -o %t.out -I%rocm_path/include -L%rocm_path/lib -lamdhip64 // RUN: %{run} %t.out -// REQUIRES: hip -// REQUIRES: build-and-run-mode +// REQUIRES: target-amd #include #include diff --git a/sycl/test-e2e/EnqueueNativeCommand/custom-command-multiple-dev-cuda.cpp b/sycl/test-e2e/EnqueueNativeCommand/custom-command-multiple-dev-cuda.cpp index f487b26026ec2..2dc30b44bfe94 100644 --- a/sycl/test-e2e/EnqueueNativeCommand/custom-command-multiple-dev-cuda.cpp +++ b/sycl/test-e2e/EnqueueNativeCommand/custom-command-multiple-dev-cuda.cpp @@ -1,5 +1,4 @@ // REQUIRES: cuda, cuda_dev_kit -// REQUIRES: build-and-run-mode // RUN: %{build} -o %t.out %cuda_options // RUN: %{run} %t.out diff --git a/sycl/test-e2e/HostInteropTask/interop-task-cuda-buffer-migrate.cpp b/sycl/test-e2e/HostInteropTask/interop-task-cuda-buffer-migrate.cpp index 2eea51a1ded9b..b6ac1f96f90e1 100644 --- a/sycl/test-e2e/HostInteropTask/interop-task-cuda-buffer-migrate.cpp +++ b/sycl/test-e2e/HostInteropTask/interop-task-cuda-buffer-migrate.cpp @@ -1,5 +1,4 @@ // REQUIRES: cuda, cuda_dev_kit -// REQUIRES: build-and-run-mode // // RUN: %{build} -o %t.out %cuda_options // RUN: %{run} %t.out diff --git a/sycl/test-e2e/HostInteropTask/interop-task-cuda.cpp b/sycl/test-e2e/HostInteropTask/interop-task-cuda.cpp index f3a61471d1d08..055160e8bb624 100644 --- a/sycl/test-e2e/HostInteropTask/interop-task-cuda.cpp +++ b/sycl/test-e2e/HostInteropTask/interop-task-cuda.cpp @@ -1,7 +1,6 @@ // RUN: %{build} -o %t.out %cuda_options // RUN: %{run} %t.out // REQUIRES: cuda, cuda_dev_kit -// REQUIRES: build-and-run-mode #include #include diff --git a/sycl/test-e2e/HostInteropTask/interop-task-hip.cpp b/sycl/test-e2e/HostInteropTask/interop-task-hip.cpp index 10e54f416f8a2..23856043230f2 100644 --- a/sycl/test-e2e/HostInteropTask/interop-task-hip.cpp +++ b/sycl/test-e2e/HostInteropTask/interop-task-hip.cpp @@ -2,8 +2,7 @@ // we should set this with some variable instead. // RUN: %{build} -Wno-error=deprecated-pragma -Wno-error=deprecated-declarations -o %t.out -I%rocm_path/include -L%rocm_path/lib -lamdhip64 // RUN: %{run} %t.out -// REQUIRES: hip -// REQUIRES: build-and-run-mode +// REQUIRES: target-amd #include #include diff --git a/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp b/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp index fbcf2c70558f4..c126a96bcb2ab 100644 --- a/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp +++ b/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp @@ -10,7 +10,6 @@ // RUN: %{run} %t.out // REQUIRES: arch-amd_gpu_gfx90a -// REQUIRES: build-and-run-mode #include "joint_matrix_hip_apply.hpp" #include "joint_matrix_hip_copy.hpp" diff --git a/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp b/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp index 7c8d576ba39d0..c39832cd64357 100644 --- a/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp +++ b/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp @@ -11,7 +11,6 @@ // REQUIRES: arch-amd_gpu_gfx90a // REQUIRES: aspect-fp16 -// REQUIRES: build-and-run-mode #include "joint_matrix_hip_apply.hpp" #include "joint_matrix_hip_copy.hpp" diff --git a/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp b/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp index dc084b7c23c0e..bfa1156bc0e6b 100644 --- a/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp +++ b/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp @@ -6,8 +6,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: cuda -// REQUIRES: build-and-run-mode +// REQUIRES: target-nvidia // RUN: %{build} -Xsycl-target-backend --cuda-gpu-arch=sm_70 -o %t.out // RUN: %{run} %t.out // diff --git a/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp b/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp index a7bdd0c056db1..ec9ecadf1ae16 100644 --- a/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp +++ b/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// // REQUIRES: arch-amd_gpu_gfx90a -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx90a %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp b/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp index 0016e8498bd9d..585b368641d6e 100644 --- a/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp +++ b/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // Test with `--offload-new-driver` // RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_x86_64 -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp \ diff --git a/sycl/test-e2e/NewOffloadDriver/cpu.cpp b/sycl/test-e2e/NewOffloadDriver/cpu.cpp index 943ea71c3386e..ef93d69f8693b 100644 --- a/sycl/test-e2e/NewOffloadDriver/cpu.cpp +++ b/sycl/test-e2e/NewOffloadDriver/cpu.cpp @@ -7,7 +7,6 @@ //===---------------------------------------------------------------------===// // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // Test with `--offload-new-driver` // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 --offload-new-driver %S/Inputs/aot.cpp -o %t.out diff --git a/sycl/test-e2e/NonUniformGroups/ballot_group.cpp b/sycl/test-e2e/NonUniformGroups/ballot_group.cpp index 1532c54879ecc..f24bffb81526a 100644 --- a/sycl/test-e2e/NonUniformGroups/ballot_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/ballot_group.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: hip diff --git a/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp index da9154ae602d0..1eed59d35f0ee 100644 --- a/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_ballot_group diff --git a/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp b/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp index 5d2b98b58ddc2..939be57799dd4 100644 --- a/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: hip // REQUIRES: sg-32 diff --git a/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp index 07898d0146fb9..7673ea36d9f53 100644 --- a/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsycl-device-code-split=per_kernel -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_fixed_size_group diff --git a/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp b/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp index 2069113c3f939..18d42487b7768 100644 --- a/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: hip diff --git a/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp index 8e7626650e01c..af4d45cee862f 100644 --- a/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_opportunistic_group diff --git a/sycl/test-e2e/NonUniformGroups/tangle_group.cpp b/sycl/test-e2e/NonUniformGroups/tangle_group.cpp index 686d1b34c6185..44191955048f3 100644 --- a/sycl/test-e2e/NonUniformGroups/tangle_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/tangle_group.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fno-sycl-early-optimizations -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: cuda || hip diff --git a/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp index 51070ed1731e4..7033c4c9e4df5 100644 --- a/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp @@ -4,7 +4,6 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fno-sycl-early-optimizations -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // -// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_tangle_group diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_amdgcn.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_amdgcn.cpp index c0a1cb07db1e1..caf53df00e1d4 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_amdgcn.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_amdgcn.cpp @@ -1,5 +1,4 @@ // REQUIRES: hip, opencl, gpu, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 -fsycl-targets=amdgcn-amd-amdhsa %S/Inputs/is_compatible_with_env.cpp -o %t.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_nvptx64.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_nvptx64.cpp index 20a5139fc12cd..ccfa829293c3f 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_nvptx64.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_nvptx64.cpp @@ -1,5 +1,4 @@ // REQUIRES: cuda, opencl, gpu, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda %S/Inputs/is_compatible_with_env.cpp -o %t.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_several_targets.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_several_targets.cpp index 3e9124954b774..eb7f4b0056162 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_several_targets.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_several_targets.cpp @@ -1,8 +1,7 @@ // REQUIRES: ocloc, any-device-is-level_zero, any-device-is-gpu, any-device-is-cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/is_compatible_with_env.cpp -o %t.out // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} %t.out -// RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} %t.out \ No newline at end of file +// RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} %t.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64.cpp index fcf6affb809fb..465a79056906a 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64.cpp @@ -1,5 +1,4 @@ // REQUIRES: cuda, opencl, gpu, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64 %S/Inputs/is_compatible_with_env.cpp -o %t.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_fpga.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_fpga.cpp index 1372c352c09ea..57366482e7082 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_fpga.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_fpga.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, accelerator, gpu, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga %S/Inputs/is_compatible_with_env.cpp -o %t.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_gen.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_gen.cpp index c6a01b3a6dc18..5adb27e0ae697 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_gen.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_gen.cpp @@ -1,5 +1,4 @@ // REQUIRES: ocloc, gpu, level_zero, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device *" %S/Inputs/is_compatible_with_env.cpp -o %t.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_x86_64.cpp b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_x86_64.cpp index 5de21b8984d71..0a6f2c39df8af 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_x86_64.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/is_compatible/is_compatible_spir64_x86_64.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu, gpu, level_zero -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/is_compatible_with_env.cpp -o %t.out diff --git a/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp b/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp index 78872c04d97ec..12699740d7da9 100644 --- a/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp +++ b/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp @@ -1,5 +1,4 @@ // REQUIRES: ocloc && gpu && linux && (opencl || level_zero) -// REQUIRES: build-and-run-mode // Test to check several use cases for multi-device kernel bundles. // Test covers AOT and JIT cases. Kernel is using some math functions to enforce diff --git a/sycl/test-e2e/Regression/compile_on_win_with_mdd.cpp b/sycl/test-e2e/Regression/compile_on_win_with_mdd.cpp index ea1e1c7d49891..57826c81ece2e 100644 --- a/sycl/test-e2e/Regression/compile_on_win_with_mdd.cpp +++ b/sycl/test-e2e/Regression/compile_on_win_with_mdd.cpp @@ -1,5 +1,4 @@ // REQUIRES: windows -// REQUIRES: build-and-run-mode // RUN: %clangxx --driver-mode=cl -fsycl /MDd -c %s -o %t.obj // RUN: %clangxx --driver-mode=cl -fsycl %t.obj -Wno-unused-command-line-argument -o %t.out diff --git a/sycl/test-e2e/Regression/fsycl-host-compiler-win.cpp b/sycl/test-e2e/Regression/fsycl-host-compiler-win.cpp index e4073831bb71b..4ffe42c45c52f 100644 --- a/sycl/test-e2e/Regression/fsycl-host-compiler-win.cpp +++ b/sycl/test-e2e/Regression/fsycl-host-compiler-win.cpp @@ -1,7 +1,6 @@ // RUN: %{build} -fsycl-host-compiler=cl -DDEFINE_CHECK -fsycl-host-compiler-options="-DDEFINE_CHECK /std:c++17 /Zc:__cplusplus" -o %t.exe // RUN: %{run} %t.exe // REQUIRES: windows -// REQUIRES: build-and-run-mode // //==------- fsycl-host-compiler-win.cpp - external host compiler test ------==// // diff --git a/sycl/test-e2e/Regression/msvc_crt.cpp b/sycl/test-e2e/Regression/msvc_crt.cpp index a54570efd820c..9d59547e50d7b 100644 --- a/sycl/test-e2e/Regression/msvc_crt.cpp +++ b/sycl/test-e2e/Regression/msvc_crt.cpp @@ -3,7 +3,6 @@ // RUN: %{build} /MDd -o %t2.exe // RUN: %{run} %t2.exe // REQUIRES: system-windows, cl_options -// REQUIRES: build-and-run-mode //==-------------- msvc_crt.cpp - SYCL MSVC CRT test -----------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/sycl/test-e2e/Regression/multiple-targets.cpp b/sycl/test-e2e/Regression/multiple-targets.cpp index aa8c125d90738..888863b84faf1 100644 --- a/sycl/test-e2e/Regression/multiple-targets.cpp +++ b/sycl/test-e2e/Regression/multiple-targets.cpp @@ -2,8 +2,7 @@ // It tests if the target triples can be specified with any order. // The test is repeated for per_kernel device code splitting. // -// REQUIRES: cuda || hip || native_cpu -// REQUIRES: build-and-run-mode +// REQUIRES: target-nvidia || target-amd || target-native_cpu // RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-device-is-hip %{ %{hip_arch_opts} %} -o %t1.out %s // RUN: %{run} %t1.out // diff --git a/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp b/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp index bc7145049ddcb..3ee1d4bd2490b 100644 --- a/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp +++ b/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/common.cpp -o %t.out \ // RUN: -fsycl-dead-args-optimization diff --git a/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp b/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp index f6b7b836e873c..8453a6556ffec 100644 --- a/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp +++ b/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp @@ -1,5 +1,4 @@ // REQUIRES: opencl-aot, cpu -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/common.cpp -o %t.out \ // RUN: -fsycl-dead-args-optimization diff --git a/sycl/test-e2e/SpecConstants/2020/non_native/cuda.cpp b/sycl/test-e2e/SpecConstants/2020/non_native/cuda.cpp index af12b66208dad..12d2ce6a9faf9 100644 --- a/sycl/test-e2e/SpecConstants/2020/non_native/cuda.cpp +++ b/sycl/test-e2e/SpecConstants/2020/non_native/cuda.cpp @@ -1,5 +1,4 @@ // REQUIRES: cuda -// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda %S/Inputs/common.cpp -o %t.out // RUN: %{run-unfiltered-devices} env ONEAPI_DEVICE_SELECTOR="cuda:*" %t.out diff --git a/sycl/test-e2e/TriStateExpr.py b/sycl/test-e2e/TriStateExpr.py new file mode 100644 index 0000000000000..08cb124b9bc88 --- /dev/null +++ b/sycl/test-e2e/TriStateExpr.py @@ -0,0 +1,176 @@ +from lit.BooleanExpression import BooleanExpression + + +class E2EExpr(BooleanExpression): + build_specific_features = { + "build-and-run-mode", + "target-spir", + "target-nvidia", + "target-amd", + "target-native_cpu", + "linux", + "system-linux", + "windows", + "system-windows", + "enable-perf-tests", + "opencl_icd", + "cuda_dev_kit", + "zstd", + "vulkan", + "true", + "false", + } + + def __init__(self, string, variables, build_only_mode, ignore_value): + BooleanExpression.__init__(self, string, variables) + self.build_only_mode = build_only_mode + self.ignore = False + self.ignore_value = ignore_value + + @staticmethod + def evaluate(string, variables, build_only_mode, ignore_value=True): + try: + parser = E2EExpr(string, set(variables), build_only_mode, ignore_value) + return parser.parseAll() + except ValueError as e: + raise ValueError(str(e) + ("\nin expression: %r" % string)) + + def parseMATCH(self): + token = self.token + BooleanExpression.parseMATCH(self) + if token not in self.build_specific_features and self.build_only_mode: + self.ignore = True + else: + self.ignore = False + + def parseAND(self): + self.parseNOT() + while self.accept("&&"): + left = self.value + left_ignore = self.ignore + self.parseNOT() + right = self.value + right_ignore = self.ignore + self.value = left and right + # Ignore if both are ignore or if one is true and the other is ignore + self.ignore = ( + (left_ignore and right_ignore) + or (left_ignore and right) + or (left and right_ignore) + ) + + def parseOR(self): + self.parseAND() + while self.accept("||"): + left = self.value + left_ignore = self.ignore + self.parseAND() + right = self.value + right_ignore = self.ignore + self.value = left or right + # Ignore if both are ignore or if one is false and the other is ignore + self.ignore = ( + (left_ignore and right_ignore) + or (left_ignore and not right) + or (not left and right_ignore) + ) + + def parseAll(self): + self.token = next(self.tokens) + self.parseOR() + self.expect(BooleanExpression.END) + return self.ignore_value if self.ignore else self.value + + +import unittest + + +class TestE2EExpr(unittest.TestCase): + def test_basic(self): + # Non build-only expressions should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) + self.assertTrue( + E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False) + ) + self.assertFalse( + E2EExpr.evaluate( + "another_aspect && rt_feature", {"linux", "rt_feature"}, False + ) + ) + # build-only expressions with no ignores should work the same + self.assertTrue( + E2EExpr.evaluate("linux", {"linux", "rt_feature"}, True, False) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && windows", {"linux", "rt_feature"}, True, True + ) + ) + self.assertTrue( + E2EExpr.evaluate( + "!(windows || zstd)", {"linux", "rt_feature"}, True, False + ) + ) + # build-only expressions where ignore affects the resulting value + self.assertTrue( + E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, True) + ) + self.assertFalse( + E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, False) + ) + self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, True)) + self.assertTrue( + E2EExpr.evaluate("!rt_feature", {"rt_feature"}, True, True) + ) + self.assertTrue( + E2EExpr.evaluate("!!rt_feature", {"rt_feature"}, True, True) + ) + self.assertTrue( + E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, True) + ) + self.assertFalse( + E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, False) + ) + self.assertTrue( + E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, True) + ) + self.assertFalse( + E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, False) + ) + self.assertTrue( + E2EExpr.evaluate( + "linux && !(windows || rt_feature)", {"linux"}, True, True + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && !(windows || rt_feature)", {"linux"}, True, False + ) + ) + # build-only expressions where ignore does not affect the resulting value + self.assertTrue( + E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, True) + ) + self.assertTrue( + E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, False) + ) + self.assertFalse( + E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, True) + ) + self.assertFalse( + E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, False) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && (windows && rt_feature)", {"linux"}, True, True + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && (windows && rt_feature)", {"linux"}, True, False + ) + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp b/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp index d228b308ab72e..323ff9ba1fb20 100644 --- a/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp +++ b/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp @@ -1,6 +1,5 @@ -// REQUIRES: cuda,aspect-ext_oneapi_cubemap +// REQUIRES: target-nvidia,aspect-ext_oneapi_cubemap // REQUIRES: aspect-ext_oneapi_cubemap_seamless_filtering -// REQUIRES: build-and-run-mode // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp b/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp index 1d5a59a40b5ab..1aeb63636cc71 100644 --- a/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp +++ b/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp @@ -1,6 +1,5 @@ // REQUIRES: aspect-ext_oneapi_bindless_images // REQUIRES: windows -// REQUIRES: build-and-run-mode // DEFINE: %{link-flags}=%if cl_options %{ /clang:-ld3d12 /clang:-ldxgi /clang:-ldxguid %} %else %{ -ld3d12 -ldxgi -ldxguid %} // RUN: %{build} %{link-flags} -o %t.out %if any-device-is-level_zero %{ -DDISABLE_UNORM_TESTS %} diff --git a/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp b/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp index c6ba9b48fad52..ebac7e6dc9b19 100644 --- a/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp +++ b/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp @@ -1,5 +1,4 @@ -// REQUIRES: cuda -// REQUIRES: build-and-run-mode +// REQUIRES: target-nvidia // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp index 57623c1b2da03..1e826270f827c 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp @@ -1,6 +1,5 @@ // REQUIRES: cuda // REQUIRES: vulkan -// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp index 12e5cfe5cad87..fc768b9246d14 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp @@ -1,6 +1,5 @@ // REQUIRES: cuda || (windows && level_zero && aspect-ext_oneapi_bindless_images) // REQUIRES: vulkan -// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out %if any-device-is-level_zero %{ -Wno-ignored-attributes -DENABLE_LINEAR_TILING -DTEST_L0_SUPPORTED_VK_FORMAT %} // RUN: %{run} env NEOReadDebugKeys=1 UseBindlessMode=1 UseExternalAllocatorForSshAndDsh=1 %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp index 159b1c9ec1b44..d480d4fed3db8 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp @@ -1,6 +1,5 @@ // REQUIRES: cuda // REQUIRES: vulkan -// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp index 497ade9d8af78..46c56f9c9db38 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp @@ -1,6 +1,5 @@ // REQUIRES: cuda || (windows && level_zero && aspect-ext_oneapi_bindless_images) // REQUIRES: vulkan -// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp index b6d046904eea9..ddc9c5e0c9fc8 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp @@ -1,6 +1,5 @@ // REQUIRES: cuda || (windows && level_zero && aspect-ext_oneapi_bindless_images) // REQUIRES: vulkan -// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out %if any-device-is-level_zero %{ -Wno-ignored-attributes -DTEST_L0_SUPPORTED_VK_FORMAT %} // RUN: %{run} env NEOReadDebugKeys=1 UseBindlessMode=1 UseExternalAllocatorForSshAndDsh=1 %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp index af9163311727c..54fc2d7bfb984 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp @@ -1,6 +1,5 @@ // REQUIRES: cuda // REQUIRES: vulkan -// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index eac6ebe0ba2ed..f920d24c2d19c 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -2,27 +2,16 @@ import lit.formats import platform -from lit.BooleanExpression import BooleanExpression from lit.TestRunner import ( ParserKind, IntegratedTestKeywordParser, - # parseIntegratedTestScript, ) +from TriStateExpr import E2EExpr import os import re -def get_triple(backend): - if backend == "cuda": - return "nvptx64-nvidia-cuda" - if backend == "hip": - return "amdgcn-amd-amdhsa" - if backend == "native_cpu": - return "native_cpu" - return "spir64" - - def parse_min_intel_driver_req(line_number, line, output): """ Driver version looks like this for Intel devices: @@ -87,19 +76,60 @@ def parseTestScript(self, test): return script - def getMatchedFromList(self, features, alist): + def getMissingRequiredFeaturesFromList( + self, features, requires, build_only_mode=False + ): try: return [ - item for item in alist if BooleanExpression.evaluate(item, features) + item + for item in requires + if not E2EExpr.evaluate(item, features, build_only_mode) + ] + except ValueError as e: + raise ValueError("Error in REQUIRES list:\n%s" % str(e)) + + def getMatchedFromList(self, features, alist, build_only_mode=False): + try: + return [ + item + for item in alist + if E2EExpr.evaluate(item, features, build_only_mode, False) ] except ValueError as e: raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e)) + def select_triples_for_test(self, test): + supported_triples = set() + for t in test.config.sycl_triples: + features = test.config.available_features.union({t}) + if self.getMissingRequiredFeaturesFromList(features, test.requires, build_only_mode=True): + continue + if self.getMatchedFromList(features, test.unsupported, build_only_mode=True): + continue + supported_triples.add(t) + + if len(supported_triples) <= 1: + return supported_triples + # Treat XFAIL as UNSUPPORTED if the test is to be compiled for multiple + # triples. + if "*" in test.xfails: + return [] + + triples_without_xfail = [ + t + for t in supported_triples + if not self.getMatchedFromList( + test.config.available_features.union({t}), test.xfails + ) + ] + + return triples_without_xfail + def select_devices_for_test(self, test): devices = [] for d in test.config.sycl_devices: features = test.config.sycl_dev_features[d] - if test.getMissingRequiredFeaturesFromList(features): + if self.getMissingRequiredFeaturesFromList(features, test.requires): continue if self.getMatchedFromList(features, test.unsupported): @@ -154,11 +184,12 @@ def execute(self, test, litConfig): devices_for_test = [] triples = set() if test.config.test_mode == "build-only": - if "build-and-run-mode" in test.requires or "true" in test.unsupported: + triples = self.select_triples_for_test(test) + if not triples: return lit.Test.Result( - lit.Test.UNSUPPORTED, "Test unsupported for this environment" + lit.Test.UNSUPPORTED, "No supported triple to build for" ) - triples = {"spir64"} + triples = set(map(lambda t: test.config.target_to_triple[t], triples)) else: devices_for_test = self.select_devices_for_test(test) if not devices_for_test: @@ -168,14 +199,14 @@ def execute(self, test, litConfig): for sycl_device in devices_for_test: (backend, _) = sycl_device.split(":") - triples.add(get_triple(backend)) + triples.add(test.config.backend_to_triple[backend]) substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase) substitutions.append(("%{sycl_triple}", format(",".join(triples)))) sycl_target_opts = "-fsycl-targets=%{sycl_triple}" - if get_triple("hip") in triples: + if test.config.backend_to_triple["hip"] in triples: hip_arch_opts = ( " -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch={}".format( test.config.amd_arch @@ -184,7 +215,7 @@ def execute(self, test, litConfig): sycl_target_opts += hip_arch_opts substitutions.append(("%{hip_arch_opts}", hip_arch_opts)) if ( - get_triple("spir64") in triples + "spir64" in triples and "spirv-backend" in test.config.available_features ): sycl_target_opts += " -fsycl-use-spirv-backend-for-spirv-gen" @@ -240,6 +271,9 @@ def get_extra_env(sycl_devices): substitutions.append(("%{run-unfiltered-devices}", run_unfiltered_substitution)) + for triple in triples: + test.config.available_features.add(test.config.triple_to_target[triple]) + new_script = [] for directive in script: if not isinstance(directive, lit.TestRunner.CommandDirective): @@ -323,19 +357,18 @@ def get_extra_env(sycl_devices): test, litConfig, useExternalSh, script, tmpBase ) - if len(devices_for_test) > 1 or test.config.test_mode == "build-only": - return result - - # Single device - might be an XFAIL. - device = devices_for_test[0] - if "*" in test.xfails or self.getMatchedFromList( - test.config.sycl_dev_features[device], test.xfails - ): - if result.code is lit.Test.PASS: - result.code = lit.Test.XPASS - # fail -> expected fail - elif result.code is lit.Test.FAIL: - result.code = lit.Test.XFAIL - return result - + # Single triple/device - might be an XFAIL. + def map_result(features, code): + if "*" in test.xfails or self.getMatchedFromList(features, test.xfails): + if code is lit.Test.PASS: + code = lit.Test.XPASS + elif code is lit.Test.FAIL: + code = lit.Test.XFAIL + return code + + if len(triples) == 1 and len(devices_for_test) == 0: + result.code = map_result(test.config.available_features, result.code) + if len(devices_for_test) == 1: + device = devices_for_test[0] + result.code = map_result(test.config.sycl_dev_features[device], result.code) return result diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index 5b60d93387b7a..bedece2b6d4a4 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -15,6 +15,23 @@ from lit.llvm.subst import ToolSubst, FindTool # Configuration file for the 'lit' test runner. +config.backend_to_target = { + "level_zero": "target-spir", + "opencl": "target-spir", + "cuda": "target-nvidia", + "hip": "target-amd", + "native_cpu": "target-native_cpu", +} +config.target_to_triple = { + "target-spir": "spir64", + "target-nvidia":"nvptx64-nvidia-cuda", + "target-amd":"amdgcn-amd-amdhsa", + "target-native_cpu":"native_cpu", +} +config.triple_to_target = {v:k for k,v in config.target_to_triple.items()} +config.backend_to_triple = { + k: config.target_to_triple.get(v) for k, v in config.backend_to_target.items() +} # name: The name of this test suite. config.name = "SYCL" @@ -43,15 +60,20 @@ if config.test_mode == "full": config.available_features.add("run-mode") config.available_features.add("build-and-run-mode") + config.sycl_triples = set() elif config.test_mode == "run-only": lit_config.note("run-only test mode enabled, only executing tests") config.available_features.add("run-mode") + config.sycl_triples = set() if lit_config.params.get("fallback-to-build-if-requires-build-and-run", False): config.available_features.add("build-and-run-mode") config.fallback_build_run_only = True elif config.test_mode == "build-only": lit_config.note("build-only test mode enabled, only compiling tests") config.sycl_devices = [] + config.sycl_triples = set(map(lambda x: "target-" + x, config.sycl_triples)) + if not config.amd_arch: + config.amd_arch = "gfx1031" else: lit_config.error("Invalid argument for test-mode") @@ -826,6 +848,10 @@ def open_check_file(file_name): features.add(dev.replace("fpga", "accelerator")) # Use short names for LIT rules. features.add(be) + # Add corresponding target feature + target = config.backend_to_target[be] + features.add(target) + config.sycl_triples.add(target) if be == "hip": if not config.amd_arch: diff --git a/sycl/test-e2e/lit.site.cfg.py.in b/sycl/test-e2e/lit.site.cfg.py.in index 00928dd9141fc..1435721dd856c 100644 --- a/sycl/test-e2e/lit.site.cfg.py.in +++ b/sycl/test-e2e/lit.site.cfg.py.in @@ -30,6 +30,9 @@ config.igc_tag_file = os.path.join("/usr/local/lib/igc/", 'IGCTAG.txt') config.sycl_devices = lit_config.params.get("sycl_devices", "@SYCL_TEST_E2E_TARGETS@").split(';') +# FIXME: current test markup only supports spir in build-only +config.sycl_triples = lit_config.params.get("sycl_triples", "spir").split(';') + config.amd_arch = lit_config.params.get("amd_arch", "@AMD_ARCH@") config.sycl_threads_lib = '@SYCL_THREADS_LIB@' config.extra_environment = lit_config.params.get("extra_environment", "@LIT_EXTRA_ENVIRONMENT@") diff --git a/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp b/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp index 85ecf5687ca63..53ce174a8b7c0 100644 --- a/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp +++ b/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp @@ -1,5 +1,4 @@ // REQUIRES: windows -// REQUIRES: build-and-run-mode // DEFINE: %{sharedflag} = %if cl_options %{/clang:-shared%} %else %{-shared%} diff --git a/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp b/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp index edd9e63a3752a..9d22804309a2c 100644 --- a/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp +++ b/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp @@ -1,5 +1,4 @@ -// REQUIRES: cuda -// REQUIRES: build-and-run-mode +// REQUIRES: target-nvidia // RUN: %{build} -Xsycl-target-backend --cuda-gpu-arch=sm_75 -o %t.out // RUN: %{run} %t.out #include From cdd3aa1bfd84dcc1e657181bc995c5172e50690c Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 22 Jan 2025 07:09:33 -0800 Subject: [PATCH 02/20] Address comments related to new expressions --- sycl/test-e2e/E2EExpr.py | 127 ++++++++++++++++++++++++ sycl/test-e2e/TriStateExpr.py | 176 ---------------------------------- sycl/test-e2e/format.py | 2 +- 3 files changed, 128 insertions(+), 177 deletions(-) create mode 100644 sycl/test-e2e/E2EExpr.py delete mode 100644 sycl/test-e2e/TriStateExpr.py diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py new file mode 100644 index 0000000000000..82ae7ccdc2a73 --- /dev/null +++ b/sycl/test-e2e/E2EExpr.py @@ -0,0 +1,127 @@ +from lit.BooleanExpression import BooleanExpression + + +class E2EExpr(BooleanExpression): + build_specific_features = { + "build-and-run-mode", + "target-spir", + "target-nvidia", + "target-amd", + "target-native_cpu", + "linux", + "system-linux", + "windows", + "system-windows", + "enable-perf-tests", + "opencl_icd", + "cuda_dev_kit", + "zstd", + "vulkan", + "true", + "false", + } + + def __init__(self, string, variables, build_only_mode, findal_unknown_value): + BooleanExpression.__init__(self, string, variables) + self.build_only_mode = build_only_mode + self.unknown = False + self.findal_unknown_value = findal_unknown_value + + @staticmethod + def evaluate(string, variables, build_only_mode, final_unknown_value=True): + """ + string: Expression to evaluate + variables: variables that evaluate to true + build_only_mode: if true enables unknown values + findal_unknown_value: findal boolean result if evaluation results in `unknown` + """ + try: + parser = E2EExpr(string, set(variables), build_only_mode, final_unknown_value) + return parser.parseAll() + except ValueError as e: + raise ValueError(str(e) + ("\nin expression: %r" % string)) + + def parseMATCH(self): + token = self.token + BooleanExpression.parseMATCH(self) + if token not in self.build_specific_features and self.build_only_mode: + self.unknown = True + else: + self.unknown = False + + def parseAND(self): + self.parseNOT() + while self.accept("&&"): + left = self.value + left_unknown = self.unknown + self.parseNOT() + right = self.value + right_unknown = self.unknown + self.value = left and right + # Unknown if both are unknown or if one is true and the other is unknown + self.unknown = ( + (left_unknown and right_unknown) + or (left_unknown and right) + or (left and right_unknown) + ) + + def parseOR(self): + self.parseAND() + while self.accept("||"): + left = self.value + left_unknown = self.unknown + self.parseAND() + right = self.value + right_unknown = self.unknown + self.value = left or right + # Unknown if both are unknown or if one is false and the other is unknown + self.unknown = ( + (left_unknown and right_unknown) + or (left_unknown and not right) + or (not left and right_unknown) + ) + + def parseAll(self): + self.token = next(self.tokens) + self.parseOR() + self.expect(BooleanExpression.END) + return self.findal_unknown_value if self.unknown else self.value + + +import unittest + + +class TestE2EExpr(unittest.TestCase): + def test_basic(self): + # Non build-only expressions should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) + self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) + self.assertFalse(E2EExpr.evaluate( "another_aspect && rt_feature", {"linux", "rt_feature"}, False)) + # build-only expressions with no unknowns should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate( "linux && windows", {"linux"}, True, final_unknown_value=True)) + self.assertTrue(E2EExpr.evaluate( "!(windows || zstd)", {"linux"}, True, final_unknown_value=False)) + # build-only expressions where unknown affects the resulting value + self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=False)) + # build-only expressions where unknown does not affect the resulting value + self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=False)) + + +if __name__ == "__main__": + unittest.main() diff --git a/sycl/test-e2e/TriStateExpr.py b/sycl/test-e2e/TriStateExpr.py deleted file mode 100644 index 08cb124b9bc88..0000000000000 --- a/sycl/test-e2e/TriStateExpr.py +++ /dev/null @@ -1,176 +0,0 @@ -from lit.BooleanExpression import BooleanExpression - - -class E2EExpr(BooleanExpression): - build_specific_features = { - "build-and-run-mode", - "target-spir", - "target-nvidia", - "target-amd", - "target-native_cpu", - "linux", - "system-linux", - "windows", - "system-windows", - "enable-perf-tests", - "opencl_icd", - "cuda_dev_kit", - "zstd", - "vulkan", - "true", - "false", - } - - def __init__(self, string, variables, build_only_mode, ignore_value): - BooleanExpression.__init__(self, string, variables) - self.build_only_mode = build_only_mode - self.ignore = False - self.ignore_value = ignore_value - - @staticmethod - def evaluate(string, variables, build_only_mode, ignore_value=True): - try: - parser = E2EExpr(string, set(variables), build_only_mode, ignore_value) - return parser.parseAll() - except ValueError as e: - raise ValueError(str(e) + ("\nin expression: %r" % string)) - - def parseMATCH(self): - token = self.token - BooleanExpression.parseMATCH(self) - if token not in self.build_specific_features and self.build_only_mode: - self.ignore = True - else: - self.ignore = False - - def parseAND(self): - self.parseNOT() - while self.accept("&&"): - left = self.value - left_ignore = self.ignore - self.parseNOT() - right = self.value - right_ignore = self.ignore - self.value = left and right - # Ignore if both are ignore or if one is true and the other is ignore - self.ignore = ( - (left_ignore and right_ignore) - or (left_ignore and right) - or (left and right_ignore) - ) - - def parseOR(self): - self.parseAND() - while self.accept("||"): - left = self.value - left_ignore = self.ignore - self.parseAND() - right = self.value - right_ignore = self.ignore - self.value = left or right - # Ignore if both are ignore or if one is false and the other is ignore - self.ignore = ( - (left_ignore and right_ignore) - or (left_ignore and not right) - or (not left and right_ignore) - ) - - def parseAll(self): - self.token = next(self.tokens) - self.parseOR() - self.expect(BooleanExpression.END) - return self.ignore_value if self.ignore else self.value - - -import unittest - - -class TestE2EExpr(unittest.TestCase): - def test_basic(self): - # Non build-only expressions should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) - self.assertTrue( - E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False) - ) - self.assertFalse( - E2EExpr.evaluate( - "another_aspect && rt_feature", {"linux", "rt_feature"}, False - ) - ) - # build-only expressions with no ignores should work the same - self.assertTrue( - E2EExpr.evaluate("linux", {"linux", "rt_feature"}, True, False) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && windows", {"linux", "rt_feature"}, True, True - ) - ) - self.assertTrue( - E2EExpr.evaluate( - "!(windows || zstd)", {"linux", "rt_feature"}, True, False - ) - ) - # build-only expressions where ignore affects the resulting value - self.assertTrue( - E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, True) - ) - self.assertFalse( - E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, False) - ) - self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, True)) - self.assertTrue( - E2EExpr.evaluate("!rt_feature", {"rt_feature"}, True, True) - ) - self.assertTrue( - E2EExpr.evaluate("!!rt_feature", {"rt_feature"}, True, True) - ) - self.assertTrue( - E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, True) - ) - self.assertFalse( - E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, False) - ) - self.assertTrue( - E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, True) - ) - self.assertFalse( - E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, False) - ) - self.assertTrue( - E2EExpr.evaluate( - "linux && !(windows || rt_feature)", {"linux"}, True, True - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && !(windows || rt_feature)", {"linux"}, True, False - ) - ) - # build-only expressions where ignore does not affect the resulting value - self.assertTrue( - E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, True) - ) - self.assertTrue( - E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, False) - ) - self.assertFalse( - E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, True) - ) - self.assertFalse( - E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, False) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && (windows && rt_feature)", {"linux"}, True, True - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && (windows && rt_feature)", {"linux"}, True, False - ) - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index f920d24c2d19c..a612ed919c89b 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -6,7 +6,7 @@ ParserKind, IntegratedTestKeywordParser, ) -from TriStateExpr import E2EExpr +from E2EExpr import E2EExpr import os import re From 0be2b74623e83e921746a5d8bb517c83c5719cef Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 22 Jan 2025 07:55:21 -0800 Subject: [PATCH 03/20] Rename triples to build_target where appropriate --- sycl/test-e2e/format.py | 20 ++++++++++---------- sycl/test-e2e/lit.cfg.py | 5 +---- sycl/test-e2e/lit.site.cfg.py.in | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index a612ed919c89b..8d2953f278ca5 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -98,18 +98,18 @@ def getMatchedFromList(self, features, alist, build_only_mode=False): except ValueError as e: raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e)) - def select_triples_for_test(self, test): - supported_triples = set() - for t in test.config.sycl_triples: + def select_build_targets_for_test(self, test): + supported_targets = set() + for t in test.config.sycl_build_targets: features = test.config.available_features.union({t}) if self.getMissingRequiredFeaturesFromList(features, test.requires, build_only_mode=True): continue if self.getMatchedFromList(features, test.unsupported, build_only_mode=True): continue - supported_triples.add(t) + supported_targets.add(t) - if len(supported_triples) <= 1: - return supported_triples + if len(supported_targets) <= 1: + return supported_targets # Treat XFAIL as UNSUPPORTED if the test is to be compiled for multiple # triples. if "*" in test.xfails: @@ -117,7 +117,7 @@ def select_triples_for_test(self, test): triples_without_xfail = [ t - for t in supported_triples + for t in supported_targets if not self.getMatchedFromList( test.config.available_features.union({t}), test.xfails ) @@ -184,12 +184,12 @@ def execute(self, test, litConfig): devices_for_test = [] triples = set() if test.config.test_mode == "build-only": - triples = self.select_triples_for_test(test) - if not triples: + build_targets = self.select_build_targets_for_test(test) + if not build_targets: return lit.Test.Result( lit.Test.UNSUPPORTED, "No supported triple to build for" ) - triples = set(map(lambda t: test.config.target_to_triple[t], triples)) + triples = set(test.config.target_to_triple[t] for t in build_targets) else: devices_for_test = self.select_devices_for_test(test) if not devices_for_test: diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index bedece2b6d4a4..7d72a768d0aaa 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -60,18 +60,16 @@ if config.test_mode == "full": config.available_features.add("run-mode") config.available_features.add("build-and-run-mode") - config.sycl_triples = set() elif config.test_mode == "run-only": lit_config.note("run-only test mode enabled, only executing tests") config.available_features.add("run-mode") - config.sycl_triples = set() if lit_config.params.get("fallback-to-build-if-requires-build-and-run", False): config.available_features.add("build-and-run-mode") config.fallback_build_run_only = True elif config.test_mode == "build-only": lit_config.note("build-only test mode enabled, only compiling tests") config.sycl_devices = [] - config.sycl_triples = set(map(lambda x: "target-" + x, config.sycl_triples)) + config.sycl_build_targets = set("target-" + t for t in config.sycl_build_targets) if not config.amd_arch: config.amd_arch = "gfx1031" else: @@ -851,7 +849,6 @@ def open_check_file(file_name): # Add corresponding target feature target = config.backend_to_target[be] features.add(target) - config.sycl_triples.add(target) if be == "hip": if not config.amd_arch: diff --git a/sycl/test-e2e/lit.site.cfg.py.in b/sycl/test-e2e/lit.site.cfg.py.in index 1435721dd856c..7baab807608f5 100644 --- a/sycl/test-e2e/lit.site.cfg.py.in +++ b/sycl/test-e2e/lit.site.cfg.py.in @@ -31,7 +31,7 @@ config.igc_tag_file = os.path.join("/usr/local/lib/igc/", 'IGCTAG.txt') config.sycl_devices = lit_config.params.get("sycl_devices", "@SYCL_TEST_E2E_TARGETS@").split(';') # FIXME: current test markup only supports spir in build-only -config.sycl_triples = lit_config.params.get("sycl_triples", "spir").split(';') +config.sycl_build_targets = lit_config.params.get("sycl_build_targets", "spir").split(';') config.amd_arch = lit_config.params.get("amd_arch", "@AMD_ARCH@") config.sycl_threads_lib = '@SYCL_THREADS_LIB@' From 5a2b31fbf847562912b70d9258cf495b0e2fe1ab Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 22 Jan 2025 08:21:17 -0800 Subject: [PATCH 04/20] Address 2 more comments --- sycl/test-e2e/format.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index 8d2953f278ca5..c1d35bab5e799 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -110,8 +110,10 @@ def select_build_targets_for_test(self, test): if len(supported_targets) <= 1: return supported_targets + # Treat XFAIL as UNSUPPORTED if the test is to be compiled for multiple # triples. + if "*" in test.xfails: return [] @@ -366,7 +368,7 @@ def map_result(features, code): code = lit.Test.XFAIL return code - if len(triples) == 1 and len(devices_for_test) == 0: + if len(triples) == 1 and test.config.test_mode == "build-only": result.code = map_result(test.config.available_features, result.code) if len(devices_for_test) == 1: device = devices_for_test[0] From 9a5f6c8e08c54aec198b8ec8669e205b98de312d Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 22 Jan 2025 11:31:10 -0800 Subject: [PATCH 05/20] Re-add `REQUIRES: build-and-run-mode` for tests failing on run-only --- sycl/test-e2e/AOT/cpu.cpp | 1 + sycl/test-e2e/AOT/double.cpp | 1 + sycl/test-e2e/AOT/half.cpp | 1 + sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp | 1 + sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp | 1 + sycl/test-e2e/Compression/compression_aot.cpp | 1 + sycl/test-e2e/Compression/compression_separate_compile.cpp | 1 + .../DeviceArchitecture/device_architecture_on_device_aot.cpp | 1 + sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp | 1 + sycl/test-e2e/DeviceLib/assert-aot.cpp | 1 + sycl/test-e2e/DeviceLib/cmath-aot.cpp | 1 + sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp | 1 + sycl/test-e2e/NewOffloadDriver/cpu.cpp | 1 + sycl/test-e2e/NonUniformGroups/ballot_group.cpp | 1 + sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp | 1 + sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp | 1 + sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp | 1 + sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp | 1 + .../test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp | 1 + sycl/test-e2e/NonUniformGroups/tangle_group.cpp | 1 + sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp | 1 + .../multi_device_bundle/device_libs_and_caching.cpp | 1 + sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp | 1 + sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp | 1 + 24 files changed, 24 insertions(+) diff --git a/sycl/test-e2e/AOT/cpu.cpp b/sycl/test-e2e/AOT/cpu.cpp index f0c71be2d481e..e7bedc04b07ba 100644 --- a/sycl/test-e2e/AOT/cpu.cpp +++ b/sycl/test-e2e/AOT/cpu.cpp @@ -7,6 +7,7 @@ //===---------------------------------------------------------------------===// // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/aot.cpp -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/AOT/double.cpp b/sycl/test-e2e/AOT/double.cpp index ead41bfc8c741..4d48f5c7b57ec 100644 --- a/sycl/test-e2e/AOT/double.cpp +++ b/sycl/test-e2e/AOT/double.cpp @@ -2,6 +2,7 @@ // using fp64 can be compiled AOT. // REQUIRES: ocloc, opencl-aot, any-device-is-cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_tgllp -o %t.tgllp.out %s // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s // RUN: %if cpu %{ %{run} %t.x86.out %} diff --git a/sycl/test-e2e/AOT/half.cpp b/sycl/test-e2e/AOT/half.cpp index e843ee65bbeef..5711b21735f72 100644 --- a/sycl/test-e2e/AOT/half.cpp +++ b/sycl/test-e2e/AOT/half.cpp @@ -2,6 +2,7 @@ // using fp16 can be compiled AOT. // REQUIRES: ocloc, opencl-aot, any-device-is-cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_tgllp -o %t.tgllp.out %s // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s // RUN: %if cpu %{ %{run} %t.x86.out %} diff --git a/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp b/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp index 8337716c3191e..32c6c3aae8f06 100644 --- a/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp +++ b/sycl/test-e2e/BFloat16/bfloat16_example_aot.cpp @@ -4,6 +4,7 @@ /// // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12, any-device-is-cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64 %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp b/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp index 2f6d893768c4e..9231a62428272 100644 --- a/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp +++ b/sycl/test-e2e/BFloat16/bfloat16_example_aot_cpu.cpp @@ -4,6 +4,7 @@ /// // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12, any-device-is-cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device dg1" %s -o %t.out // RUN: %if cpu %{ %{run} %t.out %} diff --git a/sycl/test-e2e/Compression/compression_aot.cpp b/sycl/test-e2e/Compression/compression_aot.cpp index b8293f1c79351..ba95974fde781 100644 --- a/sycl/test-e2e/Compression/compression_aot.cpp +++ b/sycl/test-e2e/Compression/compression_aot.cpp @@ -1,5 +1,6 @@ // End-to-End test for testing device image compression in AOT. // REQUIRES: zstd, opencl-aot, cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %O0 --offload-compress --offload-compression-level=3 %S/Inputs/single_kernel.cpp -o %t_compress.out // RUN: %{run} %t_compress.out diff --git a/sycl/test-e2e/Compression/compression_separate_compile.cpp b/sycl/test-e2e/Compression/compression_separate_compile.cpp index dab17e3506b4e..afbe442230e29 100644 --- a/sycl/test-e2e/Compression/compression_separate_compile.cpp +++ b/sycl/test-e2e/Compression/compression_separate_compile.cpp @@ -2,6 +2,7 @@ // seperatly compile and link device images. // REQUIRES: zstd, opencl-aot, cpu, linux +// REQUIRES: build-and-run-mode ////////////////////// Compile device images // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsycl-host-compiler=clang++ -fsycl-host-compiler-options='-std=c++17 -Wno-attributes -Wno-deprecated-declarations -fPIC -DENABLE_KERNEL1' -DENABLE_KERNEL1 -c %s -o %t_kernel1_aot.o diff --git a/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp b/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp index a62ae965683ae..1d4c41f117136 100644 --- a/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp +++ b/sycl/test-e2e/DeviceArchitecture/device_architecture_on_device_aot.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp b/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp index d2937b796fe63..319c69af0faef 100644 --- a/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp +++ b/sycl/test-e2e/DeviceCodeSplit/aot-cpu.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_x86_64 -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp \ // RUN: -fsycl-dead-args-optimization diff --git a/sycl/test-e2e/DeviceLib/assert-aot.cpp b/sycl/test-e2e/DeviceLib/assert-aot.cpp index ccff887e80adf..f5c8c61f07d78 100644 --- a/sycl/test-e2e/DeviceLib/assert-aot.cpp +++ b/sycl/test-e2e/DeviceLib/assert-aot.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu, linux +// REQUIRES: build-and-run-mode // RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=spir64_x86_64 %S/assert.cpp -o %t.aot.out // RUN: env EXPECTED_SIGNAL=SIGABRT SHOULD_CRASH=1 %{run} %t.aot.out 2>&1 | FileCheck %S/assert.cpp --check-prefixes=CHECK-MESSAGE diff --git a/sycl/test-e2e/DeviceLib/cmath-aot.cpp b/sycl/test-e2e/DeviceLib/cmath-aot.cpp index bb9e201de9282..c9897f652f034 100644 --- a/sycl/test-e2e/DeviceLib/cmath-aot.cpp +++ b/sycl/test-e2e/DeviceLib/cmath-aot.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // UNSUPPORTED: windows // DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%} diff --git a/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp b/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp index 585b368641d6e..0016e8498bd9d 100644 --- a/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp +++ b/sycl/test-e2e/NewOffloadDriver/aot-cpu.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // Test with `--offload-new-driver` // RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_x86_64 -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp \ diff --git a/sycl/test-e2e/NewOffloadDriver/cpu.cpp b/sycl/test-e2e/NewOffloadDriver/cpu.cpp index ef93d69f8693b..943ea71c3386e 100644 --- a/sycl/test-e2e/NewOffloadDriver/cpu.cpp +++ b/sycl/test-e2e/NewOffloadDriver/cpu.cpp @@ -7,6 +7,7 @@ //===---------------------------------------------------------------------===// // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // Test with `--offload-new-driver` // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 --offload-new-driver %S/Inputs/aot.cpp -o %t.out diff --git a/sycl/test-e2e/NonUniformGroups/ballot_group.cpp b/sycl/test-e2e/NonUniformGroups/ballot_group.cpp index f24bffb81526a..1532c54879ecc 100644 --- a/sycl/test-e2e/NonUniformGroups/ballot_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/ballot_group.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: hip diff --git a/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp index 1eed59d35f0ee..da9154ae602d0 100644 --- a/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/ballot_group_algorithms.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_ballot_group diff --git a/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp b/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp index 939be57799dd4..5d2b98b58ddc2 100644 --- a/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: hip // REQUIRES: sg-32 diff --git a/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp index 7673ea36d9f53..07898d0146fb9 100644 --- a/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/fixed_size_group_algorithms.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsycl-device-code-split=per_kernel -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_fixed_size_group diff --git a/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp b/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp index 18d42487b7768..2069113c3f939 100644 --- a/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/opportunistic_group.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: hip diff --git a/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp index af4d45cee862f..8e7626650e01c 100644 --- a/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/opportunistic_group_algorithms.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_opportunistic_group diff --git a/sycl/test-e2e/NonUniformGroups/tangle_group.cpp b/sycl/test-e2e/NonUniformGroups/tangle_group.cpp index 44191955048f3..686d1b34c6185 100644 --- a/sycl/test-e2e/NonUniformGroups/tangle_group.cpp +++ b/sycl/test-e2e/NonUniformGroups/tangle_group.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fno-sycl-early-optimizations -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // UNSUPPORTED: cuda || hip diff --git a/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp b/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp index 7033c4c9e4df5..51070ed1731e4 100644 --- a/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp +++ b/sycl/test-e2e/NonUniformGroups/tangle_group_algorithms.cpp @@ -4,6 +4,7 @@ // RUN: %if any-device-is-cpu && opencl-aot %{ %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fno-sycl-early-optimizations -o %t.x86.out %s %} // RUN: %if cpu %{ %{run} %t.x86.out %} // +// REQUIRES: build-and-run-mode // REQUIRES: cpu || gpu // REQUIRES: sg-32 // REQUIRES: aspect-ext_oneapi_tangle_group diff --git a/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp b/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp index 12699740d7da9..78872c04d97ec 100644 --- a/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp +++ b/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp @@ -1,4 +1,5 @@ // REQUIRES: ocloc && gpu && linux && (opencl || level_zero) +// REQUIRES: build-and-run-mode // Test to check several use cases for multi-device kernel bundles. // Test covers AOT and JIT cases. Kernel is using some math functions to enforce diff --git a/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp b/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp index 3ee1d4bd2490b..bc7145049ddcb 100644 --- a/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp +++ b/sycl/test-e2e/SpecConstants/2020/non_native/SpecConstBuffer.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/common.cpp -o %t.out \ // RUN: -fsycl-dead-args-optimization diff --git a/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp b/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp index 8453a6556ffec..f6b7b836e873c 100644 --- a/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp +++ b/sycl/test-e2e/SpecConstants/2020/non_native/cpu.cpp @@ -1,4 +1,5 @@ // REQUIRES: opencl-aot, cpu +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/common.cpp -o %t.out \ // RUN: -fsycl-dead-args-optimization From d95ce2fd0dc5647bda6041d800405ffbf934a707 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 22 Jan 2025 12:04:01 -0800 Subject: [PATCH 06/20] Add final_unknown_value as defaulted param in `getMatchedFromList` --- sycl/test-e2e/format.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index c1d35bab5e799..b1caefe244272 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -88,12 +88,14 @@ def getMissingRequiredFeaturesFromList( except ValueError as e: raise ValueError("Error in REQUIRES list:\n%s" % str(e)) - def getMatchedFromList(self, features, alist, build_only_mode=False): + def getMatchedFromList( + self, features, alist, build_only_mode=False, final_unknown_value=False + ): try: return [ item for item in alist - if E2EExpr.evaluate(item, features, build_only_mode, False) + if E2EExpr.evaluate(item, features, build_only_mode, final_unknown_value) ] except ValueError as e: raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e)) From a917988544ca949c8baf2f994939236b669250df Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Thu, 23 Jan 2025 07:36:05 -0800 Subject: [PATCH 07/20] Add test to run E2EExpr unit tests, and move unit tests to separate file --- sycl/test-e2e/E2EExpr.py | 39 ------------------- .../e2e_test_requirements/E2EExpr_tests.py | 39 +++++++++++++++++++ .../check_e2eexpr_logic.cpp | 7 ++++ 3 files changed, 46 insertions(+), 39 deletions(-) create mode 100644 sycl/test/e2e_test_requirements/E2EExpr_tests.py create mode 100644 sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 82ae7ccdc2a73..ff02aebbf3d60 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -86,42 +86,3 @@ def parseAll(self): self.parseOR() self.expect(BooleanExpression.END) return self.findal_unknown_value if self.unknown else self.value - - -import unittest - - -class TestE2EExpr(unittest.TestCase): - def test_basic(self): - # Non build-only expressions should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) - self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) - self.assertFalse(E2EExpr.evaluate( "another_aspect && rt_feature", {"linux", "rt_feature"}, False)) - # build-only expressions with no unknowns should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate( "linux && windows", {"linux"}, True, final_unknown_value=True)) - self.assertTrue(E2EExpr.evaluate( "!(windows || zstd)", {"linux"}, True, final_unknown_value=False)) - # build-only expressions where unknown affects the resulting value - self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=False)) - # build-only expressions where unknown does not affect the resulting value - self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=False)) - - -if __name__ == "__main__": - unittest.main() diff --git a/sycl/test/e2e_test_requirements/E2EExpr_tests.py b/sycl/test/e2e_test_requirements/E2EExpr_tests.py new file mode 100644 index 0000000000000..f4ef5b4cd9efa --- /dev/null +++ b/sycl/test/e2e_test_requirements/E2EExpr_tests.py @@ -0,0 +1,39 @@ +from E2EExpr import E2EExpr + +import unittest + + +class TestE2EExpr(unittest.TestCase): + def test_basic(self): + # Non build-only expressions should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) + self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) + self.assertFalse(E2EExpr.evaluate( "another_aspect && rt_feature", {"linux", "rt_feature"}, False)) + # build-only expressions with no unknowns should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate( "linux && windows", {"linux"}, True, final_unknown_value=True)) + self.assertTrue(E2EExpr.evaluate( "!(windows || zstd)", {"linux"}, True, final_unknown_value=False)) + # build-only expressions where unknown affects the resulting value + self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=False)) + # build-only expressions where unknown does not affect the resulting value + self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=False)) + + +if __name__ == "__main__": + unittest.main() diff --git a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp new file mode 100644 index 0000000000000..4aac6b5c73d48 --- /dev/null +++ b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp @@ -0,0 +1,7 @@ +// E2E tests use a modified expression parser that allows for a third "unknown" +// boolean state to handle missing run-time features in REQUIRES/UNSUPPORTED +// statements. This test runs the unit tests related to these expressions. +// +// DEFINE: %{e2e_folder}=%S/../../test-e2e +// DEFINE: %{lit_source}=%S/../../../llvm/utils/lit +// RUN: env PYTHONPATH=%{lit_source}:%{e2e_folder} python %S/E2EExpr_tests.py From 184d9d97367a03574e11a49ccdbccc695036dc49 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Thu, 23 Jan 2025 08:10:18 -0800 Subject: [PATCH 08/20] Simplify code by using build_targets set throughout execute function --- sycl/test-e2e/format.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index b1caefe244272..b084626b0037e 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -186,14 +186,13 @@ def execute(self, test, litConfig): return script devices_for_test = [] - triples = set() + build_targets = set() if test.config.test_mode == "build-only": build_targets = self.select_build_targets_for_test(test) if not build_targets: return lit.Test.Result( lit.Test.UNSUPPORTED, "No supported triple to build for" ) - triples = set(test.config.target_to_triple[t] for t in build_targets) else: devices_for_test = self.select_devices_for_test(test) if not devices_for_test: @@ -203,14 +202,16 @@ def execute(self, test, litConfig): for sycl_device in devices_for_test: (backend, _) = sycl_device.split(":") - triples.add(test.config.backend_to_triple[backend]) + build_targets.add(test.config.backend_to_target[backend]) + + triples = set(test.config.target_to_triple[t] for t in build_targets) substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase) substitutions.append(("%{sycl_triple}", format(",".join(triples)))) sycl_target_opts = "-fsycl-targets=%{sycl_triple}" - if test.config.backend_to_triple["hip"] in triples: + if "target-amd" in build_targets: hip_arch_opts = ( " -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch={}".format( test.config.amd_arch @@ -219,7 +220,7 @@ def execute(self, test, litConfig): sycl_target_opts += hip_arch_opts substitutions.append(("%{hip_arch_opts}", hip_arch_opts)) if ( - "spir64" in triples + "target-spir" in build_targets and "spirv-backend" in test.config.available_features ): sycl_target_opts += " -fsycl-use-spirv-backend-for-spirv-gen" @@ -275,8 +276,8 @@ def get_extra_env(sycl_devices): substitutions.append(("%{run-unfiltered-devices}", run_unfiltered_substitution)) - for triple in triples: - test.config.available_features.add(test.config.triple_to_target[triple]) + for target in build_targets: + test.config.available_features.add(target) new_script = [] for directive in script: From d1f8409b0f0c7d6ab8fa2fbcbae250e89e975eb6 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Thu, 23 Jan 2025 08:18:07 -0800 Subject: [PATCH 09/20] Add requires linux on E2EExpr tests --- sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp index 4aac6b5c73d48..d8d5c8ecacfeb 100644 --- a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp +++ b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp @@ -2,6 +2,7 @@ // boolean state to handle missing run-time features in REQUIRES/UNSUPPORTED // statements. This test runs the unit tests related to these expressions. // +// REQUIRES: linux // DEFINE: %{e2e_folder}=%S/../../test-e2e // DEFINE: %{lit_source}=%S/../../../llvm/utils/lit // RUN: env PYTHONPATH=%{lit_source}:%{e2e_folder} python %S/E2EExpr_tests.py From cff43417c19c72935b3b11610c309ec7a971467c Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Thu, 23 Jan 2025 09:04:37 -0800 Subject: [PATCH 10/20] Move E2EExpr unit tests back into E2EExpr.py --- sycl/test-e2e/E2EExpr.py | 39 +++++++++++++++++++ .../e2e_test_requirements/E2EExpr_tests.py | 39 ------------------- .../check_e2eexpr_logic.cpp | 4 +- 3 files changed, 41 insertions(+), 41 deletions(-) delete mode 100644 sycl/test/e2e_test_requirements/E2EExpr_tests.py diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index ff02aebbf3d60..82ae7ccdc2a73 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -86,3 +86,42 @@ def parseAll(self): self.parseOR() self.expect(BooleanExpression.END) return self.findal_unknown_value if self.unknown else self.value + + +import unittest + + +class TestE2EExpr(unittest.TestCase): + def test_basic(self): + # Non build-only expressions should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) + self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) + self.assertFalse(E2EExpr.evaluate( "another_aspect && rt_feature", {"linux", "rt_feature"}, False)) + # build-only expressions with no unknowns should work the same + self.assertTrue(E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate( "linux && windows", {"linux"}, True, final_unknown_value=True)) + self.assertTrue(E2EExpr.evaluate( "!(windows || zstd)", {"linux"}, True, final_unknown_value=False)) + # build-only expressions where unknown affects the resulting value + self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertTrue(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=False)) + # build-only expressions where unknown does not affect the resulting value + self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=False)) + self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=True)) + self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=False)) + + +if __name__ == "__main__": + unittest.main() diff --git a/sycl/test/e2e_test_requirements/E2EExpr_tests.py b/sycl/test/e2e_test_requirements/E2EExpr_tests.py deleted file mode 100644 index f4ef5b4cd9efa..0000000000000 --- a/sycl/test/e2e_test_requirements/E2EExpr_tests.py +++ /dev/null @@ -1,39 +0,0 @@ -from E2EExpr import E2EExpr - -import unittest - - -class TestE2EExpr(unittest.TestCase): - def test_basic(self): - # Non build-only expressions should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) - self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) - self.assertFalse(E2EExpr.evaluate( "another_aspect && rt_feature", {"linux", "rt_feature"}, False)) - # build-only expressions with no unknowns should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate( "linux && windows", {"linux"}, True, final_unknown_value=True)) - self.assertTrue(E2EExpr.evaluate( "!(windows || zstd)", {"linux"}, True, final_unknown_value=False)) - # build-only expressions where unknown affects the resulting value - self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=False)) - # build-only expressions where unknown does not affect the resulting value - self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=False)) - - -if __name__ == "__main__": - unittest.main() diff --git a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp index d8d5c8ecacfeb..baf6412294a6d 100644 --- a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp +++ b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp @@ -3,6 +3,6 @@ // statements. This test runs the unit tests related to these expressions. // // REQUIRES: linux -// DEFINE: %{e2e_folder}=%S/../../test-e2e +// DEFINE: %{E2EExpr}=%S/../../test-e2e/E2EExpr.py // DEFINE: %{lit_source}=%S/../../../llvm/utils/lit -// RUN: env PYTHONPATH=%{lit_source}:%{e2e_folder} python %S/E2EExpr_tests.py +// RUN: env PYTHONPATH=%{lit_source} python %{E2EExpr} From 51c46b49d8008bf9b6f8cc84274e6457c22ce8f6 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Thu, 23 Jan 2025 10:45:57 -0800 Subject: [PATCH 11/20] Format changes --- sycl/test-e2e/E2EExpr.py | 140 +++++++++++++++--- sycl/test-e2e/format.py | 12 +- sycl/test-e2e/lit.cfg.py | 8 +- .../check_e2eexpr_logic.cpp | 4 +- 4 files changed, 131 insertions(+), 33 deletions(-) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 82ae7ccdc2a73..0c7b572403c97 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -30,13 +30,15 @@ def __init__(self, string, variables, build_only_mode, findal_unknown_value): @staticmethod def evaluate(string, variables, build_only_mode, final_unknown_value=True): """ - string: Expression to evaluate + string: Expression to evaluate variables: variables that evaluate to true build_only_mode: if true enables unknown values findal_unknown_value: findal boolean result if evaluation results in `unknown` """ try: - parser = E2EExpr(string, set(variables), build_only_mode, final_unknown_value) + parser = E2EExpr( + string, set(variables), build_only_mode, final_unknown_value + ) return parser.parseAll() except ValueError as e: raise ValueError(str(e) + ("\nin expression: %r" % string)) @@ -96,31 +98,121 @@ def test_basic(self): # Non build-only expressions should work the same self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) - self.assertFalse(E2EExpr.evaluate( "another_aspect && rt_feature", {"linux", "rt_feature"}, False)) + self.assertFalse( + E2EExpr.evaluate( + "another_aspect && rt_feature", {"linux", "rt_feature"}, False + ) + ) # build-only expressions with no unknowns should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate( "linux && windows", {"linux"}, True, final_unknown_value=True)) - self.assertTrue(E2EExpr.evaluate( "!(windows || zstd)", {"linux"}, True, final_unknown_value=False)) + self.assertTrue( + E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && windows", {"linux"}, True, final_unknown_value=True + ) + ) + self.assertTrue( + E2EExpr.evaluate( + "!(windows || zstd)", {"linux"}, True, final_unknown_value=False + ) + ) # build-only expressions where unknown affects the resulting value - self.assertTrue(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("rt_feature", {"rt_feature"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("windows || rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("linux && rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertTrue(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate( "linux && !(windows || rt_feature)", {"linux"}, True, final_unknown_value=False)) + self.assertTrue( + E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True) + ) + self.assertFalse( + E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False) + ) + self.assertTrue( + E2EExpr.evaluate( + "rt_feature", {"rt_feature"}, True, final_unknown_value=True + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "rt_feature", {"rt_feature"}, True, final_unknown_value=False + ) + ) + self.assertFalse( + E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False) + ) + self.assertFalse( + E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False) + ) + self.assertTrue( + E2EExpr.evaluate( + "windows || rt_feature", {"linux"}, True, final_unknown_value=True + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "windows || rt_feature", {"linux"}, True, final_unknown_value=False + ) + ) + self.assertTrue( + E2EExpr.evaluate( + "linux && rt_feature", {"linux"}, True, final_unknown_value=True + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && rt_feature", {"linux"}, True, final_unknown_value=False + ) + ) + self.assertTrue( + E2EExpr.evaluate( + "linux && !(windows || rt_feature)", + {"linux"}, + True, + final_unknown_value=True, + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && !(windows || rt_feature)", + {"linux"}, + True, + final_unknown_value=False, + ) + ) # build-only expressions where unknown does not affect the resulting value - self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertTrue(E2EExpr.evaluate("linux || rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate("windows && rt_feature", {"linux"}, True, final_unknown_value=False)) - self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=True)) - self.assertFalse(E2EExpr.evaluate( "linux && (windows && rt_feature)", {"linux"}, True, final_unknown_value=False)) + self.assertTrue( + E2EExpr.evaluate( + "linux || rt_feature", {"linux"}, True, final_unknown_value=True + ) + ) + self.assertTrue( + E2EExpr.evaluate( + "linux || rt_feature", {"linux"}, True, final_unknown_value=False + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "windows && rt_feature", {"linux"}, True, final_unknown_value=True + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "windows && rt_feature", {"linux"}, True, final_unknown_value=False + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && (windows && rt_feature)", + {"linux"}, + True, + final_unknown_value=True, + ) + ) + self.assertFalse( + E2EExpr.evaluate( + "linux && (windows && rt_feature)", + {"linux"}, + True, + final_unknown_value=False, + ) + ) if __name__ == "__main__": diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index b084626b0037e..3e6df0cbf8ec5 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -95,7 +95,9 @@ def getMatchedFromList( return [ item for item in alist - if E2EExpr.evaluate(item, features, build_only_mode, final_unknown_value) + if E2EExpr.evaluate( + item, features, build_only_mode, final_unknown_value + ) ] except ValueError as e: raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e)) @@ -104,9 +106,13 @@ def select_build_targets_for_test(self, test): supported_targets = set() for t in test.config.sycl_build_targets: features = test.config.available_features.union({t}) - if self.getMissingRequiredFeaturesFromList(features, test.requires, build_only_mode=True): + if self.getMissingRequiredFeaturesFromList( + features, test.requires, build_only_mode=True + ): continue - if self.getMatchedFromList(features, test.unsupported, build_only_mode=True): + if self.getMatchedFromList( + features, test.unsupported, build_only_mode=True + ): continue supported_targets.add(t) diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index 7d72a768d0aaa..7cf481d692c71 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -24,11 +24,11 @@ } config.target_to_triple = { "target-spir": "spir64", - "target-nvidia":"nvptx64-nvidia-cuda", - "target-amd":"amdgcn-amd-amdhsa", - "target-native_cpu":"native_cpu", + "target-nvidia": "nvptx64-nvidia-cuda", + "target-amd": "amdgcn-amd-amdhsa", + "target-native_cpu": "native_cpu", } -config.triple_to_target = {v:k for k,v in config.target_to_triple.items()} +config.triple_to_target = {v: k for k, v in config.target_to_triple.items()} config.backend_to_triple = { k: config.target_to_triple.get(v) for k, v in config.backend_to_target.items() } diff --git a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp index baf6412294a6d..2e394d4a78687 100644 --- a/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp +++ b/sycl/test/e2e_test_requirements/check_e2eexpr_logic.cpp @@ -1,5 +1,5 @@ -// E2E tests use a modified expression parser that allows for a third "unknown" -// boolean state to handle missing run-time features in REQUIRES/UNSUPPORTED +// E2E tests use a modified expression parser that allows for a third "unknown" +// boolean state to handle missing run-time features in REQUIRES/UNSUPPORTED // statements. This test runs the unit tests related to these expressions. // // REQUIRES: linux From 694737127771660c0bde6a59bfd4ae9b60af026e Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Thu, 23 Jan 2025 12:08:13 -0800 Subject: [PATCH 12/20] Fix variable name typo --- sycl/test-e2e/E2EExpr.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 0c7b572403c97..1d006c5de714a 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -21,11 +21,11 @@ class E2EExpr(BooleanExpression): "false", } - def __init__(self, string, variables, build_only_mode, findal_unknown_value): + def __init__(self, string, variables, build_only_mode, final_unknown_value): BooleanExpression.__init__(self, string, variables) self.build_only_mode = build_only_mode self.unknown = False - self.findal_unknown_value = findal_unknown_value + self.final_unknown_value = final_unknown_value @staticmethod def evaluate(string, variables, build_only_mode, final_unknown_value=True): @@ -33,7 +33,7 @@ def evaluate(string, variables, build_only_mode, final_unknown_value=True): string: Expression to evaluate variables: variables that evaluate to true build_only_mode: if true enables unknown values - findal_unknown_value: findal boolean result if evaluation results in `unknown` + final_unknown_value: final boolean result if evaluation results in `unknown` """ try: parser = E2EExpr( @@ -87,7 +87,7 @@ def parseAll(self): self.token = next(self.tokens) self.parseOR() self.expect(BooleanExpression.END) - return self.findal_unknown_value if self.unknown else self.value + return self.final_unknown_value if self.unknown else self.value import unittest From 74cab12d2d69639ada5d8e77cdc7382765929ab8 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 08:06:15 -0800 Subject: [PATCH 13/20] Rework how E2EExpr tests are called + add exception Exception when rt feature is found in build-only --- sycl/test-e2e/E2EExpr.py | 149 +++++++++------------------------------ 1 file changed, 35 insertions(+), 114 deletions(-) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 1d006c5de714a..2a27c912de11f 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -50,6 +50,8 @@ def parseMATCH(self): self.unknown = True else: self.unknown = False + if self.value and self.unknown: + raise ValueError("Runtime feature \"" + token +"\" evaluated to True in build-only") def parseAND(self): self.parseNOT() @@ -95,124 +97,43 @@ def parseAll(self): class TestE2EExpr(unittest.TestCase): def test_basic(self): + BuildOnly = True + BuildAndRun = False + RequiresDirective = True + UnsupportedDirective = False + RegularEval= lambda expr, features: E2EExpr.evaluate(expr, features, BuildAndRun) + RequiresBuildEval = lambda expr, features: E2EExpr.evaluate(expr, features, BuildOnly, RequiresDirective) + UnsupportedBuildEval = lambda expr, features: E2EExpr.evaluate(expr, features, BuildOnly, UnsupportedDirective) # Non build-only expressions should work the same - self.assertTrue(E2EExpr.evaluate("linux", {"linux", "rt_feature"}, False)) - self.assertTrue(E2EExpr.evaluate("rt_feature", {"linux", "rt_feature"}, False)) - self.assertFalse( - E2EExpr.evaluate( - "another_aspect && rt_feature", {"linux", "rt_feature"}, False - ) - ) + self.assertTrue(RegularEval("linux", {"linux", "rt_feature"})) + self.assertTrue(RegularEval("rt_feature", {"linux", "rt_feature"})) + self.assertFalse(RegularEval("rt_feature1 && rt_feature2", {"linux", "rt_feature1"})) # build-only expressions with no unknowns should work the same - self.assertTrue( - E2EExpr.evaluate("linux", {"linux"}, True, final_unknown_value=False) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && windows", {"linux"}, True, final_unknown_value=True - ) - ) - self.assertTrue( - E2EExpr.evaluate( - "!(windows || zstd)", {"linux"}, True, final_unknown_value=False - ) - ) + self.assertTrue(UnsupportedBuildEval("linux", {"linux"})) + self.assertFalse(RequiresBuildEval("linux && windows", {"linux"})) + self.assertTrue(UnsupportedBuildEval("!(windows || zstd)", {"linux"})) # build-only expressions where unknown affects the resulting value - self.assertTrue( - E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=True) - ) - self.assertFalse( - E2EExpr.evaluate("rt_feature", {}, True, final_unknown_value=False) - ) - self.assertTrue( - E2EExpr.evaluate( - "rt_feature", {"rt_feature"}, True, final_unknown_value=True - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "rt_feature", {"rt_feature"}, True, final_unknown_value=False - ) - ) - self.assertFalse( - E2EExpr.evaluate("!rt_feature", {}, True, final_unknown_value=False) - ) - self.assertFalse( - E2EExpr.evaluate("!!rt_feature", {}, True, final_unknown_value=False) - ) - self.assertTrue( - E2EExpr.evaluate( - "windows || rt_feature", {"linux"}, True, final_unknown_value=True - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "windows || rt_feature", {"linux"}, True, final_unknown_value=False - ) - ) - self.assertTrue( - E2EExpr.evaluate( - "linux && rt_feature", {"linux"}, True, final_unknown_value=True - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && rt_feature", {"linux"}, True, final_unknown_value=False - ) - ) - self.assertTrue( - E2EExpr.evaluate( - "linux && !(windows || rt_feature)", - {"linux"}, - True, - final_unknown_value=True, - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && !(windows || rt_feature)", - {"linux"}, - True, - final_unknown_value=False, - ) - ) + self.assertTrue(RequiresBuildEval("rt_feature", {})) + self.assertFalse(UnsupportedBuildEval("rt_feature", {})) + self.assertFalse(UnsupportedBuildEval("!rt_feature", {})) + self.assertTrue(RequiresBuildEval("windows || rt_feature", {"linux"})) + self.assertFalse(UnsupportedBuildEval("windows || rt_feature", {"linux"})) + self.assertTrue(RequiresBuildEval("linux && rt_feature", {"linux"})) + self.assertFalse(UnsupportedBuildEval("linux && rt_feature", {"linux"})) + self.assertTrue(RequiresBuildEval("linux && !(zstd || rt_feature)", {"linux"})) + self.assertFalse(UnsupportedBuildEval("linux && !(zstd || rt_feature)", {"linux"})) # build-only expressions where unknown does not affect the resulting value - self.assertTrue( - E2EExpr.evaluate( - "linux || rt_feature", {"linux"}, True, final_unknown_value=True - ) - ) - self.assertTrue( - E2EExpr.evaluate( - "linux || rt_feature", {"linux"}, True, final_unknown_value=False - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "windows && rt_feature", {"linux"}, True, final_unknown_value=True - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "windows && rt_feature", {"linux"}, True, final_unknown_value=False - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && (windows && rt_feature)", - {"linux"}, - True, - final_unknown_value=True, - ) - ) - self.assertFalse( - E2EExpr.evaluate( - "linux && (windows && rt_feature)", - {"linux"}, - True, - final_unknown_value=False, - ) - ) + self.assertTrue(RequiresBuildEval("linux || rt_feature", {"linux"})) + self.assertTrue(UnsupportedBuildEval("linux || rt_feature", {"linux"})) + self.assertFalse(RequiresBuildEval("windows && rt_feature", {"linux"})) + self.assertFalse(UnsupportedBuildEval("windows && rt_feature", {"linux"})) + self.assertFalse(RequiresBuildEval("linux && (vulkan && rt_feature)", {"linux"})) + self.assertFalse(UnsupportedBuildEval("linux && (vulkan && rt_feature)", {"linux"})) + # runtime feature is present in build-only + with self.assertRaises(ValueError): + RequiresBuildEval("rt_feature", {"rt_feature"}) + with self.assertRaises(ValueError): + UnsupportedBuildEval("rt_feature", {"rt_feature"}) if __name__ == "__main__": From ee5e8ffaf5293715d71f8afc80ed896beecf3209 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 08:07:45 -0800 Subject: [PATCH 14/20] Use helper functions when calling getMatchedFromList --- sycl/test-e2e/format.py | 62 ++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index 3e6df0cbf8ec5..2a87bc159ce27 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -76,43 +76,49 @@ def parseTestScript(self, test): return script - def getMissingRequiredFeaturesFromList( - self, features, requires, build_only_mode=False - ): - try: - return [ - item - for item in requires - if not E2EExpr.evaluate(item, features, build_only_mode) - ] - except ValueError as e: - raise ValueError("Error in REQUIRES list:\n%s" % str(e)) - def getMatchedFromList( - self, features, alist, build_only_mode=False, final_unknown_value=False + self, features, expression_list, build_only_mode, is_requires_directive ): try: return [ item - for item in alist + for item in expression_list if E2EExpr.evaluate( - item, features, build_only_mode, final_unknown_value - ) + item, features, build_only_mode, is_requires_directive + ) != is_requires_directive ] except ValueError as e: - raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e)) + raise ValueError("Error in expression:\n%s" % str(e)) + + BuildOnly = True + BuildAndRun = False + RequiresDirective = True + UnsupportedDirective = False + def getMissingRequires(self, features, expression_list): + return self.getMatchedFromList( + features, expression_list, self.BuildAndRun, self.RequiresDirective + ) + def getMissingRequiresBuildOnly(self, features, expression_list): + return self.getMatchedFromList( + features, expression_list, self.BuildOnly, self.RequiresDirective + ) + def getMatchedUnsupported(self, features, expression_list): + return self.getMatchedFromList( + features, expression_list, self.BuildAndRun, self.UnsupportedDirective + ) + def getMatchedUnsupportedBuildOnly(self, features, expression_list): + return self.getMatchedFromList( + features, expression_list, self.BuildOnly, self.UnsupportedDirective + ) + getMatchedXFail = getMatchedUnsupported def select_build_targets_for_test(self, test): supported_targets = set() for t in test.config.sycl_build_targets: features = test.config.available_features.union({t}) - if self.getMissingRequiredFeaturesFromList( - features, test.requires, build_only_mode=True - ): + if self.getMissingRequiresBuildOnly(features, test.requires): continue - if self.getMatchedFromList( - features, test.unsupported, build_only_mode=True - ): + if self.getMatchedUnsupportedBuildOnly(features, test.unsupported): continue supported_targets.add(t) @@ -128,7 +134,7 @@ def select_build_targets_for_test(self, test): triples_without_xfail = [ t for t in supported_targets - if not self.getMatchedFromList( + if not self.getMatchedXFail( test.config.available_features.union({t}), test.xfails ) ] @@ -139,10 +145,10 @@ def select_devices_for_test(self, test): devices = [] for d in test.config.sycl_devices: features = test.config.sycl_dev_features[d] - if self.getMissingRequiredFeaturesFromList(features, test.requires): + if self.getMissingRequires(features, test.requires): continue - if self.getMatchedFromList(features, test.unsupported): + if self.getMatchedUnsupported(features, test.unsupported): continue driver_ok = True @@ -174,7 +180,7 @@ def select_devices_for_test(self, test): devices_without_xfail = [ d for d in devices - if not self.getMatchedFromList( + if not self.getMatchedXFail( test.config.sycl_dev_features[d], test.xfails ) ] @@ -370,7 +376,7 @@ def get_extra_env(sycl_devices): # Single triple/device - might be an XFAIL. def map_result(features, code): - if "*" in test.xfails or self.getMatchedFromList(features, test.xfails): + if "*" in test.xfails or self.getMatchedXFail(features, test.xfails): if code is lit.Test.PASS: code = lit.Test.XPASS elif code is lit.Test.FAIL: From 64bccab8103c943874886591e88f2a451be8db84 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 08:49:49 -0800 Subject: [PATCH 15/20] Add more build-mode features --- sycl/test-e2e/E2EExpr.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 2a27c912de11f..762d49e4d6873 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -13,7 +13,14 @@ class E2EExpr(BooleanExpression): "windows", "system-windows", "enable-perf-tests", + "preview-breaking-changes-supported", + "has_ndebug", + "ocloc", + "opencl-aot", "opencl_icd", + "cm-compiler", + "xptifw" + "level_zero_dev_kit", "cuda_dev_kit", "zstd", "vulkan", From 91599579d45e2fd6bf5327653b17396230448d99 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 09:26:42 -0800 Subject: [PATCH 16/20] Add `any-target-is-` features --- sycl/test-e2e/E2EExpr.py | 4 ++++ sycl/test-e2e/Regression/multiple-targets.cpp | 10 +++++----- sycl/test-e2e/format.py | 3 --- sycl/test-e2e/lit.cfg.py | 10 +++++++++- sycl/test-e2e/lit.site.cfg.py.in | 2 +- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 762d49e4d6873..2d516b26a7e39 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -8,6 +8,10 @@ class E2EExpr(BooleanExpression): "target-nvidia", "target-amd", "target-native_cpu", + "any-target-is-spir", + "any-target-is-nvidia", + "any-target-is-amd", + "any-target-is-native_cpu", "linux", "system-linux", "windows", diff --git a/sycl/test-e2e/Regression/multiple-targets.cpp b/sycl/test-e2e/Regression/multiple-targets.cpp index 888863b84faf1..9e1680453ccdb 100644 --- a/sycl/test-e2e/Regression/multiple-targets.cpp +++ b/sycl/test-e2e/Regression/multiple-targets.cpp @@ -2,17 +2,17 @@ // It tests if the target triples can be specified with any order. // The test is repeated for per_kernel device code splitting. // -// REQUIRES: target-nvidia || target-amd || target-native_cpu -// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-device-is-hip %{ %{hip_arch_opts} %} -o %t1.out %s +// REQUIRES: (target-nvidia || target-amd || target-native_cpu) && any-target-is-spir +// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-target-is-amd %{ %{hip_arch_opts} %} -o %t1.out %s // RUN: %{run} %t1.out // -// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-device-is-hip %{ %{hip_arch_opts} %} -o %t2.out %s +// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-target-is-amd %{ %{hip_arch_opts} %} -o %t2.out %s // RUN: %{run} %t2.out // -// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-device-is-hip %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t3.out %s +// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-target-is-amd %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t3.out %s // RUN: %{run} %t3.out // -// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-device-is-hip %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t4.out %s +// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-target-is-amd %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t4.out %s // RUN: %{run} %t4.out #include diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index 2a87bc159ce27..7ef07720992f7 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -288,9 +288,6 @@ def get_extra_env(sycl_devices): substitutions.append(("%{run-unfiltered-devices}", run_unfiltered_substitution)) - for target in build_targets: - test.config.available_features.add(target) - new_script = [] for directive in script: if not isinstance(directive, lit.TestRunner.CommandDirective): diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index 7cf481d692c71..670562ea8035c 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -69,7 +69,6 @@ elif config.test_mode == "build-only": lit_config.note("build-only test mode enabled, only compiling tests") config.sycl_devices = [] - config.sycl_build_targets = set("target-" + t for t in config.sycl_build_targets) if not config.amd_arch: config.amd_arch = "gfx1031" else: @@ -697,12 +696,21 @@ def open_check_file(file_name): "Couldn't find pre-installed AOT device compiler " + aot_tool ) +# Clear build targets when not in build-only, to populate according to devices +if config.test_mode != "build-only": + config.sycl_build_targets = set() + for sycl_device in config.sycl_devices: be, dev = sycl_device.split(":") config.available_features.add("any-device-is-" + dev) # Use short names for LIT rules. config.available_features.add("any-device-is-" + be) + target = config.backend_to_target[be] + config.sycl_build_targets.add(target) + +for target in config.sycl_build_targets: + config.available_features.add("any-target-is-" + target.replace("target-","")) # That has to be executed last so that all device-independent features have been # discovered already. config.sycl_dev_features = {} diff --git a/sycl/test-e2e/lit.site.cfg.py.in b/sycl/test-e2e/lit.site.cfg.py.in index 7baab807608f5..02f4125a4680f 100644 --- a/sycl/test-e2e/lit.site.cfg.py.in +++ b/sycl/test-e2e/lit.site.cfg.py.in @@ -31,7 +31,7 @@ config.igc_tag_file = os.path.join("/usr/local/lib/igc/", 'IGCTAG.txt') config.sycl_devices = lit_config.params.get("sycl_devices", "@SYCL_TEST_E2E_TARGETS@").split(';') # FIXME: current test markup only supports spir in build-only -config.sycl_build_targets = lit_config.params.get("sycl_build_targets", "spir").split(';') +config.sycl_build_targets = set("target-" + t for t in lit_config.params.get("sycl_build_targets", "spir").split(';')) config.amd_arch = lit_config.params.get("amd_arch", "@AMD_ARCH@") config.sycl_threads_lib = '@SYCL_THREADS_LIB@' From 8f8b648aa22027eecdabb7d8ce19bbe457f1deb2 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 10:10:50 -0800 Subject: [PATCH 17/20] Add missing comma to build-only features list --- sycl/test-e2e/E2EExpr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 2d516b26a7e39..9cd4e420ed551 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -23,7 +23,7 @@ class E2EExpr(BooleanExpression): "opencl-aot", "opencl_icd", "cm-compiler", - "xptifw" + "xptifw", "level_zero_dev_kit", "cuda_dev_kit", "zstd", From 71ebbe70a0f50c4ce9d122f610f6197a37ae8b01 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 11:58:50 -0800 Subject: [PATCH 18/20] Format --- sycl/test-e2e/E2EExpr.py | 32 ++++++++++++++++++++++++-------- sycl/test-e2e/format.py | 28 ++++++++++++++++------------ sycl/test-e2e/lit.cfg.py | 2 +- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index 9cd4e420ed551..08dc667661803 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -62,7 +62,9 @@ def parseMATCH(self): else: self.unknown = False if self.value and self.unknown: - raise ValueError("Runtime feature \"" + token +"\" evaluated to True in build-only") + raise ValueError( + 'Runtime feature "' + token + '" evaluated to True in build-only' + ) def parseAND(self): self.parseNOT() @@ -112,13 +114,21 @@ def test_basic(self): BuildAndRun = False RequiresDirective = True UnsupportedDirective = False - RegularEval= lambda expr, features: E2EExpr.evaluate(expr, features, BuildAndRun) - RequiresBuildEval = lambda expr, features: E2EExpr.evaluate(expr, features, BuildOnly, RequiresDirective) - UnsupportedBuildEval = lambda expr, features: E2EExpr.evaluate(expr, features, BuildOnly, UnsupportedDirective) + RegularEval = lambda expr, features: E2EExpr.evaluate( + expr, features, BuildAndRun + ) + RequiresBuildEval = lambda expr, features: E2EExpr.evaluate( + expr, features, BuildOnly, RequiresDirective + ) + UnsupportedBuildEval = lambda expr, features: E2EExpr.evaluate( + expr, features, BuildOnly, UnsupportedDirective + ) # Non build-only expressions should work the same self.assertTrue(RegularEval("linux", {"linux", "rt_feature"})) self.assertTrue(RegularEval("rt_feature", {"linux", "rt_feature"})) - self.assertFalse(RegularEval("rt_feature1 && rt_feature2", {"linux", "rt_feature1"})) + self.assertFalse( + RegularEval("rt_feature1 && rt_feature2", {"linux", "rt_feature1"}) + ) # build-only expressions with no unknowns should work the same self.assertTrue(UnsupportedBuildEval("linux", {"linux"})) self.assertFalse(RequiresBuildEval("linux && windows", {"linux"})) @@ -132,14 +142,20 @@ def test_basic(self): self.assertTrue(RequiresBuildEval("linux && rt_feature", {"linux"})) self.assertFalse(UnsupportedBuildEval("linux && rt_feature", {"linux"})) self.assertTrue(RequiresBuildEval("linux && !(zstd || rt_feature)", {"linux"})) - self.assertFalse(UnsupportedBuildEval("linux && !(zstd || rt_feature)", {"linux"})) + self.assertFalse( + UnsupportedBuildEval("linux && !(zstd || rt_feature)", {"linux"}) + ) # build-only expressions where unknown does not affect the resulting value self.assertTrue(RequiresBuildEval("linux || rt_feature", {"linux"})) self.assertTrue(UnsupportedBuildEval("linux || rt_feature", {"linux"})) self.assertFalse(RequiresBuildEval("windows && rt_feature", {"linux"})) self.assertFalse(UnsupportedBuildEval("windows && rt_feature", {"linux"})) - self.assertFalse(RequiresBuildEval("linux && (vulkan && rt_feature)", {"linux"})) - self.assertFalse(UnsupportedBuildEval("linux && (vulkan && rt_feature)", {"linux"})) + self.assertFalse( + RequiresBuildEval("linux && (vulkan && rt_feature)", {"linux"}) + ) + self.assertFalse( + UnsupportedBuildEval("linux && (vulkan && rt_feature)", {"linux"}) + ) # runtime feature is present in build-only with self.assertRaises(ValueError): RequiresBuildEval("rt_feature", {"rt_feature"}) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index 7ef07720992f7..a9e98a4ed8037 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -85,7 +85,8 @@ def getMatchedFromList( for item in expression_list if E2EExpr.evaluate( item, features, build_only_mode, is_requires_directive - ) != is_requires_directive + ) + != is_requires_directive ] except ValueError as e: raise ValueError("Error in expression:\n%s" % str(e)) @@ -94,22 +95,27 @@ def getMatchedFromList( BuildAndRun = False RequiresDirective = True UnsupportedDirective = False + def getMissingRequires(self, features, expression_list): return self.getMatchedFromList( - features, expression_list, self.BuildAndRun, self.RequiresDirective - ) + features, expression_list, self.BuildAndRun, self.RequiresDirective + ) + def getMissingRequiresBuildOnly(self, features, expression_list): return self.getMatchedFromList( - features, expression_list, self.BuildOnly, self.RequiresDirective - ) + features, expression_list, self.BuildOnly, self.RequiresDirective + ) + def getMatchedUnsupported(self, features, expression_list): return self.getMatchedFromList( - features, expression_list, self.BuildAndRun, self.UnsupportedDirective - ) + features, expression_list, self.BuildAndRun, self.UnsupportedDirective + ) + def getMatchedUnsupportedBuildOnly(self, features, expression_list): return self.getMatchedFromList( - features, expression_list, self.BuildOnly, self.UnsupportedDirective - ) + features, expression_list, self.BuildOnly, self.UnsupportedDirective + ) + getMatchedXFail = getMatchedUnsupported def select_build_targets_for_test(self, test): @@ -180,9 +186,7 @@ def select_devices_for_test(self, test): devices_without_xfail = [ d for d in devices - if not self.getMatchedXFail( - test.config.sycl_dev_features[d], test.xfails - ) + if not self.getMatchedXFail(test.config.sycl_dev_features[d], test.xfails) ] return devices_without_xfail diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index 670562ea8035c..c58f702e6f5d5 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -710,7 +710,7 @@ def open_check_file(file_name): config.sycl_build_targets.add(target) for target in config.sycl_build_targets: - config.available_features.add("any-target-is-" + target.replace("target-","")) + config.available_features.add("any-target-is-" + target.replace("target-", "")) # That has to be executed last so that all device-independent features have been # discovered already. config.sycl_dev_features = {} From 3e75a1e8a7729099cc7f8b2209282dba685e03e9 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 12:00:59 -0800 Subject: [PATCH 19/20] Revert changes in matrix, bindless_images and syclcompat tests --- sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp | 1 + sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp | 1 + sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp | 3 ++- sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp | 1 + sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp | 3 ++- .../bindless_images/dx12_interop/read_write_unsampled.cpp | 1 + .../bindless_images/examples/example_5_sample_cubemap.cpp | 3 ++- sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp | 1 + .../test-e2e/bindless_images/vulkan_interop/sampled_images.cpp | 1 + .../bindless_images/vulkan_interop/sampled_images_USM.cpp | 1 + .../vulkan_interop/sampled_images_semaphore.cpp | 1 + .../bindless_images/vulkan_interop/unsampled_images.cpp | 1 + .../vulkan_interop/unsampled_images_semaphore.cpp | 1 + sycl/test-e2e/syclcompat/kernel/kernel_win.cpp | 1 + .../test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp | 3 ++- 15 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp b/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp index c126a96bcb2ab..fbcf2c70558f4 100644 --- a/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp +++ b/sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp @@ -10,6 +10,7 @@ // RUN: %{run} %t.out // REQUIRES: arch-amd_gpu_gfx90a +// REQUIRES: build-and-run-mode #include "joint_matrix_hip_apply.hpp" #include "joint_matrix_hip_copy.hpp" diff --git a/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp b/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp index c39832cd64357..7c8d576ba39d0 100644 --- a/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp +++ b/sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp @@ -11,6 +11,7 @@ // REQUIRES: arch-amd_gpu_gfx90a // REQUIRES: aspect-fp16 +// REQUIRES: build-and-run-mode #include "joint_matrix_hip_apply.hpp" #include "joint_matrix_hip_copy.hpp" diff --git a/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp b/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp index bfa1156bc0e6b..dc084b7c23c0e 100644 --- a/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp +++ b/sycl/test-e2e/Matrix/joint_matrix_tensorcores_sm70.cpp @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: target-nvidia +// REQUIRES: cuda +// REQUIRES: build-and-run-mode // RUN: %{build} -Xsycl-target-backend --cuda-gpu-arch=sm_70 -o %t.out // RUN: %{run} %t.out // diff --git a/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp b/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp index ec9ecadf1ae16..a7bdd0c056db1 100644 --- a/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp +++ b/sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: arch-amd_gpu_gfx90a +// REQUIRES: build-and-run-mode // RUN: %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx90a %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp b/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp index 323ff9ba1fb20..d228b308ab72e 100644 --- a/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp +++ b/sycl/test-e2e/bindless_images/cubemap/cubemap_sampled.cpp @@ -1,5 +1,6 @@ -// REQUIRES: target-nvidia,aspect-ext_oneapi_cubemap +// REQUIRES: cuda,aspect-ext_oneapi_cubemap // REQUIRES: aspect-ext_oneapi_cubemap_seamless_filtering +// REQUIRES: build-and-run-mode // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp b/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp index 1aeb63636cc71..1d5a59a40b5ab 100644 --- a/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp +++ b/sycl/test-e2e/bindless_images/dx12_interop/read_write_unsampled.cpp @@ -1,5 +1,6 @@ // REQUIRES: aspect-ext_oneapi_bindless_images // REQUIRES: windows +// REQUIRES: build-and-run-mode // DEFINE: %{link-flags}=%if cl_options %{ /clang:-ld3d12 /clang:-ldxgi /clang:-ldxguid %} %else %{ -ld3d12 -ldxgi -ldxguid %} // RUN: %{build} %{link-flags} -o %t.out %if any-device-is-level_zero %{ -DDISABLE_UNORM_TESTS %} diff --git a/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp b/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp index ebac7e6dc9b19..c6ba9b48fad52 100644 --- a/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp +++ b/sycl/test-e2e/bindless_images/examples/example_5_sample_cubemap.cpp @@ -1,4 +1,5 @@ -// REQUIRES: target-nvidia +// REQUIRES: cuda +// REQUIRES: build-and-run-mode // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp index 1e826270f827c..57623c1b2da03 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp @@ -1,5 +1,6 @@ // REQUIRES: cuda // REQUIRES: vulkan +// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp index fc768b9246d14..12e5cfe5cad87 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images.cpp @@ -1,5 +1,6 @@ // REQUIRES: cuda || (windows && level_zero && aspect-ext_oneapi_bindless_images) // REQUIRES: vulkan +// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out %if any-device-is-level_zero %{ -Wno-ignored-attributes -DENABLE_LINEAR_TILING -DTEST_L0_SUPPORTED_VK_FORMAT %} // RUN: %{run} env NEOReadDebugKeys=1 UseBindlessMode=1 UseExternalAllocatorForSshAndDsh=1 %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp index d480d4fed3db8..159b1c9ec1b44 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_USM.cpp @@ -1,5 +1,6 @@ // REQUIRES: cuda // REQUIRES: vulkan +// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp index 46c56f9c9db38..497ade9d8af78 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/sampled_images_semaphore.cpp @@ -1,5 +1,6 @@ // REQUIRES: cuda || (windows && level_zero && aspect-ext_oneapi_bindless_images) // REQUIRES: vulkan +// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp index ddc9c5e0c9fc8..b6d046904eea9 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images.cpp @@ -1,5 +1,6 @@ // REQUIRES: cuda || (windows && level_zero && aspect-ext_oneapi_bindless_images) // REQUIRES: vulkan +// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out %if any-device-is-level_zero %{ -Wno-ignored-attributes -DTEST_L0_SUPPORTED_VK_FORMAT %} // RUN: %{run} env NEOReadDebugKeys=1 UseBindlessMode=1 UseExternalAllocatorForSshAndDsh=1 %t.out diff --git a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp index 54fc2d7bfb984..af9163311727c 100644 --- a/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp +++ b/sycl/test-e2e/bindless_images/vulkan_interop/unsampled_images_semaphore.cpp @@ -1,5 +1,6 @@ // REQUIRES: cuda // REQUIRES: vulkan +// REQUIRES: build-and-run-mode // RUN: %{build} %link-vulkan -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp b/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp index 53ce174a8b7c0..85ecf5687ca63 100644 --- a/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp +++ b/sycl/test-e2e/syclcompat/kernel/kernel_win.cpp @@ -1,4 +1,5 @@ // REQUIRES: windows +// REQUIRES: build-and-run-mode // DEFINE: %{sharedflag} = %if cl_options %{/clang:-shared%} %else %{-shared%} diff --git a/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp b/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp index 9d22804309a2c..edd9e63a3752a 100644 --- a/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp +++ b/sycl/test-e2e/syclcompat/memory/local_memory_ptr_to_integer.cpp @@ -1,4 +1,5 @@ -// REQUIRES: target-nvidia +// REQUIRES: cuda +// REQUIRES: build-and-run-mode // RUN: %{build} -Xsycl-target-backend --cuda-gpu-arch=sm_75 -o %t.out // RUN: %{run} %t.out #include From 737ab86867b5d032880768417e1db17f1670d52d Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Fri, 24 Jan 2025 12:03:24 -0800 Subject: [PATCH 20/20] Revert changes to adapters tests --- sycl/test-e2e/Adapters/cuda_queue_priority.cpp | 1 + sycl/test-e2e/Adapters/dll-detach-order.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/sycl/test-e2e/Adapters/cuda_queue_priority.cpp b/sycl/test-e2e/Adapters/cuda_queue_priority.cpp index 031dc252c578f..008637b91f3e2 100644 --- a/sycl/test-e2e/Adapters/cuda_queue_priority.cpp +++ b/sycl/test-e2e/Adapters/cuda_queue_priority.cpp @@ -1,4 +1,5 @@ // REQUIRES: gpu, cuda, cuda_dev_kit +// REQUIRES: build-and-run-mode // RUN: %{build} %cuda_options -o %t.out // RUN: %{run} %t.out // diff --git a/sycl/test-e2e/Adapters/dll-detach-order.cpp b/sycl/test-e2e/Adapters/dll-detach-order.cpp index c1cf32816a240..72d014eb066bb 100644 --- a/sycl/test-e2e/Adapters/dll-detach-order.cpp +++ b/sycl/test-e2e/Adapters/dll-detach-order.cpp @@ -1,4 +1,5 @@ // REQUIRES: windows +// REQUIRES: build-and-run-mode // RUN: env SYCL_UR_TRACE=-1 sycl-ls | FileCheck %s // ensure that the adapters are detached AFTER urLoaderTearDown is done