1. 28 Mar, 2020 2 commits
    • [NODE][IR] Introduce StructuralHash for the Unified IR. (#5160) · 497d01d3
      * [NODE][IR] Introduce StructuralHash for the Unified IR.
      
      This PR introduces a new way to handle structural hash for the unified IR.
      
      - Each object can now register an optional SEqualHash function, which
        describes how to reduce its structural equality to sequence of hash values.
      - Optionally, the object can choose to allow labeling of vars(e.g. function parameters)
        by calling DefHash
      - We implemented a non-recursive structural hasher that maintains its own stack
        to traverse te IR.
      
      This PR also improves the hash value property from the previous relay's hash utility.
      In particular, the graph node mode hashs a DAG differently from a tree
      by attaching an unique occurence index to each graph node.
      
      In all of the test cases so far, structural_hash is consistent with structural_equal.
      - if structrual(x, y) then structural_hash(x) == structural_hash(y)
      - if structural_hash(x) == structural_hash(y) then highly likely structural_equal(x, y)
        - hash no collison is found in our testcases.
      
      Ideally we should work on automatically generating these functions in the future.
      
      * Fix cases for EnvFunc and Array dims
      
      * fix testcase
      
      * Update src/node/structural_hash.cc
      
      Co-Authored-By: 雾雨魔理沙 <lolisa@marisa.moe>
      
      Co-authored-by: 雾雨魔理沙 <lolisa@marisa.moe>
      Tianqi Chen committed
    • [NODE][IR] Introduce StructuralEqual Infra for the unified IR. (#5154) · 997a14ed
      * [NODE][IR] Introduce StructuralEqual Infra for the Unified IR.
      
      This PR introduces a new way to handle structural equality
      for both TIR and relay nodes in an extensive way.
      
      - Each object can now register an optional SEqualReduce function, which
        describes how to reduce its structural equality to another instance
        into equality of the children.
      - Optionally, the object can choose to allow remapping of vars(e.g. function parameters)
        by calling DefEqual
      - We implemented a non-recursive structural equality checker that
        recursively traverses the objects and does the structural equality checking.
      
      This PR also fixes a few potential problems in previous relay's AlphaEqual.
      
      - In particular, the new structural equality relation will be communicative.
      - It is can be dangerous to use same_as relation to quickly check equality,
        demonstrated by the following case. (%x, %y) are shared vars between two functions.
      
      - function0: fn (%x, %y) { %x + %y }
      - function1: fn (%y, %x) { %x + %y }
      
      The new structural equal is intented to supersede AlphaEqual and AttrsEqual.
      
      Follow-up PRs should be performed to redirect the existing usages, and removes
      the corresponding implementation.
      
      * Update the rule to distinguish between graph node and non-graph nodes.
      
      * Refactor the test cases to use structural equal.
      
      * address comments
      
      * Mark more relay::Expr as graph node, fix a testcase issue(was bug that was not caught by previous alpha equal)
      
      * Remove unrelated comment
      
      * Fix file comment
      
      * Address review comment
      
      * Relax condition to fit flaky case
      Tianqi Chen committed
  2. 24 Mar, 2020 1 commit
  3. 23 Mar, 2020 2 commits
  4. 20 Mar, 2020 1 commit
    • [TIR][TARGET] Refactor Target codegen to use IRModule and PrimFunc. (#5107) · 841725cc
      As part of the unified IR refactor.
      This PR refactors the target codegen to use IRModule containing tir::PrimFuncs.
      
      In order to break the refactor into several steps without breaking the codebase,
      we built an conversion pass to convert Array<LoweredFunc> into IRModule.
      
      The follow-up refactors will gradually move the passes covered by IRModule up
      until we cover all the passes. Then we can remove the additional redundant
      concepts such as LoweredFunc.
      Tianqi Chen committed
  5. 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
  6. 11 Mar, 2020 2 commits
    • [Intrin] Adding a few missing math intrin (#5011) · a6cb4b8d
      * [intrin] exp2
      
      * [intrin] exp10
      
      * [intrin] log2/10
      
      * [intrins] exp10
      
      * [test] math intrin
      Bing Xu committed
    • [topi][relay] new PR to re-add tan to TVM (#5025) · 45ee7b5f
      * Add relay operation relay.op.tan.
      
      * Update tan implementation in TVM.
      
      * Update tests.
      
      * Add shape function for tan.
      
      * Add missing main test to python/frontend/tensorflow/test_forward.
      
      * Revert, back to sin/cos.
      
      * Revert "Revert, back to sin/cos."
      
      This reverts commit 4da5b503b921585ba9d80944b29136142b575c40.
      
      * Fix implementation of tan in cuda. Do not support tan for float16.
      
      Simplify topi/tests/python/test_topi_math. Add testing for tan with float32 and float64.
      
      Finally implement tan as sin/cos in llvm.
      notoraptor committed
  7. 10 Mar, 2020 1 commit
  8. 06 Mar, 2020 1 commit
    • [topi][relay] add operation tan to TVM (#4938) · d992468d
      * Add relay operation relay.op.tan.
      
      * Update tan implementation in TVM.
      
      * Update tests.
      
      * Add shape function for tan.
      
      * Add missing main test to python/frontend/tensorflow/test_forward.
      
      * Revert, back to sin/cos.
      
      * Revert "Revert, back to sin/cos."
      
      This reverts commit 4da5b503b921585ba9d80944b29136142b575c40.
      
      * Fix implementation of tan in cuda. Do not support tan for float16.
      
      Simplify topi/tests/python/test_topi_math. Add testing for tan with float32 and float64.
      
      Try again to implement tan as sin/cos in llvm.
      Yao Wang committed
  9. 21 Feb, 2020 1 commit
    • [CODEGEN] Support cuda tensorcore subbyte int data type in auto tensorcore (#4546) · f23ac969
      * support cuda tensorcore subbyte int data type in auto tensorcore
      
      * add lisence
      
      * pass cpplint
      
      * fix code review comments
      
      * merge the int4/int1 codegen tutorial into the existing auto tensorcore tutorial
      
      * using master's new API
      
      * disable tuning when cuda is not enabled
      
      * address cr comment
      
      * do not run the tuning
      
      * fix test failure
      
      * fix cpplint error
      
      * fix bool type reduction bug
      
      * 1. fix a index bug 2. fix returned bytes value of int1/int4/uint4
      
      * fix typo
      Orion34C committed
  10. 04 Feb, 2020 1 commit
  11. 03 Feb, 2020 1 commit
    • [TIR] Create a StringImm reference type (#4806) · c39ab93d
      This is motivated by the want to send an
      array of strings across the python/C++
      boundary. Arrays only support ObjectRef types
      and so can't carry StringImmNodes. This creates
      a string reference type, StringImm, which can
      be used with tvm::Arrays.
      
      Change-Id: I598a44536c156b97dbfe3e9518e0a1f705da850c
      mbarrett97 committed
  12. 21 Jan, 2020 1 commit
  13. 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