Zhigao [Wed, 15 Jan 2020 06:26:09 +0000 (14:26 +0800)]
link the math library by default (#4713)
Haichen Shen [Wed, 15 Jan 2020 04:03:14 +0000 (20:03 -0800)]
Revert "[Relay][TOPI]Fix meaning of conv2d_transpose output_padding parameter (#4318)" (#4708)
This reverts commit
dcf7fbf1f962569e78c624755b2d612fffa81ada.
Zhi [Wed, 15 Jan 2020 03:35:56 +0000 (19:35 -0800)]
use packed func macro for external codegen (#4710)
Tianqi Chen [Wed, 15 Jan 2020 03:03:26 +0000 (19:03 -0800)]
[REFACTOR][IR] Unify IntImm and UIntImm (#4706)
* [REFACTOR][IR] Unify IntImm and UIntImm
This PR unifies UIntImm and IntImm to simplify the codebase.
Unsigned integer constants will also be stored as IntImm.
For uint constant that does not fit into int64(rare case), we introduced
an intrinsic tvm_big_uint_imm to construct such intgers by its
lower and higher 32bits.
* [REFACTOR][IR] Remove UIntImm to use IntImm
* rename big->large
Tianqi Chen [Tue, 14 Jan 2020 22:36:16 +0000 (14:36 -0800)]
[REFACTOR][IR] Polish ir/type (#4705)
- Use consistent constructor style to construct objects.
- Move env_func to ir as it is mainly used to construct IRs.
- Make docs consistent.
Zhi [Tue, 14 Jan 2020 19:40:00 +0000 (11:40 -0800)]
[relay] Relay annotation and partitioning for external compilers (#4570)
* [relay] Relay annotation and partitioning for codegen
* Add fusion unit test
* fix comments
* Update include/tvm/relay/attrs/annotation.h
Co-Authored-By: 雾雨魔理沙 <lolisa@marisa.moe>
* rebase
* remove annotation helper
* rebase again
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: 雾雨魔理沙 <lolisa@marisa.moe>
Tianqi Chen [Tue, 14 Jan 2020 17:09:01 +0000 (09:09 -0800)]
[REFACTOR][IR] Initialize Unified IR Pass Infra. (#4702)
Move the relay's pass Infra to ir.
Keep FunctionPass in relay as it is local to the dialect.
Tianqi Chen [Tue, 14 Jan 2020 04:16:03 +0000 (20:16 -0800)]
[REFACTOR][IR] Move error.h into ir (#4701)
We will use a single ErrorReporter to report errors during
program transformations.
Zhi Chen [Mon, 13 Jan 2020 22:40:26 +0000 (22:40 +0000)]
fix RemoveUnusedFunctions pass
Liangfu Chen [Tue, 14 Jan 2020 02:39:56 +0000 (10:39 +0800)]
[VTA] Fix an issue in updating uop_idx in the TensorGemm module (#4694)
Tianqi Chen [Tue, 14 Jan 2020 00:18:01 +0000 (16:18 -0800)]
[REFACTOR][IR] Unified IR IRModule structure. (#4699)
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
Christian Clauss [Sun, 12 Jan 2020 03:08:20 +0000 (04:08 +0100)]
GitHub Action lint Python code for syntax errors (#4688)
* GitHub Action lint Python code for syntax errors
https://flake8.pycqa.org/en/latest/user/error-codes.html
On the flake8 test selection, this PR does _not_ focus on "_style violations_" (the majority of flake8 error codes that [__psf/black__](https://github.com/psf/black) can autocorrect). Instead these tests are focus on runtime safety and correctness:
* E9 tests are about Python syntax errors usually raised because flake8 can not build an Abstract Syntax Tree (AST). Often these issues are a sign of unused code or code that has not been ported to Python 3. These would be compile-time errors in a compiled language but in a dynamic language like Python they result in the script halting/crashing on the user.
* F63 tests are usually about the confusion between identity and equality in Python. Use ==/!= to compare str, bytes, and int literals is the classic case. These are areas where __a == b__ is True but __a is b__ is False (or vice versa). Python >= 3.8 will raise SyntaxWarnings on these instances.
* F7 tests logic errors and syntax errors in type hints
* F82 tests are almost always _undefined names_ which are usually a sign of a typo, missing imports, or code that has not been ported to Python 3. These also would be compile-time errors in a compiled language but in Python a __NameError__ is raised which will halt/crash the script on the user.
* Force a retest
* Rename start_rpc_server_to_tracker.py to start_rpc_server_to_tracker.sh
This is a bash file, not a Python file.
Josh Fromm [Sat, 11 Jan 2020 22:04:47 +0000 (14:04 -0800)]
[Relay/Topi][Op] Conv1D (#4639)
* added conv1d operators to topi.
* Started to add python testing.
* Added python conv1d implementation for testing.
* Wrote test but need to add cuda schedule :(
* Cuda schedules working for both conv1d layouts.
* All topi tests passing.
* Formatting topi.
* Removed pad_method option as its probably overkill.
* Added relay op definition of conv1d.
* End2end conv1d working with onnx.
* Lint fixes.
* Formatting fixes.
* Rebase fix.
* Switched to array based attributes for consistency across convs.
* Improved onnx parsing and testing for convolutions.
* lint fix
* Tiny tweak.
* Bug fix
* Rebase fix.
* Add group ignore to onnx conv1d frontend.
* Unified MakeConv and fixed documentation.
* improved autopadding
* Addressed feedback and simplified onnx frontend.
* Format fix.
* Basic X86 NCW schedule working.
* Added nwc schedule.
* fixed name
* Added more tests and basic x86 schedules.
* Format fix.
* Added non power of two shape tests.
Tianqi Chen [Sat, 11 Jan 2020 21:02:29 +0000 (13:02 -0800)]
[REFACTOR][IR] Unified IR Primitive Op and Registry (#4687)
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.
Wuwei Lin [Sat, 11 Jan 2020 20:35:54 +0000 (15:35 -0500)]
[Tutorial] Deploy Quantized Model on CUDA (#4667)
* [Tutorial] Deploy Quantized Model on CUDA
* update
* update
* address comments
Christian Clauss [Sat, 11 Jan 2020 19:30:09 +0000 (20:30 +0100)]
Update and rename start_rpc_server_to_tracker.py to start_rpc_server_to_tracker.sh (#4689)
This is a shell file, not a Python file.
Tianqi Chen [Sat, 11 Jan 2020 06:54:16 +0000 (22:54 -0800)]
[REFACTOR][IR] Allow Module to store BaseFunc. (#4678)
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.
Christian Clauss [Sat, 11 Jan 2020 05:39:04 +0000 (06:39 +0100)]
Use ==/!= to compare str, bytes, and int literals (#4686)
Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise __SyntaxWarnings__ so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8
% __python__
```
>>> dtype = "float"
>>> dtype += "16"
>>> dtype == "float16"
True
>>> dtype is "float16"
False
>>> 0 == 0.0
True
>>> 0 is 0.0
False
```
Christian Clauss [Sat, 11 Jan 2020 05:24:51 +0000 (06:24 +0100)]
Fix Python syntax error AGAIN in start_rpc_server_to_tracker.py (#4685)
#4682 Tried to fix a Python syntax error but did not go far enough because there are _three sets_ of embedded quotes.
This PR solves the syntax error by using Python's triple quoted strings on the outside and then double quotes in the middle and then single quotes on the inside.
Yong Wu [Sat, 11 Jan 2020 03:52:52 +0000 (19:52 -0800)]
[TOPI][RELAY][OP] add op crop_and_resize (#4417)
* [TOPI][RELAY][OP] add op crop_and_resize
* fix pylint
* incorporate comments
* fix ci
Tianqi Chen [Sat, 11 Jan 2020 03:27:00 +0000 (19:27 -0800)]
[REFACTOR][IR] Initialize Unified IR Expr Data Structure (#4673)
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.
Zhi [Sat, 11 Jan 2020 00:44:16 +0000 (16:44 -0800)]
[REFACTOR] Replace TensorObj and TensorValue with NDArray (#4643)
* replace TensorObj and TensorValue with NDArray
* NodeBase to Object in Python
* rebase
abergeron [Sat, 11 Jan 2020 00:24:52 +0000 (19:24 -0500)]
[Relay][TOPI]Fix meaning of conv2d_transpose output_padding parameter (#4318)
* Add output_padding to generic
* Add output_padding to the reference impl
* Add output_padding to arm_cpu
* Add output_padding to the test
* Add output_padding for cuda
* Add output_padding for x86
* Make use of the new output_padding argument in Relay
* Adjust conv2d_transpose Relay test
* Fix lint errors
* Fix the VTA declaration of conv2d_transpose
* support for output padding in conv2d transpose
* some output padding will break IR pass
* Fix new conv2d_transpose test
* Update tophub
* Fix conv1d output_padding too.
* Fix the conv1d_transpose reference function.
* Fix the cuda impl
* fix the topi test for conv1d
* Update the versions in tophub.py
Co-authored-by: Thierry Moreau <tmoreau@octoml.ai>
yuliujq [Sat, 11 Jan 2020 00:21:57 +0000 (08:21 +0800)]
[Bugfix] fskip of EliminateCommonSubexpr cannot always return false (#4620)
* 'fskip' will not always return false
fskip returns false at the end of PackedFunc, discards return true in 'cast' case
* Update build_module.cc
Christian Clauss [Fri, 10 Jan 2020 23:54:45 +0000 (00:54 +0100)]
Fix Python syntax error in start_rpc_server_to_tracker.py (#4682)
[flake8](http://flake8.pycqa.org) testing of https://github.com/apache/incubator-tvm on Python 3.8.0
$ __flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics__
```
./apps/vta_rpc/start_rpc_server_to_tracker.py:18:18: E999 SyntaxError: invalid syntax
PROJROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
^
```
Ina Dobreva [Fri, 10 Jan 2020 22:57:16 +0000 (22:57 +0000)]
[Relay][Frontend][TFlite] Add parses support for SLICE (#4502)
* [Relay][Frontend][TFlite] Add parses support for SLICE
* TFlite 1.13: convertor gives nonsense output when size[i]==-1
* TF parser: SLICE need fixing for size[i]==-1 -> gives wrong output
bcs of indices
* Set end[i] = input_tensor_shape[i] as suggested in PR review
* Add another test to cover size=-1 case
Christian Clauss [Fri, 10 Jan 2020 22:54:27 +0000 (23:54 +0100)]
os.path --> osp to match the import (#4681)
Christian Clauss [Fri, 10 Jan 2020 22:36:05 +0000 (23:36 +0100)]
GitHub actions/checkout@v1 --> v2 (#4680)
https://github.com/actions/checkout/releases
abergeron [Fri, 10 Jan 2020 22:04:15 +0000 (17:04 -0500)]
Also package core.rly (#4679)
Tianqi Chen [Fri, 10 Jan 2020 22:01:27 +0000 (14:01 -0800)]
[CI] Bump to use the new cpu image (#4677)
戚海涛 [Fri, 10 Jan 2020 19:00:10 +0000 (03:00 +0800)]
fix topi.nn.global_pool layout="NHWC" (#4656)
* Update topi.cc
fix topi.nn.global_pool layout="NHWC"
* add topi.nn.global_pool layout=NHWC test
Tianqi Chen [Fri, 10 Jan 2020 18:29:44 +0000 (10:29 -0800)]
[CI] Update deps for chisel (#4675)
Zhao Wu [Fri, 10 Jan 2020 17:01:00 +0000 (01:01 +0800)]
[CodeGen] Generate blob use LLVM directly (#4657)
Liangfu Chen [Fri, 10 Jan 2020 16:42:12 +0000 (00:42 +0800)]
[VTA] Update docker for TSIM based simulation (#4674)
Josh Fromm [Fri, 10 Jan 2020 09:29:01 +0000 (01:29 -0800)]
Added pool autopadding and simplified parsers. (#4672)
Xingyu Zhou [Fri, 10 Jan 2020 04:22:45 +0000 (20:22 -0800)]
download fallback config file for search from tophub if it does not exist (#4671)
Tianqi Chen [Thu, 9 Jan 2020 23:30:23 +0000 (15:30 -0800)]
[REFACTOR][IR] tvm::Expr -> PrimExpr(Primitive Expr) (#4669)
* [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
Trevor Morris [Thu, 9 Jan 2020 19:06:38 +0000 (11:06 -0800)]
Use int for endch to fix portability issues regarding signed/unsigned char (#4668)
Ina Dobreva [Thu, 9 Jan 2020 18:46:26 +0000 (18:46 +0000)]
[Relay][Frontend][TFlite] Add parses support for unary elemwise ops (#4634)
* [Relay][Frontend][Tflite] Add parses support for unary elemwise ops
* Add generic method to convert unary functions: abs, exp, ceil, floor
log, sin, cos, sqrt, rsqrt, neg
* Add relevant tests
* Delete excessive underscores as requested in PR review
* Change parameter name as suggested in PR review
Tianqi Chen [Thu, 9 Jan 2020 17:12:56 +0000 (09:12 -0800)]
[REFACTOR] relay::Module Def -> TypeDef (#4665)
* [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>
Josh Fromm [Thu, 9 Jan 2020 09:43:25 +0000 (01:43 -0800)]
[Relay/Topi][Op] 1D Pooling (#4663)
* Added 1D pooling to Topi
* Added 1D pooling relay op and tests.
* Added onnx parsing and tests for maxpool1d and averagepool1d
* formatting
* moved partial import.
* Fixed typo.
Haichen Shen [Thu, 9 Jan 2020 01:15:55 +0000 (17:15 -0800)]
[Autotvm] Use VM compile to extract autotvm tasks (#4328)
* [AutoTVM] Use vm compile in extracting task from relay
* update
* restructure vm compiler to reduce task extraction time
* x
* fix
* update doc
* udpate doc
* lint
Tianqi Chen [Thu, 9 Jan 2020 01:02:12 +0000 (17:02 -0800)]
[CI] Recover Windows Mac Build CI via Github Actions (#4662)
* [RUNTIME] Fix windows build after the latest dso module change.
Switch to shared_ptr to get around a problem in latest MSVC.
* [CI] Add github action for win mac build.
optima2005 [Wed, 8 Jan 2020 18:26:14 +0000 (02:26 +0800)]
[CONV] Reduce data size of asymmetric padding testcase (#4658)
Co-authored-by: Tianqi Chen <tqchen@users.noreply.github.com>
Tianqi Chen [Wed, 8 Jan 2020 17:01:00 +0000 (09:01 -0800)]
[REFACTOR][IR] Add Node suffix to low-level IR nodes (#4649)
* [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
Zhi [Wed, 8 Jan 2020 16:52:38 +0000 (08:52 -0800)]
reduce input size to fix oom (#4653)
Haichen Shen [Wed, 8 Jan 2020 02:23:02 +0000 (18:23 -0800)]
[COMMUNITY] @MarisaKirisame -> committer (#4645)
Tianqi Chen [Tue, 7 Jan 2020 23:28:26 +0000 (15:28 -0800)]
[RUNTIME][DSO] Improve TVMBackendPackedCFunc to allow return val (#4637)
* [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
Animesh Jain [Tue, 7 Jan 2020 22:07:42 +0000 (14:07 -0800)]
[QNN] Channel wise quantization - Quantize & Requantize (#4629)
Tianqi Chen [Tue, 7 Jan 2020 17:10:33 +0000 (09:10 -0800)]
Resolve constexpr related link error in debug mode (#4641)
Tianqi Chen [Tue, 7 Jan 2020 06:00:53 +0000 (22:00 -0800)]
[CI] better deletion script for pycache (#4635)
Tianqi Chen [Mon, 6 Jan 2020 21:02:16 +0000 (13:02 -0800)]
[COMMUNITY] @wweic -> committer (#4636)
Leandro Nunes [Mon, 6 Jan 2020 17:50:12 +0000 (17:50 +0000)]
[FRONTEND][Keras] Add support for tf.Keras networks in Relay Keras frontend (#4630)
* Make Relay Keras frontend support networks created using
Tensorflow (1.13) Keras implementation (tf.Keras)
* Modify Keras frontend tests to run from a class rather than a
function based script
* Adjust Keras frontend tests to run with both 'Keras' and 'tf.Keras'
* Change "TestKeras.test_forward_merge" to validate instances by
class name rather than instance type
Leandro Nunes [Mon, 6 Jan 2020 17:07:26 +0000 (17:07 +0000)]
Update image version tags in Dockerfile comments (#4631)
* Fix typos on Docker image versions that we are currently running
as part of CI
* Add version comment in the same pattern for ci_lint image
Leandro Nunes [Mon, 6 Jan 2020 16:31:07 +0000 (16:31 +0000)]
Pin python pillow to "<7" due to torchvision 1.2.0 dependency issue (#4632)
* As a result of backwards incompatible changes released in pillow 7.0,
torchvision crashes if you just "pip install pillow", as we do in
a few places.
* This patch sets pillow<7 to be installed in Dockerfiles and support
material as tutorials and documentation.
Ramana Radhakrishnan [Mon, 6 Jan 2020 16:30:51 +0000 (16:30 +0000)]
Improve comments (#4633)
* Improve commentary for operator fusion.
* Attempt to clarify what well formed checker is doing
Tianqi Chen [Mon, 6 Jan 2020 05:39:33 +0000 (21:39 -0800)]
[REFACTOR][IR] Introduce SeqStmt to replace ir::Block (#4627)
* [REFACTOR][IR] Introduce SeqStmt to replace Block
ir::Block was used to represent a sequence of Stmts in the original low-level IR.
The nested ir::Block structure is not really friendly for recursive visits,
especially when the statements are unrolled.
This PR introduce a SeqStmt that directly stores a sequence of statements in an Array container.
The new SeqStmt will be used as a replacement of the original Block structure.
* [REFACTOR] Migrate use of Block to SeqStmt.
* [REFACTOR] Remove Block
* Add more comments per yizhi's comment
optima2005 [Mon, 6 Jan 2020 03:53:47 +0000 (11:53 +0800)]
[CONV] Asymmetric padding (#4511)
* [CONV] Asymmetic padding
* fix lint error
* update for legalize, rocm and cudnn
* add more test cases
* change more symmetric padding
* change conv2d winograd tests according orginal cases
* remove 'alter_op_layout.h' header in bitserial.cc
Yao Wang [Mon, 6 Jan 2020 03:50:09 +0000 (19:50 -0800)]
[Topi]Allow empty tensor for reshape, tile and strided_slice (#4618)
* Support empty tensor
* Fix schedule
* Refactor
* Minor fix
* Fix pylint
* Merge cpp and python is_empty_shape
Tianqi Chen [Mon, 6 Jan 2020 01:52:45 +0000 (17:52 -0800)]
[REFACTOR] Automatically deduce function type signature in Registry.set_body_typed (#4623)
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 [Mon, 6 Jan 2020 01:52:30 +0000 (17:52 -0800)]
Get around limitation of g++-4.8 (#4626)
Kevin Yuan [Mon, 6 Jan 2020 00:56:16 +0000 (08:56 +0800)]
Added declare of aluBits for TensorAlu (#4624)
Zhi [Sun, 5 Jan 2020 20:17:16 +0000 (12:17 -0800)]
tensor_array split test (#4619)
Tianqi Chen [Sun, 5 Jan 2020 04:09:18 +0000 (20:09 -0800)]
[REFACTOR] IRPrinter->NodePrinter, move to node/printer.h (#4622)
Rationale: printer is a common infra that is shared across all nodes.
Tianqi Chen [Sat, 4 Jan 2020 23:38:56 +0000 (15:38 -0800)]
[REFACTOR] TVM_REGISTER_API -> TVM_REGISTER_GLOBAL (#4621)
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 [Sat, 4 Jan 2020 20:26:21 +0000 (12:26 -0800)]
[REFACTOR] Unified IR base types. (#4616)
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 [Sat, 4 Jan 2020 07:08:55 +0000 (23:08 -0800)]
[REFACTOR][TYPE] Remove un-necessary var sub-field in GlobalTypeVar and TypeVar (#4615)
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.
Yao Wang [Sat, 4 Jan 2020 06:19:00 +0000 (22:19 -0800)]
[Relay][Pass]Improve memory_allocation pass to support multiple i/o dynamic kernels (#4595)
* Add more shape funcs
* Fix test
* Enhance test_any_concat
* Fix pylint
* Minor fix test
* Fix pylint
* Minor refactor
* Add test any for elemwise
Zhi [Fri, 3 Jan 2020 21:31:21 +0000 (13:31 -0800)]
[relay][tensor_array] test tensor_array in vm (#4608)
* [relay] test tensor_array in vm
* add tensor_array scatter test
Zhi [Fri, 3 Jan 2020 20:29:05 +0000 (12:29 -0800)]
skip example json runtime test when config is not set (#4614)
Tianqi Chen [Fri, 3 Jan 2020 20:28:49 +0000 (12:28 -0800)]
[CMAKE] Remove unecessary rdynamic (#4613)
Liangfu Chen [Fri, 3 Jan 2020 17:37:50 +0000 (01:37 +0800)]
[VTA] Throw exception on mis-formatted files and avoid overwrite Scala code (#4555)
Animesh Jain [Fri, 3 Jan 2020 13:39:56 +0000 (05:39 -0800)]
{QNN] Making scale/zero_points as expr instead of attrs. (#4611)
masahi [Fri, 3 Jan 2020 12:23:09 +0000 (21:23 +0900)]
[Quantization] Make calibration faster and more memory usage friendly (#4589)
* Use memory efficient calibrate
* Fixed indexing
* add cpp kl stub
* ported KL cpp from mxnet
* Fixed std::distance arguments order
* remove python implementation
* fix lint and indent
* fix indent
* refactoring
* fix lint
* fix for i386
Tianqi Chen [Fri, 3 Jan 2020 01:52:37 +0000 (17:52 -0800)]
[REFACTOR] Remove old Low-level Visitor/Mutator (#4612)
masahi [Fri, 3 Jan 2020 00:14:14 +0000 (09:14 +0900)]
[TOPI, Relay] Add half_pixel option to Resize op (#4610)
* add onnx resize converter
* update frontends
* updating topi
* adding onnx resize tests
* fixed NHWC test by casting size dtype to int32
* fix tests
* fix lint
* update existing test cases
* fix tensorflow frontend
* fix lint
* remove NHWC stuff
* update topi resize test for half_pixel
* update doc
* fix doc
* remove onnx resize bits
Tianqi Chen [Fri, 3 Jan 2020 00:00:53 +0000 (16:00 -0800)]
[REFACTOR] Migrate Low-level IR Passes into the New Stmt/Expr Mutator (#4607)
* CombineContextCall
* Migrate BoundChecker
* Migrate CoprocSync
* Migrate detect_device
* Migrate loop_partition
* Migrate infer_fragement
* Migrate inject_copy_intrin
* Migrate inject double buffer
* Migrate lower_intrin and simplify
* Migrate storage flatten
* Migrate inject prefetch
* Migrate inject_virtual_thread
* migrate inline
* Migrate lift attr scope
* Migrate custom datatypes
* migrate lower_thread_all_reduce
* Migrate lower_tvm_builtin
* migrate lower_warp memory
* Migrate make_api.cc
* Migrate remap_thread_axis
* Migrate remove_no_op
* migrate rewrite_unsafe_select
* Migrate skip_assert simple_passes
* Migrate split_host_device
* Migrate ssa
* Migrate storage_access
* Migrate storage_rewrite
* Migrate tensor_core
* Migrate unroll_loop
* Migrate vectorize
* Migrate verify compact_buffer gpu_code
* Migrate verify_memory
* Migrate storage_sync
* Remove unused refs to mutator
* Migrate hybrid_op
* Migrate tensorize
* Migrate schedule ops
* Migrate schedule_dataflow_rewrite
* Migrate auto_inline_elemwise
* Remove unecessary ref to visitor
* remove unecessary ref
* Migrate bound_deducer
* Migrate domain_touched
* Migrate autotvm feature touch extractor
* Add annotations
Tianqi Chen [Thu, 2 Jan 2020 17:08:54 +0000 (09:08 -0800)]
Bugfix StmtMutator IfThenElse (#4609)
Tianqi Chen [Thu, 2 Jan 2020 00:30:47 +0000 (16:30 -0800)]
[IR] Unify approach to Visitor/Mutator under Functor (#4606)
IRMutator and IRVisitor were the main data structures for doing low level IR visiting.
As the project evolves, we start to introduce more powerful variants such as StmtFunctor and ExprFunctor.
This PR brings new classes that allows us to migrate the visitor mutator to be sub-class of these functors.
List of changes:
- Create separate class for ExprMutator and StmtMutator, following convention used in relay.
- Introduce copy-on-write to StmtMutator that can later benefit the statement mutations
if we use move semantics and keep a single copy of stmt.
- Move two generic visit mutate util to use the new classes.
We will send followup PRs to migrate the existing passes that use the legacy visitors
to the new one.
optima2005 [Wed, 1 Jan 2020 09:42:54 +0000 (17:42 +0800)]
[FRONTEND][TF] Add conv3d (#4604)
* [FRONTEND][TF] Add conv3d
* fix high rtol
Zhi [Wed, 1 Jan 2020 06:36:19 +0000 (22:36 -0800)]
make adt tag signed (#4605)
Zhi [Tue, 31 Dec 2019 19:16:12 +0000 (11:16 -0800)]
Sort VM stats by time (#4601)
Tianqi Chen [Tue, 31 Dec 2019 17:35:03 +0000 (09:35 -0800)]
[REFACTOR][OBJECT] Consoldiate NodePtr/Ref/Hash/Equal to Object (#4603)
* [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>
Zhi [Tue, 31 Dec 2019 00:33:50 +0000 (16:33 -0800)]
[relay][refactor] Cache Op::Get in passes to reduce lookup overhead (#4594)
* Refactor to use IsOp utility
* retrigger CI
Animesh Jain [Mon, 30 Dec 2019 23:35:25 +0000 (15:35 -0800)]
[Relay][Convert Layout] Handling batch norm layout change. (#4600)
Tianqi Chen [Mon, 30 Dec 2019 06:16:27 +0000 (22:16 -0800)]
[REFACTOR][RUNTIME] Update NDArray use the Unified Object System (#4581)
* [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
Zhi [Mon, 30 Dec 2019 04:38:16 +0000 (20:38 -0800)]
fix codegenc (#4597)
Leyuan Wang [Sun, 29 Dec 2019 22:35:38 +0000 (14:35 -0800)]
[Perf] Add CublasLt extern support for better Igemm performance (#4550)
* cublaslt added
* fix lint
* address comments
* address more comments
* Trigger CI
* Trigger CI
Neo Chien [Sun, 29 Dec 2019 21:21:04 +0000 (05:21 +0800)]
[GraphRuntime] Support parameter out in the graph runtime debug (#4598)
* [GraphRuntime] Support parameter out in the graph runtime debug
* Dummy commit to trigger build
optima2005 [Sat, 28 Dec 2019 20:05:14 +0000 (04:05 +0800)]
[FRONTEND][TF] conv2d_transpose 'SAME' support kernel more than 1x1 (#4484)
* [FRONTEND][TF] conv3d_transpose 'SAME' support kernel more than 1x1
* revised per as review comments
* add more fallback wolkaround to make all tests pass
zhuochen [Sat, 28 Dec 2019 20:04:41 +0000 (04:04 +0800)]
fix tf.compat.v1 issue for tf verison <=1.12 (#4593)
Wang Yucheng [Fri, 27 Dec 2019 19:22:42 +0000 (03:22 +0800)]
[autotvm] fix typos in comment (#4591)
Zhao Wu (Chinese Name: 吴钊) [Fri, 27 Dec 2019 15:49:57 +0000 (23:49 +0800)]
[Runtime] add necessary const qualifier for NDArray container of parameters (#4590)
optima2005 [Fri, 27 Dec 2019 14:25:25 +0000 (22:25 +0800)]
[TOPI] add 3D upsampling Op. (#4584)
* [TOPI] add 3D upsampling Op.
* fix lint issues
* change align_corners to coordinate_transformation_mode
* fix resize3d half_pixel
* make a simple function and clean up trilinear_resize3d_python
* fix doc
Animesh Jain [Fri, 27 Dec 2019 02:42:21 +0000 (18:42 -0800)]
[Relay][AlterLayout] Broadcast with scalar shape (#4577)
Animesh Jain [Thu, 26 Dec 2019 19:15:46 +0000 (11:15 -0800)]
[Relay] Convert Layout Pass. (#4335)
deepIgnorance [Thu, 26 Dec 2019 18:10:44 +0000 (02:10 +0800)]
[FIX][TOPI][X86] schedule dense pack (#4539)
黎明灰烬 [Thu, 26 Dec 2019 17:36:31 +0000 (01:36 +0800)]
[TOPI][AutoTVM] NHWC conv2d templates for ARM (#3859)
* [AutoTVM][TOPI] NHWC conv2d templates (spatial pack) for ARM
As some frontends (tflite for example) are using NHWC as the default
layout, we are enabling NHWC schedule templates in TOPI and AutoTVM.
* some comments fix
Zhao Wu [Thu, 26 Dec 2019 17:33:03 +0000 (01:33 +0800)]
[Container] Fix NDArray SaveDLTensor declaration and implementation signature different (#4586)
masahi [Thu, 26 Dec 2019 14:13:38 +0000 (23:13 +0900)]
[Quantization, Calibrate] Fix context creation when current_target is explicity set (#4582)