csullivan commented on code in PR #13138:
URL: https://github.com/apache/tvm/pull/13138#discussion_r999985043
##########
cmake/modules/Hexagon.cmake:
##########
@@ -182,6 +182,36 @@ if(BUILD_FOR_HEXAGON)
"${TVMRT_SOURCE_DIR}/hexagon/ops/conv2d_fp16_hvx.cc"
PROPERTIES COMPILE_FLAGS "-mhvx"
)
+
+ # Include hexagon external library runtime sources
+ if(DEFINED USE_HEXAGON_EXTERNAL_LIBS)
+ if (EXISTS ${USE_HEXAGON_EXTERNAL_LIBS})
+ elseif(USE_HEXAGON_EXTERNAL_LIBS MATCHES "\.git$")
+ if (NOT DEFINED HEXAGON_EXTERNAL_LIBS_SHA)
+ message(FATAL_ERROR "HEXAGON_EXTERNA_LIBS_SHA must be set when "
+ "USE_HEXAGON_EXTERNAL_LIBS is set to a git repository")
+ endif()
+ include(FetchContent)
+ FetchContent_Declare(hexagon_external
+ GIT_REPOSITORY "${USE_HEXAGON_EXTERNAL_LIBS}"
+ GIT_TAG "${HEXAGON_EXTERNAL_LIBS_SHA}")
+ FetchContent_MakeAvailable(hexagon_external)
+ set(USE_HEXAGON_EXTERNAL_LIBS "${hexagon_external_SOURCE_DIR}")
+ else()
+ message(FATAL_ERROR "Invalid use of USE_HEXAGON_EXTERNAL_LIBS="
+ "${USE_HEXAGON_EXTERNAL_LIBS}; USE_HEXAGON_EXTERNAL_LIBS only "
+ "supports absolute paths and paths and git repository urls")
+ endif()
+
+ file_glob_append(HEXAGON_EXTERNAL_RUNTIME_SRCS
+ "${USE_HEXAGON_EXTERNAL_LIBS}/src/runtime/hexagon/*.cc"
+ )
+ list(APPEND RUNTIME_HEXAGON_SRCS "${HEXAGON_EXTERNAL_RUNTIME_SRCS}")
+ set_source_files_properties(
+ "${HEXAGON_EXTERNAL_RUNTIME_SRCS}"
+ PROPERTIES COMPILE_FLAGS "-mhvx -mhmx"
Review Comment:
Thank you for the good feedback,
https://github.com/apache/tvm/pull/13138/commits/18fe01c722414045fbda3642c4f1a7ed608777f9
takes your suggestion of optionally including an external library defined
cmake config file which defines these compiler flags. The risk we run is
keeping these synchronized across repos, but as long as the footprint stays
microscopic (ie just a single shared variable name) it should be manageable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]