Commit Graph

1220 Commits

Author SHA1 Message Date
abergeron cfbecc5a74 Also package core.rly (#4679) 2020-01-10 14:04:15 -08:00
Zhao Wu 54fb55a130 [CodeGen] Generate blob use LLVM directly (#4657) 2020-01-10 09:01:00 -08:00
Josh Fromm a277575de2 Added pool autopadding and simplified parsers. (#4672) 2020-01-10 18:29:01 +09:00
Xingyu Zhou 06ce76b6ea download fallback config file for search from tophub if it does not exist (#4671) 2020-01-09 20:22:45 -08:00
Tianqi Chen d6a23cf50f [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
2020-01-09 15:30:23 -08:00
Ina Dobreva 7a30e5fe3f [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
2020-01-09 10:46:26 -08:00
Josh Fromm 8a98a2e76b [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.
2020-01-09 18:43:25 +09:00
Haichen Shen baae28b269 [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
2020-01-08 17:15:55 -08:00
Animesh Jain 76efece39f [QNN] Channel wise quantization - Quantize & Requantize (#4629) 2020-01-07 14:07:42 -08:00
Leandro Nunes dc30880b96 [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
2020-01-06 09:50:12 -08:00
Leandro Nunes d93e1dca81 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.
2020-01-06 08:31:07 -08:00
Tianqi Chen 3595cbe02c [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
2020-01-05 21:39:33 -08:00
optima2005 34b98eb704 [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
2020-01-05 19:53:47 -08:00
Tianqi Chen 24e6fcb687 [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.
2020-01-03 23:08:55 -08:00
Yao Wang 9c638f060a [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
2020-01-03 22:19:00 -08:00
Zhi e69bd1284b [relay][tensor_array] test tensor_array in vm (#4608)
* [relay] test tensor_array in vm

* add tensor_array scatter test
2020-01-03 13:31:21 -08:00
Animesh Jain 0720ed6739 {QNN] Making scale/zero_points as expr instead of attrs. (#4611) 2020-01-03 22:39:56 +09:00
masahi 2440c9ced8 [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
2020-01-03 21:23:09 +09:00
masahi e8a2c9b3cc [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
2020-01-02 16:14:14 -08:00
optima2005 1ef1605a37 [FRONTEND][TF] Add conv3d (#4604)
* [FRONTEND][TF] Add conv3d

* fix high rtol
2020-01-01 18:42:54 +09:00
Zhi 6b11ffb91b Sort VM stats by time (#4601) 2019-12-31 11:16:12 -08:00
Tianqi Chen 55bd786fe2 [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
2019-12-29 22:16:27 -08:00
Leyuan Wang fadea9229c [Perf] Add CublasLt extern support for better Igemm performance (#4550)
* cublaslt added

* fix lint

* address comments

* address more comments

* Trigger CI

* Trigger CI
2019-12-30 07:35:38 +09:00
Neo Chien f727810135 [GraphRuntime] Support parameter out in the graph runtime debug (#4598)
* [GraphRuntime] Support parameter out in the graph runtime debug

* Dummy commit to trigger build
2019-12-29 13:21:04 -08:00
optima2005 227c7af446 [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
2019-12-28 12:05:14 -08:00
zhuochen 3227614684 fix tf.compat.v1 issue for tf verison <=1.12 (#4593) 2019-12-28 12:04:41 -08:00
Wang Yucheng e6d9f89c1c [autotvm] fix typos in comment (#4591) 2019-12-27 11:22:42 -08:00
optima2005 c3deec194f [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
2019-12-27 23:25:25 +09:00
Animesh Jain 73dda6be50 [Relay] Convert Layout Pass. (#4335) 2019-12-26 11:15:46 -08:00
黎明灰烬 672b0909dc [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
2019-12-26 09:36:31 -08:00
masahi a457df8a9b [Quantization, Calibrate] Fix context creation when current_target is explicity set (#4582) 2019-12-26 23:13:38 +09:00
kice 949c4d27ef Some Windows and MSVC fixes (#4569)
* fix python exception creation in Windows

* better string conversion for msvc

* fix cpp style issue
2019-12-25 13:42:03 -08:00
Tianqi Chen e91cc5aba8 [RUNTIME] Remove Extension VTable in favor of Unified Object system. (#4578)
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.
2019-12-25 09:21:01 -08:00
Tianqi Chen ff65698f40 [DEPRECATION] Cleanup legacy verilog support (#4576)
This PR cleans up the left over code for legacy verilog support which was experimental.
The new hardware backend path is now support by VTA via TSIM.
2019-12-24 15:14:03 -08:00
Bohan Hou c90160b229 [DOC] fix doc in api.py (#4580) 2019-12-24 08:51:05 -08:00
Josh Fromm 9b92c53913 [Relay/Topi][Op] Added native DepthToSpace and SpaceToDepth Operators (#4566)
* Added tvm function stencil for subpixel operations to topi.

* Topi subpixel operators added and tested.

* Added subpixel attrs.

* Added depth_to_space relay attributes.

* depth_to_space fully working.

* Fixed NHWC shape bug.

* SpaceToDepth in and all tests passing.

* lint fixes.

* Added string include

* Fixed topi formatting.

* Added DCR/CDR mode to depthtospace operator.
2019-12-23 21:04:34 -08:00
masahi 9ec0e5ce1a remove unnecessary cast to int32 (#4573) 2019-12-23 08:48:37 -08:00
Yong Wu f277da76e4 [Relay] add max_pool3d in relay and TF converter (#4551)
* [Relay] add max_pool3d in relay and TF converter

* fix comments
2019-12-23 10:43:33 +09:00
Tianqi Chen e6ff3f701b [TEST] Remove nnvm related code in topi and test script (#4562)
* [TEST] Remove nnvm related code in topi and test script

* Remove docs dep
2019-12-22 09:47:34 -08:00
Neo Chien 8acc413cf8 [Relay][Frontend][ONNX] Support auto_pad in Conv and ConvTranspose (#4563) 2019-12-22 09:03:39 -08:00
Zhao Wu f076c839ef Support standardize runtime module (#4532) 2019-12-21 20:14:40 -08:00
Tianqi Chen bc5367a07b [PYTHON][FFI] Cythonize NDArray.copyto (#4549)
* [PYTHON][FFI] Cythonize NDArray.copyto

* Cythonize the shape property
2019-12-20 14:21:09 -08:00
Takato Yamada e274e66eae [relay][op] add expand op (from ONNX) to relay frontend (#4483)
* Add Expand to onnx.py

* add test function for expand

* Fix a onnx frontend test

* Add tests for the value itself instead of shape only on test_expand

* Cleaned up some unnecessary modifications.
2019-12-18 09:58:37 -08:00
Alex Gladkov d430fbb586 Implement 1d deconvolution (#4476) 2019-12-18 12:35:22 -05:00
Zhi c44b7bf107 [Relay] External codegen (#4482) 2019-12-17 19:17:55 -08:00
lhutton1 603280bf6f PIL is depreciated and should be replaced with pillow (a fork of PIL) (#4533)
Change-Id: If2075df5475505f2da87dae7145af5a7ab83d8a4
2019-12-17 09:55:32 -08:00
masahi 093405d8b7 fix onnx shape dtype (#4528) 2019-12-16 08:11:53 -08:00
Cody Yu 8e3b5d39c3 fix empty config caused KeyError (#4520) 2019-12-15 22:37:43 -08:00
Josh Fromm f221844bd9 Fixed extra reshape parameter bug. (#4524) 2019-12-15 15:08:35 -08:00
SWu f10944c90c Fix bias_add gradient (#4516)
* Fix bias_add gradient

A change caused collapse_sum_like to reject implicit dimension
broadcasting for bias_add gradient, so switch to explicit sum reduction
on the non-bias axis dimensions.

* Lint fix
2019-12-13 15:09:56 -05:00