Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/CUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(USE_CUDA)
if(NOT CUDA_FOUND)
message(FATAL_ERROR "Cannot find CUDA, USE_CUDA=" ${USE_CUDA})
endif()
message(STATUS "Build with CUDA support")
message(STATUS "Build with CUDA ${CUDA_VERSION} support")
file(GLOB RUNTIME_CUDA_SRCS src/runtime/cuda/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_CUDA_SRCS})
list(APPEND COMPILER_SRCS src/target/opt/build_cuda_on.cc)
Expand Down
15 changes: 15 additions & 0 deletions cmake/modules/Git.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# - GIT_FOUND - true if the command line client was found
# - GIT_EXECUTABLE - path to git command line client
# - TVM_GIT_COMMIT_HASH - The git commit hash found, or "NOT-FOUND" if anything went wrong
# - TVM_GIT_COMMIT_TIME - The git commit time, or "NOT-FOUND" if antything went wrong
find_package(Git QUIET)
if (${GIT_FOUND})
message(STATUS "Git found: ${GIT_EXECUTABLE}")
Expand All @@ -35,7 +36,21 @@ if (${GIT_FOUND})
message(STATUS "Not a git repo")
set(TVM_GIT_COMMIT_HASH "NOT-FOUND")
endif()

execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE TVM_GIT_COMMIT_TIME
RESULT_VARIABLE _TVM_GIT_RESULT
ERROR_VARIABLE _TVM_GIT_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (${_TVM_GIT_RESULT} EQUAL 0)
message(STATUS "Found TVM_GIT_COMMIT_TIME=${TVM_GIT_COMMIT_TIME}")
else()
set(TVM_GIT_COMMIT_TIME "NOT-FOUND")
endif()
else()
message(WARNING "Git not found")
set(TVM_GIT_COMMIT_HASH "NOT-FOUND")
set(TVM_GIT_COMMIT_TIME "NOT-FOUND")
endif()
8 changes: 8 additions & 0 deletions cmake/modules/LibInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ function(add_lib_info src_file)
else()
string(STRIP ${TVM_INFO_LLVM_VERSION} TVM_INFO_LLVM_VERSION)
endif()
if (NOT DEFINED CUDA_VERSION)
set(TVM_INFO_CUDA_VERSION "NOT-FOUND")
else()
string(STRIP ${CUDA_VERSION} TVM_INFO_CUDA_VERSION)
endif()

set_property(
SOURCE ${src_file}
APPEND
PROPERTY COMPILE_DEFINITIONS
TVM_INFO_GIT_COMMIT_HASH="${TVM_GIT_COMMIT_HASH}"
TVM_INFO_GIT_COMMIT_TIME="${TVM_GIT_COMMIT_TIME}"
TVM_INFO_USE_CUDA="${USE_CUDA}"
TVM_INFO_USE_OPENCL="${USE_OPENCL}"
TVM_INFO_USE_VULKAN="${USE_VULKAN}"
Expand All @@ -41,6 +48,7 @@ function(add_lib_info src_file)
TVM_INFO_USE_THREADS="${USE_THREADS}"
TVM_INFO_USE_LLVM="${USE_LLVM}"
TVM_INFO_LLVM_VERSION="${TVM_INFO_LLVM_VERSION}"
TVM_INFO_CUDA_VERSION="${TVM_INFO_CUDA_VERSION}"
TVM_INFO_USE_STACKVM_RUNTIME="${USE_STACKVM_RUNTIME}"
TVM_INFO_USE_GRAPH_EXECUTOR="${USE_GRAPH_EXECUTOR}"
TVM_INFO_USE_GRAPH_EXECUTOR_DEBUG="${USE_GRAPH_EXECUTOR_DEBUG}"
Expand Down
10 changes: 10 additions & 0 deletions src/support/libinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#define TVM_INFO_GIT_COMMIT_HASH "NOT-FOUND"
#endif

#ifndef TVM_INFO_GIT_COMMIT_TIME
#define TVM_INFO_GIT_COMMIT_TIME "NOT-FOUND"
#endif

#ifndef TVM_INFO_LLVM_VERSION
#define TVM_INFO_LLVM_VERSION "NOT-FOUND"
#endif
Expand All @@ -31,6 +35,10 @@
#define TVM_INFO_USE_CUDA "NOT-FOUND"
#endif

#ifndef TVM_INFO_CUDA_VERSION
#define TVM_INFO_CUDA_VERSION "NOT-FOUND"
#endif

#ifndef TVM_INFO_USE_OPENCL
#define TVM_INFO_USE_OPENCL "NOT-FOUND"
#endif
Expand Down Expand Up @@ -220,6 +228,7 @@ namespace tvm {
TVM_DLL Map<String, String> GetLibInfo() {
Map<String, String> result = {
{"GIT_COMMIT_HASH", TVM_INFO_GIT_COMMIT_HASH},
{"GIT_COMMIT_TIME", TVM_INFO_GIT_COMMIT_TIME},
{"USE_CUDA", TVM_INFO_USE_CUDA},
{"USE_OPENCL", TVM_INFO_USE_OPENCL},
{"USE_VULKAN", TVM_INFO_USE_VULKAN},
Expand All @@ -232,6 +241,7 @@ TVM_DLL Map<String, String> GetLibInfo() {
{"USE_THREADS", TVM_INFO_USE_THREADS},
{"USE_LLVM", TVM_INFO_USE_LLVM},
{"LLVM_VERSION", TVM_INFO_LLVM_VERSION},
{"CUDA_VERSION", TVM_INFO_CUDA_VERSION},
{"USE_STACKVM_RUNTIME", TVM_INFO_USE_STACKVM_RUNTIME},
{"USE_GRAPH_EXECUTOR", TVM_INFO_USE_GRAPH_EXECUTOR},
{"USE_GRAPH_EXECUTOR_DEBUG", TVM_INFO_USE_GRAPH_EXECUTOR_DEBUG},
Expand Down