Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTA cmake change to include Verilator header for building tsim library #8797

Merged
merged 9 commits into from
Aug 26, 2021
8 changes: 5 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ tvm_runtime = "build/libtvm_runtime.so, build/config.cmake"
tvm_lib = "build/libtvm.so, " + tvm_runtime
// LLVM upstream lib
tvm_multilib = "build/libtvm.so, " +
"build/libvta_tsim.so, " +
"build/libvta_fsim.so, " +
tvm_runtime

tvm_multilib_tsim = "build/libvta_tsim.so, " +
tvm_multilib

// command to start a docker container
docker_run = 'docker/bash.sh'
// timeout in minutes
Expand Down Expand Up @@ -218,7 +220,7 @@ stage('Build') {
init_git()
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_config_build_cpu.sh"
make(ci_cpu, 'build', '-j2')
pack_lib('cpu', tvm_multilib)
pack_lib('cpu', tvm_multilib_tsim)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_ci_setup.sh"
sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_unittest.sh"
Expand Down Expand Up @@ -252,7 +254,7 @@ stage('Build') {
init_git()
sh "${docker_run} ${ci_i386} ./tests/scripts/task_config_build_i386.sh"
make(ci_i386, 'build', '-j2')
pack_lib('i386', tvm_multilib)
pack_lib('i386', tvm_multilib_tsim)
}
}
},
Expand Down
13 changes: 12 additions & 1 deletion cmake/modules/VTA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ elseif(PYTHON)

# Cycle accurate simulator driver build
if(USE_VTA_TSIM)
if(DEFINED ENV{VERILATOR_INC_DIR})
set(VERILATOR_INC_DIR $ENV{VERILATOR_INC_DIR})
elseif (EXISTS /usr/local/share/verilator/include)
set(VERILATOR_INC_DIR /usr/local/share/verilator/include)
elseif (EXISTS /usr/share/verilator/include)
set(VERILATOR_INC_DIR /usr/share/verilator/include)
else()
message(STATUS "Verilator not found in /usr/local/share/verilator/include")
message(STATUS "Verilator not found in /usr/share/verilator/include")
message(FATAL_ERROR "Cannot find Verilator, VERILATOR_INC_DIR is not defined")
endif()
aasorokiin marked this conversation as resolved.
Show resolved Hide resolved
# Add tsim driver sources
file(GLOB TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
file(GLOB TSIM_RUNTIME_SRCS vta/runtime/*.cc)
Expand All @@ -81,7 +92,7 @@ elseif(PYTHON)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc)
# Target lib: vta_tsim
add_library(vta_tsim SHARED ${TSIM_RUNTIME_SRCS})
target_include_directories(vta_tsim SYSTEM PUBLIC ${VTA_HW_PATH}/include)
target_include_directories(vta_tsim SYSTEM PUBLIC ${VTA_HW_PATH}/include ${VERILATOR_INC_DIR} ${VERILATOR_INC_DIR}/vltstd)
target_compile_definitions(vta_tsim PUBLIC DMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
foreach(__def ${VTA_DEFINITIONS})
string(SUBSTRING ${__def} 3 -1 __strip_def)
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/task_config_build_arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ echo set\(USE_PROFILER ON\) >> config.cmake
echo set\(USE_LLVM llvm-config-8\) >> config.cmake
echo set\(CMAKE_CXX_COMPILER g++\) >> config.cmake
echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake
echo set\(USE_VTA_TSIM ON\) >> config.cmake
echo set\(USE_VTA_FSIM ON\) >> config.cmake
echo set\(USE_ARM_COMPUTE_LIB ON\) >> config.cmake
echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/acl"\) >> config.cmake
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/task_config_build_gpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ echo set\(USE_GRAPH_EXECUTOR ON\) >> config.cmake
echo set\(USE_STACKVM_RUNTIME ON\) >> config.cmake
echo set\(USE_PROFILER ON\) >> config.cmake
echo set\(USE_ANTLR ON\) >> config.cmake
echo set\(USE_VTA_TSIM ON\) >> config.cmake
echo set\(USE_VTA_FSIM ON\) >> config.cmake
echo set\(USE_BLAS openblas\) >> config.cmake
echo set\(CMAKE_CXX_COMPILER g++\) >> config.cmake
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/task_config_build_i386.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ echo set\(USE_PROFILER ON\) >> config.cmake
echo set\(USE_LLVM llvm-config-4.0\) >> config.cmake
echo set\(CMAKE_CXX_COMPILER g++\) >> config.cmake
echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake
echo set\(USE_VTA_TSIM ON\) >> config.cmake
echo set\(USE_VTA_FSIM ON\) >> config.cmake
echo set\(USE_VTA_TSIM ON\) >> config.cmake
echo set\(USE_VERILATOR ON\) >> config.cmake
echo set\(USE_CCACHE OFF\) >> config.cmake

1 change: 0 additions & 1 deletion tests/scripts/task_config_build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ echo set\(USE_ANTLR ON\) >> config.cmake
echo set\(CMAKE_CXX_COMPILER g++\) >> config.cmake
echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake
echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake
echo set\(USE_VTA_TSIM ON\) >> config.cmake
echo set\(USE_VTA_FSIM ON\) >> config.cmake
echo set\(USE_CCACHE OFF\) >> config.cmake