You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2023/07/06 16:03:46 UTC

[tvm] branch unity updated: [Unity] Add a Standalone VM Version Number (#15254)

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

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


The following commit(s) were added to refs/heads/unity by this push:
     new 5828f1e9ee [Unity] Add a Standalone VM Version Number (#15254)
5828f1e9ee is described below

commit 5828f1e9eea24747fa9366d0b396d01c1585cbb8
Author: Siyuan Feng <Hz...@sjtu.edu.cn>
AuthorDate: Fri Jul 7 00:03:40 2023 +0800

    [Unity] Add a Standalone VM Version Number (#15254)
    
    This PR introduces a new field, `RELAX_VM_VERSION`, to the `Executable`
    struct. The VM version is more stable than the TVM version, it would be
    the minimum TVM version it support the current VM status.
---
 include/tvm/runtime/relax_vm/executable.h | 6 ++++++
 src/runtime/relax_vm/executable.cc        | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/tvm/runtime/relax_vm/executable.h b/include/tvm/runtime/relax_vm/executable.h
index d3bf9d356e..68c3cc7e15 100644
--- a/include/tvm/runtime/relax_vm/executable.h
+++ b/include/tvm/runtime/relax_vm/executable.h
@@ -33,6 +33,12 @@
 
 #include "./bytecode.h"
 
+// Convention: this version should set to minimum TVM version it support
+// 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"
+
 namespace tvm {
 namespace runtime {
 namespace relax_vm {
diff --git a/src/runtime/relax_vm/executable.cc b/src/runtime/relax_vm/executable.cc
index 5abed9bbbb..6ac5b56f37 100644
--- a/src/runtime/relax_vm/executable.cc
+++ b/src/runtime/relax_vm/executable.cc
@@ -183,7 +183,7 @@ Instruction Executable::GetInstruction(Index i) const {
 void SaveHeader(dmlc::Stream* strm) {
   uint64_t header = kTVMVMBytecodeMagic;
   strm->Write(header);
-  std::string version = TVM_VERSION;
+  std::string version = RELAX_VM_VERSION;
   strm->Write(version);
 }
 
@@ -196,7 +196,7 @@ void LoadHeader(dmlc::Stream* strm) {
   // Check version.
   std::string version;
   STREAM_CHECK(strm->Read(&version), "version");
-  STREAM_CHECK(version == TVM_VERSION, "version");
+  STREAM_CHECK(version == RELAX_VM_VERSION, "version");
 }
 
 void Executable::SaveToBinary(dmlc::Stream* stream) {