From 31ae379d42f20b8fe39cc0ae9d873ce89bc6d593 Mon Sep 17 00:00:00 2001 From: David Reveman Date: Fri, 15 Nov 2024 13:54:20 -0800 Subject: [PATCH] Breeze fixes (#11537) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/11537 Reviewed By: xiaoxmeng Differential Revision: D66022781 Pulled By: Yuhta fbshipit-source-id: 2ac480e11fd1e75374f0252e0f3d1fe6acfaa296 --- velox/experimental/breeze/CMakeLists.txt | 2 +- .../breeze/breeze/platforms/openmp.h | 18 +++++++++++++----- velox/experimental/breeze/breeze/utils/trace.h | 6 ++++++ velox/experimental/breeze/cmake/cuda.cmake | 10 +++------- velox/experimental/breeze/cmake/hip.cmake | 7 +++---- velox/experimental/breeze/cmake/metal.cmake | 7 +++---- velox/experimental/breeze/cmake/opencl.cmake | 4 ++-- velox/experimental/breeze/cmake/sycl.cmake | 8 ++++---- .../perftest/algorithms/reduce_perftest.cu | 6 +++--- .../perftest/algorithms/scan_perftest.cu | 14 +++++++------- .../perftest/algorithms/sort_perftest.cu | 8 ++++---- .../perftest/functions/reduce_perftest.cu | 6 +++--- .../breeze/perftest/functions/scan_perftest.cu | 6 +++--- .../breeze/perftest/functions/sort_perftest.cu | 8 ++++---- .../breeze/perftest/perftest-cuda.cuh | 4 ++-- .../queries/caching_device_allocator.cuh | 4 ++-- .../breeze/perftest/queries/device_column.h | 4 ++-- .../perftest/queries/order_by_perftest.cu | 16 ++++++++-------- velox/experimental/breeze/test/CMakeLists.txt | 2 ++ .../breeze/test/algorithms/kernels.clcpp | 2 +- .../breeze/test/algorithms/kernels.metal | 2 +- .../breeze/test/functions/kernels.clcpp | 2 +- .../breeze/test/functions/kernels.metal | 2 +- .../breeze/test/functions/reduce_unittest.cpp | 1 + .../algorithms/algorithm_test-openmp.h | 13 ++++++++++--- .../test/generated/algorithms/kernels-openmp.h | 13 ++++++++++--- .../generated/functions/function_test-openmp.h | 13 ++++++++++--- .../test/generated/functions/kernels-openmp.h | 13 ++++++++++--- .../breeze/test/generator_common.py | 8 +++++--- .../breeze/test/kernel_generator.py | 11 +++++++++-- .../breeze/test/test_fixture_generator.py | 9 +++++++++ 31 files changed, 143 insertions(+), 86 deletions(-) diff --git a/velox/experimental/breeze/CMakeLists.txt b/velox/experimental/breeze/CMakeLists.txt index da4af3f7197b..a910ce121b21 100644 --- a/velox/experimental/breeze/CMakeLists.txt +++ b/velox/experimental/breeze/CMakeLists.txt @@ -120,7 +120,7 @@ endif() if(NOT DISABLE_GOOGLETEST) set(GTest_SOURCE AUTO) - resolve_dependency(GTest) + velox_resolve_dependency(GTest) endif() if(BUILD_TESTING) diff --git a/velox/experimental/breeze/breeze/platforms/openmp.h b/velox/experimental/breeze/breeze/platforms/openmp.h index 8e319bcd188a..df44f2438f20 100644 --- a/velox/experimental/breeze/breeze/platforms/openmp.h +++ b/velox/experimental/breeze/breeze/platforms/openmp.h @@ -140,9 +140,13 @@ struct supported_type { static float min() { return __FLT_MIN__; } static float max() { return __FLT_MAX__; } static float atomic_load(float *address) { - unsigned value = __atomic_load_n(reinterpret_cast(address), - __ATOMIC_RELAXED); - return *reinterpret_cast(&value); + union { + float value; + unsigned raw; + } content; + content.raw = __atomic_load_n(reinterpret_cast(address), + __ATOMIC_RELAXED); + return content.value; } static void atomic_store(float *address, float value) { __atomic_store_n(reinterpret_cast(address), @@ -166,9 +170,13 @@ struct supported_type { static double min() { return __DBL_MIN__; } static double max() { return __DBL_MAX__; } static double atomic_load(double *address) { - unsigned long long value = __atomic_load_n( + union { + double value; + unsigned long long raw; + } content; + content.raw = __atomic_load_n( reinterpret_cast(address), __ATOMIC_RELAXED); - return *reinterpret_cast(&value); + return content.value; } static void atomic_store(double *address, double value) { __atomic_store_n(reinterpret_cast(address), diff --git a/velox/experimental/breeze/breeze/utils/trace.h b/velox/experimental/breeze/breeze/utils/trace.h index bd879011f307..0877957bda64 100644 --- a/velox/experimental/breeze/breeze/utils/trace.h +++ b/velox/experimental/breeze/breeze/utils/trace.h @@ -29,6 +29,12 @@ #if TRACING +// Workaround for CUDA/HIP PERFETTO_NO_INLINE conflict +#ifdef __noinline__ +#undef __noinline__ +#define __noinline__ noinline +#endif + #include #include diff --git a/velox/experimental/breeze/cmake/cuda.cmake b/velox/experimental/breeze/cmake/cuda.cmake index f34b969e8af6..31d59c66f5f6 100644 --- a/velox/experimental/breeze/cmake/cuda.cmake +++ b/velox/experimental/breeze/cmake/cuda.cmake @@ -21,10 +21,6 @@ if(NOT DEFINED CMAKE_NVCC_FLAGS) set(CMAKE_NVCC_FLAGS "$ENV{NVCCFLAGS}" CACHE STRING "NVCC flags") - else() - set(CMAKE_NVCC_FLAGS - "-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_90,code=sm_90" - CACHE STRING "NVCC flags") endif() endif() if(BREEZE_BUILD_TYPE MATCHES Debug) @@ -54,7 +50,7 @@ endif() # use PTX specialization by default for CUDA if(NOT DEFINED CUDA_PLATFORM_SPECIALIZATION_HEADER) set(CUDA_PLATFORM_SPECIALIZATION_HEADER - platforms/specialization/cuda-ptx.cuh + breeze/platforms/specialization/cuda-ptx.cuh CACHE STRING "CUDA platform specialization header") endif() @@ -87,8 +83,8 @@ function(breeze_add_cuda_test target source) "FLAGS;LIBS;DEPENDS" ${ARGN}) list(APPEND arg_FLAGS -I${gtest_SOURCE_DIR}/googletest/include) - list(APPEND arg_FLAGS -I${CMAKE_SOURCE_DIR}/test) - list(APPEND arg_FLAGS -I${CMAKE_CURRENT_BINARY_DIR}) + list(APPEND arg_FLAGS -I${CMAKE_SOURCE_DIR}) + list(APPEND arg_FLAGS -I${CMAKE_BINARY_DIR}) breeze_add_cuda_object( ${target} ${source} diff --git a/velox/experimental/breeze/cmake/hip.cmake b/velox/experimental/breeze/cmake/hip.cmake index 67b6698bb8a2..4e7d2c32c02b 100644 --- a/velox/experimental/breeze/cmake/hip.cmake +++ b/velox/experimental/breeze/cmake/hip.cmake @@ -29,10 +29,9 @@ function(breeze_add_hip_test target source) OUTPUT ${target}.o COMMAND ${HIPCC_EXECUTABLE} ${HIP_HIPCC_FLAGS} ${NDEBUG_DEFINE} -DPLATFORM_HIP - -I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/test - -I${gtest_SOURCE_DIR}/googletest/include -I${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CXX_FLAGS} ${COMPILER_WARN_FLAGS} ${OPT_FLAGS} -std=c++17 -c - ${source} -MD -MF ${target}.o.d -o ${target}.o + -I${CMAKE_SOURCE_DIR} -I${gtest_SOURCE_DIR}/googletest/include + -I${CMAKE_BINARY_DIR} ${CMAKE_CXX_FLAGS} ${COMPILER_WARN_FLAGS} + ${OPT_FLAGS} -std=c++17 -c ${source} -MD -MF ${target}.o.d -o ${target}.o DEPFILE ${target}.o.d DEPENDS ${arg_DEPENDS} COMMENT "Building HIP object ${target}.o") diff --git a/velox/experimental/breeze/cmake/metal.cmake b/velox/experimental/breeze/cmake/metal.cmake index 67d0d123020a..a4813e766f04 100644 --- a/velox/experimental/breeze/cmake/metal.cmake +++ b/velox/experimental/breeze/cmake/metal.cmake @@ -27,9 +27,8 @@ function(breeze_add_metal_test_kernels target source) OUTPUT ${target}.air COMMAND xcrun -sdk macosx metal -DPLATFORM_METAL -I${CMAKE_SOURCE_DIR} - -I${CMAKE_CURRENT_BINARY_DIR} ${WARN_FLAGS} ${OPT_FLAGS} - -Wno-c++17-extensions -std=metal3.0 -c ${source} -MD -MF ${target}.air.d - -o ${target}.air + -I${CMAKE_BINARY_DIR} ${WARN_FLAGS} ${OPT_FLAGS} -Wno-c++17-extensions + -std=metal3.0 -c ${source} -MD -MF ${target}.air.d -o ${target}.air COMMENT "Compile ${source} --> ${target}.air" DEPENDS ${arg_DEPENDS} DEPFILE ${target}.air.d) @@ -44,7 +43,7 @@ endfunction() function(breeze_add_metal_test target source shaderlib) add_executable(${target} ${source} platforms/metal_test.mm) target_compile_features(${target} PRIVATE cxx_std_17) - target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(${target} PRIVATE ${CMAKE_BINARY_DIR}) target_compile_definitions(${target} PUBLIC PLATFORM_METAL=1 SHADER_LIB=\"${shaderlib}\") target_compile_options( diff --git a/velox/experimental/breeze/cmake/opencl.cmake b/velox/experimental/breeze/cmake/opencl.cmake index c3a23db1f50d..c9dbba520044 100644 --- a/velox/experimental/breeze/cmake/opencl.cmake +++ b/velox/experimental/breeze/cmake/opencl.cmake @@ -29,7 +29,7 @@ function(breeze_add_opencl_test_kernels target source) OUTPUT ${target}.so COMMAND ${CLCC_EXECUTABLE} -o ${target}.so ${source} -MD -MF ${target}.clcpp.d - -DPLATFORM_OPENCL -I${CMAKE_SOURCE_DIR} -I${CMAKE_CURRENT_BINARY_DIR} + -DPLATFORM_OPENCL -I${CMAKE_SOURCE_DIR} -I${CMAKE_BINARY_DIR} ${COMPILER_WARN_FLAGS} ${OPT_FLAGS} COMMENT "Building OpenCL kernels ${source} --> ${target}.so" DEPENDS ${arg_DEPENDS} @@ -41,7 +41,7 @@ function(breeze_add_opencl_test target source shaderlib) add_executable(${target} ${source}) target_compile_features(${target} PRIVATE cxx_std_17) target_include_directories(${target} PRIVATE ${CMAKE_OPENCL_INCLUDE} - ${CMAKE_CURRENT_BINARY_DIR}) + ${CMAKE_BINARY_DIR}) target_compile_definitions(${target} PUBLIC PLATFORM_OPENCL=1 SHADER_LIB=\"${shaderlib}\") target_compile_options(${target} PRIVATE ${WARN_FLAGS} ${OPT_FLAGS} diff --git a/velox/experimental/breeze/cmake/sycl.cmake b/velox/experimental/breeze/cmake/sycl.cmake index b043d99200af..b00bebbaded0 100644 --- a/velox/experimental/breeze/cmake/sycl.cmake +++ b/velox/experimental/breeze/cmake/sycl.cmake @@ -29,10 +29,10 @@ function(breeze_add_sycl_test target source) OUTPUT ${target}.o COMMAND ${SYCLCC_EXECUTABLE} ${NDEBUG_DEFINE} -DPLATFORM_SYCL - -I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/test - -I${gtest_SOURCE_DIR}/googletest/include -I${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CXX_FLAGS} ${OPT_FLAGS} ${SANITIZE_COMPILE_FLAGS} -std=c++17 -c - ${source} -MD -MF ${target}.o.d -o ${target}.o + -I${CMAKE_SOURCE_DIR} -I${gtest_SOURCE_DIR}/googletest/include + -I${CMAKE_BINARY_DIR} ${CMAKE_CXX_FLAGS} ${OPT_FLAGS} + ${SANITIZE_COMPILE_FLAGS} -std=c++17 -c ${source} -MD -MF ${target}.o.d -o + ${target}.o DEPFILE ${target}.o.d DEPENDS ${arg_DEPENDS} COMMENT "Building SYCL object ${target}.o") diff --git a/velox/experimental/breeze/perftest/algorithms/reduce_perftest.cu b/velox/experimental/breeze/perftest/algorithms/reduce_perftest.cu index 705ba96f2977..95e56f8c75e4 100644 --- a/velox/experimental/breeze/perftest/algorithms/reduce_perftest.cu +++ b/velox/experimental/breeze/perftest/algorithms/reduce_perftest.cu @@ -25,10 +25,10 @@ #include #include -#include "algorithms/reduce.h" +#include "breeze/algorithms/reduce.h" +#include "breeze/platforms/platform.h" +#include "breeze/utils/device_vector.h" #include "perftest/perftest.h" -#include "platforms/platform.h" -#include "utils/device_vector.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/algorithms/scan_perftest.cu b/velox/experimental/breeze/perftest/algorithms/scan_perftest.cu index d70db0078f35..0546d14a3d02 100644 --- a/velox/experimental/breeze/perftest/algorithms/scan_perftest.cu +++ b/velox/experimental/breeze/perftest/algorithms/scan_perftest.cu @@ -24,14 +24,14 @@ #include -#include "algorithms/scan.h" -#include "functions/load.h" -#include "functions/scan.h" -#include "functions/store.h" +#include "breeze/algorithms/scan.h" +#include "breeze/functions/load.h" +#include "breeze/functions/scan.h" +#include "breeze/functions/store.h" +#include "breeze/platforms/platform.h" +#include "breeze/utils/block_details.h" +#include "breeze/utils/device_vector.h" #include "perftest/perftest.h" -#include "platforms/platform.h" -#include "utils/block_details.h" -#include "utils/device_vector.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/algorithms/sort_perftest.cu b/velox/experimental/breeze/perftest/algorithms/sort_perftest.cu index d4dcae49a76a..56513553181c 100644 --- a/velox/experimental/breeze/perftest/algorithms/sort_perftest.cu +++ b/velox/experimental/breeze/perftest/algorithms/sort_perftest.cu @@ -25,11 +25,11 @@ #include #include -#include "algorithms/sort.h" +#include "breeze/algorithms/sort.h" +#include "breeze/platforms/platform.h" +#include "breeze/utils/block_details.h" +#include "breeze/utils/device_vector.h" #include "perftest/perftest.h" -#include "platforms/platform.h" -#include "utils/block_details.h" -#include "utils/device_vector.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/functions/reduce_perftest.cu b/velox/experimental/breeze/perftest/functions/reduce_perftest.cu index 79c819aca3bc..aa60a6e23029 100644 --- a/velox/experimental/breeze/perftest/functions/reduce_perftest.cu +++ b/velox/experimental/breeze/perftest/functions/reduce_perftest.cu @@ -24,10 +24,10 @@ #include -#include "functions/reduce.h" +#include "breeze/functions/reduce.h" +#include "breeze/platforms/platform.h" +#include "breeze/utils/device_vector.h" #include "perftest/perftest.h" -#include "platforms/platform.h" -#include "utils/device_vector.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/functions/scan_perftest.cu b/velox/experimental/breeze/perftest/functions/scan_perftest.cu index eecdfdaa96e2..295d3d328f2e 100644 --- a/velox/experimental/breeze/perftest/functions/scan_perftest.cu +++ b/velox/experimental/breeze/perftest/functions/scan_perftest.cu @@ -24,10 +24,10 @@ #include -#include "functions/scan.h" +#include "breeze/functions/scan.h" +#include "breeze/platforms/platform.h" +#include "breeze/utils/device_vector.h" #include "perftest/perftest.h" -#include "platforms/platform.h" -#include "utils/device_vector.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/functions/sort_perftest.cu b/velox/experimental/breeze/perftest/functions/sort_perftest.cu index 03a22ebc8c7f..4c8a408f189d 100644 --- a/velox/experimental/breeze/perftest/functions/sort_perftest.cu +++ b/velox/experimental/breeze/perftest/functions/sort_perftest.cu @@ -25,11 +25,11 @@ #include #include -#include "functions/sort.h" +#include "breeze/functions/sort.h" +#include "breeze/platforms/platform.h" +#include "breeze/utils/device_vector.h" +#include "breeze/utils/types.h" #include "perftest/perftest.h" -#include "platforms/platform.h" -#include "utils/device_vector.h" -#include "utils/types.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/perftest-cuda.cuh b/velox/experimental/breeze/perftest/perftest-cuda.cuh index 1ca7c7b8bff6..20609d359208 100644 --- a/velox/experimental/breeze/perftest/perftest-cuda.cuh +++ b/velox/experimental/breeze/perftest/perftest-cuda.cuh @@ -30,8 +30,8 @@ #include #include -#include "platforms/cuda.cuh" -#include "utils/trace.h" +#include "breeze/platforms/cuda.cuh" +#include "breeze/utils/trace.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/queries/caching_device_allocator.cuh b/velox/experimental/breeze/perftest/queries/caching_device_allocator.cuh index 5a557678f8b0..b0d377a185d9 100644 --- a/velox/experimental/breeze/perftest/queries/caching_device_allocator.cuh +++ b/velox/experimental/breeze/perftest/queries/caching_device_allocator.cuh @@ -27,12 +27,12 @@ #include #ifdef __EXCEPTIONS -#include "utils/types.h" +#include "breeze/utils/types.h" #else #include #endif -#include "platforms/cuda.cuh" +#include "breeze/platforms/cuda.cuh" // caching device allocator that can be used to eliminate // allocation cost from benchmarks by handling all neccessary diff --git a/velox/experimental/breeze/perftest/queries/device_column.h b/velox/experimental/breeze/perftest/queries/device_column.h index 96272150f604..12cf2f893d72 100644 --- a/velox/experimental/breeze/perftest/queries/device_column.h +++ b/velox/experimental/breeze/perftest/queries/device_column.h @@ -22,8 +22,8 @@ #pragma once -#include "utils/device_allocator.h" -#include "utils/device_vector.h" +#include "breeze/utils/device_allocator.h" +#include "breeze/utils/device_vector.h" namespace breeze { diff --git a/velox/experimental/breeze/perftest/queries/order_by_perftest.cu b/velox/experimental/breeze/perftest/queries/order_by_perftest.cu index a255f3c6870f..c411401edafb 100644 --- a/velox/experimental/breeze/perftest/queries/order_by_perftest.cu +++ b/velox/experimental/breeze/perftest/queries/order_by_perftest.cu @@ -28,17 +28,17 @@ #include #include -#include "algorithms/sort.h" -#include "functions/load.h" -#include "functions/reduce.h" -#include "functions/scan.h" -#include "functions/store.h" +#include "breeze/algorithms/sort.h" +#include "breeze/functions/load.h" +#include "breeze/functions/reduce.h" +#include "breeze/functions/scan.h" +#include "breeze/functions/store.h" +#include "breeze/platforms/cuda.cuh" +#include "breeze/utils/device_vector.h" +#include "breeze/utils/types.h" #include "perftest/perftest.h" #include "perftest/queries/caching_device_allocator.cuh" #include "perftest/queries/device_column.h" -#include "platforms/cuda.cuh" -#include "utils/device_vector.h" -#include "utils/types.h" namespace breeze { namespace test { diff --git a/velox/experimental/breeze/test/CMakeLists.txt b/velox/experimental/breeze/test/CMakeLists.txt index 99c67a79585b..fb5805d6ed75 100644 --- a/velox/experimental/breeze/test/CMakeLists.txt +++ b/velox/experimental/breeze/test/CMakeLists.txt @@ -16,6 +16,8 @@ # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 +include_directories(${CMAKE_SOURCE_DIR}) + cxx_library(test_main "${cxx_strict}" test_main.cpp) target_link_libraries( test_main diff --git a/velox/experimental/breeze/test/algorithms/kernels.clcpp b/velox/experimental/breeze/test/algorithms/kernels.clcpp index 53696fcf20a2..30b2607f0e12 100644 --- a/velox/experimental/breeze/test/algorithms/kernels.clcpp +++ b/velox/experimental/breeze/test/algorithms/kernels.clcpp @@ -22,7 +22,7 @@ enum { OPENCL_WARP_THREADS = 32 }; -#include "generated/algorithms/kernels-opencl.h" +#include "test/generated/algorithms/kernels-opencl.h" // kernel specializations diff --git a/velox/experimental/breeze/test/algorithms/kernels.metal b/velox/experimental/breeze/test/algorithms/kernels.metal index f564ff6091ec..c6363c5e250f 100644 --- a/velox/experimental/breeze/test/algorithms/kernels.metal +++ b/velox/experimental/breeze/test/algorithms/kernels.metal @@ -20,7 +20,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "generated/algorithms/kernels-metal.h" +#include "test/generated/algorithms/kernels-metal.h" // kernel specializations diff --git a/velox/experimental/breeze/test/functions/kernels.clcpp b/velox/experimental/breeze/test/functions/kernels.clcpp index bdb6045199e3..2349fad0d83c 100644 --- a/velox/experimental/breeze/test/functions/kernels.clcpp +++ b/velox/experimental/breeze/test/functions/kernels.clcpp @@ -20,7 +20,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "generated/functions/kernels-opencl.h" +#include "test/generated/functions/kernels-opencl.h" // kernel specializations diff --git a/velox/experimental/breeze/test/functions/kernels.metal b/velox/experimental/breeze/test/functions/kernels.metal index 8c65d90b688e..4ce6e78ab2c6 100644 --- a/velox/experimental/breeze/test/functions/kernels.metal +++ b/velox/experimental/breeze/test/functions/kernels.metal @@ -20,7 +20,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "generated/functions/kernels-metal.h" +#include "test/generated/functions/kernels-metal.h" // kernel specializations diff --git a/velox/experimental/breeze/test/functions/reduce_unittest.cpp b/velox/experimental/breeze/test/functions/reduce_unittest.cpp index d53c01e36074..3456995eba8b 100644 --- a/velox/experimental/breeze/test/functions/reduce_unittest.cpp +++ b/velox/experimental/breeze/test/functions/reduce_unittest.cpp @@ -22,6 +22,7 @@ #include +#include #include #include "function_test.h" diff --git a/velox/experimental/breeze/test/generated/algorithms/algorithm_test-openmp.h b/velox/experimental/breeze/test/generated/algorithms/algorithm_test-openmp.h index cc49085ed80b..662442b84f08 100644 --- a/velox/experimental/breeze/test/generated/algorithms/algorithm_test-openmp.h +++ b/velox/experimental/breeze/test/generated/algorithms/algorithm_test-openmp.h @@ -14,9 +14,16 @@ * limitations under the License. */ -// Copyright (c) 2024 by Rivos Inc. -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (c) 2024 by Rivos Inc. + * Licensed under the Apache License, Version 2.0, see LICENSE for details. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This file is auto-generated from test_fixture_generator.py + * DO NOT EDIT! + */ #include #include diff --git a/velox/experimental/breeze/test/generated/algorithms/kernels-openmp.h b/velox/experimental/breeze/test/generated/algorithms/kernels-openmp.h index db8b0c0ccdeb..f44a6a497f00 100644 --- a/velox/experimental/breeze/test/generated/algorithms/kernels-openmp.h +++ b/velox/experimental/breeze/test/generated/algorithms/kernels-openmp.h @@ -14,9 +14,16 @@ * limitations under the License. */ -// Copyright (c) 2024 by Rivos Inc. -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (c) 2024 by Rivos Inc. + * Licensed under the Apache License, Version 2.0, see LICENSE for details. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This file is auto-generated from kernel_generator.py + * DO NOT EDIT! + */ #include "breeze/algorithms/reduce.h" #include "breeze/algorithms/scan.h" diff --git a/velox/experimental/breeze/test/generated/functions/function_test-openmp.h b/velox/experimental/breeze/test/generated/functions/function_test-openmp.h index 825616f41541..7afec1ad025f 100644 --- a/velox/experimental/breeze/test/generated/functions/function_test-openmp.h +++ b/velox/experimental/breeze/test/generated/functions/function_test-openmp.h @@ -14,9 +14,16 @@ * limitations under the License. */ -// Copyright (c) 2024 by Rivos Inc. -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (c) 2024 by Rivos Inc. + * Licensed under the Apache License, Version 2.0, see LICENSE for details. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This file is auto-generated from test_fixture_generator.py + * DO NOT EDIT! + */ #include #include diff --git a/velox/experimental/breeze/test/generated/functions/kernels-openmp.h b/velox/experimental/breeze/test/generated/functions/kernels-openmp.h index 4274f986d5d1..7cee93f77721 100644 --- a/velox/experimental/breeze/test/generated/functions/kernels-openmp.h +++ b/velox/experimental/breeze/test/generated/functions/kernels-openmp.h @@ -14,9 +14,16 @@ * limitations under the License. */ -// Copyright (c) 2024 by Rivos Inc. -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (c) 2024 by Rivos Inc. + * Licensed under the Apache License, Version 2.0, see LICENSE for details. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This file is auto-generated from kernel_generator.py + * DO NOT EDIT! + */ #include "breeze/functions/load.h" #include "breeze/functions/reduce.h" diff --git a/velox/experimental/breeze/test/generator_common.py b/velox/experimental/breeze/test/generator_common.py index f8f7af842d98..9bb2aac382de 100644 --- a/velox/experimental/breeze/test/generator_common.py +++ b/velox/experimental/breeze/test/generator_common.py @@ -38,9 +38,11 @@ * limitations under the License. */ -// Copyright (c) {datetime.now().year} by Rivos Inc. -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (c) {datetime.now().year} by Rivos Inc. + * Licensed under the Apache License, Version 2.0, see LICENSE for details. + * SPDX-License-Identifier: Apache-2.0 + */ """ parser = argparse.ArgumentParser() diff --git a/velox/experimental/breeze/test/kernel_generator.py b/velox/experimental/breeze/test/kernel_generator.py index 2b4ddccf857e..c6654996382a 100755 --- a/velox/experimental/breeze/test/kernel_generator.py +++ b/velox/experimental/breeze/test/kernel_generator.py @@ -34,6 +34,13 @@ from abc import ABC, abstractmethod +AUTOGEN_HEADER = f"""/* + * This file is auto-generated from kernel_generator.py + * DO NOT EDIT! + */ +""" + + def kernels_extractor(tu): kernels = [] for c in tu.cursor.get_children(): @@ -87,8 +94,8 @@ def write_func_prologue(self, out, attrs): def generate(self, tu, filename): out = io.StringIO() - # Copyright and platform specific includes - out.write(f"{COPYRIGHT}\n{self.includes}\n") + # Copyright, autogen header, and platform specific includes + out.write(f"{COPYRIGHT}\n{AUTOGEN_HEADER}\n{self.includes}\n") # Add general includes for i in includes_extractor(tu): out.write(read_extent(i.extent)) diff --git a/velox/experimental/breeze/test/test_fixture_generator.py b/velox/experimental/breeze/test/test_fixture_generator.py index 9865245e4ac0..36425fac93d9 100755 --- a/velox/experimental/breeze/test/test_fixture_generator.py +++ b/velox/experimental/breeze/test/test_fixture_generator.py @@ -34,6 +34,13 @@ import subprocess +AUTOGEN_HEADER = f"""/* + * This file is auto-generated from test_fixture_generator.py + * DO NOT EDIT! + */ +""" + + def get_children_with_type(cursor, ty): return list(filter(lambda c: c.kind == ty, cursor.get_children())) @@ -126,6 +133,8 @@ def generate(self, tu, filename): f"""\ {COPYRIGHT} + {AUTOGEN_HEADER} + #include #include