From f469ed03ad7af09da0d09e2fee6c390f030208ee Mon Sep 17 00:00:00 2001 From: David Reveman Date: Sun, 24 Nov 2024 09:45:45 -0500 Subject: [PATCH] build: add flag to control breeze test fixture generation This adds a flag to control whether breeze test fixtures should be generated at build time or not. --- velox/experimental/breeze/CMakeLists.txt | 1 + velox/experimental/breeze/test/CMakeLists.txt | 192 +++++++++--------- 2 files changed, 98 insertions(+), 95 deletions(-) diff --git a/velox/experimental/breeze/CMakeLists.txt b/velox/experimental/breeze/CMakeLists.txt index b3beedf31a649..122f0c995b049 100644 --- a/velox/experimental/breeze/CMakeLists.txt +++ b/velox/experimental/breeze/CMakeLists.txt @@ -39,6 +39,7 @@ option(BUILD_OPENCL "Build OpenCL tests." OFF) option(BUILD_OPENMP "Build OpenMP tests." OFF) option(BUILD_METAL "Build Metal tests." OFF) option(BUILD_TRACING "Build tracing." ON) +option(BUILD_GENERATE_TEST_FIXTURES "Generate test fixtures at build time." ON) if(NOT DEFINED PERFTEST_EXT_TYPES) set(PERFTEST_EXT_TYPES diff --git a/velox/experimental/breeze/test/CMakeLists.txt b/velox/experimental/breeze/test/CMakeLists.txt index 76299eddf6dc6..0ee8c663ca080 100644 --- a/velox/experimental/breeze/test/CMakeLists.txt +++ b/velox/experimental/breeze/test/CMakeLists.txt @@ -160,101 +160,103 @@ function( endfunction() function(breeze_add_unittests dir type) - if(BUILD_OPENCL) - generate_kernel( - ${type}_opencl_kernels_src - ${dir} - ${type} - "opencl" - "generated/${dir}/kernels-opencl.h") - generate_test_fixture( - ${type}_opencl_test_fixture_src - ${dir} - ${type} - "opencl" - "generated/${dir}/${type}_test-opencl.h") - set(_opencl_kernels_src ${type}_opencl_kernels_src) - set(_opencl_test_fixture_src ${type}_opencl_test_fixture_src) - endif() - if(BUILD_METAL) - generate_kernel( - ${type}_metal_kernels_src - ${dir} - ${type} - "metal" - "generated/${dir}/kernels-metal.h") - generate_test_fixture( - ${type}_metal_test_fixture_src - ${dir} - ${type} - "metal" - "generated/${dir}/${type}_test-metal.h") - set(_metal_kernels_src ${type}_metal_kernels_src) - set(_metal_test_fixture_src ${type}_metal_test_fixture_src) - endif() - if(BUILD_CUDA) - generate_kernel( - ${type}_cuda_kernels_src - ${dir} - ${type} - "cuda" - "generated/${dir}/kernels.cuh") - generate_test_fixture( - ${type}_cuda_test_fixture_src - ${dir} - ${type} - "cuda" - "generated/${dir}/${type}_test-cuda.cuh") - set(_cuda_kernels_src ${type}_cuda_kernels_src) - set(_cuda_test_fixture_src ${type}_cuda_test_fixture_src) - endif() - if(BUILD_HIP) - generate_kernel( - ${type}_hip_kernels_src - ${dir} - ${type} - "hip" - "generated/${dir}/kernels-hip.hpp") - generate_test_fixture( - ${type}_hip_test_fixture_src - ${dir} - ${type} - "hip" - "generated/${dir}/${type}_test-hip.hpp") - set(_hip_kernels_src ${type}_hip_kernels_src) - set(_hip_test_fixture_src ${type}_hip_test_fixture_src) - endif() - if(BUILD_SYCL) - generate_kernel( - ${type}_sycl_kernels_src - ${dir} - ${type} - "sycl" - "generated/${dir}/kernels-sycl.hpp") - generate_test_fixture( - ${type}_sycl_test_fixture_src - ${dir} - ${type} - "sycl" - "generated/${dir}/${type}_test-sycl.hpp") - set(_sycl_kernels_src ${type}_sycl_kernels_src) - set(_sycl_test_fixture_src ${type}_sycl_test_fixture_src) - endif() - if(BUILD_OPENMP) - generate_kernel( - ${type}_openmp_kernels_src - ${dir} - ${type} - "openmp" - "generated/${dir}/kernels-openmp.h") - generate_test_fixture( - ${type}_openmp_test_fixture_src - ${dir} - ${type} - "openmp" - "generated/${dir}/${type}_test-openmp.h") - set(_openmp_kernels_src ${type}_openmp_kernels_src) - set(_openmp_test_fixture_src ${type}_openmp_test_fixture_src) + if(BUILD_GENERATE_TEST_FIXTURES) + if(BUILD_OPENCL) + generate_kernel( + ${type}_opencl_kernels_src + ${dir} + ${type} + "opencl" + "generated/${dir}/kernels-opencl.h") + generate_test_fixture( + ${type}_opencl_test_fixture_src + ${dir} + ${type} + "opencl" + "generated/${dir}/${type}_test-opencl.h") + set(_opencl_kernels_src ${type}_opencl_kernels_src) + set(_opencl_test_fixture_src ${type}_opencl_test_fixture_src) + endif() + if(BUILD_METAL) + generate_kernel( + ${type}_metal_kernels_src + ${dir} + ${type} + "metal" + "generated/${dir}/kernels-metal.h") + generate_test_fixture( + ${type}_metal_test_fixture_src + ${dir} + ${type} + "metal" + "generated/${dir}/${type}_test-metal.h") + set(_metal_kernels_src ${type}_metal_kernels_src) + set(_metal_test_fixture_src ${type}_metal_test_fixture_src) + endif() + if(BUILD_CUDA) + generate_kernel( + ${type}_cuda_kernels_src + ${dir} + ${type} + "cuda" + "generated/${dir}/kernels.cuh") + generate_test_fixture( + ${type}_cuda_test_fixture_src + ${dir} + ${type} + "cuda" + "generated/${dir}/${type}_test-cuda.cuh") + set(_cuda_kernels_src ${type}_cuda_kernels_src) + set(_cuda_test_fixture_src ${type}_cuda_test_fixture_src) + endif() + if(BUILD_HIP) + generate_kernel( + ${type}_hip_kernels_src + ${dir} + ${type} + "hip" + "generated/${dir}/kernels-hip.hpp") + generate_test_fixture( + ${type}_hip_test_fixture_src + ${dir} + ${type} + "hip" + "generated/${dir}/${type}_test-hip.hpp") + set(_hip_kernels_src ${type}_hip_kernels_src) + set(_hip_test_fixture_src ${type}_hip_test_fixture_src) + endif() + if(BUILD_SYCL) + generate_kernel( + ${type}_sycl_kernels_src + ${dir} + ${type} + "sycl" + "generated/${dir}/kernels-sycl.hpp") + generate_test_fixture( + ${type}_sycl_test_fixture_src + ${dir} + ${type} + "sycl" + "generated/${dir}/${type}_test-sycl.hpp") + set(_sycl_kernels_src ${type}_sycl_kernels_src) + set(_sycl_test_fixture_src ${type}_sycl_test_fixture_src) + endif() + if(BUILD_OPENMP) + generate_kernel( + ${type}_openmp_kernels_src + ${dir} + ${type} + "openmp" + "generated/${dir}/kernels-openmp.h") + generate_test_fixture( + ${type}_openmp_test_fixture_src + ${dir} + ${type} + "openmp" + "generated/${dir}/${type}_test-openmp.h") + set(_openmp_kernels_src ${type}_openmp_kernels_src) + set(_openmp_test_fixture_src ${type}_openmp_test_fixture_src) + endif() endif() breeze_add_tests( ${dir}