1. 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
  2. 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
  3. 17 Jan, 2020 1 commit
  4. 14 Jan, 2020 1 commit
    • [REFACTOR][IR] Unified IR IRModule structure. (#4699) · c69092ae
      This PR brings relay::Module as the unified IRModule structure.
      IRModule will be used as the basic unit for transformations
      through out the stack.
      
      - Rename relay::Module -> IRModule
      - Move relay/module.h -> ir/module.h
      - ModuleNode::FromExpr -> IRModule::FromExpr
      - FromText -> IRModule::FromText
      Tianqi Chen committed
  5. 11 Jan, 2020 2 commits
    • [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
  6. 09 Jan, 2020 1 commit
    • [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
  7. 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
  8. 05 Jan, 2020 1 commit
  9. 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
  10. 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
  11. 15 Nov, 2019 1 commit
  12. 01 Nov, 2019 2 commits
  13. 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
  14. 29 Sep, 2019 1 commit
    • [Relay] Move prelude to text format (#3939) · 2dac17d8
      * Fix parser
      
      * Doc fix
      
      * Add module utility functions necessary for prelude
      
      * Implement prelude in text format
      
      * Remove programmatically constructed prelude defs
      
      * Fix 0-arity type conses in pretty printer and test
      
      * Make prelude loading backwards-compatible
      
      * Fix patterns
      
      * Improve some prelude defs
      
      * Fix `ImportFromStd`
      
      It needs to also follow the "add unchecked, add checked" pattern
      
      * Lint roller
      
      * Woops
      
      * Address feedback
      
      * Fix `test_list_constructor` VM test
      
      * Fix `test_adt.py` failures
      Logan Weber committed
  15. 12 Sep, 2019 1 commit
  16. 06 Sep, 2019 1 commit
    • [Relay] Add ADTs to text format (#3863) · ca0292d8
      * Getting closer to having ADT defs
      
      * ADT defs working probly
      
      * Match parsing basipally done
      
      * came to earth in a silver chrome UFO
      
      * match finished?
      
      * All tests but newest are passing
      
      * ADT constructors work
      
      now cleanup?
      
      * Cleanup round 1
      
      * Cleanup round 2
      
      * Cleanup round 3
      
      * Cleanup round 4
      
      * Cleanup round 6
      
      * Cleanup round 7
      
      * Lil grammar fix
      
      * Remove ANTLR Java files
      
      * Lint roller
      
      * Lint roller
      
      * Address feedback
      
      * Test completeness in match test
      
      * Remove unused imports
      
      * Lint roller
      
      * Switch to Rust-style ADT syntax
      
      * Lil fix
      
      * Add dummy `extern type` handler
      
      * Add type arg to test
      
      * Update prelude semantic version
      
      * Repair test
      
      * Fix graph var handling in match
      
      * Revert 's/graph_equal/is_unifiable' change
      Logan Weber committed
  17. 10 Jul, 2019 2 commits
    • init (#3476) · 273c0280
      lint
      
      update
      
      address comment
      
      comment out breaking test
      雾雨魔理沙 committed
    • [Relay][Testing] Relay-to-Python compilation (#3156) · db841c24
      * First pass at Relay-to-Python converter testing utility
      
      * Indicate astor as a dependency
      
      * Add astor dep to host as well
      
      * Typos and small bugs
      
      * Handle ADTs and matching in Python conversion
      
      * Remove any dependency on ast.parse
      
      * Eliminate unnecessary type var field in Python version of ConstructorValue (already gone on C++ side)
      
      * Update constructor value, fix syntax errors
      
      * Don't forget keywords arg on Call nodes
      
      * Fix some incorrect calls to ast nodes
      
      * Fix more calls, a little more cleaning up
      
      * Missing cases in attr conversion
      
      * Lower op calls instead of running them through interpreter, as in @MarisaKirisame's AoT compiler
      
      * We do still need the module
      
      * Remove changes to op attrs: Will PR separately
      
      * Smoke test and corrections
      
      * More tests and fixes
      
      * Ensure imports are properly global in generated Python code
      
      * Add unit tests for refs
      
      * Add unit test for tuple indexing
      
      * Add unit test for if expression
      
      * Remove astor dependency
      
      * Remove astor from meta.yaml too
      
      * Fix if test and add basic local function test
      
      * Add global function test, refactor earlier tests
      
      * Correct 'clause' field in ADT so Python and C++ field names match
      
      * More fixes and tests for matching and constructors
      
      * Dramatically simplify matching: no need for a thunk
      
      * Improve ref writing test
      
      * Ensure local recursion works
      
      * cleanup
      
      * Add test for global recursion
      
      * Add test for higher-order calls
      
      * Get ops working, add basic tests
      
      * Remove accidentally duplicated test
      
      * More docstrings to appease pylint
      
      * Forgot to fix a test using constructor values
      
      * Reduce optimization level in fusion and fix tuple input to operators
      
      * Test op with tuple output, fix tuple output code
      
      * Add unit test for batch norm
      
      * Add a couple more tricky test cases
      
      * Correct nat constructor to drop unnecessary field
      
      * Fix the op attrs file (accidentally reduced it)
      
      * Address review comments
      
      * Adapt to new ConstructorValue representation (no more runtime dep on module)
      
      * Use pass manager and updated interfaces. Extend module.from_expr to accommodate necessary demands
      
      * Use sequential return value
      
      * Lift out nested conditionals
      
      * Replace triple single quotes with triple double quotes
      
      * Use main variable instead of entry_func
      Steven S. Lyubomirsky committed
  18. 06 Jul, 2019 1 commit
  19. 05 Jul, 2019 1 commit
  20. 03 Jul, 2019 1 commit
    • [Relay] Continuation Passing Style (#3456) · d1eb1229
      * save
      
      add
      
      me find type checker problem
      
      save
      
      save
      
      lint
      
      do
      
      lint
      
      reset ti
      
      add some doc
      
      add failed test case
      
      add recursion for cps
      
      add recursion for cps
      
      fix pytest
      
      lint
      
      save
      
      fix test error
      
      lint
      
      save
      
      fix error
      
      * fix rebase
      
      * fix
      
      * fix test
      
      * lint
      
      * lint
      
      * restore rewriteannotationops
      
      * do
      雾雨魔理沙 committed
  21. 02 Jul, 2019 1 commit
  22. 24 Jun, 2019 1 commit
  23. 09 May, 2019 1 commit
    • [Relay][Runtime] Implementation of Relay VM (#2889) · 4332b0aa
      * Implement the virtual machine
      
      Co-Authored-By: wweic <ipondering.weic@gmail.com>
      
      * Fix rebase build issues
      
      * Reorganize vm.py and fix allocator bug
      
      * Remove compiler
      
      * Remove tests
      
      * Remove backend/vm/vm.cc too
      
      * Fix docs
      
      * Fix doc
      
      * Fix doc
      
      * Add vm docs
      
      * Remove change to dead_code.cc
      
      * Remove Relay logging
      
      * Remove reduce
      
      * Update include/tvm/runtime/vm.h
      
      Co-Authored-By: jroesch <roeschinc@gmail.com>
      
      * Reformat
      
      * Update include/tvm/runtime/vm.h
      
      Co-Authored-By: jroesch <roeschinc@gmail.com>
      
      * Address feedback
      
      * Update include/tvm/runtime/vm.h
      
      Co-Authored-By: jroesch <roeschinc@gmail.com>
      
      * Apply suggestions from code review
      
      Co-Authored-By: jroesch <roeschinc@gmail.com>
      
      * Fix a couple outstanding comments
      
      * Last couple comments
      
      * Update include/tvm/runtime/vm.h
      
      Co-Authored-By: jroesch <roeschinc@gmail.com>
      
      * Address code review feedback
      
      * Fix final comment
      
      * Address comments
      
      * Error reporting and example
      
      * add Const
      
      * Explicitly delete copy assignment operator
      
      * Fix rebase
      
      * Pass 3rd arg to fusion
      Jared Roesch committed
  24. 10 Apr, 2019 1 commit
    • [REFACTOR] Use more TypedPackedFuncs (#2981) · 51785062
      * Add `set_body_simple` to Registry, refactor a lot of code to use it
      
      * Add more types to Relay PackedFuncs
      
      * Add Registry::set_body_method to easily make Node methods into
      PackedFuncs
      
      * Add set_body_method, set_body_node_method; start typing api_lang
      
      * Add some docs, remove unused script
      
      * Fix mysterious linter problem
      
      * Touch up api_ir.cc
      
      * Fix some issues with TOPI argument counts
      
      * Revert changes to topi.cc to avoid problems with optional arguments
      
      * A little more cleanup
      
      * Type more of the api _ functions
      
      * Whitespace
      
      * Finalize names and docs for new registry helpers
      
      * Update docs
      James Gilles committed
  25. 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
  26. 25 Feb, 2019 1 commit
  27. 16 Feb, 2019 1 commit
    • [Relay] Algebraic data types (#2442) · 2ae3124f
      * First pass on ADTs
      
      * Add doc string for tag field
      
      * Visit constructors in TypeVisitor for TypeData
      
      * Add to description of type call
      
      * Add type call to type solving and unification
      
      * Make type mutator for typecall consistent with others (only create new node if there's a change)
      
      * Ensure kindchecking can handle type calls and typedata
      
      * Fix bad nesting in module constructor
      
      * Correctly construct call in typecall test
      
      * Add call override for ordinary vars (do we want this?)
      
      * Remove generalization hack from type inference because it was breaking ADT constructors
      
      * Check that there are no free type vars in exprs after inferring type
      
      * Free var checks need module because of ADT constructors
      
      * Typecall test can't have unbound type var, make it global
      
      * Uncomment tmap test and remove comments about failing to infer ret type; those work now
      
      * Put in dummy visits for ADTs in graph runtime codegen to placate pylint
      
      * Fix Relay type infer test module constructor
      
      * Mark override for TypeCallNode in type solver
      
      * Ensure free vars check treats patern vars as bound
      
      * Run interpreter in more ADT test cases
      
      * Refactor kind check to return the kind, like typechecking
      
      * Fix invalid typecall in test
      
      * Add kind check to type inference, do not use nulls in func_type_annotation()!
      
      * Redundant whitespace
      
      * Make TypeData a separate kind
      
      * Make ADT handles a separate kind too, document calling convention better
      
      * Remove nats and tree from prelude, move to test, document prelude
      
      * Restore and document nat and tree to prelude, add more tree tests
      
      * Add alpha equality tests for match cases, fix variable binding bug
      
      * Add more kind check tests for ADTs
      
      * Add more tests for finding free or bound vars in match exprs
      
      * Add unification tests for type call
      
      * Update main() for alpha equality tests
      
      * Add simple type inference test cases for match exprs and ADT constructors
      
      * Add more ADT interpreter tests
      
      * Allow incomplete types when typechecking match cases
      
      * Type inference for pattern vars should use the type annotation if it's there
      
      * Two more specific test cases for ADT matching
      
      * Add option ADT to prelude
      
      * Fix broken reference to kind enum
      
      * Fix rebase snags
      
      * Do not attach checked types to constructors
      
      * More docstrings for module fields
      
      * Use proper wrapper for indexing into module type data
      
      * checked_type for constructors is not populated
      
      * Expand type call docstring
      
      * Rename PatternConstructor con field
      
      * Use error reporter for pattern constructor case
      
      * Condense error reporting in kind check, use error reporter
      
      * Expand docstrings and rename ADT fields
      
      * Rename 'option' ADT to 'optional' for consistency with Python
      
      * Add various list iterators and utility functions to prelude
      
      * Add smoke tests for new iterators in prelude
      
      * Add concat to prelude
      
      * Add smoke test for concat
      
      * Correct docstrings in prelude
      
      * Ensure that type defs are written in module initialization
      
      * Various requested renamings
      
      * Correct rebase snags
      
      * Add kind check tests for ref types
      
      * Update the main() for kind checking tests
      Steven S. Lyubomirsky committed
  28. 25 Jan, 2019 1 commit
  29. 15 Jan, 2019 1 commit
  30. 02 Nov, 2018 1 commit
  31. 30 Oct, 2018 1 commit
  32. 23 Oct, 2018 1 commit
  33. 20 Oct, 2018 1 commit
  34. 18 Oct, 2018 1 commit
  35. 29 Sep, 2018 1 commit