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 61e7c8fb63 [Refactor] Rename `relax_vm` to `vm` (#18049)
61e7c8fb63 is described below
commit 61e7c8fb634f5f42ea7f51aa5bd86d509894d327
Author: Ruihang Lai <[email protected]>
AuthorDate: Fri Jun 6 18:54:28 2025 -0400
[Refactor] Rename `relax_vm` to `vm` (#18049)
This PR renames the filenames/namespaces of `relax_vm`
to `vm`.
Previously, both VMs of relay and relax exist, and to avoid the
name conflicts, we added the prefix `relax_` to relax VM.
With the Relay runtime being phased out, we can now rename
`relax_vm` to `vm` for conciseness.
---
CMakeLists.txt | 2 +-
cmake/modules/CUDA.cmake | 4 ++--
cmake/modules/Hexagon.cmake | 4 ++--
docs/reference/api/python/index.rst | 2 +-
.../api/python/runtime/{relax_vm.rst => vm.rst} | 4 ++--
include/tvm/relax/exec_builder.h | 6 +++---
include/tvm/runtime/{relax_vm => vm}/builtin.h | 12 ++++++------
include/tvm/runtime/{relax_vm => vm}/bytecode.h | 12 ++++++------
include/tvm/runtime/{relax_vm => vm}/executable.h | 16 ++++++++--------
.../runtime/{relax_vm => vm}/ndarray_cache_support.h | 10 +++++-----
include/tvm/runtime/{relax_vm => vm}/vm.h | 16 ++++++++--------
python/tvm/contrib/hexagon/session.py | 4 ++--
python/tvm/relax/__init__.py | 4 ++--
python/tvm/relax/frontend/nn/core.py | 2 +-
python/tvm/relax/frontend/nn/torch.py | 2 +-
python/tvm/runtime/{relax_vm.py => vm.py} | 0
src/relax/backend/vm/codegen_vm.cc | 8 ++++----
src/relax/backend/vm/codegen_vm_tir.cc | 6 +++---
src/relax/backend/vm/vm_shape_lower.cc | 18 +++++++++---------
src/runtime/disco/builtin.cc | 2 +-
src/runtime/disco/loader.cc | 4 ++--
src/runtime/{relax_vm => vm}/attn_backend.cc | 6 +++---
src/runtime/{relax_vm => vm}/attn_backend.h | 12 ++++++------
src/runtime/{relax_vm => vm}/attn_utils.h | 12 ++++++------
src/runtime/{relax_vm => vm}/builtin.cc | 12 ++++++------
src/runtime/{relax_vm => vm}/bytecode.cc | 8 ++++----
.../{relax_vm => vm}/cuda/cuda_graph_builtin.cc | 10 +++++-----
src/runtime/{relax_vm => vm}/executable.cc | 14 +++++++-------
src/runtime/{relax_vm => vm}/hexagon/builtin.cc | 8 ++++----
src/runtime/{relax_vm => vm}/kv_state.cc | 4 ++--
src/runtime/{relax_vm => vm}/kv_state.h | 10 +++++-----
src/runtime/{relax_vm => vm}/lm_support.cc | 8 ++++----
.../{relax_vm => vm}/ndarray_cache_support.cc | 8 ++++----
src/runtime/{relax_vm => vm}/paged_kv_cache.cc | 8 ++++----
src/runtime/{relax_vm => vm}/rnn_state.cc | 6 +++---
src/runtime/{relax_vm => vm}/vm.cc | 12 ++++++------
tests/python/contrib/test_tir_triton_integration.py | 15 ++++++++-------
tests/python/disco/test_ccl.py | 2 +-
tests/python/relax/test_frontend_nn_extern_module.py | 4 ++--
tests/python/relax/test_tir_call_source_kernel.py | 6 ++++--
.../python/relax/test_training_optimizer_numeric.py | 8 ++++----
web/emcc/wasm_runtime.cc | 20 ++++++++++----------
web/tests/node/{test_relax_vm.js => test_vm.js} | 0
43 files changed, 167 insertions(+), 164 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c52f3b363a..4eb2468e4e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -334,7 +334,7 @@ tvm_file_glob(GLOB RUNTIME_SRCS
src/runtime/memory/*.cc
src/runtime/disco/*.cc
src/runtime/minrpc/*.cc
- src/runtime/relax_vm/*.cc
+ src/runtime/vm/*.cc
)
set(TVM_RUNTIME_EXT_OBJS "")
diff --git a/cmake/modules/CUDA.cmake b/cmake/modules/CUDA.cmake
index 84261c6ea0..64f41d65fa 100644
--- a/cmake/modules/CUDA.cmake
+++ b/cmake/modules/CUDA.cmake
@@ -138,8 +138,8 @@ if(USE_CUDA)
endif(USE_NVTX)
# Add CUDA builtins to RelaxVM
- tvm_file_glob(GLOB RELAX_VM_CUDA_BUILTIN_SRC_CC
src/runtime/relax_vm/cuda/*.cc)
- list(APPEND RUNTIME_SRCS ${RELAX_VM_CUDA_BUILTIN_SRC_CC})
+ tvm_file_glob(GLOB VM_CUDA_BUILTIN_SRC_CC src/runtime/vm/cuda/*.cc)
+ list(APPEND RUNTIME_SRCS ${VM_CUDA_BUILTIN_SRC_CC})
else(USE_CUDA)
list(APPEND COMPILER_SRCS src/target/opt/build_cuda_off.cc)
endif(USE_CUDA)
diff --git a/cmake/modules/Hexagon.cmake b/cmake/modules/Hexagon.cmake
index 75b0094ed6..2c153bbac9 100644
--- a/cmake/modules/Hexagon.cmake
+++ b/cmake/modules/Hexagon.cmake
@@ -126,8 +126,8 @@ if(BUILD_FOR_HEXAGON)
"${TVMRT_SOURCE_DIR}/hexagon/*.cc"
)
# Add builtins to RelaxVM
- tvm_file_glob(GLOB RELAX_VM_BUILTIN_SRC_CC src/runtime/relax_vm/hexagon/*.cc)
- list(APPEND RUNTIME_SRCS ${RELAX_VM_BUILTIN_SRC_CC})
+ tvm_file_glob(GLOB VM_BUILTIN_SRC_CC src/runtime/vm/hexagon/*.cc)
+ list(APPEND RUNTIME_SRCS ${VM_BUILTIN_SRC_CC})
else()
file_glob_append(RUNTIME_HEXAGON_SRCS
"${TVMRT_SOURCE_DIR}/hexagon/hexagon_module.cc"
diff --git a/docs/reference/api/python/index.rst
b/docs/reference/api/python/index.rst
index 2e0a9c7f2f..a233c69a01 100644
--- a/docs/reference/api/python/index.rst
+++ b/docs/reference/api/python/index.rst
@@ -35,7 +35,7 @@ Python API
runtime/runtime
runtime/ndarray
- runtime/relax_vm
+ runtime/vm
runtime/disco
runtime/profiling
diff --git a/docs/reference/api/python/runtime/relax_vm.rst
b/docs/reference/api/python/runtime/vm.rst
similarity index 93%
rename from docs/reference/api/python/runtime/relax_vm.rst
rename to docs/reference/api/python/runtime/vm.rst
index 75afcb7939..2d7b980f86 100644
--- a/docs/reference/api/python/runtime/relax_vm.rst
+++ b/docs/reference/api/python/runtime/vm.rst
@@ -15,7 +15,7 @@
specific language governing permissions and limitations
under the License.
-tvm.runtime.relax_vm
+tvm.runtime.vm
--------------------
-.. automodule:: tvm.runtime.relax_vm
+.. automodule:: tvm.runtime.vm
:members:
diff --git a/include/tvm/relax/exec_builder.h b/include/tvm/relax/exec_builder.h
index 81d6d4eb37..16223d6bfb 100644
--- a/include/tvm/relax/exec_builder.h
+++ b/include/tvm/relax/exec_builder.h
@@ -28,8 +28,8 @@
#include <tvm/node/reflection.h>
#include <tvm/node/repr_printer.h>
#include <tvm/runtime/object.h>
-#include <tvm/runtime/relax_vm/bytecode.h>
-#include <tvm/runtime/relax_vm/executable.h>
+#include <tvm/runtime/vm/bytecode.h>
+#include <tvm/runtime/vm/executable.h>
#include <string>
#include <unordered_map>
@@ -38,7 +38,7 @@
namespace tvm {
namespace relax {
-namespace vm = tvm::runtime::relax_vm;
+namespace vm = tvm::runtime::vm;
class ExecBuilder;
diff --git a/include/tvm/runtime/relax_vm/builtin.h
b/include/tvm/runtime/vm/builtin.h
similarity index 92%
rename from include/tvm/runtime/relax_vm/builtin.h
rename to include/tvm/runtime/vm/builtin.h
index b994e44ae8..3c4429b122 100644
--- a/include/tvm/runtime/relax_vm/builtin.h
+++ b/include/tvm/runtime/vm/builtin.h
@@ -18,15 +18,15 @@
*/
/*!
- * \file tvm/runtime/relax_vm/builtin.h
+ * \file tvm/runtime/vm/builtin.h
* \brief Builtin runtime APIs.
*/
-#ifndef TVM_RUNTIME_RELAX_VM_BUILTIN_H_
-#define TVM_RUNTIME_RELAX_VM_BUILTIN_H_
+#ifndef TVM_RUNTIME_VM_BUILTIN_H_
+#define TVM_RUNTIME_VM_BUILTIN_H_
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*!
* \brief Op code used in built-in match-shape function.
@@ -83,7 +83,7 @@ enum class MakeShapeCode : int {
kLoadShape = 1,
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_BUILTIN_H_
+#endif // TVM_RUNTIME_VM_BUILTIN_H_
diff --git a/include/tvm/runtime/relax_vm/bytecode.h
b/include/tvm/runtime/vm/bytecode.h
similarity index 97%
rename from include/tvm/runtime/relax_vm/bytecode.h
rename to include/tvm/runtime/vm/bytecode.h
index 4526c6fffa..bc84578fd5 100644
--- a/include/tvm/runtime/relax_vm/bytecode.h
+++ b/include/tvm/runtime/vm/bytecode.h
@@ -18,11 +18,11 @@
*/
/*!
- * \file tvm/runtime/relax_vm/bytecode.h
+ * \file tvm/runtime/vm/bytecode.h
* \brief The bytecode for the virtual machine.
*/
-#ifndef TVM_RUNTIME_RELAX_VM_BYTECODE_H_
-#define TVM_RUNTIME_RELAX_VM_BYTECODE_H_
+#ifndef TVM_RUNTIME_VM_BYTECODE_H_
+#define TVM_RUNTIME_VM_BYTECODE_H_
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/logging.h>
@@ -32,7 +32,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*!
* \brief The storage type for the bytecode in the VM.
@@ -238,8 +238,8 @@ struct Instruction {
static Instruction If(RegName cond, Index false_offset);
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_BYTECODE_H_
+#endif // TVM_RUNTIME_VM_BYTECODE_H_
diff --git a/include/tvm/runtime/relax_vm/executable.h
b/include/tvm/runtime/vm/executable.h
similarity index 95%
rename from include/tvm/runtime/relax_vm/executable.h
rename to include/tvm/runtime/vm/executable.h
index 8a9fa024ca..a84c902b67 100644
--- a/include/tvm/runtime/relax_vm/executable.h
+++ b/include/tvm/runtime/vm/executable.h
@@ -18,10 +18,10 @@
*/
/*!
- * \file tvm/runtime/relax_vm/executable.h
+ * \file tvm/runtime/vm/executable.h
*/
-#ifndef TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_
-#define TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_
+#ifndef TVM_RUNTIME_VM_EXECUTABLE_H_
+#define TVM_RUNTIME_VM_EXECUTABLE_H_
#include <tvm/ffi/function.h>
#include <tvm/runtime/module.h>
@@ -37,11 +37,11 @@
// NOTE: this file only changes if we change relax vm format
// for example if relax vm format do not change in 0.15, this should remain as
0.14
// if it changes in 0.16, we will change it to 0.16
-#define RELAX_VM_VERSION "0.14"
+#define VM_VERSION "0.14"
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*!
* \brief Information entry in executable function table.
@@ -214,11 +214,11 @@ class VMExecutable : public runtime::ModuleNode {
void LoadPackedFuncNames(dmlc::Stream* strm);
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
namespace dmlc {
-DMLC_DECLARE_TRAITS(has_saveload, ::tvm::runtime::relax_vm::VMFuncInfo, true);
+DMLC_DECLARE_TRAITS(has_saveload, ::tvm::runtime::vm::VMFuncInfo, true);
} // namespace dmlc
-#endif // TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_
+#endif // TVM_RUNTIME_VM_EXECUTABLE_H_
diff --git a/include/tvm/runtime/relax_vm/ndarray_cache_support.h
b/include/tvm/runtime/vm/ndarray_cache_support.h
similarity index 93%
rename from include/tvm/runtime/relax_vm/ndarray_cache_support.h
rename to include/tvm/runtime/vm/ndarray_cache_support.h
index 579fbf306f..3ab08df043 100644
--- a/include/tvm/runtime/relax_vm/ndarray_cache_support.h
+++ b/include/tvm/runtime/vm/ndarray_cache_support.h
@@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-#ifndef TVM_RUNTIME_RELAX_VM_NDARRAY_CACHE_SUPPORT_H_
-#define TVM_RUNTIME_RELAX_VM_NDARRAY_CACHE_SUPPORT_H_
+#ifndef TVM_RUNTIME_VM_NDARRAY_CACHE_SUPPORT_H_
+#define TVM_RUNTIME_VM_NDARRAY_CACHE_SUPPORT_H_
#include <tvm/ffi/container/array.h>
#include <tvm/ffi/function.h>
@@ -29,7 +29,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*!
* \brief Metadata for NDArray cache, which by default, is named as
"ndarray-cache.json".
@@ -89,8 +89,8 @@ struct NDArrayCacheMetadata {
static NDArrayCacheMetadata LoadFromStr(const std::string& json_str, const
std::string& path);
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_NDARRAY_CACHE_SUPPORT_H_
+#endif // TVM_RUNTIME_VM_NDARRAY_CACHE_SUPPORT_H_
diff --git a/include/tvm/runtime/relax_vm/vm.h b/include/tvm/runtime/vm/vm.h
similarity index 96%
rename from include/tvm/runtime/relax_vm/vm.h
rename to include/tvm/runtime/vm/vm.h
index 884a8d0f43..9aa34c9b44 100644
--- a/include/tvm/runtime/relax_vm/vm.h
+++ b/include/tvm/runtime/vm/vm.h
@@ -18,13 +18,13 @@
*/
/*!
- * \file tvm/runtime/relax_vm/vm.h
+ * \file tvm/runtime/vm/vm.h
*/
-#ifndef TVM_RUNTIME_RELAX_VM_VM_H_
-#define TVM_RUNTIME_RELAX_VM_VM_H_
+#ifndef TVM_RUNTIME_VM_VM_H_
+#define TVM_RUNTIME_VM_VM_H_
-#ifndef TVM_RELAX_VM_ENABLE_PROFILER
-#define TVM_RELAX_VM_ENABLE_PROFILER 1
+#ifndef TVM_VM_ENABLE_PROFILER
+#define TVM_VM_ENABLE_PROFILER 1
#endif
#include <memory>
@@ -45,7 +45,7 @@ using memory::MemoryManager;
using memory::Storage;
using memory::StorageObj;
-namespace relax_vm {
+namespace vm {
/*!
* \brief Possible instrument actions.
@@ -227,8 +227,8 @@ class VirtualMachine : public runtime::ModuleNode {
std::unordered_map<uint32_t, VMExtension> extensions;
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_VM_H_
+#endif // TVM_RUNTIME_VM_VM_H_
diff --git a/python/tvm/contrib/hexagon/session.py
b/python/tvm/contrib/hexagon/session.py
index 4f017abcf6..b92c783094 100644
--- a/python/tvm/contrib/hexagon/session.py
+++ b/python/tvm/contrib/hexagon/session.py
@@ -218,7 +218,7 @@ class Session:
The hexagon arch to be used
"""
if isinstance(module, (runtime.Executable, str)):
- return self._relax_vm_executable_executor(module,
hexagon_arch=hexagon_arch)
+ return self._vm_executable_executor(module,
hexagon_arch=hexagon_arch)
raise TypeError(f"Unsupported executor type: {type(module)}")
@@ -244,7 +244,7 @@ class Session:
else:
self._requires_cpu_device = False
- def _relax_vm_executable_executor(
+ def _vm_executable_executor(
self, executable: Union[runtime.Executable, str], hexagon_arch: str
):
"""Create a local TVM module which consumes a remote vm executable.
diff --git a/python/tvm/relax/__init__.py b/python/tvm/relax/__init__.py
index da288942ed..b880001198 100644
--- a/python/tvm/relax/__init__.py
+++ b/python/tvm/relax/__init__.py
@@ -16,8 +16,8 @@
# under the License.
# pylint: disable=invalid-name, wrong-import-position
"""The Relax IR namespace containing the IR, type, operator, builder, vm,
etc."""
-from tvm.runtime import relax_vm as vm
-from tvm.runtime.relax_vm import VirtualMachine, VMInstrumentReturnKind
+from tvm.runtime import vm
+from tvm.runtime.vm import VirtualMachine, VMInstrumentReturnKind
from .type_converter import args_converter
diff --git a/python/tvm/relax/frontend/nn/core.py
b/python/tvm/relax/frontend/nn/core.py
index 5b0eae4acc..068b2090db 100644
--- a/python/tvm/relax/frontend/nn/core.py
+++ b/python/tvm/relax/frontend/nn/core.py
@@ -45,7 +45,7 @@ from tvm.ir.transform import Pass
from tvm.runtime import Device, NDArray
from tvm.runtime import device as as_device
from tvm.runtime import ndarray
-from tvm.runtime.relax_vm import VirtualMachine
+from tvm.runtime.vm import VirtualMachine
from tvm.target import Target
from .... import relax as rx
diff --git a/python/tvm/relax/frontend/nn/torch.py
b/python/tvm/relax/frontend/nn/torch.py
index 28ccf3b8ea..ae98868dae 100644
--- a/python/tvm/relax/frontend/nn/torch.py
+++ b/python/tvm/relax/frontend/nn/torch.py
@@ -22,7 +22,7 @@ import torch
from tvm.ir import Array
from tvm.runtime import NDArray, ShapeTuple, ndarray
-from tvm.runtime.relax_vm import VirtualMachine
+from tvm.runtime.vm import VirtualMachine
from . import core
from . import spec as _spec
diff --git a/python/tvm/runtime/relax_vm.py b/python/tvm/runtime/vm.py
similarity index 100%
rename from python/tvm/runtime/relax_vm.py
rename to python/tvm/runtime/vm.py
diff --git a/src/relax/backend/vm/codegen_vm.cc
b/src/relax/backend/vm/codegen_vm.cc
index f61579e25e..4cf2811922 100644
--- a/src/relax/backend/vm/codegen_vm.cc
+++ b/src/relax/backend/vm/codegen_vm.cc
@@ -24,7 +24,7 @@
#include <tvm/relax/exec_builder.h>
#include <tvm/relax/expr_functor.h>
#include <tvm/relax/op_attr_types.h>
-#include <tvm/runtime/relax_vm/bytecode.h>
+#include <tvm/runtime/vm/bytecode.h>
#include <tvm/target/target.h>
#include <tvm/tir/function.h>
@@ -37,12 +37,12 @@
namespace tvm {
namespace relax {
-namespace relax_vm {
+namespace codegen_vm {
using tvm::Target;
using namespace relax;
using namespace tvm::runtime;
-using namespace tvm::runtime::relax_vm;
+using namespace tvm::runtime::vm;
/*!
* \brief A class to generate VM executable for Relax functions.
@@ -492,6 +492,6 @@ Module VMLink(ExecBuilder builder, Target target,
Optional<Module> lib, Array<Mo
TVM_FFI_REGISTER_GLOBAL("relax.VMLink").set_body_typed(VMLink);
-} // namespace relax_vm
+} // namespace codegen_vm
} // namespace relax
} // namespace tvm
diff --git a/src/relax/backend/vm/codegen_vm_tir.cc
b/src/relax/backend/vm/codegen_vm_tir.cc
index aa228822de..72789c9c1f 100644
--- a/src/relax/backend/vm/codegen_vm_tir.cc
+++ b/src/relax/backend/vm/codegen_vm_tir.cc
@@ -25,7 +25,7 @@
#include <tvm/relax/exec_builder.h>
#include <tvm/relax/expr_functor.h>
#include <tvm/relax/op_attr_types.h>
-#include <tvm/runtime/relax_vm/executable.h>
+#include <tvm/runtime/vm/executable.h>
#include <tvm/target/target.h>
#include <tvm/tir/builtin.h>
#include <tvm/tir/expr.h>
@@ -39,7 +39,7 @@
namespace tvm {
namespace relax {
-namespace relax_vm {
+namespace codegen_vm {
using vm::VMFuncInfo;
@@ -532,6 +532,6 @@ IRModule VMTIRCodeGen(ExecBuilder exec_builder, IRModule
mod) {
TVM_FFI_REGISTER_GLOBAL("relax.VMTIRCodeGen").set_body_typed(VMTIRCodeGen);
-} // namespace relax_vm
+} // namespace codegen_vm
} // namespace relax
} // namespace tvm
diff --git a/src/relax/backend/vm/vm_shape_lower.cc
b/src/relax/backend/vm/vm_shape_lower.cc
index 0b60553034..50e71ccc14 100644
--- a/src/relax/backend/vm/vm_shape_lower.cc
+++ b/src/relax/backend/vm/vm_shape_lower.cc
@@ -25,7 +25,7 @@
#include <tvm/relax/expr_functor.h>
#include <tvm/relax/struct_info.h>
#include <tvm/relax/struct_info_functor.h>
-#include <tvm/runtime/relax_vm/builtin.h>
+#include <tvm/runtime/vm/builtin.h>
#include <tvm/tir/analysis.h>
#include <tvm/tir/function.h>
#include <tvm/tir/op.h>
@@ -176,7 +176,7 @@ class PrimExprSlotCollector : public ExprVisitor, public
StructInfoVisitor {
* - VisitExpr_(ShapeExprNode*): makes symbolic shape tuple.
*
* The checks and symbolic shape all maps to runtime builtin functions. Please
checkout
- * runtime/relax_vm/builtin.cc for their definitions.
+ * runtime/vm/builtin.cc for their definitions.
*
* Shape computation are lowered to host-side TIR functions that load var from
slot
* and store computed results into the slot. For a given slot map: {0:m, 1:
n+1: 2: n}
@@ -353,7 +353,7 @@ class VMShapeLowerMutator
}
std::pair<Expr, Expr> MakeSymbolicShapeArg(const PrimExpr& expr) {
- using runtime::relax_vm::MakeShapeCode;
+ using runtime::vm::MakeShapeCode;
if (auto* int_expr = expr.as<IntImmNode>()) {
return {PrimValue::Int64(static_cast<int>(MakeShapeCode::kUseImm)),
@@ -370,7 +370,7 @@ class VMShapeLowerMutator
}
Expr VisitExpr_(const PrimValueNode* op) final {
- using runtime::relax_vm::MakeShapeCode;
+ using runtime::vm::MakeShapeCode;
// Constant shape can be preserved.
bool is_const_value =
op->value->IsInstance<IntImmNode>() ||
op->value->IsInstance<FloatImmNode>();
@@ -389,7 +389,7 @@ class VMShapeLowerMutator
}
Expr VisitExpr_(const ShapeExprNode* op) final {
- using runtime::relax_vm::MakeShapeCode;
+ using runtime::vm::MakeShapeCode;
// Constant shape can be preserved.
bool is_const_shape = std::all_of(op->values.begin(), op->values.end(),
[](const PrimExpr& e) {
return e->IsInstance<IntImmNode>();
@@ -444,9 +444,9 @@ class VMShapeLowerMutator
* \return The MatchShapeCode, and a relax expression specifying the
* argument used by that MatchShapeCode.
*/
- std::pair<runtime::relax_vm::MatchShapeCode, Expr> MakeMatchArgs(const
PrimExpr& expr,
- bool
require_value_computed) {
- using runtime::relax_vm::MatchShapeCode;
+ std::pair<runtime::vm::MatchShapeCode, Expr> MakeMatchArgs(const PrimExpr&
expr,
+ bool
require_value_computed) {
+ using runtime::vm::MatchShapeCode;
if (auto* int_expr = expr.as<IntImmNode>()) {
return {MatchShapeCode::kAssertEqualToImm,
PrimValue::Int64(int_expr->value)};
@@ -496,7 +496,7 @@ class VMShapeLowerMutator
bool require_value_computed) {
std::vector<MatchShapeTodoItem> outstanding_todos;
- using runtime::relax_vm::MatchShapeCode;
+ using runtime::vm::MatchShapeCode;
for (const MatchShapeTodoItem& item : match_todos) {
bool all_nop = true;
bool any_nop = false;
diff --git a/src/runtime/disco/builtin.cc b/src/runtime/disco/builtin.cc
index 7c769b7dd0..9cd76e673a 100644
--- a/src/runtime/disco/builtin.cc
+++ b/src/runtime/disco/builtin.cc
@@ -22,7 +22,7 @@
#include <tvm/runtime/disco/builtin.h>
#include <tvm/runtime/disco/disco_worker.h>
#include <tvm/runtime/disco/session.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/vm.h>
#include <sstream>
diff --git a/src/runtime/disco/loader.cc b/src/runtime/disco/loader.cc
index f93170d02f..52e7833601 100644
--- a/src/runtime/disco/loader.cc
+++ b/src/runtime/disco/loader.cc
@@ -24,7 +24,7 @@
#include <tvm/ffi/function.h>
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/disco/builtin.h>
-#include <tvm/runtime/relax_vm/ndarray_cache_support.h>
+#include <tvm/runtime/vm/ndarray_cache_support.h>
#include <functional>
#include <numeric>
@@ -38,7 +38,7 @@
namespace tvm {
namespace runtime {
-using relax_vm::NDArrayCacheMetadata;
+using vm::NDArrayCacheMetadata;
using FileRecord = NDArrayCacheMetadata::FileRecord;
using ParamRecord = NDArrayCacheMetadata::FileRecord::ParamRecord;
diff --git a/src/runtime/relax_vm/attn_backend.cc
b/src/runtime/vm/attn_backend.cc
similarity index 97%
rename from src/runtime/relax_vm/attn_backend.cc
rename to src/runtime/vm/attn_backend.cc
index 09f2d2c736..f3aaf3f688 100644
--- a/src/runtime/relax_vm/attn_backend.cc
+++ b/src/runtime/vm/attn_backend.cc
@@ -17,13 +17,13 @@
* under the License.
*/
-/*! \file src/runtime/relax_vm/attn_backend.cc */
+/*! \file src/runtime/vm/attn_backend.cc */
#include "attn_backend.h"
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
std::unique_ptr<PagedPrefillFunc> ConvertPagedPrefillFunc(Array<ObjectRef>
args,
AttnKind attn_kind) {
@@ -120,6 +120,6 @@ std::unique_ptr<RaggedPrefillTreeMaskFunc>
ConvertRaggedPrefillTreeMaskFunc(Arra
throw;
}
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/attn_backend.h b/src/runtime/vm/attn_backend.h
similarity index 99%
rename from src/runtime/relax_vm/attn_backend.h
rename to src/runtime/vm/attn_backend.h
index 2eb9cf3d66..21d8d81a8b 100644
--- a/src/runtime/relax_vm/attn_backend.h
+++ b/src/runtime/vm/attn_backend.h
@@ -18,12 +18,12 @@
*/
/*!
- * \file src/runtime/relax_vm/attn_backend.h
+ * \file src/runtime/vm/attn_backend.h
* \brief The attention backend classes used by KV cache.
*/
-#ifndef TVM_RUNTIME_RELAX_VM_ATTN_BACKEND_H_
-#define TVM_RUNTIME_RELAX_VM_ATTN_BACKEND_H_
+#ifndef TVM_RUNTIME_VM_ATTN_BACKEND_H_
+#define TVM_RUNTIME_VM_ATTN_BACKEND_H_
#include <tvm/ffi/container/array.h>
#include <tvm/ffi/function.h>
@@ -39,7 +39,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*! \brief The attention backend kinds. */
enum class AttnBackendKind : int {
@@ -537,8 +537,8 @@ std::unique_ptr<PagedPrefillTreeMaskFunc>
ConvertPagedPrefillTreeMaskFunc(Array<
std::unique_ptr<RaggedPrefillTreeMaskFunc>
ConvertRaggedPrefillTreeMaskFunc(Array<ObjectRef> args,
AttnKind attn_kind);
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_ATTN_BACKEND_H_
+#endif // TVM_RUNTIME_VM_ATTN_BACKEND_H_
diff --git a/src/runtime/relax_vm/attn_utils.h b/src/runtime/vm/attn_utils.h
similarity index 99%
rename from src/runtime/relax_vm/attn_utils.h
rename to src/runtime/vm/attn_utils.h
index 547d32c120..dce577da08 100644
--- a/src/runtime/relax_vm/attn_utils.h
+++ b/src/runtime/vm/attn_utils.h
@@ -17,12 +17,12 @@
* under the License.
*/
/*!
- * \file src/runtime/relax_vm/attn_utils.h
+ * \file src/runtime/vm/attn_utils.h
* \brief Data structure and utilities for KV cache.
*/
-#ifndef TVM_RUNTIME_RELAX_VM_ATTN_UTILS_H_
-#define TVM_RUNTIME_RELAX_VM_ATTN_UTILS_H_
+#ifndef TVM_RUNTIME_VM_ATTN_UTILS_H_
+#define TVM_RUNTIME_VM_ATTN_UTILS_H_
#include <tvm/runtime/ndarray.h>
@@ -36,7 +36,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*!
* \brief The maximum allowed block depth (a.k.a. number of common
@@ -1023,8 +1023,8 @@ class CachedPagedKVCacheAuxDataManager : public
PagedKVCacheAuxDataManager {
NDArray merged_compact_kv_aux_data_device_;
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_ATTN_UTILS_H_
+#endif // TVM_RUNTIME_VM_ATTN_UTILS_H_
diff --git a/src/runtime/relax_vm/builtin.cc b/src/runtime/vm/builtin.cc
similarity index 99%
rename from src/runtime/relax_vm/builtin.cc
rename to src/runtime/vm/builtin.cc
index 3d7904bd8f..a23e196e5c 100644
--- a/src/runtime/relax_vm/builtin.cc
+++ b/src/runtime/vm/builtin.cc
@@ -17,7 +17,7 @@
* under the License.
*/
/*!
- * \file src/runtime/relax_vm/builtin.cc
+ * \file src/runtime/vm/builtin.cc
*/
#include <tvm/ffi/any.h>
#include <tvm/ffi/container/array.h>
@@ -29,13 +29,13 @@
#include <tvm/runtime/logging.h>
#include <tvm/runtime/memory/memory_manager.h>
#include <tvm/runtime/ndarray.h>
-#include <tvm/runtime/relax_vm/builtin.h>
-#include <tvm/runtime/relax_vm/bytecode.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/builtin.h>
+#include <tvm/runtime/vm/bytecode.h>
+#include <tvm/runtime/vm/vm.h>
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
using tvm::runtime::NDArray;
@@ -562,7 +562,7 @@
TVM_FFI_REGISTER_GLOBAL("vm.builtin.ensure_zero_offset").set_body_typed([](NDArr
}
});
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/bytecode.cc b/src/runtime/vm/bytecode.cc
similarity index 93%
rename from src/runtime/relax_vm/bytecode.cc
rename to src/runtime/vm/bytecode.cc
index 9084207848..4356305521 100644
--- a/src/runtime/relax_vm/bytecode.cc
+++ b/src/runtime/vm/bytecode.cc
@@ -18,19 +18,19 @@
*/
/*!
- * \file src/runtime/relax_vm/bytecode.cc
+ * \file src/runtime/vm/bytecode.cc
* \brief The bytecode for Relax virtual machine.
*/
#include <tvm/runtime/logging.h>
-#include <tvm/runtime/relax_vm/bytecode.h>
+#include <tvm/runtime/vm/bytecode.h>
#include <functional>
#include <sstream>
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
Instruction Instruction::Call(Index func_idx, Index num_args,
Instruction::Arg* args, RegName dst) {
Instruction instr;
@@ -63,6 +63,6 @@ Instruction Instruction::If(RegName cond, Index false_offset)
{
instr.false_offset = false_offset;
return instr;
}
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/cuda/cuda_graph_builtin.cc
b/src/runtime/vm/cuda/cuda_graph_builtin.cc
similarity index 97%
rename from src/runtime/relax_vm/cuda/cuda_graph_builtin.cc
rename to src/runtime/vm/cuda/cuda_graph_builtin.cc
index d3484cbc7b..fb0534eec5 100644
--- a/src/runtime/relax_vm/cuda/cuda_graph_builtin.cc
+++ b/src/runtime/vm/cuda/cuda_graph_builtin.cc
@@ -18,19 +18,19 @@
*/
/*!
- * \file src/runtime/relax_vm/cuda_graph_builtin.cc
+ * \file src/runtime/vm/cuda_graph_builtin.cc
* \brief The CUDA graph related builtin functions for Relax virtual machine.
*/
#include <tvm/ffi/container/array.h>
#include <tvm/ffi/function.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/vm.h>
#include "../../../support/utils.h"
#include "../../cuda/cuda_common.h"
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
namespace {
@@ -213,7 +213,7 @@ class CUDAGraphExtensionNode : public VMExtensionNode {
return alloc_result;
}
- static constexpr const char* _type_key = "relax_vm.CUDAGraphExtension";
+ static constexpr const char* _type_key = "vm.CUDAGraphExtension";
private:
/*!
@@ -265,6 +265,6 @@
TVM_FFI_REGISTER_GLOBAL("vm.builtin.cuda_graph.get_cached_alloc")
*rv = extension->GetCachedAllocation(vm, alloc_func, entry_index);
});
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/executable.cc b/src/runtime/vm/executable.cc
similarity index 98%
rename from src/runtime/relax_vm/executable.cc
rename to src/runtime/vm/executable.cc
index 52a0588be3..f33ce6bc0e 100644
--- a/src/runtime/relax_vm/executable.cc
+++ b/src/runtime/vm/executable.cc
@@ -18,13 +18,13 @@
*/
/*!
- * \file src/runtime/relax_vm/executable.cc
+ * \file src/runtime/vm/executable.cc
*/
#include <dmlc/memory_io.h>
#include <tvm/runtime/logging.h>
-#include <tvm/runtime/relax_vm/executable.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/executable.h>
+#include <tvm/runtime/vm/vm.h>
#include <functional>
#include <sstream>
@@ -33,7 +33,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*! \brief The magic number for the serialized VM bytecode file */
constexpr uint64_t kTVMVMBytecodeMagic = 0xD225DE2F4214151D;
@@ -144,7 +144,7 @@ Instruction VMExecutable::GetInstruction(Index i) const {
void SaveHeader(dmlc::Stream* strm) {
uint64_t header = kTVMVMBytecodeMagic;
strm->Write(header);
- std::string version = RELAX_VM_VERSION;
+ std::string version = VM_VERSION;
strm->Write(version);
}
@@ -157,7 +157,7 @@ void LoadHeader(dmlc::Stream* strm) {
// Check version.
std::string version;
STREAM_CHECK(strm->Read(&version), "version");
- STREAM_CHECK(version == RELAX_VM_VERSION, "version");
+ STREAM_CHECK(version == VM_VERSION, "version");
}
void VMExecutable::SaveToBinary(dmlc::Stream* stream) {
@@ -559,6 +559,6 @@ String VMExecutable::AsPython() const {
TVM_FFI_REGISTER_GLOBAL("relax.ExecutableLoadFromFile").set_body_typed(VMExecutable::LoadFromFile);
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/hexagon/builtin.cc
b/src/runtime/vm/hexagon/builtin.cc
similarity index 95%
rename from src/runtime/relax_vm/hexagon/builtin.cc
rename to src/runtime/vm/hexagon/builtin.cc
index 89f1708b28..c48445130c 100644
--- a/src/runtime/relax_vm/hexagon/builtin.cc
+++ b/src/runtime/vm/hexagon/builtin.cc
@@ -18,18 +18,18 @@
*/
/*!
- * \file src/runtime/relax_vm/hexagon/builtin.cc
+ * \file src/runtime/vm/hexagon/builtin.cc
* \brief The hexagon graph related builtin functions for Relax virtual
machine.
*/
#include <tvm/ffi/function.h>
#include <tvm/runtime/device_api.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/vm.h>
#include "../../hexagon/hexagon_device_api.h"
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
TVM_FFI_REGISTER_GLOBAL("vm.builtin.hexagon.dma_copy")
.set_body_typed([](ffi::AnyView vm_ptr, NDArray src_arr, NDArray dst_arr,
int queue_id,
@@ -66,6 +66,6 @@ TVM_FFI_REGISTER_GLOBAL("vm.builtin.hexagon.dma_wait")
QURT_MEM_DCACHE);
}
});
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/kv_state.cc b/src/runtime/vm/kv_state.cc
similarity index 99%
rename from src/runtime/relax_vm/kv_state.cc
rename to src/runtime/vm/kv_state.cc
index 12f52c0794..466d41e3d3 100644
--- a/src/runtime/relax_vm/kv_state.cc
+++ b/src/runtime/vm/kv_state.cc
@@ -23,7 +23,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
// Register Object Type
TVM_REGISTER_OBJECT_TYPE(KVStateObj);
@@ -114,6 +114,6 @@ TVM_FFI_REGISTER_GLOBAL("vm.builtin.rnn_state_set")
});
TVM_FFI_REGISTER_GLOBAL("vm.builtin.rnn_state_debug_get").set_body_method(&RNNStateObj::DebugGet);
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/kv_state.h b/src/runtime/vm/kv_state.h
similarity index 98%
rename from src/runtime/relax_vm/kv_state.h
rename to src/runtime/vm/kv_state.h
index 5800c4e2db..46d8f4f596 100644
--- a/src/runtime/relax_vm/kv_state.h
+++ b/src/runtime/vm/kv_state.h
@@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-#ifndef TVM_RUNTIME_RELAX_VM_KV_STATE_H_
-#define TVM_RUNTIME_RELAX_VM_KV_STATE_H_
+#ifndef TVM_RUNTIME_VM_KV_STATE_H_
+#define TVM_RUNTIME_VM_KV_STATE_H_
#include <tvm/ffi/container/array.h>
#include <tvm/ffi/function.h>
#include <tvm/runtime/device_api.h>
@@ -28,7 +28,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
/*! \brief The base class of attention KV cache and rnn state. */
class KVStateObj : public Object {
@@ -345,8 +345,8 @@ class RNNState : public KVState {
TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(RNNState, KVState, RNNStateObj);
};
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
-#endif // TVM_RUNTIME_RELAX_VM_KV_STATE_H_
+#endif // TVM_RUNTIME_VM_KV_STATE_H_
diff --git a/src/runtime/relax_vm/lm_support.cc b/src/runtime/vm/lm_support.cc
similarity index 99%
rename from src/runtime/relax_vm/lm_support.cc
rename to src/runtime/vm/lm_support.cc
index 8abeddcf18..baf5bf480e 100644
--- a/src/runtime/relax_vm/lm_support.cc
+++ b/src/runtime/vm/lm_support.cc
@@ -17,7 +17,7 @@
* under the License.
*/
/*!
- * \file src/runtime/relax_vm/lm_support.cc
+ * \file src/runtime/vm/lm_support.cc
* \brief Runtime to support language model related task
*
* Including inplace attention kv cache for runtime and simple sampler.
@@ -42,13 +42,13 @@
#include <tvm/runtime/logging.h>
#include <tvm/runtime/memory/memory_manager.h>
#include <tvm/runtime/ndarray.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/vm.h>
#include <cmath>
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
//-------------------------------------------
// We keep the implementation private as
@@ -621,6 +621,6 @@ void ApplySoftmaxWithTemperature(NDArray logits, double
temperature) {
TVM_FFI_REGISTER_GLOBAL("vm.builtin.apply_softmax_with_temperature")
.set_body_typed(ApplySoftmaxWithTemperature);
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/ndarray_cache_support.cc
b/src/runtime/vm/ndarray_cache_support.cc
similarity index 98%
rename from src/runtime/relax_vm/ndarray_cache_support.cc
rename to src/runtime/vm/ndarray_cache_support.cc
index 7341507e9a..17f07df70c 100644
--- a/src/runtime/relax_vm/ndarray_cache_support.cc
+++ b/src/runtime/vm/ndarray_cache_support.cc
@@ -17,7 +17,7 @@
* under the License.
*/
/*!
- * \file src/runtime/relax_vm/ndarray_cache_support.cc
+ * \file src/runtime/vm/ndarray_cache_support.cc
* \brief Runtime to support ndarray cache file loading.
*
* This file provides a minimum support for ndarray cache file loading.
@@ -41,7 +41,7 @@
#include <picojson.h>
#include <tvm/ffi/function.h>
#include <tvm/runtime/ndarray.h>
-#include <tvm/runtime/relax_vm/ndarray_cache_support.h>
+#include <tvm/runtime/vm/ndarray_cache_support.h>
#include <string>
#include <vector>
@@ -51,7 +51,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
template <typename ExpectedType>
inline ExpectedType AsType(const picojson::value& json) {
@@ -375,6 +375,6 @@
TVM_FFI_REGISTER_GLOBAL("vm.builtin.param_array_from_cache_by_name_unpacked")
*rv = ParamModuleNode::GetParamByName(names);
});
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/paged_kv_cache.cc
b/src/runtime/vm/paged_kv_cache.cc
similarity index 99%
rename from src/runtime/relax_vm/paged_kv_cache.cc
rename to src/runtime/vm/paged_kv_cache.cc
index 2f21e6978a..5b70c03177 100644
--- a/src/runtime/relax_vm/paged_kv_cache.cc
+++ b/src/runtime/vm/paged_kv_cache.cc
@@ -17,7 +17,7 @@
* under the License.
*/
/*!
- * \file src/runtime/relax_vm/paged_kv_cache.cc
+ * \file src/runtime/vm/paged_kv_cache.cc
* \brief Runtime paged KV cache object for language models.
*/
#include <tvm/ffi/function.h>
@@ -39,7 +39,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
//-------------------------------------------
// We keep the implementation private as
@@ -2276,7 +2276,7 @@ class PagedAttentionKVCacheObj : public
AttentionKVCacheObj {
// - Reset the dirty flag to false.
dirty_aux_data_device_ = false;
}
-}; // namespace relax_vm
+}; // namespace vm
TVM_REGISTER_OBJECT_TYPE(PagedAttentionKVCacheObj);
@@ -2387,6 +2387,6 @@
TVM_FFI_REGISTER_GLOBAL("vm.builtin.paged_attention_kv_cache_create")
*rv = AttentionKVCache(std::move(n));
});
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/rnn_state.cc b/src/runtime/vm/rnn_state.cc
similarity index 99%
rename from src/runtime/relax_vm/rnn_state.cc
rename to src/runtime/vm/rnn_state.cc
index d431fdb2ae..e7a655d392 100644
--- a/src/runtime/relax_vm/rnn_state.cc
+++ b/src/runtime/vm/rnn_state.cc
@@ -17,7 +17,7 @@
* under the License.
*/
/*!
- * \file src/runtime/relax_vm/rnn_state.cc
+ * \file src/runtime/vm/rnn_state.cc
* \brief Runtime RNN state object for space state models.
*/
@@ -28,7 +28,7 @@
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
//-----------------------------------------------------------------------------
// We keep the implementation private as they may subject to future changes.
@@ -495,6 +495,6 @@ TVM_FFI_REGISTER_GLOBAL("vm.builtin.rnn_state_create")
return RNNState(std::move(n));
});
-} // namespace relax_vm
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/src/runtime/relax_vm/vm.cc b/src/runtime/vm/vm.cc
similarity index 99%
rename from src/runtime/relax_vm/vm.cc
rename to src/runtime/vm/vm.cc
index 8d0b928f85..55a5a87d27 100644
--- a/src/runtime/relax_vm/vm.cc
+++ b/src/runtime/vm/vm.cc
@@ -18,21 +18,21 @@
*/
/*!
- * \file src/runtime/relax_vm/vm.cc
+ * \file src/runtime/vm/vm.cc
*/
#include <dlpack/dlpack.h>
#include <tvm/ffi/function.h>
#include <tvm/runtime/memory/memory_manager.h>
#include <tvm/runtime/nvtx.h>
#include <tvm/runtime/profiling.h>
-#include <tvm/runtime/relax_vm/vm.h>
+#include <tvm/runtime/vm/vm.h>
#include <optional>
#include <thread>
namespace tvm {
namespace runtime {
-namespace relax_vm {
+namespace vm {
//---------------------------------------------
// VM Closure object
@@ -965,7 +965,7 @@ ffi::Function VirtualMachineImpl::_LookupFunction(const
String& name) {
//----------------------------------------------------------------
// Profiler can be optionally disabled via a macro to reduce dep.
//----------------------------------------------------------------
-#if TVM_RELAX_VM_ENABLE_PROFILER
+#if TVM_VM_ENABLE_PROFILER
/*!
* \brief An extension of VirtualMachineImpl to support per-op profiling
@@ -1081,7 +1081,7 @@ ObjectPtr<VirtualMachine>
VirtualMachine::CreateProfiler() {
LOG(FATAL) << "Profiler support is disabled";
return nullptr;
}
-#endif // TVM_RELAX_VM_ENABLE_PROFILER
-} // namespace relax_vm
+#endif // TVM_VM_ENABLE_PROFILER
+} // namespace vm
} // namespace runtime
} // namespace tvm
diff --git a/tests/python/contrib/test_tir_triton_integration.py
b/tests/python/contrib/test_tir_triton_integration.py
index 69f7271505..b349d2fabc 100644
--- a/tests/python/contrib/test_tir_triton_integration.py
+++ b/tests/python/contrib/test_tir_triton_integration.py
@@ -14,17 +14,18 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import numpy as np
import sys
+import numpy as np
+import pytest
+
import tvm
-from tvm.script import tir as T
-from tvm.script import relax as R
-from tvm.script import ir as I
+import tvm.testing
from tvm import relax
from tvm.relax.frontend import nn
-import tvm.testing
-import pytest
+from tvm.script import ir as I
+from tvm.script import relax as R
+from tvm.script import tir as T
try:
import triton
@@ -115,5 +116,5 @@ def test_tir_triton_integration():
with tvm.target.Target("cuda"):
lib = tvm.compile(Module)
- output_nd = tvm.runtime.relax_vm.VirtualMachine(lib,
device)["main"](x_nd, y_nd)
+ output_nd = tvm.runtime.vm.VirtualMachine(lib, device)["main"](x_nd,
y_nd)
tvm.testing.assert_allclose(output_nd.numpy(), output_np, rtol=1e-5)
diff --git a/tests/python/disco/test_ccl.py b/tests/python/disco/test_ccl.py
index f93030f639..649b865b6c 100644
--- a/tests/python/disco/test_ccl.py
+++ b/tests/python/disco/test_ccl.py
@@ -28,7 +28,7 @@ from tvm import dlight as dl
from tvm import get_global_func
from tvm import relax as rx
from tvm.runtime import disco as di
-from tvm.runtime.relax_vm import VirtualMachine
+from tvm.runtime.vm import VirtualMachine
from tvm.script import relax as R
_all_session_kinds = [di.ThreadedSession, di.ProcessSession]
diff --git a/tests/python/relax/test_frontend_nn_extern_module.py
b/tests/python/relax/test_frontend_nn_extern_module.py
index 5aa48dd18a..cbc2e7f429 100644
--- a/tests/python/relax/test_frontend_nn_extern_module.py
+++ b/tests/python/relax/test_frontend_nn_extern_module.py
@@ -189,7 +189,7 @@ def test_extern_object():
)
_check_ir_equality(mod)
mod = AttachExternModules(ext_mods)(mod) # pylint:
disable=not-callable
- compiled = tvm.runtime.relax_vm.VirtualMachine(
+ compiled = tvm.runtime.vm.VirtualMachine(
tvm.compile(mod, target="llvm"),
device=tvm.cpu(),
)
@@ -238,7 +238,7 @@ def test_extern_source():
)
_check_ir_equality(mod)
mod = AttachExternModules(ext_mods)(mod) # pylint: disable=not-callable
- compiled = tvm.runtime.relax_vm.VirtualMachine(
+ compiled = tvm.runtime.vm.VirtualMachine(
tvm.compile(mod, target="llvm"),
device=tvm.cpu(),
)
diff --git a/tests/python/relax/test_tir_call_source_kernel.py
b/tests/python/relax/test_tir_call_source_kernel.py
index 9aba489f48..d7ca2a672b 100644
--- a/tests/python/relax/test_tir_call_source_kernel.py
+++ b/tests/python/relax/test_tir_call_source_kernel.py
@@ -20,7 +20,9 @@ import numpy as np
import tvm
import tvm.testing
from tvm import relax
-from tvm.script import tir as T, ir as I, relax as R
+from tvm.script import ir as I
+from tvm.script import relax as R
+from tvm.script import tir as T
add_cuda_source = """
extern "C" __global__ void add_kernel(float* x, float* y, float* output, int
n_elements) {
@@ -96,5 +98,5 @@ def test_tir_call_source_kernel():
with tvm.target.Target("cuda"):
lib = tvm.compile(Module)
- output_nd = tvm.runtime.relax_vm.VirtualMachine(lib,
device)["main"](x_nd, y_nd)
+ output_nd = tvm.runtime.vm.VirtualMachine(lib, device)["main"](x_nd,
y_nd)
tvm.testing.assert_allclose(output_nd.numpy(), output_np, rtol=1e-5)
diff --git a/tests/python/relax/test_training_optimizer_numeric.py
b/tests/python/relax/test_training_optimizer_numeric.py
index 937582adf7..6a9c34a5fb 100644
--- a/tests/python/relax/test_training_optimizer_numeric.py
+++ b/tests/python/relax/test_training_optimizer_numeric.py
@@ -18,13 +18,13 @@
from typing import Callable, List
import numpy as np
+
import tvm
import tvm.testing
-from tvm import relax
-from tvm import IRModule
-from tvm.relax.training.optimizer import Adam, SGD, MomentumSGD
+from tvm import IRModule, relax
+from tvm.relax.training.optimizer import SGD, Adam, MomentumSGD
+from tvm.runtime.vm import VirtualMachine
from tvm.script.parser import relax as R
-from tvm.runtime.relax_vm import VirtualMachine
from tvm.testing import assert_allclose
diff --git a/web/emcc/wasm_runtime.cc b/web/emcc/wasm_runtime.cc
index 40dfb31ad1..3c1c15a861 100644
--- a/web/emcc/wasm_runtime.cc
+++ b/web/emcc/wasm_runtime.cc
@@ -60,16 +60,16 @@
#include "ffi/src/ffi/traceback.cc"
#include "src/runtime/memory/memory_manager.cc"
#include "src/runtime/nvtx.cc"
-#include "src/runtime/relax_vm/attn_backend.cc"
-#include "src/runtime/relax_vm/builtin.cc"
-#include "src/runtime/relax_vm/bytecode.cc"
-#include "src/runtime/relax_vm/executable.cc"
-#include "src/runtime/relax_vm/kv_state.cc"
-#include "src/runtime/relax_vm/lm_support.cc"
-#include "src/runtime/relax_vm/ndarray_cache_support.cc"
-#include "src/runtime/relax_vm/paged_kv_cache.cc"
-#include "src/runtime/relax_vm/rnn_state.cc"
-#include "src/runtime/relax_vm/vm.cc"
+#include "src/runtime/vm/attn_backend.cc"
+#include "src/runtime/vm/builtin.cc"
+#include "src/runtime/vm/bytecode.cc"
+#include "src/runtime/vm/executable.cc"
+#include "src/runtime/vm/kv_state.cc"
+#include "src/runtime/vm/lm_support.cc"
+#include "src/runtime/vm/ndarray_cache_support.cc"
+#include "src/runtime/vm/paged_kv_cache.cc"
+#include "src/runtime/vm/rnn_state.cc"
+#include "src/runtime/vm/vm.cc"
// --- Implementations of backend and wasm runtime API. ---
diff --git a/web/tests/node/test_relax_vm.js b/web/tests/node/test_vm.js
similarity index 100%
rename from web/tests/node/test_relax_vm.js
rename to web/tests/node/test_vm.js