-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Description
We are in the process of refactoring recently. Some of them are cleanup of legacy code in the new version, some other prepares code changes for #4617
This thread tracks related infra changes and guides to sync the code with the mainline as suggested by @merrymercy . Please feel free to reply to add more suggestions
DataType to runtime
- Rationale: DataType is a runtime data structure
- PRs [REFACTOR][DTYPE] Isolate dtype to runtime #4560
- Rename all old reference of tvm::Type to DataType
- ExprNode.type -> ExprNode.dtype, Expr.type() -> Expr.dtype()
- Move type constructors as static function: Int(bits) -> DataType::Int(bits)
Node Object Unification
- Rationale: remove a few redirected macros and alias, unify node and object
- PRs: [REFACTOR][OBJECT] Consoldiate NodePtr/Ref/Hash/Equal to Object #4603
- NodeXYZ -> ObjectXYZ
- TVM_DEFINE_NODE_REF: define the class and TVM_DEFINE_OBJECT_REF_METHODS
IRMutator/Visitor Functor Unification
- Rationale: Unify mutator and functor
- PRs: [REFACTOR] Migrate Low-level IR Passes into the New Stmt/Expr Mutator #4607 [REFACTOR] Unify approach to Visitor/Mutator under Functor #4606
- Add
#include<tvm/tir/stmt_functor.h>for places that need mutator - IRMutator: sub-class StmtMutator or StmtExprMutator instead
- IRVisitor: sub-class StmtVisitor or StmtExprVisitor instead
TVM_REGISTER_API -> TVM_REGISTER_GLOBAL
- Rationale: remove indirection
- PR: [REFACTOR] TVM_REGISTER_API -> TVM_REGISTER_GLOBAL #4621
- Rename to TVM_REGISTER_GLOBAL in
runtime/registry.h
SeqStmt
- Rationale: avoid nested recursion in long blocks
- PR [REFACTOR][IR] Introduce SeqStmt to replace ir::Block #4627
- Use SeqStmt instead to constructs sequences
tir::Call.name -> op
- Use op(RelayExpr) to replace the string name. see [TIR][REFACTOR][API-CHANGE] Change Call.name to Call.op(RelayExpr) #5863
- Remove the call_type field [TIR][OP][API-CHANGE] Remove CallNode.call_type in favor of attribute. #5937
IRPrinter -> ReprPrinter
- Rationale: repr printer is shared across all variants in the stack
- PRs [REFACTOR] IRPrinter->NodePrinter, move to node/printer.h #4622 [REFACTOR] Establish printer in the source folder #4752
- Rename IRPrinter -> ReprPrinter
set_body_typed
- Rationale: avoid duplication in terms of type signatures
- [REFACTOR] Automatically deduce ftype signature in Registry.set_body_typed #4623
- Remove type signature argument in set_body_typed
// before
TVM_REGISTER_GLOBAL("add")
.set_body_typed<int(int)>([](int x) { return x + 1; }
// after
TVM_REGISTER_GLOBAL("add")
.set_body_typed([](int x) { return x + 1; }Node suffix Convention
- Rationale: unify the naming convention throughout the codebase see also [RFC] Unify IR Node and Reference Class Naming Convention #4648
- PRs [REFACTOR][IR] Add Node suffix to low-level IR nodes #4649
- Add Node suffix to low level IR nodes
- Add ObjectRef classes to the TIR nodes
- [TIR][REFACTOR][API-Change] Migrate the tvm/tir/expr.h to constructor #5773
- [TIR][REFACTOR][API-Change] Migrate tir/stmt.h to use constructor. #5778
- [REFACTOR][API-Change] Migrate all Object construction to constructor. #5784
tvm::Expr -> PrimExpr
- Rationale: the low-level expression is renamed to "primitive" expression in order to bring more unifications.
- PR [REFACTOR][IR] tvm::Expr -> PrimExpr(Primitive Expr) #4669
- tvm::Expr -> PrimExpr, ExprHash/ExprEqual->ObjectHash/ObjectEqual, VarExpr->Var
Relay Type/Module/Op
- Rationale: unify type system, and module across the stack.
- PRs [REFACTOR] Initialize Unified IR Type Data Structures #4616 [REFACTOR][IR] Allow Module to store BaseFunc #4678 [REFACTOR][IR] Unified IR IRModule structure. #4699
- tvm/relay/module.h -> tvm/ir/module.h
- relay::Module -> IRModule
Unified IR file Reorg
- Rationale: reorganize code to fit into the new unified ir proposal
New Subfolders and Namespaces
- ir: Common set of types and IR structures
- attrs.h -> ir/attrs.h [REFACTOR][IR] attrs.h -> ir #4709
- arith: Arithmetic simplification and integer analysis
- arithmetic.h -> arith/analyzer.h arith/bound.h arith/int_set.h arith/pattern.h
- [REFACTOR][ARITH] Unified IR, introduce include/tvm/arith/ #4722
- target: Target dependent information and codegen
- target_info.h -> target/target_info.h [REFACTOR] Introduce include/tvm/target #4721
- codegen.h -> target/codegen.h [REFACTOR][CODEGEN] codegen->target, build_module->driver #4742
- te namespace: Tensor expression DSL(compute and schedule)
- Add namespace to compute/schedule
- operation.h -> te/operation.h
- schedule.h -> te/schedule.h
- schedule_pass.h -> te/schedule_pass.h
- tensor.h -> te/tensor.h
- [REFACTOR] top - namespace for Tensor Operation DSL #4727, [REFACTOR] top->te #4759
- tir namespace: tensor-level IR
- lowered_func.h,buffer.h,data_layout.h -> tir/buffer.h,tir/data_layout.h,tir/lowered_func.h
- ir.h -> tir/expr.h, tir/stmt.h
- ir_functor_ext.h -> tir/expr_functor.h, tir/stmt_functor.h
- [REFACTOR][IR] Establish tir namespace #4740
LoweredFunc
TIR uses IRModule as basic unit of transformation instead of LoweredFunc.
ir_pass.h
- The IRModule->IRModule transformations are moved to tir/transform.h
- The IRModule->Analaysis result passes are moved to tir/analysis.h
Simplify
- Simplify function is removed, use Analyzer in arith/analyzer.h instead
- [REFACTOR][ARITH] Remove the legacy Simplify, migrate to Analyzer. #5385
BuildConfig
- BuildConfig-> PassContext
[REFACTOR][TIR][API-Change] Migrate BuildConfig to PassContext. #5668
Runtime Misc
- ThreadScope::make -> ThreadScope::Create
- StorageScope::make -> StorageScope::Create
- [REFACTOR][API-Change] Migrate all Object construction to constructor. #5784
Python
tvm.module -> tvm.runtime.module
API changes wrt to runtime.Module #4837
- tvm.module.load -> tvm.runtime.load_module
- tvm.module.enabled -> tvm.runtime.enabled
- tvm.module.system_lib -> tvm.runtime.system_lib
tvm.ir
API changes wrt to tvm.ir #4862
- tvm.relay.Module -> tvm.IRModule
tvm.target
API change wrt to tvm.target #4872
tvm.te
API change wrt to #4943
- tvm.create_schedule -> tvm.te.create_schedule
- tvm.placeholder -> tvm.te.placeholder
- tvm.compute -> tvm.te.compute
merrymercy, MarisaKirisame, ZihengJiang, bwasti, Hzfengsy and 1 more
Metadata
Metadata
Assignees
Labels
No labels