diff --git a/hpvm/test/CMakeLists.txt b/hpvm/test/CMakeLists.txt index 3c41260c4b8cc28c6e8ac1c9de585364f2abd64d..a9098bb01d7ef174a3abe49ae4a6631195bb6005 100644 --- a/hpvm/test/CMakeLists.txt +++ b/hpvm/test/CMakeLists.txt @@ -1,3 +1,3 @@ include(../cmake/TestFile.cmake) # Generation of `.test` files in CMake -add_subdirectory(hpvm_pass) -add_subdirectory(dnn_benchmarks) +add_subdirectory(hpvm_pass) # Passes test suite +add_subdirectory(dnn_benchmarks/hpvm-c) # DNN accuracy test suite diff --git a/hpvm/test/dnn_benchmarks/CMakeLists.txt b/hpvm/test/dnn_benchmarks/CMakeLists.txt deleted file mode 100644 index 58bcd174706e4c3ab09d8b22ee395a977e604202..0000000000000000000000000000000000000000 --- a/hpvm/test/dnn_benchmarks/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# --[ 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 -) diff --git a/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt b/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt index a9384956b78b2bfd32c4f3afeabf2117a14efd77..3a0c6534e02ce82fdfd02f483f71c6be1a9ab433 100644 --- a/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt +++ b/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt @@ -13,6 +13,30 @@ configure_file( # and we'll give this to approxhpvm.py 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 "") function(compile_hpvm_c bin_filename src_filepath codegen_target) add_custom_command( @@ -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) 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) # llvm_test_run* composes a .test file with the RUN line needed by llvm-lit # No need to give binary path yet; diff --git a/hpvm/test/dnn_benchmarks/lit.cfg.py b/hpvm/test/dnn_benchmarks/hpvm-c/lit.cfg.py similarity index 100% rename from hpvm/test/dnn_benchmarks/lit.cfg.py rename to hpvm/test/dnn_benchmarks/hpvm-c/lit.cfg.py diff --git a/hpvm/test/dnn_benchmarks/lit.site.cfg.py.in b/hpvm/test/dnn_benchmarks/lit.site.cfg.py.in deleted file mode 100644 index a30a803ca6d0148e010410d7310b243e25e52802..0000000000000000000000000000000000000000 --- a/hpvm/test/dnn_benchmarks/lit.site.cfg.py.in +++ /dev/null @@ -1,10 +0,0 @@ -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") diff --git a/hpvm/test/hpvm_pass/CMakeLists.txt b/hpvm/test/hpvm_pass/CMakeLists.txt index 527406f3ce649f1ef9dc7033f7fb27baa37711fd..fe929f4d6316b54e4b4b19db1221ae146534ee0b 100644 --- a/hpvm/test/hpvm_pass/CMakeLists.txt +++ b/hpvm/test/hpvm_pass/CMakeLists.txt @@ -1,5 +1,5 @@ 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 MAIN_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py diff --git a/hpvm/test/hpvm_pass/lit.site.cfg.py.in b/hpvm/test/lit.site.cfg.py.in similarity index 72% rename from hpvm/test/hpvm_pass/lit.site.cfg.py.in rename to hpvm/test/lit.site.cfg.py.in index 17dff330d0029c30d07767324ec0e4898c65b4a7..0ed68ccfa0d05e797463dcd2e0a1f9030a20b99a 100644 --- a/hpvm/test/hpvm_pass/lit.site.cfg.py.in +++ b/hpvm/test/lit.site.cfg.py.in @@ -1,4 +1,5 @@ -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_obj_root = "@LLVM_BINARY_DIR@"