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

Reorganized test suites to welcome new ones

parent 5b4f7335
No related branches found
No related tags found
No related merge requests found
include(../cmake/TestFile.cmake) # Generation of `.test` files in CMake include(../cmake/TestFile.cmake) # Generation of `.test` files in CMake
add_subdirectory(hpvm_pass) add_subdirectory(hpvm_pass) # Passes test suite
add_subdirectory(dnn_benchmarks) add_subdirectory(dnn_benchmarks/hpvm-c) # DNN accuracy test suite
# --[ llvm-lit test setup
# lit.cfg.py looks for tests in CMAKE_CURRENT_BINARY_DIR (see lit.cfg.py)
# as most of the tests require some kind of compilation / generation
# which is best done over there.
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)
add_subdirectory(hpvm-c)
set(HPVM_TEST_DEPENDS dnn_benchmarks) # Compile all dnn benchmarks to run them
add_lit_testsuite(check-hpvm-dnn "Running HPVM DNNs"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${HPVM_TEST_DEPENDS}
ARGS "-j1" # Run DNN benchmarks sequentially
)
...@@ -13,6 +13,30 @@ configure_file( ...@@ -13,6 +13,30 @@ configure_file(
# and we'll give this to approxhpvm.py # and we'll give this to approxhpvm.py
set(CONFIG_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include") set(CONFIG_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
# --[ llvm-lit test setup
# lit.cfg.py looks for tests in CMAKE_CURRENT_BINARY_DIR (see lit.cfg.py)
# as most of the tests require some kind of compilation / generation
# which is best done over there.
configure_lit_site_cfg(
../../lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)
add_lit_testsuite(check-hpvm-dnn "Running HPVM DNNs"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS dnn_benchmarks # Compile all dnn benchmarks to run them
ARGS "-j1" # Run DNN benchmarks sequentially
)
# Install an accuracy comparator under build/bin
set(BIN_DIR ${LLVM_BINARY_DIR}/${LLVM_TOOLS_INSTALL_DIR})
add_custom_command(
OUTPUT ${BIN_DIR}/check_dnn_acc.py
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/check_dnn_acc.py ${BIN_DIR}
COMMAND chmod +x ${BIN_DIR}/check_dnn_acc.py
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/check_dnn_acc.py
)
set(test_compile_targets "") set(test_compile_targets "")
function(compile_hpvm_c bin_filename src_filepath codegen_target) function(compile_hpvm_c bin_filename src_filepath codegen_target)
add_custom_command( add_custom_command(
...@@ -26,15 +50,6 @@ function(compile_hpvm_c bin_filename src_filepath codegen_target) ...@@ -26,15 +50,6 @@ function(compile_hpvm_c bin_filename src_filepath codegen_target)
set(test_compile_targets ${test_compile_targets} ${bin_filename} PARENT_SCOPE) set(test_compile_targets ${test_compile_targets} ${bin_filename} PARENT_SCOPE)
endfunction(compile_hpvm_c) endfunction(compile_hpvm_c)
# Install an accuracy comparator under build/bin
set(BIN_DIR ${LLVM_BINARY_DIR}/${LLVM_TOOLS_INSTALL_DIR})
add_custom_command(
OUTPUT ${BIN_DIR}/check_dnn_acc.py
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/check_dnn_acc.py ${BIN_DIR}
COMMAND chmod +x ${BIN_DIR}/check_dnn_acc.py
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/check_dnn_acc.py
)
function(hpvm_add_dnn_test benchmark_target) function(hpvm_add_dnn_test benchmark_target)
# llvm_test_run* composes a .test file with the RUN line needed by llvm-lit # llvm_test_run* composes a .test file with the RUN line needed by llvm-lit
# No need to give binary path yet; # No need to give binary path yet;
......
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
import lit.llvm
lit.llvm.initialize(lit_config, config)
# Let the main config do the real work.
lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg.py")
configure_lit_site_cfg( configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in ../lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
......
from lit.llvm import llvm_config # This file is shared between test suites.
# It's repeatedly generated into build directory with different CMAKE_CURRENT_SOURCE_DIR.
config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@"
......
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