1. 07 Feb, 2020 1 commit
    • [REFACTOR][PY][API-Change] Polish tvm.runtime, tvm.runtime.module API update (#4837) · e0122c0e
      * [REFACTOR][PY-API] Polish tvm.runtime, tvm.runtime.module API update
      
      This PR updates the tvm.runtime to use the new FFI style.
      
      - Remove top-level tvm.module to avoid confusion between runtime.Module and IRModule
      - API changes wrt to runtime.Module
        - tvm.module.load -> tvm.runtime.load_module
        - tvm.module.enabled -> tvm.runtime.enabled
        - tvm.module.system_lib -> tvm.runtime.system_lib
      - Remove dep on api_internal from runtime.
      
      * Update module.load in the latest API
      Tianqi Chen committed
  2. 04 Feb, 2020 1 commit
  3. 20 Jan, 2020 1 commit
  4. 18 Jan, 2020 2 commits
    • [runtime][refactor] Unify vm and interpreter objects (#4693) · acbf8851
      * unify vm and interpreter objects
      
      * move closure back vm
      
      * adt/closure back to vm.adt/vm.closure
      
      * closure base
      Zhi committed
    • [CodeGen][CUDA] Improve CUDA vectorizer (#4736) · 2630ffcb
      - Fixes issues to enable fp16 vectorizer. Now correct packing and
        unpacking CUDA code will be emitted. Enabled more unit tests.
      
      - Do not emit code to read the first lane from an undef variable
      
        int _3;
        _3 = _3 & ~(0x000000ff << 0) | ...
      
        and emit the following code instead:
      
        _3 = (((0x000000ff & (_1 >> 0))+(0x000000ff & (_2 >> 0))) << 0);
      
        Note that nvcc 10.2 is forgiving and emits the same code for both cases.
        A warning appears in test_codegen_cuda.py.
      
      Signed-off-by: Wei Pan <weip@nvidia.com>
      wpan11nv committed
  5. 17 Jan, 2020 1 commit
    • [REFACTOR] Polish runtime (#4729) · b171cf1d
      - Remove operator bool from base object ref macro
        - Raitionale: operator bool can be dangerous for sub-classes
          that also overloads other operators(e.g. ==).
        - If bool is still needed, use explicit operator bool.
      - Use absolute include when necessary
      - Move type related util to data_type
      - Isolate stackvm code from compiler
      Tianqi Chen committed
  6. 16 Jan, 2020 2 commits
  7. 11 Jan, 2020 2 commits
    • [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
    • [REFACTOR] Replace TensorObj and TensorValue with NDArray (#4643) · 86092de0
      * replace TensorObj and TensorValue with NDArray
      
      * NodeBase to Object in Python
      
      * rebase
      Zhi committed
  8. 09 Jan, 2020 2 commits
  9. 07 Jan, 2020 1 commit
    • [RUNTIME][DSO] Improve TVMBackendPackedCFunc to allow return val (#4637) · 77c47748
      * [RUNTIME][DSO] Improve TVMBackendPackedCFunc to allow return value.
      
      Previously the signature of LibraryModule's PackedFunc does not support return value.
      This wasn't a limitation for our current usecase but could become one
      as we start to generate more interesting functions.
      
      This feature also start to get interesting as we move towards unified
      object protocol and start to pass object around.
      This PR enhances the function signature to allow return values.
      
      We also created two macros TVM_DLL_EXPORT_PACKED_FUNC and TVM_DLL_EXPORT_TYPED_FUNC
      to allow manual creation of functions that can be loaded by a LibraryModule.
      
      Examples are added in apps/dso_plugin_module.
      The change to TVMBackendPackedCFunc is backward compatible,
      as previous function will simply ignore the return value field.
      
      * address review comments
      Tianqi Chen committed
  10. 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
  11. 04 Jan, 2020 1 commit
    • [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
  12. 01 Jan, 2020 1 commit
  13. 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
  14. 30 Dec, 2019 1 commit
    • [REFACTOR][RUNTIME] Update NDArray use the Unified Object System (#4581) · 55bd786f
      * [REFACTOR][RUNTIME] Move NDArray to Object System.
      
      Previously NDArray has its own object reference counting mechanism.
      This PR migrates NDArray to the unified object protocol.
      
      The calling convention of NDArray remained intact.
      That means NDArray still has its own type_code and
      its handle is still DLTensor compatible.
      
      In order to do so, this PR added a few minimum runtime type
      detection in TVMArgValue and RetValue only when the corresponding
      type is a base type(ObjectRef) that could also refer to NDArray.
      
      This means that even if we return a base reference object ObjectRef
      which refers to the NDArray. The type_code will still be translated
      correctly as kNDArrayContainer.
      If we assign a non-base type(say Expr) that we know is not compatible
      with NDArray during compile time, no runtime type detection will be performed.
      
      This PR also adopts the object protocol for NDArray sub-classing and
      removed the legacy NDArray subclass protocol.
      Examples in apps/extension are now updated to reflect that.
      
      Making NDArray as an Object brings all the benefits of the object system.
      For example, we can now use the Array container to store NDArrays.
      
      * Address review comments
      Tianqi Chen committed
  15. 27 Dec, 2019 1 commit
  16. 26 Dec, 2019 1 commit
  17. 25 Dec, 2019 1 commit
    • [RUNTIME] Remove Extension VTable in favor of Unified Object system. (#4578) · e91cc5ab
      Before the unified object protocol, we support pass
      additional extension objects around by declaring a type as an extension type.
      The old extension mechanism requires the types to register their
      constructor and deleter to a VTable and does not enjoy the benefit of the
      self-contained deletion property of the new Object system.
      
      This PR upgrades the extension example to make use of the new object system
      and removed the old Extension VTable.
      
      Note that the register_extension funtion in the python side continues to work
      when the passed argument does not require explicit container copy/deletion,
      which covers the current usecases of the extension mechanism.
      Tianqi Chen committed
  18. 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
  19. 09 Dec, 2019 1 commit
  20. 03 Dec, 2019 2 commits
  21. 01 Dec, 2019 1 commit
  22. 25 Nov, 2019 1 commit
  23. 24 Nov, 2019 2 commits
  24. 23 Nov, 2019 1 commit
  25. 22 Nov, 2019 2 commits
  26. 15 Nov, 2019 1 commit
  27. 11 Nov, 2019 1 commit
  28. 01 Nov, 2019 1 commit
  29. 30 Oct, 2019 1 commit
  30. 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
  31. 22 Oct, 2019 1 commit
  32. 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
  33. 20 Oct, 2019 1 commit