This is an automated email from the ASF dual-hosted git repository.

mehrdadh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 28aac0e48f [Hexagon] Deprecate USE_HEXAGON_DEVICE, introduce 
USE_HEXAGON (#11025)
28aac0e48f is described below

commit 28aac0e48ffa7084c9f0cfa5306a6c592c7f269d
Author: Krzysztof Parzyszek <kparz...@quicinc.com>
AuthorDate: Mon Apr 18 11:29:11 2022 -0500

    [Hexagon] Deprecate USE_HEXAGON_DEVICE, introduce USE_HEXAGON (#11025)
    
    The new cmake flag `USE_HEXAGON=[ON|OFF]` enables/disables Hexagon
    support in TVM and TVM runtime. It should be turned on _whenever_
    Hexagon support is required, even when compiling TVM runtime for
    Hexagon itself.
    
    This is one in a series of commits intended to remove offload
    support, and make the whole-model support the default mode of
    operation.
    
    With `USE_HEXAGON_DEVICE` deprecated, offload runtime is not built
    anymore, so register `device_api.hexagon` to be same as `.v2`
    (presence of device API is taken as evidence of support for the
    device in TVM, so this step is necessary).
---
 CMakeLists.txt                                     |  4 +-
 apps/hexagon_api/CMakeLists.txt                    |  3 +
 apps/hexagon_launcher/cmake/android/CMakeLists.txt |  9 ++-
 apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt |  7 +-
 cmake/config.cmake                                 | 13 ++--
 cmake/modules/Hexagon.cmake                        | 90 +++-------------------
 cmake/modules/LibInfo.cmake                        |  2 +-
 src/runtime/hexagon/README.md                      | 70 ++++++++---------
 src/runtime/hexagon/android/hexagon_device_api.cc  |  2 +-
 .../hexagon/hexagon/hexagon_device_api_v2.cc       |  5 ++
 src/support/libinfo.cc                             |  6 +-
 tests/python/contrib/test_hexagon/test_launcher.md |  2 +-
 tests/scripts/task_config_build_hexagon.sh         |  3 +-
 13 files changed, 75 insertions(+), 141 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e59a112fab..d174b8bf71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,8 +40,8 @@ tvm_option(USE_SPIRV_KHR_INTEGER_DOT_PRODUCT "whether enable 
SPIRV_KHR_DOT_PRODU
 tvm_option(USE_METAL "Build with Metal" OFF)
 tvm_option(USE_ROCM "Build with ROCM" OFF)
 tvm_option(ROCM_PATH "The path to rocm" /opt/rocm)
-tvm_option(USE_HEXAGON_DEVICE "Build with Hexagon device support in TVM 
runtime" OFF)
-tvm_option(USE_HEXAGON_SDK "Path to the Hexagon SDK root (required for Hexagon 
support in TVM runtime or for building TVM runtime for Hexagon)" /path/to/sdk)
+tvm_option(USE_HEXAGON "Build with Hexagon support" OFF)
+tvm_option(USE_HEXAGON_SDK "Path to the Hexagon SDK root (required for Hexagon 
support)" /path/to/sdk)
 tvm_option(USE_HEXAGON_RPC "Enable Hexagon RPC using minRPC implementation 
over Android." OFF)
 tvm_option(USE_RPC "Build with RPC" ON)
 tvm_option(USE_THREADS "Build with thread support" ON)
diff --git a/apps/hexagon_api/CMakeLists.txt b/apps/hexagon_api/CMakeLists.txt
index 6d9f04948a..40f070513e 100644
--- a/apps/hexagon_api/CMakeLists.txt
+++ b/apps/hexagon_api/CMakeLists.txt
@@ -35,6 +35,7 @@ ExternalProject_Add(x86_tvm_runtime_rpc
     "-DUSE_LIBBACKTRACE=OFF"
     "-DUSE_RPC=ON"
     "-DUSE_CPP_RPC=ON"
+    "-DUSE_HEXAGON=ON"
     "-DUSE_HEXAGON_RPC=ON"
     "-DBUILD_STATIC_RUNTIME=ON"
     "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
@@ -66,6 +67,7 @@ ExternalProject_Add(android_tvm_runtime_rpc
     "-DUSE_LIBBACKTRACE=OFF"
     "-DUSE_RPC=ON"
     "-DUSE_CPP_RPC=ON"
+    "-DUSE_HEXAGON=ON"
     "-DUSE_HEXAGON_RPC=ON"
     "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
     "-DUSE_ALTERNATIVE_LINKER=OFF"
@@ -101,6 +103,7 @@ ExternalProject_Add(hexagon_tvm_runtime_rpc
     "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}"
     "-DUSE_LIBBACKTRACE=OFF"
     "-DUSE_RPC=OFF"
+    "-DUSE_HEXAGON=ON"
     "-DUSE_HEXAGON_RPC=ON"
     "-DBUILD_STATIC_RUNTIME=ON"
     "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
diff --git a/apps/hexagon_launcher/cmake/android/CMakeLists.txt 
b/apps/hexagon_launcher/cmake/android/CMakeLists.txt
index 28cb3576e3..0d62aefe7a 100644
--- a/apps/hexagon_launcher/cmake/android/CMakeLists.txt
+++ b/apps/hexagon_launcher/cmake/android/CMakeLists.txt
@@ -71,15 +71,16 @@ ExternalProject_Add(android_tvm_runtime
   SOURCE_DIR "${TVM_SOURCE_DIR}"
   BUILD_COMMAND $(MAKE) runtime
   CMAKE_ARGS
-  "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
-  "-DANDROID_PLATFORM=${ANDROID_PLATFORM}"
   "-DANDROID_ABI=${ANDROID_ABI}"
+  "-DANDROID_PLATFORM=${ANDROID_PLATFORM}"
   "-DCMAKE_CXX_STANDARD=14"
+  "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
+  "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}"
+  "-DUSE_HEXAGON=ON"
+  "-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}"
   "-DUSE_LIBBACKTRACE=OFF"
   "-DUSE_LLVM=OFF"
   "-DUSE_RPC=OFF"
-  "-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}"
-  "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}"
   INSTALL_COMMAND ""
   BUILD_ALWAYS ON
 )
diff --git a/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt 
b/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt
index a3e0277433..b14ee18c29 100644
--- a/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt
+++ b/apps/hexagon_launcher/cmake/hexagon/CMakeLists.txt
@@ -79,15 +79,16 @@ ExternalProject_Add(static_hexagon_tvm_runtime
   SOURCE_DIR "${TVM_SOURCE_DIR}"
   BUILD_COMMAND $(MAKE) runtime
   CMAKE_ARGS
+  "-DBUILD_STATIC_RUNTIME=ON"
   "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
   "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
-  "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}"
   "-DCMAKE_CXX_STANDARD=14"
+  "-DUSE_HEXAGON_ARCH=${USE_HEXAGON_ARCH}"
+  "-DUSE_HEXAGON=ON"
+  "-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}"
   "-DUSE_LIBBACKTRACE=OFF"
   "-DUSE_LLVM=OFF"
   "-DUSE_RPC=OFF"
-  "-DBUILD_STATIC_RUNTIME=ON"
-  "-DUSE_HEXAGON_SDK=${USE_HEXAGON_SDK}"
   INSTALL_COMMAND ""
   BUILD_ALWAYS ON
 )
diff --git a/cmake/config.cmake b/cmake/config.cmake
index d8d0a6482a..dc2512175b 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -293,20 +293,17 @@ set(USE_PT_TVMDSOOP OFF)
 # Whether to use STL's std::unordered_map or TVM's POD compatible Map
 set(USE_FALLBACK_STL_MAP OFF)
 
-# Whether to use hexagon device
-set(USE_HEXAGON_DEVICE OFF)
+# Whether to enable Hexagon support
+set(USE_HEXAGON OFF)
 set(USE_HEXAGON_SDK /path/to/sdk)
 
-# Whether to build the hexagon launcher
-set(USE_HEXAGON_LAUNCHER OFF)
-
-# Whether to build the minimal support android rpc server for hexagon
-set(USE_HEXAGON_PROXY_RPC OFF)
+# Whether to build the minimal support android rpc server for Hexagon
+set(USE_HEXAGON_RPC OFF)
 
 # Hexagon architecture to target when compiling TVM itself (not the target for
 # compiling _by_ TVM). This applies to components like the TVM runtime, but is
 # also used to select correct include/library paths from the Hexagon SDK when
-# building offloading runtime for Android.
+# building runtime for Android.
 # Valid values are v65, v66, v68, v69.
 set(USE_HEXAGON_ARCH "v66")
 
diff --git a/cmake/modules/Hexagon.cmake b/cmake/modules/Hexagon.cmake
index eeb1980eb0..2914b0e3b1 100644
--- a/cmake/modules/Hexagon.cmake
+++ b/cmake/modules/Hexagon.cmake
@@ -18,10 +18,6 @@
 include(ExternalProject)
 include(cmake/modules/HexagonSDK.cmake)
 
-set(PICK_SIM  "sim")
-set(PICK_HW   "target")
-set(PICK_NONE "OFF")
-
 set(FOUND_HEXAGON_TOOLCHAIN FALSE)
 
 function(find_hexagon_toolchain)
@@ -56,27 +52,17 @@ endmacro()
 
 set(TVMRT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/runtime")
 
-# First, verify that USE_HEXAGON_DEVICE has a valid value.
 if(DEFINED USE_HEXAGON_DEVICE)
-  if(NOT USE_HEXAGON_DEVICE STREQUAL "${PICK_SIM}" AND
-     NOT USE_HEXAGON_DEVICE STREQUAL "${PICK_HW}" AND
-     NOT USE_HEXAGON_DEVICE STREQUAL "${PICK_NONE}")
-    message(SEND_ERROR "USE_HEXAGON_DEVICE must be one of "
-            "[${PICK_NONE}|${PICK_SIM}|${PICK_HW}]")
-    set(USE_HEXAGON_DEVICE OFF)
-  endif()
+  message(WARNING "USE_HEXAGON_DEVICE is deprecated, use USE_HEXAGON instead")
 endif()
 
 # This .cmake file is included when building any part of TVM for any
-# architecture. It shouldn't require any Hexagon-specific parameters
-# (like the path to the SDK), unless it's needed.
-#
-# Aside from building the code for Hexagon, two flags can enable some
-# Hexagon-related functionality:
-# - USE_HEXAGON_DEVICE
-# - USE_HEXAGON_RPC
-#
-# USE_HEXAGON_RPC:
+# architecture. It shouldn't require any Hexagon-specific parameters (like
+# the path to the SDK), unless it's needed. The flag USE_HEXAGON decides
+# whether any Hexagon-related functionality is enabled. Specifically,
+# setting USE_HEXAGON=OFF, disables any form of Hexagon support.
+# 
+# Note on the function of USE_HEXAGON_RPC:
 # - When building for Hexagon, this will build the Hexagon endpoint of the
 #   RPC server: the FastRPC skel library (with TVM runtime built into it),
 #   and the standalone RPC server for simulator.
@@ -91,7 +77,7 @@ if(NOT BUILD_FOR_HEXAGON AND NOT BUILD_FOR_ANDROID)
 endif()
 
 
-if(NOT USE_HEXAGON_DEVICE AND NOT USE_HEXAGON_RPC AND NOT BUILD_FOR_HEXAGON)
+if(NOT USE_HEXAGON)
   # If nothing related to Hexagon is enabled, add phony Hexagon codegen,
   # and some stuff needed by cpptests (this part is a temporary workaround
   # until e2e support for Hexagon is enabled).
@@ -104,6 +90,7 @@ if(NOT USE_HEXAGON_DEVICE AND NOT USE_HEXAGON_RPC AND NOT 
BUILD_FOR_HEXAGON)
   return()
 endif()
 
+# From here on, USE_HEXAGON is assumed to be TRUE.
 
 function(add_android_paths)
   get_hexagon_sdk_property("${USE_HEXAGON_SDK}" "${USE_HEXAGON_ARCH}"
@@ -132,10 +119,12 @@ function(add_hexagon_wrapper_paths)
   link_directories("${HEXAGON_TOOLCHAIN}/lib/iss")
 endfunction()
 
+
 # Common sources for TVM runtime with Hexagon support
-file_glob_append(RUNTIME_HEXAGON_COMMON_SRCS
+file_glob_append(RUNTIME_HEXAGON_SRCS
   "${TVMRT_SOURCE_DIR}/hexagon/hexagon_module.cc"
   "${TVMRT_SOURCE_DIR}/hexagon/hexagon/*.cc"
+  "${TVMRT_SOURCE_DIR}/hexagon/host/*.cc"
 )
 
 
@@ -154,61 +143,10 @@ if(BUILD_FOR_HEXAGON)
   # Add SDK and QuRT includes when building for Hexagon.
   include_directories(SYSTEM ${SDK_INCLUDE_DIRS} ${QURT_INCLUDE_DIRS})
 
-  list(APPEND RUNTIME_HEXAGON_SRCS ${RUNTIME_HEXAGON_COMMON_SRCS})
   set(USE_CUSTOM_LOGGING ON) # To use a custom logger
 endif()
 
 
-if(USE_HEXAGON_DEVICE)
-  function(invalid_device_value_for BUILD_TARGET)
-    message(SEND_ERROR
-      "USE_HEXAGON_DEVICE=${USE_HEXAGON_DEVICE} is not supported when "
-      "building for ${BUILD_TARGET}"
-    )
-  endfunction()
-
-  list(APPEND RUNTIME_HEXAGON_SRCS ${RUNTIME_HEXAGON_COMMON_SRCS})
-
-  if(BUILD_FOR_HOST)
-    if(NOT USE_HEXAGON_DEVICE STREQUAL "${PICK_SIM}")
-      invalid_device_value_for("host")
-    endif()
-    find_hexagon_toolchain()
-    add_hexagon_wrapper_paths()
-    file_glob_append(RUNTIME_HEXAGON_SRCS
-      "${TVMRT_SOURCE_DIR}/hexagon/android/*.cc"
-      "${TVMRT_SOURCE_DIR}/hexagon/android/sim/*.cc"
-    )
-    list(APPEND TVM_RUNTIME_LINKER_LIBS "-lwrapper")
-
-    ExternalProject_Add(sim_dev
-      SOURCE_DIR "${TVMRT_SOURCE_DIR}/hexagon/android/sim/driver"
-      CMAKE_ARGS
-        "-DCMAKE_C_COMPILER=${HEXAGON_TOOLCHAIN}/bin/hexagon-clang"
-        "-DCMAKE_CXX_COMPILER=${HEXAGON_TOOLCHAIN}/bin/hexagon-clang++"
-        "-DHEXAGON_ARCH=${USE_HEXAGON_ARCH}"
-      INSTALL_COMMAND "true"
-    )
-
-  elseif(BUILD_FOR_ANDROID)
-    if(NOT USE_HEXAGON_DEVICE STREQUAL "${PICK_HW}")
-      invalid_device_value_for("Android")
-    endif()
-    find_hexagon_toolchain()
-    add_android_paths()
-    file_glob_append(RUNTIME_HEXAGON_SRCS
-      "${TVMRT_SOURCE_DIR}/hexagon/android/*.cc"
-      "${TVMRT_SOURCE_DIR}/hexagon/android/target/*.cc"
-    )
-    # Hexagon runtime uses __android_log_print, which is in liblog.
-    list(APPEND TVM_RUNTIME_LINKER_LIBS dl log cdsprpc)
-
-  elseif(BUILD_FOR_HEXAGON)
-    invalid_device_value_for("Hexagon")
-  endif()
-endif()   # USE_HEXAGON_DEVICE
-
-
 if(USE_HEXAGON_RPC)
   function(build_rpc_idl)
     get_hexagon_sdk_property("${USE_HEXAGON_SDK}" "${USE_HEXAGON_ARCH}"
@@ -232,14 +170,11 @@ if(USE_HEXAGON_RPC)
     )
   endfunction()
 
-  list(APPEND RUNTIME_HEXAGON_SRCS ${RUNTIME_HEXAGON_COMMON_SRCS})
-
   if(BUILD_FOR_ANDROID)
     # Android part
     add_android_paths()
     build_rpc_idl()
     file_glob_append(RUNTIME_HEXAGON_SRCS
-      "${TVMRT_SOURCE_DIR}/hexagon/host/*.cc"
       "${TVMRT_SOURCE_DIR}/hexagon/rpc/android/*.cc"
     )
     # Add this file separately, because it's auto-generated, and glob won't
@@ -285,7 +220,6 @@ if(USE_HEXAGON_RPC)
     find_hexagon_toolchain()
     add_hexagon_wrapper_paths()
     file_glob_append(RUNTIME_HEXAGON_SRCS
-      "${TVMRT_SOURCE_DIR}/hexagon/host/*.cc"
       "${TVMRT_SOURCE_DIR}/hexagon/rpc/simulator/session.cc"
     )
     list(APPEND TVM_RUNTIME_LINKER_LIBS "-lwrapper")
diff --git a/cmake/modules/LibInfo.cmake b/cmake/modules/LibInfo.cmake
index b9da94aed4..eefa7036a0 100644
--- a/cmake/modules/LibInfo.cmake
+++ b/cmake/modules/LibInfo.cmake
@@ -71,7 +71,7 @@ function(add_lib_info src_file)
     TVM_INFO_USE_GRAPH_EXECUTOR_CUDA_GRAPH="${USE_GRAPH_EXECUTOR_CUDA_GRAPH}"
     TVM_INFO_USE_GRAPH_EXECUTOR="${USE_GRAPH_EXECUTOR}"
     TVM_INFO_USE_GTEST="${USE_GTEST}"
-    TVM_INFO_USE_HEXAGON_DEVICE="${USE_HEXAGON_DEVICE}"
+    TVM_INFO_USE_HEXAGON="${USE_HEXAGON}"
     TVM_INFO_USE_HEXAGON_RPC="${USE_HEXAGON_RPC}"
     TVM_INFO_USE_HEXAGON_SDK="${USE_HEXAGON_SDK}"
     TVM_INFO_USE_IOS_RPC="${USE_IOS_RPC}"
diff --git a/src/runtime/hexagon/README.md b/src/runtime/hexagon/README.md
index 6641637a0c..fed1d33e42 100644
--- a/src/runtime/hexagon/README.md
+++ b/src/runtime/hexagon/README.md
@@ -17,61 +17,55 @@
 
 # Hexagon backend runtime
 
-The Hexagon runtime is a part of the TVM runtime that facilitates 
communication between a host and a Hexagon device. There are two types of 
host/device arrangements that are supported:
-- X86/Linux host running Hexagon simulator,
-- Android/AArch64 host running on a physical device containing a Hexagon 
module (i.e. CSDP or ADSP).
+The Hexagon runtime implements the functionality necessary for executing ML
+models on Hexagon hardware (or emulation).
 
-The TVM runtime that contains Hexagon runtime is the one executing on host.  
In either case, there will need to be a separate TVM runtime (i.e.  the 
`libtvm_runtime.so` library) compiled for execution on Hexagon.
+The prerequisite is to have Hexagon SDK installed, version 4.0.0 or later.
 
-The prerequisite is to have Hexagon SDK installed, preferably version 3.5.0 or 
later. The Hexagon SDK can be downloaded from 
https://developer.qualcomm.com/software/hexagon-dsp-sdk.
+It is also recommended to use as recent version of LLVM as possible, version
+7.0.0 being the minimum (based on community feedback).
 
-It is also recommended to use as recent version of LLVM as possible, version 
7.0.0 being the minimum (based on community feedback).
+### Compiling TVM with support for Hexagon for host (x86)
 
-### Compiling TVM runtime for x86
-
-This will use Hexagon simulator, which is provided in the Hexagon SDK.
-
-When configuring TVM (cmake), set the following variables:
+TVM running on host can serve as a cross-compiler that produces machine code
+for Hexagon. To enable that, certain elements of both, the compiler and the
+runtime need to include Hexagon-specific functionality. For the compiler, it
+is code generation, and for the runtime, it is the ability to represent
+modules with Hexagon code. Since Hexagon codegen is based on LLVM, LLVM
+codegen needs to be enabled as well. The set of cmake options to enable
+Hexagon support is
 ```
 USE_LLVM=llvm-config
-USE_HEXAGON_DEVICE=sim
+USE_HEXAGON=ON
 USE_HEXAGON_SDK=/path/to/sdk
 ```
 
-You can then build the entire TVM with the usual command (e.g. `make`).
-
-### Compiling TVM runtime for Android
+### Compiling TVM runtime for non-x86
 
-This will use FastRPC mechanism to communicate between the AArch64 host and 
Hexagon.
+Aside from x86, there are two other platforms where support for Hexagon may
+be relevant. One of them is obviously Hexagon itself, the other one is
+Android. Neither of these platforms supports the compiler side of TVM, only
+runtime, and so the only compiler-related cmake option from the x86 build
+above can be omitted: USE_LLVM.
 
-When configuring TVM (cmake), set the following variables:
+Additionally, for Android, set the toolchain and target flags:
 ```
-USE_LLVM=llvm-config
-USE_HEXAGON_DEVICE=device
+ANDROID_ABI=aarch64-v8a
+ANDROID_PLATFORM=android-28
+CMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake
+USE_HEXAGON=ON
+USE_HEXAGON_ARCH=v65|v66|v68|v69
 USE_HEXAGON_SDK=/path/to/sdk
 ```
 
-You will need Android clang toolchain to compile the runtime.  It is provided 
in Android NDK r19 or newer.
-
-Set the C/C++ compiler to the Android clang for aarch64, and pass 
`-DCMAKE_CXX_FLAGS='-stdlib=libc++'` to the cmake command.
-
-Only build the `runtime` component of TVM (e.g. `make runtime`), building the 
entire TVM will not work.
-
-### Compiling TVM runtime for Hexagon
-
-The TVM runtime executing on Hexagon does not need to have support for Hexagon 
device in it (as it is only for communication between host and Hexagon device). 
In fact, it's only needed for basic services (like thread control), and so it 
should not contain support for any devices.
-
-When configuring TVM (cmake), set the following variables:
+Building for Hexagon requires setting the C/C++ compiler to `hexagon-clang/++`:
 ```
-USE_RPC=OFF
-USE_LLVM=OFF
-USE_HEXAGON_DEVICE=OFF
+CMAKE_C_COMPILER=hexagon-clang
+CMAKE_CXX_COMPILER=hexagon-clang++
+USE_HEXAGON=ON
+USE_HEXAGON_ARCH=v65|v66|v68|v69
 USE_HEXAGON_SDK=/path/to/sdk
 ```
 
-Please note that while suport for a Hexagon device is disabled, the Hexagon 
SDK is still needed and the path to it needs to be passed to cmake.
-
-Set the C/C++ compiler to `hexagon-clang` (included in the Hexagon SDK), and 
set `CMAKE_CXX_FLAGS='-stdlib=libc++'`.
-
-As in the case of Android, only build the `runtime` component (e.g.  `make 
runtime`).
+As mentioned before, only build the `runtime` component (e.g. `make runtime`).
 
diff --git a/src/runtime/hexagon/android/hexagon_device_api.cc 
b/src/runtime/hexagon/android/hexagon_device_api.cc
index ec50b4bf93..f80c7e245a 100644
--- a/src/runtime/hexagon/android/hexagon_device_api.cc
+++ b/src/runtime/hexagon/android/hexagon_device_api.cc
@@ -124,7 +124,7 @@ inline void HexagonDeviceAPI::FreeWorkspace(Device dev, 
void* ptr) {
   DeviceAPI::FreeWorkspace(dev, ptr);
 }
 
-TVM_REGISTER_GLOBAL("device_api.hexagon").set_body([](TVMArgs args, 
TVMRetValue* rv) {
+TVM_REGISTER_GLOBAL("device_api.hexagon.v1").set_body([](TVMArgs args, 
TVMRetValue* rv) {
   DeviceAPI* ptr = HexagonDeviceAPI::Global();
   *rv = ptr;
 });
diff --git a/src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc 
b/src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
index 3419c7e68b..5a7642abeb 100644
--- a/src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
+++ b/src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
@@ -227,6 +227,11 @@ 
TVM_REGISTER_GLOBAL("device_api.hexagon.free_nd").set_body([](TVMArgs args, TVMR
   *rv = static_cast<int32_t>(0);
 });
 
+TVM_REGISTER_GLOBAL("device_api.hexagon").set_body([](TVMArgs args, 
TVMRetValue* rv) {
+  DeviceAPI* ptr = HexagonDeviceAPIv2::Global();
+  *rv = static_cast<void*>(ptr);
+});
+
 TVM_REGISTER_GLOBAL("device_api.hexagon.v2").set_body([](TVMArgs args, 
TVMRetValue* rv) {
   DeviceAPI* ptr = HexagonDeviceAPIv2::Global();
   *rv = static_cast<void*>(ptr);
diff --git a/src/support/libinfo.cc b/src/support/libinfo.cc
index 0972713749..c6cf916ae8 100644
--- a/src/support/libinfo.cc
+++ b/src/support/libinfo.cc
@@ -59,8 +59,8 @@
 #define TVM_INFO_ROCM_PATH "NOT-FOUND"
 #endif
 
-#ifndef TVM_INFO_USE_HEXAGON_DEVICE
-#define TVM_INFO_USE_HEXAGON_DEVICE "NOT-FOUND"
+#ifndef TVM_INFO_USE_HEXAGON
+#define TVM_INFO_USE_HEXAGON "NOT-FOUND"
 #endif
 
 #ifndef TVM_INFO_USE_HEXAGON_SDK
@@ -264,7 +264,7 @@ TVM_DLL Map<String, String> GetLibInfo() {
       {"USE_GRAPH_EXECUTOR_CUDA_GRAPH", 
TVM_INFO_USE_GRAPH_EXECUTOR_CUDA_GRAPH},
       {"USE_GRAPH_EXECUTOR", TVM_INFO_USE_GRAPH_EXECUTOR},
       {"USE_GTEST", TVM_INFO_USE_GTEST},
-      {"USE_HEXAGON_DEVICE", TVM_INFO_USE_HEXAGON_DEVICE},
+      {"USE_HEXAGON", TVM_INFO_USE_HEXAGON},
       {"USE_HEXAGON_RPC", TVM_INFO_USE_HEXAGON_RPC},
       {"USE_HEXAGON_SDK", TVM_INFO_USE_HEXAGON_SDK},
       {"USE_IOS_RPC", TVM_INFO_USE_IOS_RPC},
diff --git a/tests/python/contrib/test_hexagon/test_launcher.md 
b/tests/python/contrib/test_hexagon/test_launcher.md
index 08bfd419ad..b9d9052685 100644
--- a/tests/python/contrib/test_hexagon/test_launcher.md
+++ b/tests/python/contrib/test_hexagon/test_launcher.md
@@ -63,7 +63,7 @@ cmake -DUSE_LLVM="path to `llvm/bin/llvm-config`" \
         -DCMAKE_CXX_FLAGS='-stdlib=libc++' \
         -DUSE_HEXAGON_SDK="path to Hexagon SDK" \
         -DUSE_HEXAGON_ARCH="choose from v65|v66|v68|v69" \
-        -DUSE_HEXAGON_DEVICE=sim ..
+        -DUSE_HEXAGON=ON ..
 ```
 
 ## Use Hexagon Docker Image
diff --git a/tests/scripts/task_config_build_hexagon.sh 
b/tests/scripts/task_config_build_hexagon.sh
index a9e073e61e..c298800fcd 100755
--- a/tests/scripts/task_config_build_hexagon.sh
+++ b/tests/scripts/task_config_build_hexagon.sh
@@ -30,8 +30,7 @@ echo set\(USE_MICRO ON\) >> config.cmake
 echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake
 echo set\(USE_LLVM "${CLANG_LLVM_HOME}/bin/llvm-config"\) >> config.cmake
 echo set\(CMAKE_CXX_COMPILER "${CLANG_LLVM_HOME}/bin/clang++"\) >> config.cmake
+echo set\(USE_HEXAGON "ON"\) >> config.cmake
 echo set\(USE_HEXAGON_SDK "${HEXAGON_SDK_PATH}"\) >> config.cmake
-echo set\(USE_HEXAGON_ARCH "v68"\) >> config.cmake
-echo set\(USE_HEXAGON_DEVICE "sim"\) >> config.cmake
 echo set\(USE_CCACHE OFF\) >> config.cmake
 echo set\(SUMMARIZE ON\) >> config.cmake

Reply via email to