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.
* 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
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.
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
* [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>
* [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>
* 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>
* 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.
* [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>
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.