Skip to content
Snippets Groups Projects
Commit 6a828121 authored by Yifan Zhao's avatar Yifan Zhao
Browse files

Added cmake targets to run benchmarks

parent c1bcf681
No related branches found
No related tags found
No related merge requests found
...@@ -40,10 +40,10 @@ list( ...@@ -40,10 +40,10 @@ list(
) )
# The hpvm-rt runtime # The hpvm-rt runtime
# This has to be explicitly set as hpvm-rt.ll is created in a custom_target # This has to be explicitly set as hpvm-rt.bc is created in a custom_target
# and does not export its file location. # and does not export its file location.
# Keep this in sync with hpvm/projects/hpvm-rt/CMakeLists.txt. # Keep this in sync with hpvm/projects/hpvm-rt/CMakeLists.txt.
set(HPVM_RT_PATH ${PROJECT_BINARY_DIR}/tools/hpvm/projects/hpvm-rt/hpvm-rt.ll) set(HPVM_RT_PATH ${PROJECT_BINARY_DIR}/tools/hpvm/projects/hpvm-rt/hpvm-rt.bc)
# Compile flags (clang++) # Compile flags (clang++)
set(CLANG_FLAGS -fno-exceptions -std=c++11 -O3) set(CLANG_FLAGS -fno-exceptions -std=c++11 -O3)
...@@ -89,7 +89,7 @@ function(compile_single_benchmark target src_file extra_passes extra_dfg_flags) ...@@ -89,7 +89,7 @@ function(compile_single_benchmark target src_file extra_passes extra_dfg_flags)
) )
add_custom_command( add_custom_command(
OUTPUT "${WORK_DIR}/${target}.linked.bc" OUTPUT "${WORK_DIR}/${target}.linked.bc"
DEPENDS "${WORK_DIR}/${target}.llvm.ll" hpvm-rt.ll llvm-link DEPENDS "${WORK_DIR}/${target}.llvm.ll" hpvm-rt.bc llvm-link
COMMAND ${LLVM_LINK} ${WORK_DIR}/${target}.llvm.ll ${HPVM_RT_PATH} COMMAND ${LLVM_LINK} ${WORK_DIR}/${target}.llvm.ll ${HPVM_RT_PATH}
-o ${WORK_DIR}/${target}.linked.bc -o ${WORK_DIR}/${target}.linked.bc
) )
...@@ -106,12 +106,23 @@ function(compile_single_benchmark target src_file extra_passes extra_dfg_flags) ...@@ -106,12 +106,23 @@ function(compile_single_benchmark target src_file extra_passes extra_dfg_flags)
set(test_compile_targets ${test_compile_targets} ${target} PARENT_SCOPE) set(test_compile_targets ${test_compile_targets} ${target} PARENT_SCOPE)
endfunction(compile_single_benchmark) endfunction(compile_single_benchmark)
set(test_run_targets "")
function(run_single_benchmark run_target benchmark)
add_custom_target(
${run_target}
COMMAND ${WORK_DIR}/${benchmark}
)
add_dependencies(${run_target} ${benchmark})
set(test_run_targets ${test_run_targets} ${run_target} PARENT_SCOPE)
endfunction(run_single_benchmark)
file(GLOB entries ./benchmarks/*) file(GLOB entries ./benchmarks/*)
foreach(dir ${entries}) foreach(dir ${entries})
get_filename_component(dirname "${dir}" NAME) get_filename_component(dirname "${dir}" NAME)
compile_single_benchmark( compile_single_benchmark(
"test_${dirname}" ${dir}/${dirname}.cpp LLVMDFG2LLVM_CUDNN -dfg2llvm-cudnn "test_${dirname}" ${dir}/${dirname}.cpp LLVMDFG2LLVM_CUDNN -dfg2llvm-cudnn
) )
run_single_benchmark("run_${dirname}" "test_${dirname}")
set( set(
loop_extra_flags loop_extra_flags
-dfg2llvm-wrapperapi -dfg2llvm-wrapperapi
...@@ -122,6 +133,7 @@ foreach(dir ${entries}) ...@@ -122,6 +133,7 @@ foreach(dir ${entries})
"test_${dirname}_loop" ${dir}/${dirname}_loop.cpp "test_${dirname}_loop" ${dir}/${dirname}_loop.cpp
LLVMDFG2LLVM_WrapperAPI "${loop_extra_flags}" LLVMDFG2LLVM_WrapperAPI "${loop_extra_flags}"
) )
run_single_benchmark("run_${dirname}_loop" "test_${dirname}_loop")
endforeach(dir) endforeach(dir)
message(STATUS "List of test dnn benchmarks: ${test_compile_targets}") message(STATUS "List of test dnn benchmarks: ${test_compile_targets}")
add_custom_target(dnn_benchmarks DEPENDS ${test_compile_targets}) add_custom_target(dnn_benchmarks DEPENDS ${test_compile_targets})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment