Commit Graph

63 Commits

Author SHA1 Message Date
Gheorghe-Teodor Bercea 3c505ae31d
Split convolution into explicit padding and unpaded convolution. (#82)
* Split convolution into explicit padding and unpaded convolution.

* Refactor code. Add test.
2020-02-14 16:06:38 -05:00
Gheorghe-Teodor Bercea 17d84901b7
Allow 1-D convolutions. (#86)
* Fix check.

* Fix comment.
2020-02-14 10:54:08 -05:00
Tung D. Le b521719587
Lower Matmul operation to Krnl dialect (#57)
* Allocate memory for matmul's result

* Group cases

* Add support of N-D x N-D, N>=2

* Revise createIterateOperandPack

* Add 1-D x 1-D

* Add 1-D x N-D

* Add MLIR tests

* Change variable names

* Change type from int to int64_t for indices

* Change variable names

* Change int64_t back to int

* Change int64_t back to int

* Change int64_t back to int

* Use decltype

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-02-14 10:43:17 -05:00
chentong319 49dae74eab
Create constant pad (#75)
* handle pad op which does not have the optional third argment

* rewrite PadConstantValue with constant pad into PadConstantValuePad

* add test for PadConstantValuePad

* update onnx.md
2020-02-11 15:32:01 -05:00
Tung D. Le 2c7046ff5f
Lowering ReductionMax, ReductionMin, ReductionProd and ReductionSum (#31)
* Shape inference for reduction

* Lower ReduceSum

* Support list-like attributes

* Add ReduceMax, ReduceMin, ReduceProd

* Add tests

* Emit errors for unsupported types

* Typos

* Add backend test

* Fix axis computation

* Update the use of attributes

* Use SmallVector

* Address stylistic comments

* Change type from int to int64_t for indices

* Change type from int to int64_t for indices
2020-02-10 21:38:19 +08:00
Gheorghe-Teodor Bercea 0272451521
Lower convolution to KRNL dialect. (#65)
* Ensure data shape is at least 4.

* First version of convolution.

* Simplify code for KRNL lowering.

* Add test without padding or strides.

* Refactor code for lowering frontend operations to KRNL dialect.

* Add test for conv with no bias and no padding.

* Add test with group greater than one.

* Address comment.
2020-02-07 16:51:32 -05:00
chentong319 60ac8f081f
Op def output (#73)
* fix name of operator output in onnxop.inc and Operator.md

* remove Operators.md
2020-02-08 00:10:35 +08:00
Gheorghe-Teodor Bercea ae297f14ee
Revert "fix name of operator output in onnxop.inc and Operator.md (#62)" (#72)
This reverts commit c45655413d.
2020-02-06 10:52:57 -05:00
chentong319 c45655413d
fix name of operator output in onnxop.inc and Operator.md (#62)
* fix name of operator output in onnxop.inc and Operator.md

* Update directive.py

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-02-06 20:54:03 +08:00
Haruki Imai 477227a0ec
Added lowering of SignOp (#21)
* Support lowering of SignOp

* Fixed test code for signop of integer input

* Inserted Sigh and Reciprocal in SharingWork.md (Reciprocal is for past commit 7e3f96e)

* Added test for Sign Op

* Fixed minus_one -> minusOne

* Fixed test for signop
2020-02-04 22:27:17 +08:00
Tung D. Le 2b56c09454
Rewrite ReduceL1, ReduceL2, ReduceLogSum, ReduceLogSumExp, ReduceSumSquare in the ONNX dialect (#38)
* Rewrite ReduceSumSquare

* Edit gen_doc.py

* Revise the code

* Do shape inference after canonicalization so that there is no need to implement shape inference of rewritten ops

* Rewrite ReduceL2

* Add onnx_rewrite.cpp for all rewriting for ONNX ops

* Rewrite ReduceL1, ReduceLogSum, ReduceLogSumExp

* Edit comments

* Change the use of -> to .

* Checkout gen_doc.py from the master branch

* Use emplace_back instead of push_back

* Revise the code

* Edit comments

Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-01-31 19:00:39 +08:00
Alexandre Eichenberger 0d77840969
Inference maxpool (#48)
* first steps for shape inference of maxpool

* setps forward

* ongoing

* working version

* first steps for shape inference of maxpool

* setps forward

* ongoing

* working version

* fix errors introduced by github merge

* changes suggested by Doru

* updates

* requested fixes

* reqested changes

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-01-30 14:30:28 -05:00
Gheorghe-Teodor Bercea 9fb826ae7e
Lower transpose operation to KRNL dialect (#54)
* Lower transpose operation.

* Fix IndetityOp.

* Add tests.

* Add backend tests.

* Clean-up code.

* Move transpose code and improve comment.
2020-01-30 11:44:56 -05:00
chentong319 6959cf4586
clean up gen_doc.py (#59)
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-01-29 13:54:46 -05:00
Tung D. Le 400676e371
Lowering Gemm (#19)
* Initial implementation

* Support transposing inputs

* Revise unidirectional broadcasting and unknown dimensions

* Revise gemm

* Add testcase

* Rename some variables

* Update SharingWork.md

* Change from the use of Value* to Value

* Insert deallocation

* Initilize the output matrix and fix wrong computation

* Add end-to-end testcases

* Edit lowering tests

* Change attribute names

* Use emplace_push for SmallVector

* Use the new way of getting attributes

* Revise the use of attributes

* Check the bias's shape

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-01-29 11:11:49 -05:00
Tung D. Le 9e82d388f0
Add support for Unsqueeze (#50)
* Infer shape for Unsqueeze

* Lower Unsqueeze

* Revise

* Turn off backend tests

* Compute tensorSize for static shape

* Compute tensorSize with unknown dims

* Edit tests

* Update the use of attributes

* Add e2e tests

* Use SmallVector

* Remove return

* Check whether the operand is ranked or not

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-01-29 10:46:02 -05:00
Tung D. Le f3047943a1
Handle 1-D MATMUL N-D (#56) 2020-01-29 10:35:05 -05:00
Tung D. Le 195bf9d15d Add KrnlSqrtOp (#22)
* Initial lowering of KrnlSqrtOp

* Fix errors and add a testcase

* typos

* Add the MLIR example

* Restore doc/doc_check/CMakeLists.txt

* Clean the code

* Edit comments

* Remove redundant parts

* Chang the use of -> to .

* Add a test for f64

* Support ONNXSqrtOp

* Fix indentation

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-01-28 11:10:47 -05:00
Tung D. Le 7c889548a7 Allow importing variadic inputs/outputs of onnx operators (#16)
* Allow importing variadic inputs/outputs of onnx operators

* Enable testcases for variadic ops

* Modify gen_doc.py
2020-01-28 21:48:11 +08:00
Doru Bercea b450a763d1 Change variable names to use rank. Add aditional check for scalars. 2020-01-27 12:08:23 -05:00
Gheorghe-Teodor Bercea 3f5c543782
Merge branch 'master' into matmul-shape 2020-01-27 11:37:40 -05:00
chentong319 c74f814f64 Add attributes as operation parameters (#45)
* add attributes of Op into parameters

* fix rewrite rule for GemmOp with attributes

* use I64Attr instead of I32Attr and modify test cases for the changes in attributes

* add output name (prefixed with o_) to Op definition

* update shape inference for the new attributes
2020-01-27 10:09:14 -05:00
Gheorghe-Teodor Bercea 696da50d2a
Merge branch 'master' into matmul-shape 2020-01-24 15:53:02 -05:00
Yasushi Negishi 383a5c31ac Support Softplus and Softsign operations (#17)
* Support Softplus and Softsign operations

* Add the default shape inference for the transposition operation.

* Fix conflict with master

* Fix conflict with master branch

* Add test for softplus and softsign in test/backend/test.py

* Re-enable Reciprocal tests.

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-01-23 21:18:38 -07:00
Doru Bercea 07d28769d3 Merge remote-tracking branch 'origin/master' into matmul-shape 2020-01-23 11:53:53 -05:00
Doru Bercea 68efd21064 Fix dilation formula in the code. 2020-01-22 16:34:59 -05:00
Doru Bercea 1784ec2314 Fix reference error. 2020-01-22 16:09:19 -05:00
Doru Bercea 0bc07ef661 Merge remote-tracking branch 'origin/master' into matmul-shape 2020-01-22 15:29:09 -05:00
Doru Bercea 94391a3cde Add comment. 2020-01-22 15:05:56 -05:00
Doru Bercea ea45cbcca9 Add support for dilations attribute and add tests. 2020-01-22 14:40:10 -05:00
Doru Bercea de77758faf Fix kernel dimensions. 2020-01-22 10:11:36 -05:00
Doru Bercea 169236a8fc Handle SAME_LOWER and SAME_UPPER. 2020-01-22 10:11:36 -05:00
Doru Bercea ec9e023f04 Add shape inference method. 2020-01-22 10:11:36 -05:00
Doru Bercea 3fe0f2e735 Fix operand type access. 2020-01-22 10:11:36 -05:00
Doru Bercea ab8e2f9a1b Add verifier to check for required attributes. 2020-01-22 10:11:34 -05:00
Tian Jin 51b0f4c9dd
Chentong319 attribute with variant (#25)
* change the read-in of attribute, using variant

* Use backported variant.

* Reduce code duplication.

* 1. Make array attribute parsing more clear.
2. int -> int64_t.

* 1. Fix how array attributes are imported.

* 1. Fix clang-tidy warnings.

* 1. Nit: fix clang-tidy warnings.

* Fix MaxPool node construction.

* Fix call to MaxPool.

* Comment out backend tests that fail.

* Add path to variant submodule to enable include file detection.

* Allow unused argument to avoid special casing generator.

* Address attribute related e2e test failures for Hard sigmoid,Elu,LeakyRelu,Selu,Softmax

Co-authored-by: chentong319 <chentong@us.ibm.com>
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-01-21 19:36:21 -07:00
Tung D. Le e89e51699b Lowering softmax (#14)
* Rebase

* Use max normalization

* Handle axis

* Add tests

* Update SharingWork.md

* Remove redundant spaces

* Format code

* Rebase

* Change from the use of Value* to Value

* Add end-to-end tests

Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-01-20 21:57:32 -05:00
Doru Bercea 6b55bb43c7 Fix operand type access. 2020-01-20 15:48:16 -05:00
Doru Bercea bd44d8402e Add verifier function for checking negative perms. 2020-01-20 14:54:40 -05:00
Doru Bercea 9d1078540d Transpose using perm attribute. 2020-01-20 14:54:40 -05:00
Gheorghe-Teodor Bercea a87f01747a
Merge branch 'master' into matmul-shape 2020-01-15 18:03:03 -05:00
Gheorghe-Teodor Bercea d895670656
Merge branch 'master' into fix-conv 2020-01-15 17:56:57 -05:00
Gheorghe-Teodor Bercea deb7a7c4bb
Merge branch 'master' into matmul-shape 2020-01-15 17:51:13 -05:00
Gheorghe-Teodor Bercea 969459ddcb
Merge branch 'master' into fix-conv 2020-01-15 17:50:36 -05:00
Gheorghe-Teodor Bercea 514cbcb1dc
Merge branch 'master' into fix-gemm 2020-01-15 17:50:15 -05:00
Doru Bercea a1b44905e2 Add documentation for handling optional arguments. 2020-01-15 17:06:14 -05:00
Doru Bercea 3f6efdf4a4 Fix MaxPool translation to ONNX dialect. 2020-01-15 15:16:45 -05:00
Doru Bercea d2a90e2923 Remove references to FullGemm. 2020-01-15 14:27:21 -05:00
Doru Bercea a42fdd08f3 Fix Gemm translation to ONNX dialect. 2020-01-15 14:11:32 -05:00
Doru Bercea 67ec9e9009 Fix convolution translation to MLIR. 2020-01-15 13:26:50 -05:00