1. 12 Mar, 2020 1 commit
    • [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
  2. 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
  3. 04 Feb, 2020 1 commit
  4. 28 Jan, 2020 1 commit
  5. 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
  6. 20 Jan, 2020 1 commit
  7. 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
  8. 17 Jan, 2020 2 commits
  9. 16 Jan, 2020 1 commit
  10. 15 Jan, 2020 3 commits
  11. 14 Jan, 2020 4 commits
  12. 11 Jan, 2020 2 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] 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
  13. 04 Jan, 2020 1 commit
    • [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