tmoreau89 commented on a change in pull request #8822:
URL: https://github.com/apache/tvm/pull/8822#discussion_r695062189



##########
File path: cmake/modules/HexagonSDK.cmake
##########
@@ -0,0 +1,123 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set(FOUND_HEXAGON_SDK_ROOT FALSE)
+
+macro(set_parent var)
+  set(${var} ${ARGN} PARENT_SCOPE)
+endmacro()
+
+function(find_hexagon_sdk_root HEXAGON_SDK_PATH HEXAGON_ARCH)
+  if(FOUND_HEXAGON_SDK_ROOT)
+    return()
+  endif()
+  if(${ARGC} LESS "2")
+    message(SEND_ERROR "Must provide Hexagon SDK path and Hexagon arch")
+  endif()
+
+  # Initial verification of the Hexagon SDK.
+  message(STATUS "Checking Hexagon SDK root: ${HEXAGON_SDK_PATH}")
+  file(GLOB_RECURSE VERSION_HEADERS "${HEXAGON_SDK_PATH}/*/version.h")
+  if(VERSION_HEADERS)
+    foreach(HEADER IN LISTS VERSION_HEADERS)
+      if(HEADER MATCHES "incs/version.h$")
+        set(SDK_VERSION_HEADER "${HEADER}")
+        break()
+      endif()
+    endforeach()
+    # The path is ${HEXAGON_SDK_ROOT}/incs/version.h.
+    get_filename_component(TMP0 "${SDK_VERSION_HEADER}" DIRECTORY)
+    get_filename_component(TMP1 "${TMP0}" DIRECTORY)
+    set(HEXAGON_SDK_ROOT "${TMP1}" CACHE PATH "Root directory of Hexagon SDK")
+  else()
+    message(SEND_ERROR "Cannot validate Hexagon SDK in ${HEXAGON_SDK_PATH}")
+  endif()
+
+  execute_process(
+    COMMAND grep "#define[ \t]*VERSION_STRING" "${SDK_VERSION_HEADER}"
+    OUTPUT_VARIABLE SDK_VERSION_DEFINE)
+  string(
+    REGEX REPLACE ".*VERSION_STRING.* ([0-9\\.]+) .*" "\\1"
+    SDK_VERSION_STRING "${SDK_VERSION_DEFINE}")
+
+  if (SDK_VERSION_STRING MATCHES "3.5.1")
+    message(SEND_ERROR "Hexagon SDK 3.5.1 is not supported")
+  endif()
+
+  # Set the Hexagon arch directory component.
+  set(HEXARCH_DIR_v60 "ADSPv60MP")
+  set(HEXARCH_DIR_v62 "ADSPv62MP")
+  set(HEXARCH_DIR_v65 "computev65")
+  set(HEXARCH_DIR_v66 "computev66")
+  set(HEXARCH_DIR_v68 "computev68")

Review comment:
       These don't appear to be used anywhere - do we want to clean this up?




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