Commit Graph

1625 Commits

Author SHA1 Message Date
Jared Roesch 60cfb79ce7 [Rust] Second stage of Rust Refactor (#5527)
* Add tvm-rt crate

* Backport changes from frontend branch

* Format

* Add ASF headers

* Address self-code review

* Replace with helper

* Fix lint

* Fix

* Clean up repro debugging

* WIP

* Remove global resgistry to fix one memory issue

* Fix

* Format

* Format

* Update rust/tvm-rt/README.md

Co-authored-by: Jason Knight <binarybana@gmail.com>

* Format

* Duplicate TVM macros

* Split macros

* Restore old macro for old crates

* Repair macros

* Fix format

* Format

Co-authored-by: Jason Knight <binarybana@gmail.com>
2020-06-10 02:07:19 -07:00
Tianqi Chen 10bff2717e [REFACTOR][TIR] Provide->ProducerStore, Realize->ProducerRealize. (#5750)
This PR finishes up the final step for DSL/TIR de-coupling to refactor
Provide/Realize to use the DataProducer.

As in the case of ProducerLoad, ProducerStore/Realize are not supposed
to appear in a vaid TIR function ans are only used by high-level DSLs
as intermediate structures.
2020-06-09 22:28:52 -07:00
Cody Yu 54641ec26e [Bugfix] Fix reshape (#5739)
* Fix reshape

* fix doc warning

* fix ci

* address comments
2020-06-09 22:03:09 -07:00
Matthew Brookhart 9f79199822 Add Scatter to Topi/Relay/ONNX via hybrid script (#5619)
* I can construct scatter but not embed it in a Relay Graph

* working 1-4 dimesion scatter

* add scatter to ONNX

fix lint

* isolate tests to cpu backend

* Fix i386 test

* fix gpu tolerance

* use elemwise_shape_func for scatter

* fix incorrect rebase
2020-06-10 07:33:57 +09:00
Yong Wu aa808570db [TOPI][Relay][OP] support dynamic NMS(Non Maximum Suppression), symbolic begin, end, and strides for strided_slice (#4312)
* [TOPI][Relay][OP] Dynamic NMS and strided_slice

* Incorporate comments

* fix nnvm compatibility issues

* fix InferCorrectLayout

* Minor fix

* fix for fuse

* Workaround to pass batch_size into hybrid function to handle dynamic shape

* Seperate rearrange

* fix lint

* fix ci, comments

* change attr to Optional<T>

* clang format

* remove empty lines

* partial ignore for end of strided_slice

* pylint

* add out_indices for gpu get_valid_counts

* change to slice_mode

* clang-format, fix comments

* fix comment

* change slice_mode to string

* fix CI

* update docstring

Co-authored-by: Yao Wang <kevinthesunwy@gmail.com>
2020-06-09 09:48:33 -07:00
Trevor Morris 2e1ef8e4b7 Don't add cast for TF batch norm when type isn't changing (#5731) 2020-06-09 05:13:28 +05:30
Tianqi Chen 6ae439c8c5 [REFACTOR][TE][TIR] Call::Halide => ProducerLoad, DSL/TIR decouple. (#5743)
In the HalideIR's design, DSL components and IR are mixed together.
For example, Call::Halide can containa reference to a function which is
constructed in the tensor expression language.

While this coupled design simplifies certain aspect of the DSL construction,
it prevents the TIR to evolve as a clean standalone IR:

- The additional tensor expression provided in the function is opaque to the IR
  and may become obsolete as we transform them.
- The duplication of the information in the DSL tensor and IR makes it hard to
  design a stand-alone text format (when there are elements shared in the tensor
  expression and normal statements).

This PR aims to clearly de-couple the TIR from high-level DSL structures(tensor expression),
while still provide clear extensions to build DSLs on top of the TIR.

We introduce a DataProducer as a base class for high level tensor expressions objects
that produce data. We then introduce ProducerLoad to replace the Call::Halide usage,
so that the Call node can always be self contained and used for low-level calls.

The high-level tensor expression DSL can still generate a PrimExpr that contains a ProducerLoad.
These PrimExprs contains fragments of information that can be combined together to
generate a low-level TIR PrimFunc.

We also state clearly that DataProducer **should not** appear in any TIR PrimFunc.
Instead, the high-level DSL layer should lowered DataProducers to Buffers and TIR statements
that produces these buffers. We can further provide verifications to validate such invariance.

Changes:
- Introduce DataProducer to serve as a base class for Tensor in tensor expressions.
- Migrate use of Call::Halide to ProducerLoad
- Migrate the other usages of Calls.

We will also create follow-up PRs to migrate the remaining two DSL related IR nodes(Realize/Provide)
to use the DataProducer.
2020-06-07 14:11:05 -07:00
handar423 2ec7caa073 fix small bug about dense_grad (#5695) 2020-06-06 09:10:17 +05:30
Samuel fbc2b87b5c [ONNX]MaxRoiPool, Mod & Xor op support added (#5729) 2020-06-05 14:48:44 +09:00
Tianqi Chen 8a98782cdf [REFACTOR] Separate ArgTypeCode from DLDataTypeCode (#5730)
We use a single enum(TypeCode) to represent ArgTypeCode and DLDataTypeCode.
However, as we start to expand more data types, it is clear that argument
type code(in the FFI convention) and data type code needs to evolve separately.
So that we can add first class for data types without having changing the FFI ABI.

This PR makes the distinction clear and refactored the code to separate the two.

- [PY] Separate ArgTypeCode from DataTypeCode
- [WEB] Separate ArgTypeCode from DataTypeCode
- [JAVA] Separate ArgTypeCode from DataTypeCode
2020-06-04 15:04:17 -07:00
Dhruva Ray 34c95a89ea [Frontend][TFLite] Add parser support for shape and range (#5329)
* [Relay][Frontend][TFLite] Add parser support for shape and range

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* Incorporated review comments and used new functions

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* Few cosmetic changes

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* Removed an extra line added by rebase...

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>
2020-06-04 10:55:38 -07:00
Dhruva Ray c2e248f07e [TOPI,RELAY][TFLITE] Sparse to dense operator (#5447)
* [Relay][Frontend][TFLite] Add parser support for shape and range

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* [TOPI,RELAY][TFLITE] Sparse to dense operator

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* use param name in documentation

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* sphinx doc errors fixed

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* incorporated review comments

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* Missing a blank line...

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* use get_tensor_expr

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* Accidently removed this function in the rebase...

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* support default value for default_value

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* clang format fixes

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>

* topi pylint fixes

Signed-off-by: Dhruva Ray <dhruvaray@gmail.com>
2020-06-04 10:54:56 -07:00
Junru Shao 89359907d6 Fix runtime::String backward compatibility in JSON (#5725) 2020-06-04 08:29:03 -07:00
Wuwei Lin a64208910b [AutoTVM, Relay] Clear compile engine after task extraction (#5724) 2020-06-03 23:47:04 -07:00
Deepak 43dcbc6bd4 [TENSORFLOW]StatefulPartitionedCall/PartitionedCall Ops support added (#5617)
* Implemented functionInvocation Unit Test for StatefulPartitionedCall operator(working) and initial changes for placeholder(not working as of now)

* Placeholder exercises with tvm

* placeholder interim

* SPOP Test cases structure

* New test cases for spop

* miscellaneous test cases for spop

* Placeholder samples..working with shapes explicitly passed

* Variables test case. Works with the same fix of shape_dict

* SPOP Positive test cases first iteration

* support output tensors as function args, multiple functions

* Corrected Indentation

* filewritter is only for debug purpose

* support variables in function args

* First working iteration of positive spop test cases

* Removed commented code, simplified code

* Code Reorganization- First working iteration of positive spop test cases

* corrected variable name after refactor

* Code Reorganization- First working iteration of positive spop test cases

* move code inside mapped operator function

* Removed extra line

* support variables in function args

* Removed commented code, simplified code

* move code inside mapped operator function

* Code Reorganization- First working iteration of positive spop test cases

# Conflicts:
#	tests/python/frontend/tensorflow/test_forward.py

* Code Reorganization- First working iteration of positive spop test cases

* Function invocation more test cases

* Simplified & Merged different Function Invocation Test cases

* support invocation of nested callables

no need to explicitly handle paratitioned and
statefulPartitioned condition in convert_operator function

* Simplified and Uniform testcases

* support invocation of nested callables

no need to explicitly handle paratitioned and
statefulPartitioned condition in convert_operator function

* Simplified and Uniform testcases

* removed duplicate and renamed testcase

* Negative scenario added for testing operator statefulness. Only Exception to stateful operators are Partitioned & StatefulPartitionedOp which have capability to execute even stateless operators within them

* Miscellaneous reorganization changes for spop scenarios

* Miscellaneous reorganization changes for spop scenarios

* Corrected import of tensorflow modules safely using try except and other code reorganization

* Negative scenario for resource variables handled

* Documentation update for code

* SPOP change in function handling

* handle nested subgraph

* refactor

* get op def compatible with tf 1x & 2x

* Fixed liniting issues

* added doctsring and few nits

* Merged changes for positive test cases and negative test cases

* Moved StatefulPartitionedCall test case to the end of the TC list

* Fixed some typos and semantics

* dmlc-core

* dmlc-core

* fixes

* Addressing Review comments in the PR for SPOP support

* Fixed pylint errors

* Corrected tensorflow import syntax

* Placed the op_def_registry module import outside of for loop

* Removed new stateful operators list and combined these operators with missing operators to display as single list. Also removed throwing seperate exception for stateful ops

Co-authored-by: Prashant Sail <psail4444@gmail.com>
Co-authored-by: maheshambule <mahesh_ambule@persistent.com>
2020-06-04 10:03:42 +05:30
Samuel 3d61dc892c [ONNX]ReduceL1, ReduceL2, ReduceSumSquare, ReduceLogSum ops added (#5721) 2020-06-04 11:06:21 +09:00
Junru Shao 64ac555063 [Object] Restore the StrMap behavior in JSON/SHash/SEqual (#5719) 2020-06-03 13:34:44 -07:00
lixiaoquan 927510a6f3 Avoid downloading when TOPHUB_LOCATION is NONE (#5720) 2020-06-03 08:01:10 -07:00
Samuel c1f3b2f496 [MXNET]Softmin, trunc op support added (#5715) 2020-06-03 17:29:38 +09:00
Junru Shao 4347b41a5e [Object] Unify StrMapNode and MapNode (#5687)
* Pass cpptest and py unittest

* fix graph runtime

* right fix

* fix a bug that runtime::String's operator < is actually compare by address

* Update container.py

* Renaming

* Address comments

* lint

* Replace ObjectHash in object.py
2020-06-02 16:33:09 -07:00
tobe 062a244d66 Rename tvm_dso_op to libtvm_dso_op (#5714) 2020-06-02 09:22:42 -07:00
Tianqi Chen f272e06095 Remove deprecated opengl files (#5711) 2020-06-01 17:53:33 -07:00
Samuel 663a5ab46a [PYTORCH]ReplicationPad support added (#5708) 2020-06-02 09:15:41 +09:00
Cody Yu 43162d669d [PatternLang] Simplify Pattern API Implementations (#5703)
* Add syntatic sugar; include pattern to API docs

* fix doc warnings
2020-06-02 09:14:33 +09:00
Tianqi Chen afc239aeb8 [REFACTOR][PY] relay.op.Op -> tvm.ir.Op (#5705)
* [REFACTOR][PY] relay.op.Op -> tvm.ir.Op

* Improve the error check
2020-06-01 15:35:06 -07:00
Rand Xie f280883f4c fix typo: anchor windoes should be anchor windows (#5706) 2020-06-01 08:39:36 -07:00
Samuel 55aefc22a6 [PYTORCH]floor_divide support for squeezenet (#5702)
https://github.com/apache/incubator-tvm/issues/5133#issuecomment-636330705
2020-05-31 06:25:36 +09:00
Zhi c55ed37169 [REFACTOR][RELAY] Replace build_config with PassContext (#5698) 2020-05-29 21:59:35 -07:00
Balint Cristian 879158a071 [ONNX] Skip ADD inside Gemm op when vector is zero (#5697) 2020-05-30 10:10:22 +09:00
Matthew Brookhart 2cd5117096 [PatternLang]Conditionally Embedding Constants in Partitioned Functions (#5693)
* Embed constants in the partition function if the pattern explicity requests constants

fix rst

fix pylint

* improve comments based on Cody's feedback
2020-05-30 10:07:07 +09:00
notoraptor 1ae7162f5e In memory_plan, check if value is not None, instead of just checking value as boolean. (#5700) 2020-05-29 16:35:03 -07:00
Samuel ff10e6c2fd [ONNX]LpPool Support added (#5696) 2020-05-30 06:29:43 +09:00
Zhi ddf7190846 [REFACTOR][RELAY] move fallback_device to config (#5690) 2020-05-29 07:52:03 -07:00
Samuel 2599c2cad3 [PYTORCH]Minor bug fixes (#5683)
* [PYTORCH]Minor bug fixes

* Review comment fix, testcase added

* Added testcase for bert model
2020-05-29 16:16:49 +09:00
Cody Yu 95b3ad971d [PatternLang] Add ConstantPattern (#5689)
* Add ConstantPattern

* update doc
2020-05-29 08:48:07 +09:00
Neo Chien a072da0588 [TIR][REFACTOR] std::string -> String Migration in TIR nodes (#5596)
* [TIR][REFACTOR] std::string -> String Migration for Var node and SizeVar Node

* update json_compact.py
2020-05-28 01:56:06 -07:00
Samuel 162a29e0b8 [TFLITE]Quantize & Dequantize op (#5394)
* [TFLITE]Quantize & Dequantize op

* Testcases added

* Review comment fixed
2020-05-28 11:10:58 +08:00
Junru Shao 291f4dc8bb [Bugfix] Fix Python debugger segfaults with TVM built with LLVM (#5685)
* Import readline before loading libtvm

* make lint happy
2020-05-27 13:50:56 -07:00
notoraptor 07449f5a57 Call previous excepthook in tvm_excepthook. (#5675)
* Call previous excepthook in tvm_excepthook.

* Rename prev_excepthook.

* Create a tvm_wrap_excepthook to wrap a given excepthook with tvm custom excepthook work
and call it on system previous excepthook.

* Add docstring.
2020-05-26 18:15:18 -07:00
Cody Yu 81ad18edc7 [BYOC] Pattern Language MergeComposite (#5656)
* Pattern Language MergeComposite

* fix DNNL pattern

* Use builtin binary operator syntax for demo

* Improve unit test
2020-05-27 07:04:01 +09:00
lixiaoquan 4f9d4d78a0 [TF] Support TupleWrapper as direct ancestor of control flow ops (#5639) 2020-05-26 11:29:29 -07:00
Mei Ye 03d21ff141 enable amd_apu device on vulkan target (#5659) 2020-05-26 09:30:38 -07:00
Tianqi Chen b2640260cd [REFACTOR][TIR][API-Change] Migrate BuildConfig to PassContext. (#5668)
* [REFACTOR][TIR] Migrate BuildConfig to PassContext.

This PR migrates the TIR configurations from BuildConfig to the
PassContext used by the unified IR.
Moving forward, PassContext will be the unified way to configure passes in the TVM stack.

Changes

- Refactored TVM_PASS_REGISTER_CONFIG_OPTION to take in the reference type.
- Removed BuildConfig.
- Migrated the passes to use PassContext.

* Update include/tvm/ir/attrs.h

Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>

Co-authored-by: Zhi <5145158+zhiics@users.noreply.github.com>
2020-05-25 20:50:00 -07:00
Tianqi Chen 9d1d8a90ff [PYTHON] Add buffer name when creating tensor bindings (#5670) 2020-05-25 20:19:15 -07:00
Yao Wang cc79591f5e [Relay][Op]Support symbolic TopK, Ones, Zeros and Full (#5459)
* Support symbolic TopK, Ones, Zeros and Full

* Fix pylint

* Add docstring for topk shape func

* Fix grad

* Fix lazy_gradient_init

* Fix parser

* Fix print ir text

* Fix lint

* Improve pattern_util

* Fix topk

* Fix build

* Use Optional for attribute

* Fix clang-format

* Minot fix

* Fix pylint

* Fix build warning

* Fix parser

* Move ToScalar

* Fix lint

* Fix lint

* Make topk shape func as data independent when k is constant.

* Fix lint

* Minor fix
2020-05-25 18:09:44 -07:00
Tianqi Chen 0833b07b41 [TIR][BUILD] Remove buffer params from pass config. (#5652)
Buffer configurations can be passed during construction
and does not need to be part of the build config.

This is a refactor step to simplify the BuildConfig for the PassContext migration.
2020-05-23 08:38:00 -07:00
Wuwei Lin e369c5a9cb [Relay,Topi][OP] affine_grid and grid_sample (#5657)
* [Relay,Topi][OP] affine_grid and grid_sample

* lint
2020-05-23 13:57:58 +09:00
Andrew Reusch e2d66e1688 Increase bss section size. (#5660)
* Likely broken in PR 5590.
2020-05-22 19:41:14 -07:00
Philip Hyunsu Cho 3827cd044d Upgrade XGBoost to latest (#5658) 2020-05-22 19:40:46 -07:00
ANSHUMAN TRIPATHY 9fa8341302 [REFACTOR][IR] Migrate IRModule ObjectRef to not-null (#5654) 2020-05-22 14:32:59 -07:00