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

tqchen 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 9e773927af [REFACTOR] Clarify shared support header ownership (#20693)
9e773927af is described below

commit 9e773927af0bc5ef153a3e417349e517ec8f15f8
Author: Tianqi Chen <[email protected]>
AuthorDate: Mon Oct 12 22:34:21 2026 -0400

    [REFACTOR] Clarify shared support header ownership (#20693)
    
    Expose shared byte streams, base64, environment access, ordered maps,
    and string escaping through public support headers and install them for
    runtime consumers. Replace the private utility header with FFI helpers
    and consumer-local parsing and process execution. Keep parent-specific
    support machinery private.
---
 CMakeLists.txt                                     |   2 +-
 apps/cpp_rpc/main.cc                               |  14 +-
 apps/cpp_rpc/rpc_env.cc                            |  41 +++-
 apps/cpp_rpc/rpc_server.cc                         |   7 +-
 apps/ios_rpc/tvmrpc/RPCArgs.mm                     |   8 +-
 {src => include/tvm}/support/base64.h              |   0
 {src => include/tvm}/support/bytes_io.h            |   0
 {src => include/tvm}/support/env.h                 |   0
 {src => include/tvm}/support/ordered_map.h         |   0
 {src => include/tvm}/support/str_escape.h          |   0
 src/backend/cuda/codegen/cuda_fallback_module.cc   |   3 +-
 src/backend/cuda/codegen/cuda_fallback_module.h    |   2 +-
 src/backend/cuda/codegen/ptx.cc                    |   2 -
 src/backend/cuda/runtime/cuda_module.cc            |   2 +-
 .../hexagon/codegen/hexagon_fallback_module.cc     |   3 +-
 .../hexagon/codegen/hexagon_fallback_module.h      |   2 +-
 src/backend/hexagon/runtime/hexagon_module.cc      |   2 +-
 src/backend/metal/codegen/metal_fallback_module.cc |   3 +-
 src/backend/metal/codegen/metal_fallback_module.h  |   2 +-
 src/backend/metal/runtime/metal_module.mm          |   2 +-
 .../opencl/codegen/opencl_fallback_module.cc       |   3 +-
 .../opencl/codegen/opencl_fallback_module.h        |   2 +-
 src/backend/opencl/runtime/opencl_device_api.cc    |   2 +-
 src/backend/opencl/runtime/opencl_module.cc        |   2 +-
 src/backend/rocm/codegen/rocm_fallback_module.cc   |   3 +-
 src/backend/rocm/codegen/rocm_fallback_module.h    |   2 +-
 src/backend/rocm/runtime/rocm_module.cc            |   2 +-
 src/backend/vulkan/codegen/build_vulkan.cc         |   2 +-
 src/backend/vulkan/codegen/spirv_utils.cc          |   4 +-
 .../vulkan/codegen/vulkan_fallback_module.cc       |   3 +-
 .../vulkan/codegen/vulkan_fallback_module.h        |   2 +-
 src/backend/vulkan/runtime/vulkan_device.cc        |   7 +-
 src/backend/vulkan/runtime/vulkan_instance.cc      |   6 +-
 src/backend/vulkan/runtime/vulkan_module.cc        |   2 +-
 src/backend/vulkan/runtime/vulkan_stream.cc        |   5 +-
 src/backend/vulkan/runtime/vulkan_wrapped_func.cc  |   2 +-
 src/backend/webgpu/codegen/codegen_webgpu.cc       |   2 +-
 .../webgpu/codegen/webgpu_fallback_module.cc       |   3 +-
 .../webgpu/codegen/webgpu_fallback_module.h        |   2 +-
 src/relax/backend/pattern_registry.cc              |   4 +-
 src/relax/transform/eliminate_common_subexpr.cc    |   5 +-
 src/relax/transform/rewrite_cuda_graph.cc          |   8 +-
 src/runtime/extra/contrib/clml/clml_runtime.cc     |   3 +-
 src/runtime/extra/contrib/coreml/coreml_runtime.mm |   2 +-
 src/runtime/extra/contrib/json/json_runtime.h      |   2 +-
 .../extra/contrib/tensorrt/tensorrt_runtime.cc     |   2 +-
 src/runtime/extra/disco/protocol.h                 |   4 +-
 src/runtime/rpc/rpc_endpoint.cc                    |   3 +-
 src/runtime/static_library.cc                      |   3 +-
 src/runtime/tensor.cc                              |   4 +-
 src/runtime/thread_pool.cc                         |   5 +-
 src/runtime/vm/const_loader_module.cc              |   3 +-
 src/runtime/vm/cuda/cuda_graph_builtin.cc          |   4 +-
 src/runtime/vm/executable.cc                       |   2 +-
 src/runtime/vm/params.cc                           |   3 +-
 src/runtime/vm/tensor_cache_support.cc             |   2 -
 src/s_tir/meta_schedule/database/database_utils.cc |   3 +-
 .../feature_extractor/per_store_feature.cc         |   4 +-
 .../schedule_rule/multi_level_tiling.cc            |   2 +-
 .../multi_level_tiling_tensor_core.cc              |   5 +-
 .../space_generator/space_generator.cc             |   2 +-
 src/s_tir/meta_schedule/utils.h                    |   5 +-
 src/s_tir/schedule/primitive/cache_index_helpers.h |   3 +-
 src/s_tir/transform/compact_tensor_region.cc       |   1 -
 src/s_tir/transform/inject_permuted_layout.cc      |   1 -
 src/s_tir/transform/inject_software_pipeline.cc    |   1 -
 .../transform/lower_cross_thread_reduction.cc      |   2 -
 src/script/printer/doc_printer.cc                  |  14 +-
 src/support/socket.h                               |   1 -
 src/support/utils.h                                | 231 ---------------------
 src/sym/iter_affine_map.cc                         |   5 +-
 src/target/codegen.cc                              |   3 +-
 src/target/llvm/canonicalizer/arm_aprofile.cc      |   7 +-
 src/target/source/source_module.cc                 |   2 +-
 src/target/target_kind.cc                          |   1 -
 src/tirx/transform/common_subexpr_elim.cc          |   3 +-
 web/emcc/webgpu_runtime.cc                         |   2 +-
 77 files changed, 146 insertions(+), 362 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c3bff01777..1b2c4d764e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -779,7 +779,7 @@ if (INSTALL_DEV)
   )
 else(INSTALL_DEV)
   install(
-    DIRECTORY "include/tvm/runtime/" DESTINATION "include/tvm/runtime"
+    DIRECTORY "include/tvm/runtime" "include/tvm/support" DESTINATION 
"include/tvm"
     FILES_MATCHING
     PATTERN "*.h"
     )
diff --git a/apps/cpp_rpc/main.cc b/apps/cpp_rpc/main.cc
index a349f66b92..363e03bae3 100644
--- a/apps/cpp_rpc/main.cc
+++ b/apps/cpp_rpc/main.cc
@@ -35,7 +35,6 @@
 #include <vector>
 
 #include "../../src/support/socket.h"
-#include "../../src/support/utils.h"
 #include "rpc_server.h"
 
 #if defined(_WIN32)
@@ -46,6 +45,12 @@ using namespace std;
 using namespace tvm::runtime;
 using namespace tvm::support;
 
+namespace {
+bool IsNumber(const std::string& str) {
+  return !str.empty() && str.find_first_not_of("0123456789") == 
std::string::npos;
+}
+}  // namespace
+
 static const string kUsage =
     "Command line usage\n"
     " server       - Start the server\n"
@@ -157,7 +162,12 @@ string GetCmdOption(int argc, char* argv[], string option, 
bool key = false) {
  * \return result of operation.
  */
 bool ValidateTracker(string& tracker) {
-  vector<string> list = Split(tracker, ':');
+  vector<string> list;
+  istringstream tracker_stream(tracker);
+  string field;
+  while (getline(tracker_stream, field, ':')) {
+    list.push_back(field);
+  }
   if ((list.size() != 2) || (!ValidateIP(list[0])) || (!IsNumber(list[1]))) {
     return false;
   }
diff --git a/apps/cpp_rpc/rpc_env.cc b/apps/cpp_rpc/rpc_env.cc
index aae7eec683..c2bf79c71d 100644
--- a/apps/cpp_rpc/rpc_env.cc
+++ b/apps/cpp_rpc/rpc_env.cc
@@ -26,15 +26,39 @@
 #include <tvm/ffi/function.h>
 #include <tvm/runtime/logging.h>
 
+#ifndef _WIN32
+#include <sys/wait.h>
+#endif
+
+#include <array>
+#include <cstdio>
 #include <filesystem>
 #include <fstream>
 #include <string>
 #include <system_error>
 #include <vector>
 
-#include "../../src/support/utils.h"
-
 namespace {
+int Execute(std::string cmd, std::string* err_msg) {
+  std::array<char, 128> buffer;
+  cmd += " 2>&1";
+#ifdef _WIN32
+  FILE* fd = _popen(cmd.c_str(), "r");
+#else
+  FILE* fd = popen(cmd.c_str(), "r");
+#endif
+  while (fgets(buffer.data(), buffer.size(), fd) != nullptr) {
+    *err_msg += buffer.data();
+  }
+#ifdef _WIN32
+  int status = _pclose(fd);
+  return status != 3 ? status : 255;
+#else
+  int status = pclose(fd);
+  return WIFEXITED(status) ? WEXITSTATUS(status) : 255;
+#endif
+}
+
 std::string GenerateUntarCommand(const std::string& tar_file, const 
std::string& output_dir) {
   std::string untar_cmd;
   untar_cmd.reserve(512);
@@ -197,7 +221,7 @@ void LinuxShared(const std::string output, const 
std::vector<std::string>& files
   }
   cmd += " " + options;
   std::string err_msg;
-  auto executed_status = support::Execute(cmd, &err_msg);
+  auto executed_status = Execute(cmd, &err_msg);
   if (executed_status) {
     TVM_FFI_THROW(InternalError) << err_msg;
   }
@@ -222,7 +246,7 @@ void WindowsShared(const std::string& output, const 
std::vector<std::string>& fi
   }
   cmd += " " + options;
   std::string err_msg;
-  const auto executed_status = support::Execute(cmd, &err_msg);
+  const auto executed_status = Execute(cmd, &err_msg);
   if (executed_status) {
     TVM_FFI_THROW(InternalError) << err_msg;
   }
@@ -245,15 +269,14 @@ void CreateShared(const std::string& output, const 
std::vector<std::string>& fil
 }
 
 std::string BuildSharedLibrary(std::string file) {
-  if (support::EndsWith(file, ".so") || support::EndsWith(file, ".dll") ||
-      support::EndsWith(file, ".dylib")) {
+  if (file.ends_with(".so") || file.ends_with(".dll") || 
file.ends_with(".dylib")) {
     return file;
   }
 
   std::string file_name = file + ".so";
-  if (support::EndsWith(file, ".o")) {
+  if (file.ends_with(".o")) {
     CreateShared(file_name, {file});
-  } else if (support::EndsWith(file, ".tar")) {
+  } else if (file.ends_with(".tar")) {
     const std::string tmp_dir = "./rpc/tmp/";
     std::error_code ec;
     std::filesystem::create_directories(tmp_dir, ec);
@@ -269,7 +292,7 @@ std::string BuildSharedLibrary(std::string file) {
     const std::string cmd = GenerateUntarCommand(file, tmp_dir);
 
     std::string err_msg;
-    const int executed_status = support::Execute(cmd, &err_msg);
+    const int executed_status = Execute(cmd, &err_msg);
     if (executed_status) {
       TVM_FFI_THROW(InternalError) << err_msg;
     }
diff --git a/apps/cpp_rpc/rpc_server.cc b/apps/cpp_rpc/rpc_server.cc
index db9d1fb82b..ba52687197 100644
--- a/apps/cpp_rpc/rpc_server.cc
+++ b/apps/cpp_rpc/rpc_server.cc
@@ -50,6 +50,11 @@ using namespace std::chrono;
 
 namespace tvm {
 namespace runtime {
+namespace {
+bool IsNumber(const std::string& str) {
+  return !str.empty() && str.find_first_not_of("0123456789") == 
std::string::npos;
+}
+}  // namespace
 
 #ifdef __ANDROID__
 static std::string getNextString(std::stringstream* iss) {
@@ -332,7 +337,7 @@ class RPCServer {
     size_t pos = opts.rfind(option);
     if (pos != std::string::npos) {
       const std::string cmd = opts.substr(pos + option.size());
-      TVM_FFI_ICHECK(support::IsNumber(cmd)) << "Timeout is not valid";
+      TVM_FFI_ICHECK(IsNumber(cmd)) << "Timeout is not valid";
       return std::stoi(cmd);
     }
     return 0;
diff --git a/apps/ios_rpc/tvmrpc/RPCArgs.mm b/apps/ios_rpc/tvmrpc/RPCArgs.mm
index 5368ac6178..43b52c87fb 100644
--- a/apps/ios_rpc/tvmrpc/RPCArgs.mm
+++ b/apps/ios_rpc/tvmrpc/RPCArgs.mm
@@ -22,12 +22,17 @@
 #import <Foundation/Foundation.h>
 
 #import "../../../src/support/socket.h"
-#import "../../../src/support/utils.h"
 
 #import <string>
 
 using std::string;
 
+namespace {
+bool IsNumber(const std::string& str) {
+  return !str.empty() && str.find_first_not_of("0123456789") == 
std::string::npos;
+}
+}  // namespace
+
 const char* kUsage =
     "\n"
     "iOS tvmrpc application supported flags:\n"
@@ -126,7 +131,6 @@ void update_rpc_args(int argc, char* argv[]) {
   restore_from_cache();
   RPCArgs_cpp& args = g_rpc_args;
 
-  using tvm::support::IsNumber;
   using tvm::support::ValidateIP;
   constexpr int MAX_PORT_NUM = 65535;
 
diff --git a/src/support/base64.h b/include/tvm/support/base64.h
similarity index 100%
rename from src/support/base64.h
rename to include/tvm/support/base64.h
diff --git a/src/support/bytes_io.h b/include/tvm/support/bytes_io.h
similarity index 100%
rename from src/support/bytes_io.h
rename to include/tvm/support/bytes_io.h
diff --git a/src/support/env.h b/include/tvm/support/env.h
similarity index 100%
rename from src/support/env.h
rename to include/tvm/support/env.h
diff --git a/src/support/ordered_map.h b/include/tvm/support/ordered_map.h
similarity index 100%
rename from src/support/ordered_map.h
rename to include/tvm/support/ordered_map.h
diff --git a/src/support/str_escape.h b/include/tvm/support/str_escape.h
similarity index 100%
rename from src/support/str_escape.h
rename to include/tvm/support/str_escape.h
diff --git a/src/backend/cuda/codegen/cuda_fallback_module.cc 
b/src/backend/cuda/codegen/cuda_fallback_module.cc
index 3354fcec6b..7e3f9ba977 100644
--- a/src/backend/cuda/codegen/cuda_fallback_module.cc
+++ b/src/backend/cuda/codegen/cuda_fallback_module.cc
@@ -31,12 +31,11 @@
 #include <tvm/ffi/container/array.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/cuda/codegen/cuda_fallback_module.h 
b/src/backend/cuda/codegen/cuda_fallback_module.h
index 0ceeec2054..c8dbb0c3c7 100644
--- a/src/backend/cuda/codegen/cuda_fallback_module.h
+++ b/src/backend/cuda/codegen/cuda_fallback_module.h
@@ -35,11 +35,11 @@
 #include <tvm/ffi/container/map.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/backend/cuda/codegen/ptx.cc b/src/backend/cuda/codegen/ptx.cc
index 42f2cc5068..6ffb43b21e 100644
--- a/src/backend/cuda/codegen/ptx.cc
+++ b/src/backend/cuda/codegen/ptx.cc
@@ -31,8 +31,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../../support/utils.h"
-
 namespace tvm {
 namespace codegen {
 
diff --git a/src/backend/cuda/runtime/cuda_module.cc 
b/src/backend/cuda/runtime/cuda_module.cc
index e3fa272118..400dab4b02 100644
--- a/src/backend/cuda/runtime/cuda_module.cc
+++ b/src/backend/cuda/runtime/cuda_module.cc
@@ -33,6 +33,7 @@
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 
 #include <array>
 #include <memory>
@@ -43,7 +44,6 @@
 
 #include "../../../runtime/metadata.h"
 #include "../../../runtime/pack_args.h"
-#include "../../../support/bytes_io.h"
 #include "../launch/launch_config.h"
 #include "../launch/launch_plan.h"
 
diff --git a/src/backend/hexagon/codegen/hexagon_fallback_module.cc 
b/src/backend/hexagon/codegen/hexagon_fallback_module.cc
index 1101a4810e..e5417f0419 100644
--- a/src/backend/hexagon/codegen/hexagon_fallback_module.cc
+++ b/src/backend/hexagon/codegen/hexagon_fallback_module.cc
@@ -29,12 +29,11 @@
 
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/hexagon/codegen/hexagon_fallback_module.h 
b/src/backend/hexagon/codegen/hexagon_fallback_module.h
index cd7fcc2358..6134e43d08 100644
--- a/src/backend/hexagon/codegen/hexagon_fallback_module.h
+++ b/src/backend/hexagon/codegen/hexagon_fallback_module.h
@@ -36,11 +36,11 @@
 #include <tvm/ffi/container/variant.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/backend/hexagon/runtime/hexagon_module.cc 
b/src/backend/hexagon/runtime/hexagon_module.cc
index 0ffd887d7b..24e911da1c 100644
--- a/src/backend/hexagon/runtime/hexagon_module.cc
+++ b/src/backend/hexagon/runtime/hexagon_module.cc
@@ -36,13 +36,13 @@
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 #include <vector>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/bytes_io.h"
 
 namespace tvm {
 namespace runtime {
diff --git a/src/backend/metal/codegen/metal_fallback_module.cc 
b/src/backend/metal/codegen/metal_fallback_module.cc
index 6637e018f9..76c30c0e25 100644
--- a/src/backend/metal/codegen/metal_fallback_module.cc
+++ b/src/backend/metal/codegen/metal_fallback_module.cc
@@ -29,12 +29,11 @@
 
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/metal/codegen/metal_fallback_module.h 
b/src/backend/metal/codegen/metal_fallback_module.h
index 7a2f2925fb..4d8ed0eae6 100644
--- a/src/backend/metal/codegen/metal_fallback_module.h
+++ b/src/backend/metal/codegen/metal_fallback_module.h
@@ -35,11 +35,11 @@
 #include <tvm/ffi/container/map.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/backend/metal/runtime/metal_module.mm 
b/src/backend/metal/runtime/metal_module.mm
index 9df3cca9b9..3dbe81d58f 100644
--- a/src/backend/metal/runtime/metal_module.mm
+++ b/src/backend/metal/runtime/metal_module.mm
@@ -30,6 +30,7 @@
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/logging.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 #include <array>
 #include <mutex>
@@ -40,7 +41,6 @@
 #include "../../../runtime/launch_param.h"
 #include "../../../runtime/metadata.h"
 #include "../../../runtime/pack_args.h"
-#include "../../../support/bytes_io.h"
 #include "metal_common.h"
 
 #if (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED 
>= 260000) || \
diff --git a/src/backend/opencl/codegen/opencl_fallback_module.cc 
b/src/backend/opencl/codegen/opencl_fallback_module.cc
index 40d6dea2a0..8d011ad24c 100644
--- a/src/backend/opencl/codegen/opencl_fallback_module.cc
+++ b/src/backend/opencl/codegen/opencl_fallback_module.cc
@@ -30,12 +30,11 @@
 
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/opencl/codegen/opencl_fallback_module.h 
b/src/backend/opencl/codegen/opencl_fallback_module.h
index 4700367328..6f1287abc0 100644
--- a/src/backend/opencl/codegen/opencl_fallback_module.h
+++ b/src/backend/opencl/codegen/opencl_fallback_module.h
@@ -35,11 +35,11 @@
 #include <tvm/ffi/container/map.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/backend/opencl/runtime/opencl_device_api.cc 
b/src/backend/opencl/runtime/opencl_device_api.cc
index 04e4301bb0..cbd9cf0519 100644
--- a/src/backend/opencl/runtime/opencl_device_api.cc
+++ b/src/backend/opencl/runtime/opencl_device_api.cc
@@ -24,10 +24,10 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/logging.h>
 #include <tvm/runtime/timer.h>
+#include <tvm/support/env.h>
 
 #include <sstream>
 
-#include "../../../support/env.h"
 #include "opencl_common.h"
 
 #ifdef OPENCL_ENABLE_HOST_PTR
diff --git a/src/backend/opencl/runtime/opencl_module.cc 
b/src/backend/opencl/runtime/opencl_module.cc
index 13380f9412..1babfbf207 100644
--- a/src/backend/opencl/runtime/opencl_module.cc
+++ b/src/backend/opencl/runtime/opencl_module.cc
@@ -29,6 +29,7 @@
 #include <tvm/ffi/cast.h>
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <string>
@@ -36,7 +37,6 @@
 #include <vector>
 
 #include "../../../runtime/launch_param.h"
-#include "../../../support/bytes_io.h"
 #include "opencl_common.h"
 #include "source_utils.h"
 
diff --git a/src/backend/rocm/codegen/rocm_fallback_module.cc 
b/src/backend/rocm/codegen/rocm_fallback_module.cc
index 4d6164b0df..f40ba56f18 100644
--- a/src/backend/rocm/codegen/rocm_fallback_module.cc
+++ b/src/backend/rocm/codegen/rocm_fallback_module.cc
@@ -29,12 +29,11 @@
 
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/rocm/codegen/rocm_fallback_module.h 
b/src/backend/rocm/codegen/rocm_fallback_module.h
index fe65d80630..1e88d506f0 100644
--- a/src/backend/rocm/codegen/rocm_fallback_module.h
+++ b/src/backend/rocm/codegen/rocm_fallback_module.h
@@ -35,11 +35,11 @@
 #include <tvm/ffi/container/map.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/backend/rocm/runtime/rocm_module.cc 
b/src/backend/rocm/runtime/rocm_module.cc
index df68d86e4d..148089d76e 100644
--- a/src/backend/rocm/runtime/rocm_module.cc
+++ b/src/backend/rocm/runtime/rocm_module.cc
@@ -30,6 +30,7 @@
 #include <tvm/ffi/extra/c_env_api.h>
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 
 #include <array>
 #include <mutex>
@@ -39,7 +40,6 @@
 #include "../../../runtime/launch_param.h"
 #include "../../../runtime/metadata.h"
 #include "../../../runtime/pack_args.h"
-#include "../../../support/bytes_io.h"
 #include "rocm_common.h"
 
 namespace tvm {
diff --git a/src/backend/vulkan/codegen/build_vulkan.cc 
b/src/backend/vulkan/codegen/build_vulkan.cc
index 8fc846d1e3..7abbf85d2d 100644
--- a/src/backend/vulkan/codegen/build_vulkan.cc
+++ b/src/backend/vulkan/codegen/build_vulkan.cc
@@ -23,11 +23,11 @@
  */
 
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
 #include "../../../target/build_common.h"
 #include "../runtime/spirv_shader.h"
 #include "spirv_utils.h"
diff --git a/src/backend/vulkan/codegen/spirv_utils.cc 
b/src/backend/vulkan/codegen/spirv_utils.cc
index c23515aa29..56b7dab88b 100644
--- a/src/backend/vulkan/codegen/spirv_utils.cc
+++ b/src/backend/vulkan/codegen/spirv_utils.cc
@@ -25,6 +25,7 @@
 #include "spirv_utils.h"
 
 #include <tvm/ir/function.h>
+#include <tvm/support/env.h>
 
 #if TVM_ENABLE_SPIRV
 #include <libspirv.h>
@@ -39,7 +40,6 @@
 #include <sstream>
 #include <vector>
 
-#include "../../../support/utils.h"
 #include "../runtime/spirv_shader.h"
 
 namespace tvm {
@@ -157,7 +157,7 @@ std::pair<std::unordered_map<std::string, 
runtime::SPIRVShader>, std::string> Lo
       }
     }
 
-    if (!support::BoolEnvironmentVar("TVM_VULKAN_DISABLE_SHADER_VALIDATION")) {
+    if (!support::GetEnv<bool>("TVM_VULKAN_DISABLE_SHADER_VALIDATION", false)) 
{
       spirv_tools.ValidateShader(shader.data);
     }
 
diff --git a/src/backend/vulkan/codegen/vulkan_fallback_module.cc 
b/src/backend/vulkan/codegen/vulkan_fallback_module.cc
index b258de0e95..28cc6c5134 100644
--- a/src/backend/vulkan/codegen/vulkan_fallback_module.cc
+++ b/src/backend/vulkan/codegen/vulkan_fallback_module.cc
@@ -30,12 +30,11 @@
 
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/vulkan/codegen/vulkan_fallback_module.h 
b/src/backend/vulkan/codegen/vulkan_fallback_module.h
index cf38361e61..026ec69d56 100644
--- a/src/backend/vulkan/codegen/vulkan_fallback_module.h
+++ b/src/backend/vulkan/codegen/vulkan_fallback_module.h
@@ -35,11 +35,11 @@
 #include <tvm/ffi/container/map.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/backend/vulkan/runtime/vulkan_device.cc 
b/src/backend/vulkan/runtime/vulkan_device.cc
index 3592854bf5..a9124256b6 100644
--- a/src/backend/vulkan/runtime/vulkan_device.cc
+++ b/src/backend/vulkan/runtime/vulkan_device.cc
@@ -19,12 +19,13 @@
 
 #include "vulkan_device.h"
 
+#include <tvm/support/env.h>
+
 #include <algorithm>
 #include <mutex>
 #include <unordered_map>
 #include <utility>
 
-#include "../../../support/utils.h"
 #include "vulkan_common.h"
 #include "vulkan_device.h"
 #include "vulkan_device_api.h"
@@ -125,14 +126,14 @@ VulkanDeviceProperties::VulkanDeviceProperties(const 
VulkanInstance& instance,
   // be disabled based on an environment variable.
   supports_push_descriptor = device.HasExtension("VK_KHR_push_descriptor") &&
                              
device.HasExtension("VK_KHR_descriptor_update_template") &&
-                             
!support::BoolEnvironmentVar("TVM_VULKAN_DISABLE_PUSH_DESCRIPTOR");
+                             
!support::GetEnv<bool>("TVM_VULKAN_DISABLE_PUSH_DESCRIPTOR", false);
 
   // Support is available based on these extensions, but allow it to
   // be disabled based on an environment variable.
   supports_dedicated_allocation =
       device.HasExtension("VK_KHR_get_memory_requirements2") &&
       device.HasExtension("VK_KHR_dedicated_allocation") &&
-      !support::BoolEnvironmentVar("TVM_VULKAN_DISABLE_DEDICATED_ALLOCATION");
+      !support::GetEnv<bool>("TVM_VULKAN_DISABLE_DEDICATED_ALLOCATION", false);
 
   supports_integer_dot_product = 
device.HasExtension("VK_KHR_shader_integer_dot_product");
 
diff --git a/src/backend/vulkan/runtime/vulkan_instance.cc 
b/src/backend/vulkan/runtime/vulkan_instance.cc
index 0b375c7118..4743872236 100644
--- a/src/backend/vulkan/runtime/vulkan_instance.cc
+++ b/src/backend/vulkan/runtime/vulkan_instance.cc
@@ -20,11 +20,11 @@
 #include "vulkan_instance.h"
 
 #include <tvm/runtime/logging.h>
+#include <tvm/support/env.h>
 
 #include <cstdlib>
 #include <utility>
 
-#include "../../../support/utils.h"
 #include "vulkan_common.h"
 
 namespace tvm {
@@ -35,7 +35,7 @@ VulkanInstance::VulkanInstance() {
   const auto layers = []() {
     std::vector<const char*> layers;
 
-    if (support::BoolEnvironmentVar("TVM_VULKAN_ENABLE_VALIDATION_LAYERS")) {
+    if (support::GetEnv<bool>("TVM_VULKAN_ENABLE_VALIDATION_LAYERS", false)) {
       uint32_t inst_layer_prop_count;
       VULKAN_CALL(vkEnumerateInstanceLayerProperties(&inst_layer_prop_count, 
nullptr));
       std::vector<VkLayerProperties> inst_layer_prop(inst_layer_prop_count);
@@ -63,7 +63,7 @@ VulkanInstance::VulkanInstance() {
 
     // Check if RGP support is needed. If needed, enable VK_EXT_debug_utils 
extension for
     // inserting debug labels into the queue.
-    if (support::BoolEnvironmentVar("TVM_USE_AMD_RGP")) {
+    if (support::GetEnv<bool>("TVM_USE_AMD_RGP", false)) {
       LOG(INFO) << "Push VK_EXT_debug_utils";
       required_extensions.push_back("VK_EXT_debug_utils");
     }
diff --git a/src/backend/vulkan/runtime/vulkan_module.cc 
b/src/backend/vulkan/runtime/vulkan_module.cc
index 7aa5085a79..cd04880297 100644
--- a/src/backend/vulkan/runtime/vulkan_module.cc
+++ b/src/backend/vulkan/runtime/vulkan_module.cc
@@ -27,12 +27,12 @@
  */
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
 #include "spirv_shader.h"
 #include "vulkan_wrapped_func.h"
 
diff --git a/src/backend/vulkan/runtime/vulkan_stream.cc 
b/src/backend/vulkan/runtime/vulkan_stream.cc
index 96d773c06d..5c631cf6bc 100644
--- a/src/backend/vulkan/runtime/vulkan_stream.cc
+++ b/src/backend/vulkan/runtime/vulkan_stream.cc
@@ -19,7 +19,8 @@
 
 #include "vulkan_stream.h"
 
-#include "../../../support/utils.h"
+#include <tvm/support/env.h>
+
 #include "vulkan_device.h"
 
 namespace tvm {
@@ -57,7 +58,7 @@ VulkanStream::VulkanStream(const VulkanDevice* device)
   cb_begin.pInheritanceInfo = nullptr;
   VULKAN_CALL(vkBeginCommandBuffer(state_->cmd_buffer_, &cb_begin));
 
-  if (support::BoolEnvironmentVar("TVM_USE_AMD_RGP")) {
+  if (support::GetEnv<bool>("TVM_USE_AMD_RGP", false)) {
     profiler_ = new AmdRgpProfiler(device_);
   }
 }
diff --git a/src/backend/vulkan/runtime/vulkan_wrapped_func.cc 
b/src/backend/vulkan/runtime/vulkan_wrapped_func.cc
index ed100379e1..6f3bce6d3e 100644
--- a/src/backend/vulkan/runtime/vulkan_wrapped_func.cc
+++ b/src/backend/vulkan/runtime/vulkan_wrapped_func.cc
@@ -20,11 +20,11 @@
 #include "vulkan_wrapped_func.h"
 
 #include <tvm/ffi/cast.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <utility>
 
-#include "../../../support/bytes_io.h"
 #include "vulkan_device_api.h"
 
 namespace tvm {
diff --git a/src/backend/webgpu/codegen/codegen_webgpu.cc 
b/src/backend/webgpu/codegen/codegen_webgpu.cc
index cabdb1e7aa..3df9fa02db 100644
--- a/src/backend/webgpu/codegen/codegen_webgpu.cc
+++ b/src/backend/webgpu/codegen/codegen_webgpu.cc
@@ -27,6 +27,7 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/ir/function.h>
 #include <tvm/ir/prim/op.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/gpu_thread_tag.h>
 #include <tvm/support/io.h>
 #include <tvm/tirx/analysis.h>
@@ -47,7 +48,6 @@
 
 #include "../../../runtime/metadata.h"
 #include "../../../runtime/thread_storage_scope.h"
-#include "../../../support/bytes_io.h"
 #include "../../../sym/pattern_match.h"
 #include "../../../target/build_common.h"
 #include "webgpu_fallback_module.h"
diff --git a/src/backend/webgpu/codegen/webgpu_fallback_module.cc 
b/src/backend/webgpu/codegen/webgpu_fallback_module.cc
index 3192785e87..814e65ffaf 100644
--- a/src/backend/webgpu/codegen/webgpu_fallback_module.cc
+++ b/src/backend/webgpu/codegen/webgpu_fallback_module.cc
@@ -35,13 +35,12 @@
 #include <tvm/ffi/extra/json.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/bytes_io.h>
 
 #include <sstream>
 #include <string>
 #include <utility>
 
-#include "../../../support/bytes_io.h"
-
 namespace tvm {
 namespace target {
 
diff --git a/src/backend/webgpu/codegen/webgpu_fallback_module.h 
b/src/backend/webgpu/codegen/webgpu_fallback_module.h
index 3eeebc87ac..da12b39ea6 100644
--- a/src/backend/webgpu/codegen/webgpu_fallback_module.h
+++ b/src/backend/webgpu/codegen/webgpu_fallback_module.h
@@ -35,11 +35,11 @@
 #include <tvm/ffi/container/map.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/ffi/function.h>
+#include <tvm/support/env.h>
 
 #include <utility>
 
 #include "../../../runtime/metadata.h"
-#include "../../../support/env.h"
 
 namespace tvm {
 namespace target {
diff --git a/src/relax/backend/pattern_registry.cc 
b/src/relax/backend/pattern_registry.cc
index c11ef6a35e..06555bb57f 100644
--- a/src/relax/backend/pattern_registry.cc
+++ b/src/relax/backend/pattern_registry.cc
@@ -21,8 +21,6 @@
 
 #include <tvm/ffi/reflection/registry.h>
 
-#include "../../support/utils.h"
-
 namespace tvm {
 namespace relax {
 namespace backend {
@@ -52,7 +50,7 @@ ffi::Array<FusionPattern> GetPatternsWithPrefix(const 
ffi::String& prefix) {
   auto* table = GetRegistryTable();
   ffi::Array<FusionPattern> result;
   for (auto it = table->rbegin(); it != table->rend(); ++it) {
-    if (support::StartsWith((*it)->name, prefix.data())) {
+    if ((*it)->name.starts_with(prefix.data())) {
       result.push_back(*it);
     }
   }
diff --git a/src/relax/transform/eliminate_common_subexpr.cc 
b/src/relax/transform/eliminate_common_subexpr.cc
index b12463aaa7..2f198362ac 100644
--- a/src/relax/transform/eliminate_common_subexpr.cc
+++ b/src/relax/transform/eliminate_common_subexpr.cc
@@ -24,6 +24,7 @@
  *
  * Currently it removes common subexpressions within a Function.
  */
+#include <tvm/ffi/base_details.h>
 #include <tvm/ffi/cast.h>
 #include <tvm/ffi/extra/structural_equal.h>
 #include <tvm/ffi/extra/structural_hash.h>
@@ -35,8 +36,6 @@
 #include <tvm/relax/utils.h>
 #include <tvm/runtime/logging.h>
 
-#include "../../support/utils.h"
-
 namespace tvm {
 namespace relax {
 namespace {
@@ -82,7 +81,7 @@ template <>
 struct std::hash<tvm::relax::ReplacementKey> {
   std::size_t operator()(const tvm::relax::ReplacementKey& key) const {
     tvm::ffi::StructuralHash hasher;
-    return tvm::support::HashCombine(hasher(key.bound_value), 
hasher(key.match_cast));
+    return tvm::ffi::details::StableHashCombine(hasher(key.bound_value), 
hasher(key.match_cast));
   }
 };
 
diff --git a/src/relax/transform/rewrite_cuda_graph.cc 
b/src/relax/transform/rewrite_cuda_graph.cc
index 4cdd04df2a..3ad746c44a 100644
--- a/src/relax/transform/rewrite_cuda_graph.cc
+++ b/src/relax/transform/rewrite_cuda_graph.cc
@@ -66,7 +66,6 @@
 
 #include "../../support/arena.h"
 #include "../../support/ordered_set.h"
-#include "../../support/utils.h"
 namespace tvm {
 namespace relax {
 
@@ -384,7 +383,7 @@ class CUDAGraphRewritePlanner : public ExprVisitor {
         return false;
       }
       if (const auto* extern_func = call->op.as<ExternFuncNode>();
-          extern_func != nullptr && 
support::StartsWith(extern_func->global_symbol, "vm.builtin")) {
+          extern_func != nullptr && 
extern_func->global_symbol.starts_with("vm.builtin")) {
         return false;
       }
       return true;
@@ -401,9 +400,8 @@ class CUDAGraphRewritePlanner : public ExprVisitor {
           return true;
         }
         if (const auto* op = call->op.as<OpNode>()) {
-          return !support::StartsWith(op->name, "relax.memory") &&
-                 !support::StartsWith(op->name, "relax.builtin") && op->name 
!= "relax.reshape" &&
-                 !ffi::GetRef<Op>(op).same_as(null_value_op) &&
+          return !op->name.starts_with("relax.memory") && 
!op->name.starts_with("relax.builtin") &&
+                 op->name != "relax.reshape" && 
!ffi::GetRef<Op>(op).same_as(null_value_op) &&
                  !ffi::GetRef<Op>(op).same_as(call_builtin_with_ctx_op);
         }
         return false;
diff --git a/src/runtime/extra/contrib/clml/clml_runtime.cc 
b/src/runtime/extra/contrib/clml/clml_runtime.cc
index 9c7d24635a..e9f029afd9 100644
--- a/src/runtime/extra/contrib/clml/clml_runtime.cc
+++ b/src/runtime/extra/contrib/clml/clml_runtime.cc
@@ -26,12 +26,11 @@
 #include <tvm/ffi/container/tensor.h>
 #include <tvm/ffi/extra/json.h>
 #include <tvm/ffi/reflection/registry.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <unordered_map>
 
-#include "../../../../support/bytes_io.h"
-
 #ifdef TVM_GRAPH_EXECUTOR_CLML
 #include "clml_memory_planner.h"
 #include "clml_utils.h"
diff --git a/src/runtime/extra/contrib/coreml/coreml_runtime.mm 
b/src/runtime/extra/contrib/coreml/coreml_runtime.mm
index 490218c0e6..af24e9496c 100644
--- a/src/runtime/extra/contrib/coreml/coreml_runtime.mm
+++ b/src/runtime/extra/contrib/coreml/coreml_runtime.mm
@@ -24,7 +24,7 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/logging.h>
 
-#include "../../../../support/bytes_io.h"
+#include <tvm/support/bytes_io.h>
 #include "coreml_runtime.h"
 
 namespace tvm {
diff --git a/src/runtime/extra/contrib/json/json_runtime.h 
b/src/runtime/extra/contrib/json/json_runtime.h
index 2fc3ec2f63..f53390c114 100644
--- a/src/runtime/extra/contrib/json/json_runtime.h
+++ b/src/runtime/extra/contrib/json/json_runtime.h
@@ -29,6 +29,7 @@
 #include <tvm/ffi/extra/json.h>
 #include <tvm/ffi/extra/module.h>
 #include <tvm/runtime/tensor.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <cstddef>
@@ -40,7 +41,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../../../support/bytes_io.h"
 #include "json_node.h"
 
 namespace tvm {
diff --git a/src/runtime/extra/contrib/tensorrt/tensorrt_runtime.cc 
b/src/runtime/extra/contrib/tensorrt/tensorrt_runtime.cc
index bb0a840a71..3fccb2d058 100644
--- a/src/runtime/extra/contrib/tensorrt/tensorrt_runtime.cc
+++ b/src/runtime/extra/contrib/tensorrt/tensorrt_runtime.cc
@@ -27,6 +27,7 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/logging.h>
 #include <tvm/runtime/tensor.h>
+#include <tvm/support/env.h>
 #include <tvm/support/file_utils.h>
 
 #include <cstdint>
@@ -38,7 +39,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../../../support/env.h"
 #include "../json/json_node.h"
 #include "../json/json_runtime.h"
 
diff --git a/src/runtime/extra/disco/protocol.h 
b/src/runtime/extra/disco/protocol.h
index 036c91ecb9..ca85e7f6e1 100644
--- a/src/runtime/extra/disco/protocol.h
+++ b/src/runtime/extra/disco/protocol.h
@@ -23,6 +23,8 @@
 #include <tvm/ffi/extra/serialization.h>
 #include <tvm/runtime/base.h>
 #include <tvm/runtime/disco/session.h>
+#include <tvm/support/base64.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 #include <tvm/support/serializer.h>
 
@@ -33,8 +35,6 @@
 #include <vector>
 
 #include "../../../support/arena.h"
-#include "../../../support/base64.h"
-#include "../../../support/bytes_io.h"
 #include "../../rpc/minrpc/rpc_reference.h"
 
 namespace tvm {
diff --git a/src/runtime/rpc/rpc_endpoint.cc b/src/runtime/rpc/rpc_endpoint.cc
index 822f6923d7..cd7b7abccd 100644
--- a/src/runtime/rpc/rpc_endpoint.cc
+++ b/src/runtime/rpc/rpc_endpoint.cc
@@ -42,7 +42,6 @@
 
 #include "../../support/arena.h"
 #include "../../support/ring_buffer.h"
-#include "../../support/utils.h"
 #include "rpc_local_session.h"
 
 namespace tvm {
@@ -474,7 +473,7 @@ class RPCEndpoint::EventHandler : public support::Stream {
       // switch to the state before sending exception.
       this->SwitchToState(kRecvPacketNumBytes);
       ffi::String msg = args[0].cast<ffi::String>();
-      if (support::StartsWith(msg, "RPCSessionTimeoutError: ")) {
+      if (msg.starts_with("RPCSessionTimeoutError: ")) {
         TVM_FFI_THROW(RPCSessionTimeoutError) << msg;
       } else {
         msg = "RPCError: Error caught from RPC call:\n" + msg;
diff --git a/src/runtime/static_library.cc b/src/runtime/static_library.cc
index 97f77f09a4..ec49b34d53 100644
--- a/src/runtime/static_library.cc
+++ b/src/runtime/static_library.cc
@@ -30,14 +30,13 @@
 #include <tvm/ffi/memory.h>
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/logging.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/file_utils.h>
 #include <tvm/support/io.h>
 #include <tvm/support/serializer.h>
 
 #include <iostream>
 
-#include "../support/bytes_io.h"
-
 namespace tvm {
 namespace runtime {
 
diff --git a/src/runtime/tensor.cc b/src/runtime/tensor.cc
index b04c13b47c..3a39cf36a8 100644
--- a/src/runtime/tensor.cc
+++ b/src/runtime/tensor.cc
@@ -28,12 +28,12 @@
 #include <tvm/runtime/base.h>
 #include <tvm/runtime/device_api.h>
 #include <tvm/runtime/tensor.h>
+#include <tvm/support/base64.h>
+#include <tvm/support/bytes_io.h>
 
 #include <algorithm>
 #include <limits>
 
-#include "../support/base64.h"
-#include "../support/bytes_io.h"
 #include "tvm/ffi/dtype.h"
 
 namespace tvm {
diff --git a/src/runtime/thread_pool.cc b/src/runtime/thread_pool.cc
index c7e0b9979e..573603ddcf 100644
--- a/src/runtime/thread_pool.cc
+++ b/src/runtime/thread_pool.cc
@@ -43,13 +43,14 @@
 #include <thread>
 #include <vector>
 
-#include "../support/utils.h"
 const constexpr int kL1CacheBytes = 64;
 
 namespace tvm {
 namespace runtime {
 namespace {
-using support::IsNumber;
+bool IsNumber(const std::string& str) {
+  return !str.empty() && str.find_first_not_of("0123456789") == 
std::string::npos;
+}
 constexpr uint32_t kDefaultSpinCount = 300000;
 
 uint32_t GetSpinCount() {
diff --git a/src/runtime/vm/const_loader_module.cc 
b/src/runtime/vm/const_loader_module.cc
index 20ccbdff82..e50cdd66e0 100644
--- a/src/runtime/vm/const_loader_module.cc
+++ b/src/runtime/vm/const_loader_module.cc
@@ -34,6 +34,7 @@
 #include <tvm/ffi/string.h>
 #include <tvm/runtime/logging.h>
 #include <tvm/runtime/tensor.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <cstdint>
@@ -41,8 +42,6 @@
 #include <unordered_map>
 #include <vector>
 
-#include "../../support/bytes_io.h"
-
 namespace tvm {
 namespace runtime {
 
diff --git a/src/runtime/vm/cuda/cuda_graph_builtin.cc 
b/src/runtime/vm/cuda/cuda_graph_builtin.cc
index 0135ad1a5a..0671b93a80 100644
--- a/src/runtime/vm/cuda/cuda_graph_builtin.cc
+++ b/src/runtime/vm/cuda/cuda_graph_builtin.cc
@@ -22,6 +22,7 @@
  * \brief The CUDA graph related builtin functions for Relax virtual machine.
  */
 
+#include <tvm/ffi/base_details.h>
 #include <tvm/ffi/cast.h>
 #include <tvm/ffi/container/array.h>
 #include <tvm/ffi/extra/c_env_api.h>
@@ -30,7 +31,6 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/vm/vm.h>
 
-#include "../../../support/utils.h"
 namespace tvm {
 namespace runtime {
 namespace vm {
@@ -57,7 +57,7 @@ struct CUDAGraphCaptureKeyHash {
     std::hash<int64_t> hash_fn;
     size_t hash = hash_fn(key.index);
     for (const auto& shape : key.shape_expr) {
-      support::HashCombine(hash, hash_fn(shape));
+      ffi::details::StableHashCombine(hash, hash_fn(shape));
     }
     return hash;
   }
diff --git a/src/runtime/vm/executable.cc b/src/runtime/vm/executable.cc
index 4cde076829..ec57fc7c35 100644
--- a/src/runtime/vm/executable.cc
+++ b/src/runtime/vm/executable.cc
@@ -26,13 +26,13 @@
 #include <tvm/runtime/logging.h>
 #include <tvm/runtime/vm/executable.h>
 #include <tvm/runtime/vm/vm.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/file_utils.h>
 #include <tvm/support/io.h>
 
 #include <functional>
 #include <sstream>
 
-#include "../../support/bytes_io.h"
 #include "./module_utils.h"
 
 namespace tvm {
diff --git a/src/runtime/vm/params.cc b/src/runtime/vm/params.cc
index 80f22dedb3..1fe01e538d 100644
--- a/src/runtime/vm/params.cc
+++ b/src/runtime/vm/params.cc
@@ -25,6 +25,7 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/ffi/string.h>
 #include <tvm/runtime/tensor.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 
 #include <cstdio>
@@ -33,8 +34,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../support/bytes_io.h"
-
 namespace tvm {
 namespace runtime {
 namespace vm {
diff --git a/src/runtime/vm/tensor_cache_support.cc 
b/src/runtime/vm/tensor_cache_support.cc
index 9bd9940fb8..d28b68bf7a 100644
--- a/src/runtime/vm/tensor_cache_support.cc
+++ b/src/runtime/vm/tensor_cache_support.cc
@@ -45,8 +45,6 @@
 #include <string>
 #include <vector>
 
-#include "../../support/utils.h"
-
 namespace tvm {
 namespace runtime {
 namespace vm {
diff --git a/src/s_tir/meta_schedule/database/database_utils.cc 
b/src/s_tir/meta_schedule/database/database_utils.cc
index 826c38c8d1..4eaba976af 100644
--- a/src/s_tir/meta_schedule/database/database_utils.cc
+++ b/src/s_tir/meta_schedule/database/database_utils.cc
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+#include <tvm/support/str_escape.h>
+
 #include <iomanip>
 #include <sstream>
 #include <vector>
 
-#include "../../../support/str_escape.h"
 #include "../utils.h"
 
 namespace tvm {
diff --git a/src/s_tir/meta_schedule/feature_extractor/per_store_feature.cc 
b/src/s_tir/meta_schedule/feature_extractor/per_store_feature.cc
index 7e7e5b30ff..a206957b95 100644
--- a/src/s_tir/meta_schedule/feature_extractor/per_store_feature.cc
+++ b/src/s_tir/meta_schedule/feature_extractor/per_store_feature.cc
@@ -316,7 +316,7 @@ Pass SimplifyForFeatureExtraction(bool 
normalize_thread_bindings = false) {
       }
       if (normalize_thread_bindings_ && 
tvm::s_tir::GetThreadBinding(loop).has_value()) {
         const auto tag = tvm::s_tir::GetThreadBinding(loop).value();
-        if (support::StartsWith(tag, "vthread")) {
+        if (tag.starts_with("vthread")) {
           // Virtual axes are independent iterations and isolate hardware 
aliases.
           thread_bindings_.push_back(nullptr);
           auto result = mutate_retained_loop();
@@ -469,7 +469,7 @@ struct LoopNest {
         ref_loops = &threadIdx_y;
       } else if (thread_tag == "threadIdx.z") {
         ref_loops = &threadIdx_z;
-      } else if (support::StartsWith(thread_tag, "vthread")) {
+      } else if (thread_tag.starts_with("vthread")) {
         ref_loops = &vthread;
       } else {
         TVM_FFI_THROW(ValueError) << "Unable to recognize thread tag: " << 
thread_tag;
diff --git a/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling.cc 
b/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling.cc
index 3b36a41a9e..47c34543b2 100644
--- a/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling.cc
+++ b/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling.cc
@@ -90,7 +90,7 @@ void MultiLevelTilingObj::InitializeWithTuneContext(const 
TuneContext& context)
   }
   if (ffi::Optional<ffi::String> opt_sm = 
context->target.value()->GetAttr<ffi::String>("arch")) {
     std::string sm = opt_sm.value();
-    if (support::StartsWith(sm, "sm_")) {
+    if (sm.starts_with("sm_")) {
       sm = sm.substr(3);
       try {
         // only sm_80 or higher supports async memcopy
diff --git 
a/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc 
b/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc
index f519ec5a8d..69d0ac46a6 100644
--- a/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc
+++ b/src/s_tir/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc
@@ -24,6 +24,7 @@
 #include <tvm/s_tir/tensor_intrin.h>
 
 #include <algorithm>
+#include <array>
 #include <utility>
 #include <vector>
 
@@ -126,7 +127,7 @@ TensorCoreState::TensorCoreState(TensorCoreIntrinGroup 
intrin_group,
   node->mapping_info = mapping_info;
   node->block_rv = std::move(block_rv);
   node->tiles = std::move(tiles);
-  node->is_mma = support::StartsWith(intrin_group.compute_intrin, "mma_sync");
+  node->is_mma = intrin_group.compute_intrin.starts_with("mma_sync");
   node->use_async = use_async;
   data_ = std::move(node);
 }
@@ -949,7 +950,7 @@ ScheduleRule ScheduleRule::MultiLevelTilingTensorCore(
   node->intrin_groups.reserve(intrin_groups.size());
   for (const auto& intrin_group_config : intrin_groups) {
     TensorCoreIntrinGroup group = 
TensorCoreIntrinGroup::FromConfig(intrin_group_config);
-    if (support::StartsWith(group.compute_intrin, "wmma")) {
+    if (group.compute_intrin.starts_with("wmma")) {
       have_wmma_intrin_group = true;
     }
     node->intrin_groups.emplace_back(group);
diff --git a/src/s_tir/meta_schedule/space_generator/space_generator.cc 
b/src/s_tir/meta_schedule/space_generator/space_generator.cc
index 2469f9a1a5..0057e3ea35 100644
--- a/src/s_tir/meta_schedule/space_generator/space_generator.cc
+++ b/src/s_tir/meta_schedule/space_generator/space_generator.cc
@@ -63,7 +63,7 @@ ffi::String GetRuleKindFromTarget(const Target& target) {
   if (target->kind->name == "cuda") {
     if (ffi::Optional<ffi::String> opt_sm = 
target->GetAttr<ffi::String>("arch")) {
       std::string sm = opt_sm.value();
-      if (support::StartsWith(sm, "sm_")) {
+      if (sm.starts_with("sm_")) {
         sm = sm.substr(3);
         try {
           if (std::stoi(sm) >= 75) {
diff --git a/src/s_tir/meta_schedule/utils.h b/src/s_tir/meta_schedule/utils.h
index b7f0ea92c5..c2596dbe22 100644
--- a/src/s_tir/meta_schedule/utils.h
+++ b/src/s_tir/meta_schedule/utils.h
@@ -41,6 +41,8 @@
 #include <tvm/s_tir/meta_schedule/tune_context.h>
 #include <tvm/s_tir/schedule/schedule.h>
 #include <tvm/s_tir/stmt.h>
+#include <tvm/support/base64.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 #include <tvm/support/serializer.h>
 #include <tvm/sym/analyzer.h>
@@ -53,9 +55,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../support/base64.h"
-#include "../../support/bytes_io.h"
-#include "../../support/utils.h"
 #include "../schedule/primitive.h"
 #include "../schedule/utils.h"
 #include "../support/array_utils.h"
diff --git a/src/s_tir/schedule/primitive/cache_index_helpers.h 
b/src/s_tir/schedule/primitive/cache_index_helpers.h
index 9f55408605..34382e0f0b 100644
--- a/src/s_tir/schedule/primitive/cache_index_helpers.h
+++ b/src/s_tir/schedule/primitive/cache_index_helpers.h
@@ -31,14 +31,13 @@
 #include <tvm/ir/expr_functor.h>
 #include <tvm/ir/prim/expr.h>
 #include <tvm/s_tir/stmt_functor.h>  // For the class s_tir::StmtExprVisitor
+#include <tvm/support/ordered_map.h>
 #include <tvm/tirx/stmt.h>
 
 #include <unordered_map>
 #include <utility>  // For pairs datatype
 #include <vector>
 
-#include "../../../support/ordered_map.h"
-
 namespace tvm {
 namespace tirx {
 
diff --git a/src/s_tir/transform/compact_tensor_region.cc 
b/src/s_tir/transform/compact_tensor_region.cc
index f6567adafc..ad30315c40 100644
--- a/src/s_tir/transform/compact_tensor_region.cc
+++ b/src/s_tir/transform/compact_tensor_region.cc
@@ -39,7 +39,6 @@
 #include <stack>
 
 #include "../../support/arena.h"
-#include "../../support/utils.h"
 #include "../analysis/conditional_bounds.h"
 #include "../schedule/utils.h"
 #include "../support/nd_int_set.h"
diff --git a/src/s_tir/transform/inject_permuted_layout.cc 
b/src/s_tir/transform/inject_permuted_layout.cc
index 875191dd8c..f3523ede37 100644
--- a/src/s_tir/transform/inject_permuted_layout.cc
+++ b/src/s_tir/transform/inject_permuted_layout.cc
@@ -33,7 +33,6 @@
 #include <tvm/tirx/op/memory.h>
 
 #include "../../runtime/thread_storage_scope.h"
-#include "../../support/utils.h"
 #include "../../tirx/transform/ir_utils.h"
 
 namespace tvm {
diff --git a/src/s_tir/transform/inject_software_pipeline.cc 
b/src/s_tir/transform/inject_software_pipeline.cc
index 1dfb991411..e3082b88ab 100644
--- a/src/s_tir/transform/inject_software_pipeline.cc
+++ b/src/s_tir/transform/inject_software_pipeline.cc
@@ -36,7 +36,6 @@
 #include <map>
 #include <unordered_set>
 
-#include "../../support/utils.h"
 #include "../schedule/utils.h"
 #include "ir_utils.h"
 
diff --git a/src/s_tir/transform/lower_cross_thread_reduction.cc 
b/src/s_tir/transform/lower_cross_thread_reduction.cc
index e32d5fd3d3..1ed402e52b 100644
--- a/src/s_tir/transform/lower_cross_thread_reduction.cc
+++ b/src/s_tir/transform/lower_cross_thread_reduction.cc
@@ -37,7 +37,6 @@
 #include <tvm/tirx/op/gpu.h>
 #include <tvm/tirx/stmt.h>
 
-#include "../../support/utils.h"
 #include "../../tirx/transform/ir_utils.h"
 #include "../schedule/analysis.h"
 #include "../schedule/utils.h"
@@ -48,7 +47,6 @@ using namespace tvm::prim;
 
 using namespace tvm::tirx;
 using support::GPUThreadTag;
-using support::StartsWith;
 
 // Implement a hash and equality function for GPUThreadTag so that
 // GPUThreadTag can serve as map key class
diff --git a/src/script/printer/doc_printer.cc 
b/src/script/printer/doc_printer.cc
index 7887b140d8..98bb2e1059 100644
--- a/src/script/printer/doc_printer.cc
+++ b/src/script/printer/doc_printer.cc
@@ -25,6 +25,7 @@
 #include <tvm/ir/object_functor.h>
 #include <tvm/ir/prim/expr.h>
 #include <tvm/script/printer/printer.h>
+#include <tvm/support/str_escape.h>
 
 #include <algorithm>
 #include <cmath>
@@ -41,9 +42,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../support/str_escape.h"
-#include "../../support/utils.h"
-
 namespace tvm {
 namespace script {
 namespace printer {
@@ -1039,10 +1037,11 @@ class PythonDocPrinter : public DocPrinter {
 
   void MaybePrintCommenMultiLines(const StmtDoc& stmt, bool new_line = false) {
     if (stmt->comment.has_value()) {
-      std::vector<std::string> comment_lines = 
support::Split(stmt->comment.value(), '\n');
+      std::istringstream comment_stream(stmt->comment.value());
+      std::string line;
       bool first_line = true;
       size_t start_pos = output_.tellp();
-      for (const std::string& line : comment_lines) {
+      while (std::getline(comment_stream, line)) {
         if (first_line) {
           output_ << "# " << line;
           first_line = false;
@@ -1062,8 +1061,9 @@ class PythonDocPrinter : public DocPrinter {
     size_t start_pos = output_.tellp();
     output_ << "\"\"\"";
 
-    std::vector<std::string> comment_lines = support::Split(comment, '\n');
-    for (const std::string& line : comment_lines) {
+    std::istringstream comment_stream(comment);
+    std::string line;
+    while (std::getline(comment_stream, line)) {
       if (line.empty()) {
         // No indentation on empty line
         output_ << "\n";
diff --git a/src/support/socket.h b/src/support/socket.h
index 3647054497..e05539e72c 100644
--- a/src/support/socket.h
+++ b/src/support/socket.h
@@ -58,7 +58,6 @@
 
 #include "errno_handling.h"
 #include "ssize.h"
-#include "utils.h"
 
 #if defined(_WIN32)
 static inline int poll(struct pollfd* pfd, int nfds, int timeout) {
diff --git a/src/support/utils.h b/src/support/utils.h
deleted file mode 100644
index 8af2747831..0000000000
--- a/src/support/utils.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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.
- */
-
-/*!
- * \file utils.h
- * \brief Defines some common utility function..
- */
-#ifndef TVM_SUPPORT_UTILS_H_
-#define TVM_SUPPORT_UTILS_H_
-
-#include <stdio.h>
-#ifndef _WIN32
-#include <sys/types.h>
-#ifndef __hexagon__
-#include <sys/wait.h>
-#endif  // __hexagon__
-#endif  // _WIN32
-
-#include <tvm/ffi/string.h>
-
-#include <algorithm>
-#include <array>
-#include <cctype>
-#include <cstdlib>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-namespace tvm {
-namespace support {
-/*!
- * \brief TVMPOpen wrapper of popen between windows / unix.
- * \param command executed command
- * \param type "r" is for reading or "w" for writing.
- * \return normal standard stream
- */
-#ifndef __hexagon__
-inline FILE* TVMPOpen(const char* command, const char* type) {
-#if defined(_WIN32)
-  return _popen(command, type);
-#else
-  return popen(command, type);
-#endif
-}
-#endif  // __hexagon__
-
-/*!
- * \brief TVMPClose wrapper of pclose between windows / linux
- * \param stream the stream needed to be close.
- * \return exit status
- */
-#ifndef __hexagon__
-inline int TVMPClose(FILE* stream) {
-#if defined(_WIN32)
-  return _pclose(stream);
-#else
-  return pclose(stream);
-#endif
-}
-#endif  // __hexagon__
-
-/*!
- * \brief TVMWifexited wrapper of WIFEXITED between windows / linux
- * \param status The status field that was filled in by the wait or waitpid 
function
- * \return the exit code of the child process
- */
-#ifndef __hexagon__
-inline int TVMWifexited(int status) {
-#if defined(_WIN32)
-  return (status != 3);
-#else
-  return WIFEXITED(status);
-#endif
-}
-#endif  // __hexagon__
-
-/*!
- * \brief TVMWexitstatus wrapper of WEXITSTATUS between windows / linux
- * \param status The status field that was filled in by the wait or waitpid 
function.
- * \return the child process exited normally or not
- */
-#ifndef __hexagon__
-inline int TVMWexitstatus(int status) {
-#if defined(_WIN32)
-  return status;
-#else
-  return WEXITSTATUS(status);
-#endif
-}
-#endif  // __hexagon__
-
-/*!
- * \brief IsNumber check whether string is a number.
- * \param str input string
- * \return result of operation.
- */
-inline bool IsNumber(const std::string& str) {
-  return !str.empty() &&
-         std::find_if(str.begin(), str.end(), [](char c) { return 
!std::isdigit(c); }) == str.end();
-}
-
-/*!
- * \brief split Split the string based on delimiter
- * \param str Input string
- * \param delim The delimiter.
- * \return vector of strings which are splitted.
- */
-inline std::vector<std::string> Split(const std::string& str, char delim) {
-  std::string item;
-  std::istringstream is(str);
-  std::vector<std::string> ret;
-  while (std::getline(is, item, delim)) {
-    ret.push_back(item);
-  }
-  return ret;
-}
-
-/*!
- * \brief Check whether the string starts with a given prefix.
- * \param str The given string.
- * \param prefix The given prefix.
- * \return Whether the prefix matched.
- */
-inline bool StartsWith(const ffi::String& str, const char* prefix) {
-  const char* data = str.data();
-  const char* data_end = data + str.size();
-  for (; data != data_end; ++data, ++prefix) {
-    if (*prefix == '\0') return true;
-    if (*data != *prefix) return false;
-  }
-  // return true if the str is equal to the prefix
-  return *prefix == '\0';
-}
-
-/*!
- * \brief EndsWith check whether the strings ends with
- * \param value The full string
- * \param end The end substring
- * \return bool The result.
- */
-inline bool EndsWith(std::string const& value, std::string const& end) {
-  if (end.size() <= value.size()) {
-    return std::equal(end.rbegin(), end.rend(), value.rbegin());
-  }
-  return false;
-}
-
-/*!
- * \brief Execute the command
- * \param cmd The command we want to execute
- * \param err_msg The error message if we have
- * \return executed output status
- */
-#ifndef __hexagon__
-inline int Execute(std::string cmd, std::string* err_msg) {
-  std::array<char, 128> buffer;
-  std::string result;
-  cmd += " 2>&1";
-  FILE* fd = TVMPOpen(cmd.c_str(), "r");
-  while (fgets(buffer.data(), buffer.size(), fd) != nullptr) {
-    *err_msg += buffer.data();
-  }
-  int status = TVMPClose(fd);
-  if (TVMWifexited(status)) {
-    return TVMWexitstatus(status);
-  }
-  return 255;
-}
-#endif  // __hexagon__
-
-/*!
- * \brief hash an object and combines uint64_t key with previous keys
- *
- * This hash function is stable across platforms.
- *
- * \param key The left operand.
- * \param value The right operand.
- * \return the combined result.
- */
-template <typename T, std::enable_if_t<std::is_convertible<T, 
uint64_t>::value, bool> = true>
-inline uint64_t HashCombine(uint64_t key, const T& value) {
-  // XXX: do not use std::hash in this function. This hash must be stable
-  // across different platforms and std::hash is implementation dependent.
-  return key ^ (uint64_t(value) + 0x9e3779b9 + (key << 6) + (key >> 2));
-}
-
-/*!
- * \brief Return whether a boolean flag is set as an environment variable.
- *
- * Returns true if the environment variable is set to a non-zero
- * integer, or to a non-empty string that is not an integer.
- *
- * Returns false if the environment variable is unset, if the
- * environment variable is set to the integer zero, or if the
- * environment variable is an empty string.
- */
-inline bool BoolEnvironmentVar(const char* varname) {
-  const char* var = std::getenv(varname);
-  if (!var) {
-    return false;
-  }
-
-  int x = 0;
-  std::istringstream is(var);
-  if (is >> x) {
-    return x;
-  }
-
-  return *var;
-}
-
-}  // namespace support
-}  // namespace tvm
-#endif  // TVM_SUPPORT_UTILS_H_
diff --git a/src/sym/iter_affine_map.cc b/src/sym/iter_affine_map.cc
index 1c1bf7a880..a398685ad9 100644
--- a/src/sym/iter_affine_map.cc
+++ b/src/sym/iter_affine_map.cc
@@ -20,6 +20,7 @@
 /*!
  * \file src/sym/iter_affine_map.cc
  */
+#include <tvm/ffi/base_details.h>
 #include <tvm/ffi/cast.h>
 #include <tvm/ffi/expected.h>
 #include <tvm/ffi/extra/structural_visit.h>
@@ -32,7 +33,6 @@
 #include <unordered_set>
 #include <utility>
 
-#include "../support/utils.h"
 #include "const_fold.h"
 #include "pattern_match.h"
 #include "product_normal_form.h"
@@ -414,7 +414,8 @@ class IterMapRewriter : public tvm::ExprMutator {
       // for now only hash on source index.
       size_t hash = value->args.size();
       for (const IterSplitExpr& arg : value->args) {
-        hash = support::HashCombine(hash, std::hash<const 
ffi::Object*>()(arg->source.get()));
+        hash = ffi::details::StableHashCombine(hash,
+                                               std::hash<const 
ffi::Object*>()(arg->source.get()));
       }
       return hash;
     }
diff --git a/src/target/codegen.cc b/src/target/codegen.cc
index 07ef1d41ed..7954d948d5 100644
--- a/src/target/codegen.cc
+++ b/src/target/codegen.cc
@@ -27,6 +27,7 @@
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/ir/module.h>
 #include <tvm/runtime/base.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/io.h>
 #include <tvm/support/serializer.h>
 #include <tvm/target/codegen.h>
@@ -41,8 +42,6 @@
 #include <unordered_set>
 #include <vector>
 
-#include "../support/bytes_io.h"
-
 namespace tvm {
 namespace codegen {
 
diff --git a/src/target/llvm/canonicalizer/arm_aprofile.cc 
b/src/target/llvm/canonicalizer/arm_aprofile.cc
index e08fccd0b4..782bee556b 100644
--- a/src/target/llvm/canonicalizer/arm_aprofile.cc
+++ b/src/target/llvm/canonicalizer/arm_aprofile.cc
@@ -29,7 +29,6 @@
 #include <memory>
 #include <string>
 
-#include "../../../support/utils.h"
 #include "../llvm_instance.h"
 
 namespace tvm {
@@ -59,15 +58,15 @@ double 
GetArchVersion(ffi::Optional<ffi::Array<ffi::String>> attr) {
 
 bool IsAArch32(ffi::Optional<ffi::String> mtriple, ffi::Optional<ffi::String> 
mcpu) {
   if (mtriple) {
-    bool is_mprofile = mcpu && support::StartsWith(mcpu.value(), "cortex-m");
-    return support::StartsWith(mtriple.value(), "arm") && !is_mprofile;
+    bool is_mprofile = mcpu && mcpu.value().starts_with("cortex-m");
+    return mtriple.value().starts_with("arm") && !is_mprofile;
   }
   return false;
 }
 
 bool IsAArch64(ffi::Optional<ffi::String> mtriple) {
   if (mtriple) {
-    return support::StartsWith(mtriple.value(), "aarch64");
+    return mtriple.value().starts_with("aarch64");
   }
   return false;
 }
diff --git a/src/target/source/source_module.cc 
b/src/target/source/source_module.cc
index 944ff2badf..347e85465f 100644
--- a/src/target/source/source_module.cc
+++ b/src/target/source/source_module.cc
@@ -27,6 +27,7 @@
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/tensor.h>
+#include <tvm/support/bytes_io.h>
 #include <tvm/support/file_utils.h>
 #include <tvm/support/io.h>
 
@@ -36,7 +37,6 @@
 #include <unordered_set>
 #include <vector>
 
-#include "../../support/bytes_io.h"
 #include "codegen_source_base.h"
 
 namespace tvm {
diff --git a/src/target/target_kind.cc b/src/target/target_kind.cc
index 97687beeb8..ff7ede54e5 100644
--- a/src/target/target_kind.cc
+++ b/src/target/target_kind.cc
@@ -32,7 +32,6 @@
 
 #include <algorithm>
 
-#include "../support/utils.h"
 #include "./llvm/canonicalizer/canonicalize.h"
 
 namespace tvm {
diff --git a/src/tirx/transform/common_subexpr_elim.cc 
b/src/tirx/transform/common_subexpr_elim.cc
index 755d5c4960..0f8969a875 100644
--- a/src/tirx/transform/common_subexpr_elim.cc
+++ b/src/tirx/transform/common_subexpr_elim.cc
@@ -73,6 +73,7 @@
 #include <tvm/ir/prim/expr.h>
 #include <tvm/ir/prim/op.h>
 #include <tvm/ir/transform.h>
+#include <tvm/support/ordered_map.h>
 #include <tvm/tirx/analysis.h>
 #include <tvm/tirx/function.h>
 #include <tvm/tirx/op/region.h>
@@ -87,8 +88,6 @@
 #include <utility>
 #include <vector>
 
-#include "../../support/ordered_map.h"
-
 namespace tvm {
 namespace tirx {
 
diff --git a/web/emcc/webgpu_runtime.cc b/web/emcc/webgpu_runtime.cc
index bced4636e6..7e6fd8f098 100644
--- a/web/emcc/webgpu_runtime.cc
+++ b/web/emcc/webgpu_runtime.cc
@@ -31,6 +31,7 @@
 #include <tvm/ffi/function.h>
 #include <tvm/ffi/reflection/registry.h>
 #include <tvm/runtime/device_api.h>
+#include <tvm/support/bytes_io.h>
 
 #include <algorithm>
 #include <iostream>
@@ -38,7 +39,6 @@
 #include <string>
 
 #include "../../src/runtime/metadata.h"
-#include "../../src/support/bytes_io.h"
 
 namespace tvm {
 namespace runtime {

Reply via email to