Skip to content

Commit

Permalink
build: add flag to control breeze test fixture generation
Browse files Browse the repository at this point in the history
This adds a flag to control whether breeze test fixtures should
be generated at build time or not.
  • Loading branch information
David Reveman committed Nov 24, 2024
1 parent 5b3f140 commit f469ed0
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 95 deletions.
1 change: 1 addition & 0 deletions velox/experimental/breeze/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
192 changes: 97 additions & 95 deletions velox/experimental/breeze/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit f469ed0

Please sign in to comment.