* Add shape inference and names
- Add shape inference for PRelu
- Fix shape inference for group conv
for ConvTranspose
- Add input and output names for
graphs (functions)
- Add support for (u)int8 tensor
attributes
* Fix format issues
* Revert formatting for gen_onnx_mlir.py
* Pads can have ArrayAttr and DenseElementsAttr so support both
* NumInputs is the number of graph inputs that don't have initializers
* Add test for 2D batchnorm
* Fix typo in define_loops in new 2d BN test
* Change 'name' to 'onnx_node_name'
* Fix Batchnorm for 2D I/O and add lowering test
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Rewriting rule
* Fix formulas
* Reuse op results
* Const propagation for Div and Sqrt
* Explicitly use ONNXConstantOp
* Minor revise
* Const propagation for unsqueeze
* Do const propagationnce all tensors have inferred shapes
* LIT tests for fusion
* Add LIT tests for constant propagation on Div, Sqrt, and Unsqueeze
* Missing dash
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* move scalerop to decompose
* change clang format
* change clang format
* add shape inference for scaler op
* fixing generated onnxop
* generate onnx.md
* redo get onnx.md and onnxop.td.inc using onnx 1.6
* Add shape inference for scaler op
* add benefit for scaler decompose and simplify scaler shape inference
* add scaler decompose benefit num and simplify shape inference
* add cast builder
* cast rewrite only for float
* add cast op same type rewrite rule
* working on cast lowering
* cast lowering working
* add cast lowering
* fix format
* Delete OpBuildTable.inc
* complete requested changes
Co-authored-by: chentong319 <chentong@us.ibm.com>
* Add shape inference for Ops used by BERT
* Erf
* Pow
* ReduceMean
* Dropout
* Expand
https://github.com/onnx/onnx/blob/master/docs/Operators.md#expand
Deduce the value of the shape operand by looking at the producer
of the operand.
Currently supported producers are: onnx.Constant and onnx.Shape.
* Add corresponding tests for each op.
* Sort the list of ops with shape inference in gen_onnx_mlir.py
in alphabetic order for clarity.
* Restart CI
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* base implementation
* add example
* change table gen
* docs
* small change for review
Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* move scalerop to decompose
* change clang format
* change clang format
* add shape inference for scaler op
* fixing generated onnxop
* generate onnx.md
* add benefit for scaler decompose and simplify scaler shape inference
* cast rewrite only for float
* add cast op same type rewrite rule
* fix format
Co-authored-by: chentong319 <chentong@us.ibm.com>
* move scalerop to decompose
* change clang format
* change clang format
* add shape inference for scaler op
* fixing generated onnxop
* generate onnx.md
* Add shape inference for scaler op
* add benefit for scaler decompose and simplify scaler shape inference
* changes for mypipeline.onnx
* format
* rm MLOpBuildTable.inc
* copy string without free
* fix the memory issue
* restore change for STRING
* format
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* Lower Squeeze op to Krnl dialect
* Emit tensor size as a single constant; add a lit test for unknown dimensions
* Code style
* Speical case where the input is only used by this squeeze op
* Remove squeeze-in-place optimization
* Update ConvertONNXToKrnl.cpp
Twek to re-run tests.
* Trigger buildbot re-run.
* Re-run CI
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* string type from tensorflow
* simplify type
* parser and print
* gen StringType for tablegen
* onnx to onnx-mlir type
* add namespace
* allow all integer type
* dialect document
* add test case
* format
* more precise type for ONNXOp
* format
* enable the failed test
* update comment
* update onnx.md
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* support map and seq in tablegen
* register MLONNX for testing
* format
* remove the unwanted test
* add a test
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* 1. Add shape inference for the following ops:
- Atan
- Tan
- Sin
- Cast
- ConvTranspose
- Flatten
- DynamicQuantizeLinear
- QuantizeLinear
- DequantizeLinear
- ConvInteger
2. Import attributes for generic nodes
3. Fixes for cases where .cast<> should be .isa<> (ONNXConcat::inferShapes)
* Fix foormatting issues
* Address comments:
- SmallVector<> * -> SmallVectorImpl<> &
- switch-case -> helper function
- Inside helper function, preserve signed-ness
- add TODOs
* Can't use signed integers yet in convertONNXTypeToMLIRType, add TODO
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* initial const prop attempt
* added support for broadcast ops
* adde all binary broadcast ops into custom builders with precise type
* added test example
* working
* format
* fixed suggestion by Tung, start woring on unary
* added subtraction and neg the right way, and added elementwise mul too
* formatting changes
* format
* format
* added instructions to add new optimizations
* Add type inference for CastOp
* Share type translation between op builder and onnx importer
* clang-format
* Format emitted code
* Remove unnecessary dependencies
* fix type inference for ConstantOp and MaxPoolSingleOut
* modify interface
* use OpInterface
* change name to OpInterface
* Builder dependence
* Update CMakeLists.txt
* Update CMakeLists.txt
Co-authored-by: Tian Jin <tjingrant@gmail.com>