diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 149f6a610b5c..1f6abcdc6e64 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -45,7 +45,7 @@ add_app(depthwise_separable_conv) add_app(fft) add_app(hannk) add_app(harris) -# add_app(hexagon_benchmarks) # TODO(#5374): missing CMake build +add_app(hexagon_benchmarks) # add_app(hexagon_dma) # TODO(#5374): missing CMake build add_app(hist) add_app(iir_blur) diff --git a/apps/hexagon_benchmarks/CMakeLists.txt b/apps/hexagon_benchmarks/CMakeLists.txt new file mode 100644 index 000000000000..9cbcc541b76a --- /dev/null +++ b/apps/hexagon_benchmarks/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.22) +project(hexagon_benchmarks) + +enable_testing() + +# Set up language settings +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED YES) +set(CMAKE_CXX_EXTENSIONS NO) +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +# Find Halide +find_package(Halide REQUIRED) + +macro(add_generator_and_library FILTER_NAME) + set(GENERATOR_EXE ${FILTER_NAME}.generator) + set(GENERATOR_SRC ${FILTER_NAME}_generator.cpp) + add_halide_generator(${GENERATOR_EXE} SOURCES ${GENERATOR_SRC}) + add_halide_library(${FILTER_NAME} FROM ${GENERATOR_EXE}) +endmacro() + +add_generator_and_library(dilate3x3) +add_generator_and_library(gaussian5x5) +add_generator_and_library(median3x3) + +# Main executable +add_executable(process process.cpp) +target_compile_options(process PRIVATE $<$:-O2>) +if (Halide_TARGET MATCHES "hvx") + target_compile_definitions(process PRIVATE DILATE3X3 GAUSSIAN5X5 MEDIAN3X3 TARGET_HAS_HVX) +else() + target_compile_definitions(process PRIVATE DILATE3X3 GAUSSIAN5X5 MEDIAN3X3) +endif() +target_link_libraries(process + PRIVATE + Halide::Tools + dilate3x3 gaussian5x5 median3x3) + +# Test that the app actually works! +add_test(NAME hexagon_benchmarks COMMAND process -n 1) +set_tests_properties(hexagon_benchmarks PROPERTIES + LABELS hexagon_benchmarks + PASS_REGULAR_EXPRESSION "Success!" + SKIP_REGULAR_EXPRESSION "\\[SKIP\\]") diff --git a/apps/hexagon_benchmarks/process.cpp b/apps/hexagon_benchmarks/process.cpp index 975bf8aa2da4..87a492c577d1 100644 --- a/apps/hexagon_benchmarks/process.cpp +++ b/apps/hexagon_benchmarks/process.cpp @@ -3,6 +3,10 @@ #include #include +#ifdef TARGET_HAS_HVX +#include "HalideRuntimeHexagonHost.h" +#endif + #include "halide_benchmark.h" #include "process.h" @@ -39,11 +43,10 @@ int main(int argc, char **argv) { Dilate3x3Descriptor dilate3x3_pipeine(W, H); Median3x3Descriptor median3x3_pipeline(W, H); Gaussian5x5Descriptor gaussian5x5_pipeline(W, H); - SobelDescriptor sobel_pipeline(W, H); Conv3x3a32Descriptor conv3x3a32_pipeline(W, H); std::vector pipelines = {&conv3x3a16_pipeline, &dilate3x3_pipeine, &median3x3_pipeline, - &gaussian5x5_pipeline, &sobel_pipeline, &conv3x3a32_pipeline}; + &gaussian5x5_pipeline, &conv3x3a32_pipeline}; for (PipelineDescriptorBase *p : pipelines) { if (!p->defined()) {