Skip to content

Instantly share code, notes, and snippets.

@ganler
Created October 6, 2022 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ganler/1c58a7795211f0e11413f97a14af9f36 to your computer and use it in GitHub Desktop.
Save ganler/1c58a7795211f0e11413f97a14af9f36 to your computer and use it in GitHub Desktop.
Memcov Bitmap Compilation Extension to TVM
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e961c6d2d..45c496c17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -511,6 +511,9 @@ include(cmake/modules/Git.cmake)
include(cmake/modules/LibInfo.cmake)
include(cmake/modules/RustExt.cmake)
+tvm_option(USE_MEMCOV "Build with ganler/memcov" ON)
+include(cmake/modules/contrib/Memcov.cmake)
+
include(CheckCXXCompilerFlag)
if(NOT MSVC)
check_cxx_compiler_flag("-std=c++17" SUPPORT_CXX17)
@@ -615,6 +618,15 @@ endif()
target_link_libraries(tvm PRIVATE ${TVM_LINKER_LIBS} ${TVM_RUNTIME_LINKER_LIBS})
target_link_libraries(tvm_runtime PRIVATE ${TVM_RUNTIME_LINKER_LIBS})
+if(USE_MEMCOV)
+ MESSAGE(STATUS )
+ set_source_files_properties(
+ ${COMPILER_SRCS}
+ ${RUNTIME_SRCS}
+ PROPERTIES COMPILE_OPTIONS
+ -fsanitize-coverage=edge,trace-pc-guard)
+endif()
+
if(BUILD_FOR_HEXAGON AND DEFINED USE_HEXAGON_GTEST AND EXISTS ${USE_HEXAGON_GTEST})
include(FetchContent)
FetchContent_Declare(googletest SOURCE_DIR "${USE_HEXAGON_GTEST}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment