Commit Graph

1507 Commits

Author SHA1 Message Date
Samuel e2fb5039a2 [TOPI][RELAY][PYTORCH]Conv3d_transpose op support added (#5737)
* [TOPI][RELAY][PYTORCH]Conv3d_transpose op support added

* Test cases in topi/relay

* conv3d_transpose_ncdhw_python added

* Review comments fixed
2020-06-11 18:12:35 +09: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
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
xqdan 0ea99698f4 [ARITH][BACKPORT-0.6] fix a min/max simplify bug (#5749)
* fix a min/max simplify bug

* fix cpplint

* turn into oposite when c1val<0 and add more case

* fix c1=0

Co-authored-by: xqdan <danxiaoqiang@huawei.com>
2020-06-09 08:34:27 -07:00
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
abergeron de54754480 Fix the values for test_fmod since it fails way too often otherwise (#5723) 2020-06-05 14:17:41 -07:00
Thomas Viehmann e1b11712ac ROCm: Add warp shuffles and enable reductions (#5727)
Thank you @masahi and @wpan11nv for the feedback
2020-06-05 18:49:37 +09:00
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
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
Samuel c1f3b2f496 [MXNET]Softmin, trunc op support added (#5715) 2020-06-03 17:29:38 +09: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
Zhi c55ed37169 [REFACTOR][RELAY] Replace build_config with PassContext (#5698) 2020-05-29 21:59:35 -07:00
Cody Yu 910edef099 [BYOC] Support Tuple Output in C/DNNL Codegen (#5701)
* Support tuple output runtime

* fix unit test
2020-05-30 11:11:24 +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
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
lhutton1 3698d5d004 [RELAY] Fix segfault in pretty print when ObjectRef is null (#5681)
* [RELAY] Fix segfault in pretty print when ObjectRef is null

Encountered when pretty printing module with function attribute equal to NullValue<ObjectRef>().

Change-Id: I2e7b304859f03038730ba9c3b9db41ebd3e1fbb5

* Add test case

Change-Id: I579b20da3f5d49054823392be80aaf78a055f596
2020-05-29 07:51:30 -07:00
lixiaoquan 05b1b235bf [Relay] Fix dataflow_pattern.rewrite() hang if Match in IR (#5680)
rewrite() quits only if graph stop changing, but ExprMutator
  always creates new Match node. This patch fixes this.
2020-05-29 19:37:05 +09: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
Samuel 162a29e0b8 [TFLITE]Quantize & Dequantize op (#5394)
* [TFLITE]Quantize & Dequantize op

* Testcases added

* Review comment fixed
2020-05-28 11:10:58 +08:00
Matthew Brookhart af162c4826 add a testcase for #5674 (#5677) 2020-05-26 18:14:58 -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
Matthew Brookhart 37b84cc34b [POC][PatternLang]Remove constants from partitioned functions (#5663)
* remove constants from partitioned functions

* remove print statements
2020-05-27 02:26:31 +09: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
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
Wei Pan 7b74a8672e [TOPI] Improve CUDA softmax scheduling (#5600)
- Do not use multiple kernels

- Schedule with warp reductions

- Fixed a bug on the lower warp memory pass

- Fixed warp shuffle intrinsics for the nvptx backend.

Signed-off-by: Wei Pan <weip@nvidia.com>
2020-05-25 09:44:57 -07:00
Shizhi Tang 4c976a6acc handle likely in IRMutatorWithAnalyzer (#5665) 2020-05-25 09:39:33 -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
Matthew Brookhart 53251c87b2 [PatternLang] Convert PatternGrouper to do pre-order, non-recursive analysis (#5653)
* make the PatternGrouper iterate over the input Expr in a non-recursive pre-order fasion

* add a comment
2020-05-23 12:17:39 +09:00
Wuwei Lin e55f9ff115 [Relay, Topi][OP] Correlation (#5628)
* [Relay,Topi] Correlation

* fix

* move

* typo

* Update test_topi_correlation.py
2020-05-22 15:00:33 +09:00
Matthew Brookhart 4bde554109 Add a check Callback to the Pattern Paritioner (#5646)
* add a check callback to the paritioner

* fix doc string

* fix unit test spelling

* add a test with types
2020-05-22 13:35:35 +09:00
mbaret 0884659eb8 [RELAY][BYOC] Preserve type information in Merge Composite (#5640)
Keep the type information when extracting patterns
so that it can be used as part of 'check' functions.

Change-Id: I16cc70c3d013a794d2ceefb5bec815129c7b8825
2020-05-22 11:24:23 +09:00
Junru Shao b4d4193aae [Runtime] Introduce runtime::Array (#5585)
* Introduce runtime::Array

* Sync with dmlc-core

* Tests added: size, capacity, empty, front, back, push_back, pop_back, insert * 2, erase * 2, resize, reserve, clear
2020-05-21 16:27:14 -07:00
Samuel d090b8e20e [PYTORCH]Padding support (#5638) 2020-05-22 05:44:17 +09:00
Matthew Brookhart cafb49846d Extend AttrPattern to support CallNode and FunctionNode attributes (#5637)
* Extend AttrPattern to support CallNode and FunctionNode attributes

* Update tutorial and add breaks

* add func attr test
2020-05-21 12:16:40 +09:00
Samuel e10ea86fd7 [RELAY][PYTORCH]Resize3d, Upsample3d op support (#5633) 2020-05-21 09:35:28 +09:00
Matthew Brookhart c94e6ba4b3 Label Pattern Partitions (#5627)
* Label Pattern Partitions with a default label to prevent nested partitions and an optional user supplied-label

* Add node names in topological order to Partitioned attribute

* respond to review comments

* move partition tag into const in attr namespace
2020-05-21 09:28:43 +09:00