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

Added hpvm-tensor-rt unit tests

parent f06101df
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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.
......
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
)
# -*- 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)
RUN: sampling_tests
RUN: perforation_tests
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