diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4fd589046bb8ee951febdf3f812557b9650831ce..b626521245a4d961b38112211cb57cdc36761767 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,6 +25,7 @@ build-and-test: - ./install.sh -j32 -t "X86" DCMAKE_BUILD_TYPE=Release - cd build - make -j32 check-hpvm-pass + - make -j32 check-hpvm-tensor-rt - make -j32 check-hpvm-dnn - make -j32 check-hpvm-keras-acc - make -j32 check-hpvm-torch-acc diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt index be42ebec07cc5aebad8ad975155f86cc25715dab..c448ce9c37f2e5c4bc3ca3f5f745f7f20829e251 100644 --- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt +++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt @@ -140,6 +140,10 @@ add_tensor_runtime(tensor_runtime_online -DONLINE_PROFILING=true -DFP16_tuning=f add_dependencies(tensor_runtime_online tensor_runtime) # Adding rule for the debugging source +# Don't put these binaries into the global bin/ (which is the LLVM default) +# Put it in our current dir. +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_executable(sampling_tests tests/sampling_tests.cc) target_link_libraries(sampling_tests tensor_runtime_online) diff --git a/hpvm/test/CMakeLists.txt b/hpvm/test/CMakeLists.txt index c0409b2101d26f4109bd5484c6b1a62cea63e020..8b4185294fcafdcbbab9181b9bc57b7135ce232b 100644 --- a/hpvm/test/CMakeLists.txt +++ b/hpvm/test/CMakeLists.txt @@ -6,6 +6,7 @@ set(CLANG_C ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/clang) set(CLANG_CXX ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/clang++) add_subdirectory(hpvm_pass) # Passes test suite +add_subdirectory(hpvm-tensor-rt) # Unit tests of tensor_runtime add_subdirectory(benchmarks) # HPVM benchmarks (no DNN) add_subdirectory(dnn_benchmarks/hpvm-c) # HPVM-C DNN accuracy test suite add_subdirectory(dnn_benchmarks/keras) # Keras frontend test suite diff --git a/hpvm/test/README.rst b/hpvm/test/README.rst index 54cb32352783d084d4008620459991178b9f1833..efd37dccf16468cf3cc2e224ba8503ed496032c8 100644 --- a/hpvm/test/README.rst +++ b/hpvm/test/README.rst @@ -8,6 +8,10 @@ The ``hpvm/test`` directory holds all tests and benchmarks in HPVM and is organi * ``hpvm_pass/``: unit and regression tests for HPVM Passes, written in LLVM-bitcode. +* ``hpvm-tensor-rt/``: unit tests for the HPVM `tensor_runtime`. + This folder just contains the test fixtures and the test files to run. + The actual test cases live under ``${project_root}/hpvm/projects/hpvm-tensor-rt/tests/``. + * ``benchmarks/``: includes a few applications written in HPVM-C, a template, and directions for compiling and running these benchmarks. * ``benchmarks/parboil``: Selected benchmarks from the `Parboil <http://impact.crhc.illinois.edu/parboil/parboil.aspx>`_ benchmark suite. @@ -54,6 +58,8 @@ The following targets runs these tests respectively: * ``make -j check-hpvm-pass`` runs tests in ``hpvm_pass``: ``hpvm_pass/**/*.ll``. These are regression and unit tests for HPVM passes. +* ``make -j check-hpvm-tensor-rt`` checks the approximation implementations of `tensor_runtime`. + * ``make -j check-hpvm-dnn`` runs all 20 DNN benchmarks under ``dnn_benchmarks/hpvm-c`` (10 DNNs x 2 versions) and validates their accuracy. diff --git a/hpvm/test/hpvm-tensor-rt/CMakeLists.txt b/hpvm/test/hpvm-tensor-rt/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c1314d9ebbf32039cb54fece43162e0351f3737 --- /dev/null +++ b/hpvm/test/hpvm-tensor-rt/CMakeLists.txt @@ -0,0 +1,11 @@ +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-tensor-rt "Running unit tests of HPVM Tensor Runtime" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS sampling_tests perforation_tests # These are from under projects/hpvm-tensor-rt +) diff --git a/hpvm/test/hpvm-tensor-rt/lit.cfg.py b/hpvm/test/hpvm-tensor-rt/lit.cfg.py new file mode 100644 index 0000000000000000000000000000000000000000..861281e56da6bc5155d2f9063df12715530fd8fa --- /dev/null +++ b/hpvm/test/hpvm-tensor-rt/lit.cfg.py @@ -0,0 +1,35 @@ +# -*- Python -*- + +# Configuration file for the 'lit' test runner. + +import os + +import lit.formats +from lit.llvm import llvm_config + +# name: The name of this test suite. +config.name = "HPVM-Tensor-Runtime" + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.ShTest(False) + +# suffixes: A list of file extensions to treat as test files. This is overriden +# by individual lit.local.cfg files in the test subdirectories. +config.suffixes = [".test"] + +# test_source_root: The root path where tests are located. +config.test_source_root = os.path.dirname(__file__) + +# test_exec_root: The root path where tests should be run. +# This is set to the current directory under build dir (think CMAKE_CURRENT_BINARY_DIR) +current_source_dir = os.path.dirname(os.path.relpath(__file__, config.llvm_src_root)) +current_binary_dir = os.path.join(config.llvm_obj_root, current_source_dir) +config.test_exec_root = current_binary_dir + +# Tweak the PATH to include the tools dir. +# We'll include the PATH to where the hpvm-tensor-rt test cases are built. +# TODO: "tools/hpvm/..." is a bit of hardcoding. Not too bad. +# Still, think about how to improve this. +proj_trt_dir = os.path.join(config.llvm_obj_root, "tools/hpvm/projects/hpvm-tensor-rt") +print(proj_trt_dir) +llvm_config.with_environment("PATH", proj_trt_dir, append_path=True) diff --git a/hpvm/test/hpvm-tensor-rt/perforation.test b/hpvm/test/hpvm-tensor-rt/perforation.test new file mode 100644 index 0000000000000000000000000000000000000000..c585dd8f64afc06636a7cb31305d2f3a1a94e0a0 --- /dev/null +++ b/hpvm/test/hpvm-tensor-rt/perforation.test @@ -0,0 +1 @@ +RUN: sampling_tests diff --git a/hpvm/test/hpvm-tensor-rt/sampling.test b/hpvm/test/hpvm-tensor-rt/sampling.test new file mode 100644 index 0000000000000000000000000000000000000000..ef56cfabce566966494b309262d20aa11ff3912e --- /dev/null +++ b/hpvm/test/hpvm-tensor-rt/sampling.test @@ -0,0 +1 @@ +RUN: perforation_tests