1. 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
  2. 16 Jan, 2020 1 commit
  3. 15 Jan, 2020 1 commit
  4. 09 Jan, 2020 1 commit
    • [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
  5. 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
  6. 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
  7. 24 Oct, 2019 1 commit
    • [NODE][REFACTOR] Refactor reflection system in node. (#4189) · 78ca6fc8
      * [NODE][REFACTOR] Refactor reflection system in node.
      
      - Removed the old Node, Node is now just an alias of runtime::Object
      - Introduce ReflectionVTable, a new columnar dispatcher to support reflection
        - This allows us to remove vtable from most node objects
        - The VisitAttrs are registered via TVM_RESGITER_NODE_TYPE,
          they are no longer virtual.
      - Consolidated serialization and reflection features into node.
      
      * Explicit type qualification when calling destructor.
      
      * Fix SPIRV, more comments
      Tianqi Chen committed
  8. 21 Oct, 2019 1 commit
    • [REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol. (#4161) · 7895adb2
      * [REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol.
      
      This PR removes the original node system, and make node as a subclass of Object.
      This is a major refactor towards a better unified runtime object system.
      
      List of changes in the refactor:
      
      - We now hide data_ field, use Downcast explicitly to get a sub-class object.
      - Removed the node system FFI in python.
      - Removed the node C API, instead use PackedFunc for list and get attrs.
      - Change relay::Op::set_attr_type_key(attr_key_name) to relay::Op::set_attr_type<AttrType>().
        - This change was necessary because of the new Object registration mechanism.
        - Subsequent changes to the op registrations
        - The change revealed a few previous problems that is now fixed.
      - Patched up a few missing node type registration.
        - Now we will raise an error if we register object that is not registered.
      - The original node.h and container.h are kept in the same location.
      - Calling convention: kObjectHandle now equals the old kNodeHandle, kNodeHandle is removed.
      - IRFunctor now dispatches on ObjectRef.
      - Update to the new type checking API: is_type, derived_from are replaced by IsInstance.
      - Removed .hash member function, instead use C++ convention hasher functors.
      
      * Address review comments
      Tianqi Chen committed
  9. 09 Oct, 2019 1 commit
    • [TVM] Rewrite simplification rule to eliminate unnecessary conditionals. (#4076) · f2abd9f6
      The current bounds checking infrastructure inserts checks like:
      
      ```
      for (i, 0, bounds[n]) {
        if (likely(i < bounds[n]) {
           ...
        }
      }
      ```
      
      into the TVM IR which is currently not removed by simplification infrastructure.
      This is a little unclean, as these are trivially true since for a loop var `i`
      with a given min and extent, we are guaranteed that `i >= min` and `i < min +
      extent`. Thus, we can insert these checks into the IR and use them to eliminate
      trivial bounds checks early on.
      Andrew Tulloch committed
  10. 25 Sep, 2019 1 commit
    • Changes to make tensorize work. These changes also fix the previously broken test. (#3981) · b410df8c
      * Changes to make tensorize work. These changes also fix the previously
      broken test.
      
      Summary:
      Tensorize was breaking  for a few reasons.
      1)
      Assert at: src/op/tensorize.cc:234 CHECK(is_one(e.region[j]->extent))
      In some cases this cannot be proven, e.g.:
      expected shape=[16, 4], given region=[range(min=((ax1.outer*16)/16), ext=(((((ax1.outer*16) + 15)/16) + 1) - ax1.outer)), range(min=((k.outer*4)/4), ext=(((((k.outer*4) + 3)/4) + 1) - k.outer)), range(min=0, ext=16), range(min=0, ext=4)]
      The unprovable one is: ext=(((((ax1.outer*16) + 15)/16) + 1) - ax1.outer)).
      This can be simplified but it is not because to simplify divide, it must
      prove ax1.outer > 0 and since it is var it cannot. The fix for this to
      just find all the vars in expr in relace them with some const value.
      
      2) Equivalence between tensorized expr and one being asked to tensorize. For example,
      the error would be.
      TVMError: Check failed: Equal(lhs, rhs):
      Failed to match the compute with TensorIntrin tensor_intrin's declaration
      provided= reduce(combiner=comm_reducer(result=[(x + y)], lhs=[x], rhs=[y], identity_element=[(int16)0]), source=[(int16(data(k))*int16(kernel(((((((((k.outer.outer*64) + (k.outer.inner*2)) + k)/2)*128) + i) - (k.outer.inner*128)) - (k.outer.outer*4096)), ((((k.outer.outer*64) + (k.outer.inner*2)) + k) % 2))))], axis=[iter_var(k, range(min=0, ext=2))], where=(bool)1, value_index=0),
      intrin=  reduce(combiner=comm_reducer(result=[(x + y)], lhs=[x], rhs=[y], identity_element=[(int16)0]), source=[(int16(data(k))*int16(kernel(i, k)))], axis=[iter_var(k, range(min=0, ext=2))], where=(bool)1, value_index=0)
      Difference is mainly in the source part:
      source=[(int16(data(k))*int16(kernel(((((((((k.outer.outer*64) + (k.outer.inner*2)) + k)/2)*128) + i) - (k.outer.inner*128)) - (k.outer.outer*4096)), ((((k.outer.outer*64) + (k.outer.inner*2)) + k) % 2))))]
      source=[(int16(data(k))*int16(kernel(i, k)))], axis=[iter_var(k, range(min=0, ext=2))]
      This was not being simpifiled due to compute_intrin_iter_space (map for
      iter var to range) not containing leaf iter vars.
      
      3) Here it fails with:
      Check failed: is_one(Simplify(value->shape[i])): Argument b_buffer shape mismatch[16, 4] vs [(((((ax1.outer*16) + 15)/16) + 1) - ax1.outer), (((((k.outer*4) + 3)/4) + 1) - k.outer), 16, 4]
      This is in buffer binding where it thinks expected and buffer bound
      shape is different. Although if we could simplify expr, this would not
      be the case.
      
      Test Plan:
      On skylake avx512 machine:
      python tests/python/contrib/test_gemm_acc16.py
      
      Reviewers:
      
      Subscribers:
      
      Tasks:
      
      Tags:
      
      * Implemented bounded analyzer which traverses tree and for reduce/for
      statements binds the bound of the analyzer. Later this is used to
      simplify expressions. Inspired from ir_mutator_with_analyzer
      
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      Subscribers:
      
      Tasks:
      
      Tags:
      
      * Addressed comments.
      
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      Subscribers:
      
      Tasks:
      
      Tags:
      
      * Added ASF header + define macro for the header file: TVM_ARITHMETIC_IR_VISITOR_WITH_ANALYZER_H_
      Some lint fixes as well.
      
      * Relax the assumption that dom_map must always contain all leaf itervars.
      
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      Subscribers:
      
      Tasks:
      
      Tags:
      
      * Disable copy constructor and move to raw ptr.
      
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      Subscribers:
      
      Tasks:
      
      Tags:
      Kimish Patel committed
  11. 11 Jul, 2019 1 commit
  12. 01 Jul, 2019 2 commits
  13. 13 Jun, 2019 1 commit
  14. 24 May, 2019 1 commit
  15. 23 May, 2019 1 commit
  16. 22 Apr, 2019 1 commit
  17. 08 Apr, 2019 1 commit
    • [HEADER] Add Header to Comply with ASF Release Policy (#2982) · cffb4fba
      * [HEADER] ASF header dir=include
      
      * [HEADER] ASF Header dir=src
      
      * [HEADER] ASF Header -dir=python
      
      * [HEADER] ASF header dir=topi
      
      * [HEADER] ASF Header dir=nnvm
      
      * [HEADER] ASF Header -dir=tutorials
      
      * [HEADER] ASF Header dir=tests
      
      * [HEADER] ASF Header -dir=docker
      
      * fix whitespace
      
      * [HEADER] ASF Header -dir=jvm
      
      * [HEADER] ASF Header -dir=web
      
      * [HEADER] ASF Header --dir=apps
      
      * [HEADER] ASF Header --dir=vta
      
      * [HEADER] ASF Header -dir=go
      
      * temp
      
      * [HEADER] ASF Header --dir=rust
      
      * [HEADER] Add ASF Header --dir=cmake
      
      * [HEADER] ASF Header --dir=docs
      
      * [HEADER] Header for Jenkinsfile
      
      * [HEADER] ASF Header to toml and md
      
      * [HEADER] ASF Header to gradle
      
      * Finalize rat cleanup
      
      * Fix permission
      
      * Fix java test
      
      * temporary remove nnvm onnx test
      Tianqi Chen committed
  18. 31 Mar, 2019 1 commit
  19. 10 Mar, 2019 1 commit
  20. 02 Mar, 2019 1 commit
  21. 04 Jan, 2019 1 commit
  22. 20 Sep, 2018 1 commit
  23. 23 Aug, 2018 1 commit
  24. 29 May, 2018 1 commit
  25. 11 Oct, 2017 1 commit
  26. 10 Oct, 2017 1 commit
  27. 03 Aug, 2017 2 commits
  28. 18 Jul, 2017 1 commit
    • [API] Prefetch schedule supported (#258) · 01cbc61a
      * prefetch interface added
      
      * prefetch python comments modified. prefetch info data structure maintained.
      
      * start injecting prefetches. first step (domain touch) implemented.
      
      * domain touch tested.
      
      * Prefetch ir_mutator and ir_visitor dispatch registered.
      
      * modify domain touched from passing a func_ref to passing a tensor
      
      * modify domain touched from passing a func_ref to passing a tensor
      
      * modify Tensor copy to Tensor ref
      
      * temp commit for rebase
      
      * debug info removed, typo fixed, ready to rebase
      
      * prefetch flatten test add!
      
      * roll back builtin functions to side effect functions
      
      * lint error fixed!
      
      * add cache line size to storage flatten argument
      
      * forgot modifications add
      
      * change code style to dmlc-like; get rid of can_prove, use manually compute instead
      
      * python lint error fixed
      
      * modify instrinsic name to pass tests
      
      * [TEST] get rid of str(), replace them by accessing attributes
      
      * change map to list comprehension
      
      * redundant numpy import removed
      Jian Weng committed
  29. 06 Jul, 2017 2 commits
  30. 26 Mar, 2017 1 commit
  31. 05 Mar, 2017 1 commit
  32. 04 Mar, 2017 1 commit
    • [PASS]LoopPartition (#56) · c8ebfbe3
      * loop_partition draft
      
      * divide loop variable into constant domain and variable domain & consider multiple partitions
      
      * process doubt interval
      
      * fix and refactor, add relax_map arg in BoundDeduce
      
      * fix testcase and comment
      
      * rebase to zero, convert to SSA
      
      * change the logic of generating loop code & fix issues
      
      * add a testcase for relax map in deducebound && fix issues
      
      * clean code
      
      * const auto&
      
      * add test_multi_if
      Ziheng Jiang committed
  33. 22 Feb, 2017 1 commit
  34. 17 Feb, 2017 1 commit
    • [ARITH] DeduceBound (#40) · 5198c100
      * [PYTHON/API] Add compare and logic build-in op for Expr
      
      * remove 'and', 'or'
      
      * add deducer
      
      * [WIP] bound_deducer.cc
      
      * move IntervalSet and StrideSet into int_set_internal.h
      
      * add multiple failure for VariablePathFinder, add EvalSign
      
      * consider round in deduce, add success flag
      
      * remove Visit_(Div)
      
      * add comment, update HalideIR
      
      * expose intset to python
      
      * check the sign of every expr
      
      * set return type as ExprSignType
      
      * fine tune
      
      * add min & max python api for interval set
      
      * support for conditional expr
      
      * refactor test
      
      * add checker for BoundDeducer
      
      * add python check test
      
      * fix
      
      * fix
      
      * change range to interval; remove converter
      
      * remove converter declaration
      
      * remove int_set_internal.h
      Ziheng Jiang committed
  35. 12 Feb, 2017 1 commit
  36. 07 Feb, 2017 1 commit
  37. 05 Feb, 2017 1 commit