Skip to content

Commit

Permalink
[VM][Refactor] Move VM files to TVM runtime directory (tlc-pack#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterJH5574 authored and yongwww committed Mar 23, 2022
1 parent 7b01c35 commit f5376ca
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 55 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ list(APPEND COMPILER_SRCS "src/target/datatype/myfloat/myfloat.cc")
tvm_file_glob(GLOB RUNTIME_SRCS
src/runtime/*.cc
src/runtime/vm/*.cc
src/runtime/relax_vm/*.cc
)

if(BUILD_FOR_HEXAGON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@
*/

/*!
* \file tvm/relax/vm/exec_builder.h
* \file tvm/relax/exec_builder.h
*/
#ifndef TVM_RELAX_VM_EXEC_BUILDER_H_
#define TVM_RELAX_VM_EXEC_BUILDER_H_
#ifndef TVM_RELAX_EXEC_BUILDER_H_
#define TVM_RELAX_EXEC_BUILDER_H_

#include <tvm/ir/expr.h>
#include <tvm/node/reflection.h>
#include <tvm/node/repr_printer.h>
#include <tvm/runtime/object.h>
#include <tvm/runtime/registry.h>
#include <tvm/runtime/relax_vm/bytecode.h>
#include <tvm/runtime/relax_vm/executable.h>

#include <string>
#include <vector>

#include "./bytecode.h"
#include "./executable.h"

namespace tvm {
namespace relax {

Expand Down Expand Up @@ -121,4 +120,4 @@ class ExecBuilder : public ObjectRef {
} // namespace relax
} // namespace tvm

#endif // TVM_RELAX_VM_EXEC_BUILDER_H_
#endif // TVM_RELAX_EXEC_BUILDER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/

/*!
* \file tvm/relax/vm/bytecode.h
* \file tvm/runtime/relax_vm/bytecode.h
* \brief The bytecode for the virtual machine.
*/
#ifndef TVM_RELAX_VM_BYTECODE_H_
#define TVM_RELAX_VM_BYTECODE_H_
#ifndef TVM_RUNTIME_RELAX_VM_BYTECODE_H_
#define TVM_RUNTIME_RELAX_VM_BYTECODE_H_

#include <tvm/runtime/data_type.h>
#include <tvm/runtime/logging.h>
Expand Down Expand Up @@ -177,4 +177,4 @@ struct Instruction {
} // namespace runtime
} // namespace tvm

#endif // TVM_RELAX_VM_BYTECODE_H_
#endif // TVM_RUNTIME_RELAX_VM_BYTECODE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
*/

/*!
* \file tvm/relax/vm/executable.h
* \brief
* \file tvm/runtime/relax_vm/executable.h
*/
#ifndef TVM_RELAX_VM_EXECUTABLE_H_
#define TVM_RELAX_VM_EXECUTABLE_H_
#ifndef TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_
#define TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_

#include <tvm/ir/expr.h>
#include <tvm/runtime/object.h>
Expand Down Expand Up @@ -192,4 +191,4 @@ class Executable : public runtime::ModuleNode {
} // namespace runtime
} // namespace tvm

#endif // TVM_RELAX_VM_EXECUTABLE_H_
#endif // TVM_RUNTIME_RELAX_VM_EXECUTABLE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/

/*!
* \file tvm/relax/vm/memory_manager.h
* \file tvm/runtime/relax_vm/memory_manager.h
* \brief Abstract device memory management API
*/
#ifndef TVM_RELAX_VM_MEMORY_MANAGER_H_
#define TVM_RELAX_VM_MEMORY_MANAGER_H_
#ifndef TVM_RUNTIME_RELAX_VM_MEMORY_MANAGER_H_
#define TVM_RUNTIME_RELAX_VM_MEMORY_MANAGER_H_

#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/ndarray.h>
Expand Down Expand Up @@ -139,4 +139,4 @@ class Storage : public ObjectRef {
} // namespace runtime
} // namespace tvm

#endif // TVM_RELAX_VM_MEMORY_MANAGER_H_
#endif // TVM_RUNTIME_RELAX_VM_MEMORY_MANAGER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
*/

/*!
* \file tvm/relax/vm/vm.h
* \brief
* \file tvm/runtime/relax_vm/vm.h
*/
#ifndef TVM_RELAX_VM_VM_H_
#define TVM_RELAX_VM_VM_H_
#ifndef TVM_RUNTIME_RELAX_VM_VM_H_
#define TVM_RUNTIME_RELAX_VM_VM_H_

#include <memory>
#include <string>
Expand Down Expand Up @@ -202,4 +201,4 @@ class VirtualMachine : public runtime::ModuleNode {
} // namespace runtime
} // namespace tvm

#endif // TVM_RELAX_VM_VM_H_
#endif // TVM_RUNTIME_RELAX_VM_VM_H_
8 changes: 4 additions & 4 deletions src/relax/vm/builtin.cc → src/relax/backend/vm/builtin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
* under the License.
*/
/*!
* \file src/relax/vm/builtin.cc
* \file src/relax/backend/vm/builtin.cc
*/
#include <tvm/relax/vm/bytecode.h>
#include <tvm/relax/vm/memory_manager.h>
#include <tvm/relax/vm/vm.h>
#include <tvm/runtime/container/adt.h>
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/device_api.h>
Expand All @@ -30,6 +27,9 @@
#include <tvm/runtime/ndarray.h>
#include <tvm/runtime/packed_func.h>
#include <tvm/runtime/registry.h>
#include <tvm/runtime/relax_vm/bytecode.h>
#include <tvm/runtime/relax_vm/memory_manager.h>
#include <tvm/runtime/relax_vm/vm.h>

namespace tvm {
namespace runtime {
Expand Down
4 changes: 2 additions & 2 deletions src/relax/backend/vm/codegen_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#define TVM_RELAX_BACKEND_VM_CODEGEN_VM_H_

#include <tvm/ir/module.h>
#include <tvm/relax/vm/exec_builder.h>
#include <tvm/relax/vm/executable.h>
#include <tvm/relax/exec_builder.h>
#include <tvm/runtime/relax_vm/executable.h>
#include <tvm/target/target.h>

#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

/*!
* \file src/relax/vm/exec_builder.cc
* \file src/relax/backend/vm/exec_builder.cc
*/
#include <tvm/relax/vm/exec_builder.h>
#include <tvm/relax/exec_builder.h>

#include <sstream>

Expand Down
4 changes: 2 additions & 2 deletions src/relax/vm/bytecode.cc → src/runtime/relax_vm/bytecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/

/*!
* \file src/relax/vm/bytecode.cc
* \file src/runtime/relax_vm/bytecode.cc
* \brief The bytecode for Relax virtual machine.
*/

#include <tvm/relax/vm/bytecode.h>
#include <tvm/runtime/logging.h>
#include <tvm/runtime/relax_vm/bytecode.h>

#include <functional>
#include <sstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@
*/

/*!
* \file src/relax/vm/executable.cc
* \brief
* \file src/runtime/relax_vm/executable.cc
*/

#include <dmlc/memory_io.h>
#include <tvm/relax/vm/executable.h>
#include <tvm/relax/vm/vm.h>
#include <tvm/runtime/logging.h>
#include <tvm/runtime/relax_vm/executable.h>
#include <tvm/runtime/relax_vm/vm.h>

#include <functional>
#include <sstream>

#include "../../runtime/file_utils.h"
#include "../file_utils.h"

namespace tvm {
namespace runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/

/*!
* \file tvm/relax/vm/memory_manager.cc
* \file tvm/runtime/relax_vm/memory_manager.cc
* \brief Allocate and manage memory for the Relay VM.
*/
#include <tvm/relax/vm/memory_manager.h>
#include <tvm/runtime/relax_vm/memory_manager.h>

#include <memory>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/

/*!
* \file tvm/relax/vm/naive_allocator.h
* \file tvm/runtime/relax_vm/naive_allocator.h
*/
#ifndef TVM_RELAX_VM_NAIVE_ALLOCATOR_H_
#define TVM_RELAX_VM_NAIVE_ALLOCATOR_H_
#ifndef TVM_RUNTIME_RELAX_VM_NAIVE_ALLOCATOR_H_
#define TVM_RUNTIME_RELAX_VM_NAIVE_ALLOCATOR_H_

#include <tvm/relax/vm/memory_manager.h>
#include <tvm/runtime/device_api.h>
#include <tvm/runtime/relax_vm/memory_manager.h>

#include <atomic>

Expand Down Expand Up @@ -62,4 +62,4 @@ class NaiveAllocator final : public Allocator {
} // namespace runtime
} // namespace tvm

#endif // TVM_RELAX_VM_NAIVE_ALLOCATOR_H_
#endif // TVM_RUNTIME_RELAX_VM_NAIVE_ALLOCATOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/

/*!
* \file tvm/relax/vm/pooled_allocator.h
* \file tvm/runtime/relax_vm/pooled_allocator.h
*/
#ifndef TVM_RELAX_VM_POOLED_ALLOCATOR_H_
#define TVM_RELAX_VM_POOLED_ALLOCATOR_H_
#ifndef TVM_RUNTIME_RELAX_VM_POOLED_ALLOCATOR_H_
#define TVM_RUNTIME_RELAX_VM_POOLED_ALLOCATOR_H_

#include <tvm/relax/vm/memory_manager.h>
#include <tvm/runtime/device_api.h>
#include <tvm/runtime/relax_vm/memory_manager.h>

#include <atomic>
#include <mutex>
Expand Down Expand Up @@ -108,4 +108,4 @@ class PooledAllocator final : public Allocator {
} // namespace runtime
} // namespace tvm

#endif // TVM_RELAX_VM_POOLED_ALLOCATOR_H_
#endif // TVM_RUNTIME_RELAX_VM_POOLED_ALLOCATOR_H_
5 changes: 2 additions & 3 deletions src/relax/vm/vm.cc → src/runtime/relax_vm/vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
*/

/*!
* \file src/relax/vm/vm.cc
* \brief
* \file src/runtime/relax_vm/vm.cc
*/

#include <tvm/relax/vm/vm.h>
#include <tvm/runtime/relax_vm/vm.h>

namespace tvm {
namespace runtime {
Expand Down

0 comments on commit f5376ca

Please sign in to comment.