janetsc commented on code in PR #13138:
URL: https://github.com/apache/tvm/pull/13138#discussion_r999918384


##########
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:
   Could these properties specific to the external private repro be define 
there, and this pulls them in from a known sub-location within an external 
repo?  (So that each private repo could customize flags inside itself.)



-- 
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]

Reply via email to