1. 18 Mar, 2020 2 commits
  2. 17 Mar, 2020 1 commit
  3. 14 Mar, 2020 1 commit
    • [TIR] Introduce tir::PrimFunc (#5070) · e0316415
      This PR introduces tir::PrimFunc which will be used as the TIR function
      container in the unified IR.
      
      Also streamlined the function attributes a bit further.
      - All common attributes are under tvm::attr
      - TIR specific attributes are under tvm::tir::attr and comes with a tir prefix
      - Use stl_style for attributes for now
      Tianqi Chen committed
  4. 12 Mar, 2020 2 commits
    • [REFACTOR] Streamline Function Attr interface. (#5045) · ec86d7f1
      * [REFACTOR] Streamline Function Attr interface.
      
      There has been quite a few recent changes that depends heavily on
      the function attr interface. This PR streamlines that interface by introducing
      two APIs that covers most of the usages.
      
      - GetAttr which gets a typed object for a given key
        - HasNonzeroAttr is a quick helper that calls GetAttr to quickly check an attribute
      - WithAttr that creates a new function object with the given attr
        - The API comes with copy on write optimization to avoid multiple copies
        - We deliberately pick the prefix With(instead of Set) to indicate this
          function does not mutate the original input.
      
      On the python side:
      - We allow read access via func.attrs (which is a DictAttr)
      - func.with_attrs to create a new instance with updated attrs.
      
      We also get rid of the small wrapper functions and make sure the API centered around
      the GetAttr and HasNonzeroAttr interface.
      
      This PR also changes the function construction to follow the new convention.
      
      * Address review comments
      
      * Address review comments
      
      * Fix doxygen path
      Tianqi Chen committed
    • [refactor][relay pass] Separate analysis and transform passes (#5035) · 14ba49c6
      * [refactor][relay pass] Separate analysis and transform passes into different subfolders
      
      * remove pass folder
      Zhi committed
  5. 11 Mar, 2020 2 commits
  6. 05 Mar, 2020 1 commit
  7. 02 Mar, 2020 1 commit
  8. 24 Feb, 2020 1 commit
    • [Relay][AutoTVM] Relay op strategy (#4644) · 623dd208
      * relay op strategy
      
      fix lint
      
      bitpack strategy
      
      bitserial_dense (#6)
      
      * update strategy
      
      * address comments
      
      fix a few topi test
      
      Dense strategy (#5)
      
      * dense
      
      * add biforst; remove comments
      
      * address comment
      
      Refactor x86 conv2d_NCHWc (#4)
      
      * Refactor x86 conv2d
      
      * Add x86 depthwise_conv2d_NCHWc
      
      * Add back topi x86 conv2d_nchw
      
      * Merge x86 conv2d_nchw and conv2d_NCHWc
      
      * Minor fix for x86 conv2d
      
      fix more strategy
      
      Add x86 conv2d_NCHWc_int8 strategy (#8)
      
      * Add x86 conv2d_NCHWc_int8 strategy
      
      * Remove contrib_conv2d_nchwc_int8
      
      * Fix generic conv2d_NCHWc for int8
      
      * Fix topi arm_cpu conv2d_NCHWc_int8
      
      update x86 conv2d
      
      enable specify relay ops to be tuned for autotvm
      
      add cuda conv2d strategy
      
      add conv2d strategy for rocm
      
      add conv2d strategy for hls
      
      add conv2d strategy for arm cpu
      
      add conv2d strategy for mali
      
      add conv2d strategy for bifrost
      
      add conv2d strategy for intel graphics
      
      clean up and fix lint
      
      remove template keys from autotvm
      
      remove 2 in the func name
      
      address comments
      
      fix
      
      * fix bugs
      
      * lint
      
      * address comments
      
      * add name to op implement
      
      * Modify topi tests (#9)
      
      * Add pooling, reorg, softmax and vision
      
      * Add lrn
      
      * fix topi test
      
      * fix more topi test
      
      * lint
      
      * address comments
      
      * x
      
      * fix more tests & bugs
      
      * Modify more tests (#10)
      
      * Modify tests for bitserial_conv2d, bitserial_dense, bitserial_conv2d_rasp and bnn
      
      * Minor fix
      
      * More minor fix
      
      * fix more test
      
      * try to update vta using strategy
      
      * fix cpptest
      
      * x
      
      * fix rebase err
      
      * Fix two tests (#11)
      
      * change autotvm log format
      
      * lint
      
      * minor fix
      
      * try fix vta test
      
      * fix rebase err
      
      * tweak
      
      * tmp hack for vta pass
      
      * fix tutorial
      
      * fix
      
      * fix more tutorials
      
      * fix vta tutorial
      
      * minor
      
      * address comments
      
      * fix
      
      * address comments
      
      * fix cpptest
      
      * fix docs
      
      * change data structure name and api
      
      * address comments
      
      * lint
      
      * fix rebase err
      
      * updates
      
      * fix winograd test
      
      * fix doc
      
      * rebase
      
      * upgrade tophub version number
      
      * fix bug
      
      * re-enable vta tsim test after tophub is upgraded
      
      * fix vta test to use the correct args so the config can be found in tophub
      
      Co-authored-by: Yao Wang <kevinthesunwy@gmail.com>
      Haichen Shen committed
  9. 18 Feb, 2020 1 commit
  10. 17 Feb, 2020 1 commit
  11. 12 Feb, 2020 1 commit
    • [REFACTOR][PY][API-CHANGE] establish tvm.ir, migrate corresponding files (#4862) · a5661611
      * [REFACTOR][PY][API-CHANGE] establish tvm.ir, migrate corresponding relay files.
      
      This PR establishes tvm.ir and migrates the corresponding relay
      files into the new folder.
      
      API Change:
      - relay.Module -> tvm.IRModule
      
      * Update with ADT
      
      * Migrate transform
      
      * address comments
      
      * Migrate module
      
      * Migrate json_compact
      
      * Migrate attrs
      
      * Move LoweredFunc to stmt temporarily
      
      * temp migrate container
      
      * Finish migrate container
      Tianqi Chen committed
  12. 28 Jan, 2020 1 commit
  13. 21 Jan, 2020 1 commit
    • [REFACTOR] Establish printer in the source folder (#4752) · e4d817d4
      * [REFACTOR] Establish printer in the source folder.
      
      As we move towards the unified IR, we will eventually want to build a unified
      printers for both relay and TIR.
      
      This PR isolate the printer component into a separate folder in src as a first step.
      
      - Refactored the Doc DSL using Object, clean up APIs.
      - Isolate out the meta data into a header.
      - move printer into relay_text_printer, add comments about further TODos.
      
      * Rename NodePrinter -> ReprPrinter to distinguish it from other printers
      Tianqi Chen committed
  14. 20 Jan, 2020 1 commit
  15. 19 Jan, 2020 1 commit
    • [REFACTOR] Establish tir (#4740) · cf59b206
      TIR is the new namespace for low-level IR
      for tensor-level optimizations and loop transformations.
      
      This PR establishes the namespace and files.
      
      - 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
      Tianqi Chen committed
  16. 17 Jan, 2020 1 commit
  17. 16 Jan, 2020 1 commit
  18. 15 Jan, 2020 3 commits
  19. 14 Jan, 2020 4 commits
  20. 11 Jan, 2020 3 commits
    • [REFACTOR][IR] Unified IR Primitive Op and Registry (#4687) · d8f06020
      This PR migrates relay's Op into the ir folder.
      Op and its registry provides an useful mechanism to
      store any attribute meta-data of an operator include
      function signatures, lowering rules, side effect etc.
      
      These features are not only useful for Relay, but also needed in the low-level IR.
      At the current moment, intrinsic functions in the low-level IR are simply
      represented by a string. This means we cannot type-check the low-level IR
      when the type does not meet the constraint, nor can we obtain further
      information such as side-effect and read write relation of these intrinsics
      wrt to arguments.
      
      Op will be used as the way to handle primitive ops(in DL terminology)
      (builtin intrinsics or in compiler terminology).
      We will perform follow-up refactors to make low-level CallNode
      take Op as the function argument.
      Tianqi Chen committed
    • [REFACTOR][IR] Allow Module to store BaseFunc. (#4678) · 3d52a99c
      Under the unified IR. We will allow a single IRModule
      to store different function variants, such as relay::Function,
      ExternFunc, and low-level function.
      
      This PR changes relay::Function -> BaseFunc in the module file
      to support multiple function variants.
      Tianqi Chen committed
    • [REFACTOR][IR] Initialize Unified IR Expr Data Structure (#4673) · 12e51e6c
      This PR moves a few base types from relay and low-level Expr into the ir sub-folder.
      These classes will serve as a common type system across the stack.
      
      Rationale:
      
      - PrimExpr for low-level expressions
      - RelayExpr for advanced features, including Function definition.
      - Introduce BaseFunc to host all functions, including future PrimFunc(low-level expr functions, subject to discussion).
      
      This is a minimum change we can do to unify the classes into a common hierarchy.
      The main data structure that are variant specific will still be kept in the sub-namespaces.
      We only include classes that is needed to allow a common Module class.
      - BaseFunc
      - GlobalVar
      - Type definition part of ADT
      
      We will only need the BaseFunc and their checked_type to decide the calling convention
      across the function variants.
      Tianqi Chen committed
  21. 09 Jan, 2020 2 commits
    • [REFACTOR][IR] tvm::Expr -> PrimExpr(Primitive Expr) (#4669) · d6a23cf5
      * [REFACTOR][IR] tvm::Expr -> PrimExpr(Primitive Expr)
      
      As part of unified IR, we will need to unify relay::Expr
      and the current tvm::Expr under the same base type.
      
      From the techinical point of view. tvm::Expr is a "primitive"
      expression that only contains POD types and handles and does
      not do life-cycle management.
      
      This PR renames Expr->PrimExpr to clarify that.
      We will send a subsequent PR to introduce the base expr class.
      
      * Remove legacy VarExpr and ExprHash/Equal
      Tianqi Chen committed
    • [REFACTOR] relay::Module Def -> TypeDef (#4665) · 78243e98
      * [REFACTOR] relay::Module Def -> TypeDef
      
      The term Def was not very clear about what is the object of interest(could be function def or type def).
      Changes the term to TypeDef to be more explicit.
      
      * Update include/tvm/relay/module.h
      
      Co-Authored-By: Wei Chen <ipondering.weic@gmail.com>
      
      Co-authored-by: Wei Chen <ipondering.weic@gmail.com>
      Tianqi Chen committed
  22. 08 Jan, 2020 1 commit
    • [REFACTOR][IR] Add Node suffix to low-level IR nodes (#4649) · f4c5f93b
      * [REFACTOR][IR] Variable -> VarNode
      
      * [REFACTOR][IR] Add/Sub/Mul/Div -> AddNode/SubNode etc.
      
      * [REFACTOR][IR] Min/Max/FloorDiv/FloorMod -> MinNode/MaxNode etc.
      
      * [REFACTOR][IR] EQ/NE/LT/LE/GT/GE/Select -> EQNode/NENode etc.
      
      * [REFACTOR][IR] Add Node suffix to Select/Call/Load/Ramp/Shuffle/Let
      
      * [REFACTOR][IR] Add node suffix to IntImm/UIntImm/FloatImm/StringImm
      
      * [REFACTOR][IR] Add Node suffix to Any, AttrStmt, AssertStmt
      
      * [REFACTOR][IR] Add Node suffix to Store/Provide/Allocate/Free
      
      * [REFACTOR][IR] Add Node suffix to ProducerConsumer
      
      * Fix lint
      
      * style updates, test fixes
      Tianqi Chen committed
  23. 06 Jan, 2020 1 commit
    • [REFACTOR] Automatically deduce function type signature in Registry.set_body_typed (#4623) · d5d63a44
      Previously we support a limited case of function type deduction and in many places
      we have to supply the type twice during set_body_typed (one in the template parameter, another in the lambda signature).
      
      This PR improves the deduce function by enablng automatic function signature deduction.
      
      ```
      TVM_REGISTER_GLOBAL("sub")
      .set_body_typed([](int x, int y) -> int { return x - y; });
      ```
      
      Unfortunately, because of template conflict, we can not support the original case
      where both type signature and lambda are supplied through set_body_typed.
      
      This PR refactors the existing regsitration to the new style.
      Tianqi Chen committed
  24. 05 Jan, 2020 1 commit
  25. 04 Jan, 2020 3 commits
    • [REFACTOR] TVM_REGISTER_API -> TVM_REGISTER_GLOBAL (#4621) · 81523604
      TVM_REGSISTER_API is an alias of TVM_REGISTER_GLOBAL.
      In the spirit of simplify redirections, this PR removes
      the original TVM_REGISTER_API macro and directly use TVM_REGISTER_GLOBAL.
      
      This type of refactor will also simplify the IDE navigation tools
      such as FFI navigator to provide better code reading experiences.
      
      Move EnvFunc's definition to node.
      Tianqi Chen committed
    • [REFACTOR] Unified IR base types. (#4616) · 1ecd3ee2
      This PR moves a few base types from relay to the ir sub-folder.
      These types will serve as a common type system across the stack.
      
      Notably, we want to be able to use the same FuncType for all function signatures.
      I tried to make a minimum move to bring the necessary dependencies for a FuncType.
      We can discuss what additional things we want to move as a follow-up.
      
      Notably, because the TensorType will have a dependency on low-level Expr,
      we will need to break the type.h into two files and introduce a
      tensor_type.h(or leave them in relay for now).
      Tianqi Chen committed
    • [REFACTOR][TYPE] Remove un-necessary var sub-field in GlobalTypeVar and TypeVar (#4615) · 24e6fcb6
      Currently, we use a tvm::Var to represent a placeholder for shapes in generic types.
      This is not necessary for GlobalTypeVar(as we never parameterize by shape var),
      and is a bit twisted for TypeVar.
      
      As we move to a unified type system, we want to break the dependency
      from the base TypeVar(which is shared across the languages) from the expression.
      Note that it is fine for TensorType to depend on Expr.
      
      One alternative solution to embed the Var would be to introduce a TypeVarExpr,
      which can wrap a TypeVar as Expr. However, this new alternative won't be
      natural until we migrate the type to the global scope.
      
      Lucikly, we have not yet start to depend on the shape parameterization heavily yet.
      
      This PR removes the tvm::Var from the typevars. We will follow up with another
      PR to migrate the types to a base location. After that, we should be able to
      use the more elegant approach via TypeVarExpr.
      Tianqi Chen committed
  26. 31 Dec, 2019 1 commit
    • [REFACTOR][OBJECT] Consoldiate NodePtr/Ref/Hash/Equal to Object (#4603) · a8c36921
      * [REFACTOR][OBJECT] Consoldiate NodePtr/Ref/Hash/Equal and macros to Object.
      
      Historically, we have classes like NodePtr/Ref/HashEqual.
      After unified object protocol, these names are just alias of the object counterpart.
      Moreover, there are helper macros defined over the places for defining these object.
      
      This PR consoldiate the terminologies into the corresponding ones
      in the Object system so we have a clean and consistent API moving forward.
      
      * Update include/tvm/attrs.h
      
      Co-Authored-By: Wei Chen <ipondering.weic@gmail.com>
      
      * fix compilation
      
      Co-authored-by: Wei Chen <ipondering.weic@gmail.com>
      Tianqi Chen committed
  27. 22 Dec, 2019 1 commit
    • [REFACTOR][DTYPE] Isolate dtype to runtime (#4560) · 7fa8aab5
      dtype.h -> runtime/data_type.h
      
      Changes:
      - Rename all old reference of tvm::Type to DataType
      - ExprNode.type -> ExprNode.dtype
      - Expr.type() -> Expr.dtype()
      - Change Expr related functions to expr_operator.
        - DataType::min() -> min_value(DataType)
        - DataType::max() -> max_value(DataType)
      - Move type constructor Int, UInt, Float, Handle, Bool into DataType.
        - Int(bits) -> DataType::Int(bits)
        - UInt(bits) -> DataType::UInt(bits)
      Tianqi Chen committed