Commit Graph

470 Commits

Author SHA1 Message Date
Tung D. Le 5357fc1421
Use SqrtOp in Standard dialect (#108)
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-26 12:03:24 -05:00
Tung D. Le 0c4a010283
Remove rank constraints in gemm fusion (#101)
* Remove rank constraints in gemm fusion

* Add an MLIR test

Co-authored-by: Tian Jin <tjingrant@gmail.com>
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-26 11:40:52 -05:00
Tung D. Le 24d89625e3
Remove redundant lower_frontend_to_krnl since we reorganized it (#99)
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-02-26 16:32:06 +08:00
chentong319 04d9e2f341
Merge pull request #84 from chentong319/shapeinference-pad
Shape inference for pad with constant pads
2020-02-25 19:32:34 -05:00
chentong 4edc97f3de Merge branch 'shapeinference-pad' of github.com:chentong319/ONNF into shapeinference-pad 2020-02-25 17:46:44 -05:00
chentong 3abbf1c0e9 put the common code into a helper function 2020-02-25 17:43:49 -05:00
chentong 4079ee1f26 Merge remote-tracking branch 'upstream/master' into shapeinference-pad 2020-02-25 15:54:18 -05:00
Alexandre Eichenberger 3a88361b17
use input/output operation names, use helper for attribute function and int values (#106) 2020-02-25 15:46:11 -05:00
Alexandre Eichenberger 3b1c29c078
Using attribute setters for maxpool (#105)
* using attribute setters for maxpool

* fix typos, added handling of storage order, simplified code
2020-02-25 14:33:48 -05:00
Tian Jin e02aa87748
Update gitignore file to ignore Filesystem artifacts and python related temporary files. (#103)
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-25 11:18:37 -05:00
Gheorghe-Teodor Bercea 907104d7e8
Merge branch 'master' into shapeinference-pad 2020-02-25 11:14:28 -05:00
Gheorghe-Teodor Bercea ee3e140ddb
[NFC] Change structure of conversion folder. (#96)
* Change structure of conversion folder.

* Fix comments.

Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-02-25 10:38:08 -05:00
Gheorghe-Teodor Bercea 32f08bcf0c
Clean-up code. (#98) 2020-02-25 09:54:29 -05:00
Gheorghe-Teodor Bercea 0d307d1183
Set flag to true when definition is emitted. (#97) 2020-02-25 09:47:42 -05:00
Tung D. Le a720f9a7b2
Remove special GemmNoBias since we can handle it using NoneType bias (#100)
* Remove special GemmNoBias since we can handle it using NoneType bias

* Remove GemmNoBias from onnx.md

Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-02-25 13:20:43 +08:00
Tian Jin 732317cd5a
Transition to ONNX-1.6.0. (#95)
* Transition to ONNX-1.6.0.

* Use the version of ONNX inside ONNF when running backend tests.

* Install quietly and with sudo previledge.
2020-02-25 13:04:15 +08:00
Gheorghe-Teodor Bercea 1ad7989fc5
Merge branch 'master' into shapeinference-pad 2020-02-24 17:22:00 -05:00
Alexandre Eichenberger fcb5f35993
Introduce helper class to generate KRNL code and apply it to Convolution (#93)
* helper to gen krnl code, applied to conv

* suggested changes, name, removed set insertion point

* format

* suggested changes

* added comments and made a small name change
2020-02-24 17:20:15 -05:00
Gheorghe-Teodor Bercea d4f8fef947
Merge branch 'master' into shapeinference-pad 2020-02-24 16:13:21 -05:00
Tian Jin 9c398c0121
Support Optional Inputs (#94)
* 1. Combine variadicIn/Out with expectedNumOperands/Results to simplify import function arguments.
2. Generic improvements to code readability in gen_doc.py.

* Update ONNX Dialect doc.

* Remove redundant code in ImportNode.

* Prettify op_build_table.inc.

* 1. Remove irrelevant code in gen_doc.py

* Refactor code to be more readable.

* Further refactoring for readability improvements.

* Allow gemm to have an optional operand (bias term), and include an example of declarative optimization pattern targeting gemm with bias term ommitted.

* Make shape inference/lowering of gemm op compatible with optional operand declaration.

* Apply canonicalization again after lowering from onnx -> std dialects.

* Make hasBias compatible with the situation of GemmNoBias op.

* Update doc.

* Add a canonicalization test.

* Remove special handler for importing Gemm op, as it's redundant now.
2020-02-24 23:46:48 +08:00
chentong b3df3c64b5 Merge branch 'master' of github.com:clang-ykt/ONNF into shapeinference-pad 2020-02-24 09:26:45 -05:00
chentong319 5ab7fe37c4
Merge branch 'master' into shapeinference-pad 2020-02-21 09:36:41 -05:00
chentong 2281cc060f Merge branch 'master' of github.com:clang-ykt/ONNF into shapeinference-pad
Conflicts:
	src/pass/shape_inference_pass.cpp
2020-02-21 09:30:40 -05:00
Tung D. Le 479dd5e35a
Add result type inference to op definition (#87)
* Add result type inference to op definition

* Edit MLIR tests

* Fix result type for Mul

* Format comments

* Return UnrankedTensorType as result type

* Just for testing -split-input-file

* Undo: Just for testing -split-input-file

* Extract a function, get_operand_ins, that gets operand types; rewrite gen_attr_ins function

* Generate custom builders

* Call existing build methods

* Add comments

* Minor changes

* Generate build methods with attributes

* Add support of variadic type

* Do not generate custom build methods for ops having only attributes

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-21 22:28:24 +08:00
Tung D. Le aea6479ad3
Lower BatchNormalization (test mode) to Krnl dialect (#70)
* Add ONNXBatchNormalizationTestModeOp and its shape inference

* Lower batchnormalization test mode

* re-use scale, bias, mean, and variance

* Add MLIR tests

* Add e2e tests

* fix typos

* Fix a bug in MLIR tests

* Change type from int to int64_t for indices

* Uncomment e2e tests due to segmentation fault

* Uncomment e2e tests due to segmentation fault

* Revise the code

* [Tian] Fix segmentation fault in e2e tests

* Re-generate onnx.md to include BatchNormalizationTestModeOp

* Reverse an unintentional change

* Fix some typos in comments

* Use convertToMemRefType from the master branch

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-20 11:45:40 -05:00
Tung D. Le f1d20e368f
Add support of GemmNoBias (#91)
* Add support of GemmNoBias

* Fix a wrong indentation
2020-02-20 10:55:24 -05:00
Tung D. Le a3f042220e
Get MemRefType for result types (#69)
* Get memreftype for result types

* Revise

* Replace convertToMemRefType

* Use convertToMemRefType in ONNXConvNoBiasOpLowering

* Merge with the master branch

* Reverse an unintentional change

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-20 21:44:01 +08:00
Gheorghe-Teodor Bercea b28c6906b4
Fix building ONNF with latest LLVM/MLIR (#89)
* Fix build and link errors.

* Fix end to end tests.

* Fix indentation.

* Fix type conversion.

* Use newest LLVM version.

* Use newest LLVM version.
2020-02-19 18:15:02 -05:00
Gheorghe-Teodor Bercea da037ffc7d
Merge branch 'master' into shapeinference-pad 2020-02-19 13:46:00 -05:00
Tung D. Le b9f2f25b56
[NFC] Categorize ONNX ops lowering (#80)
* Create two categories: elementwise and tensor

* typos

* Create directories for categories

* Edit comments

* Extract a function that creates a KrnlIterateOp

* Add comments

* Extract some common parts

* Revise softmax

* Add reduction.inc

* Move lower-frontend to lib/conversion

* Move  directory to  directory

* Change file/directory names

* Comment format

* Add matmul.inc
2020-02-19 15:17:48 +08:00
chentong c11f97f1b5 fix test case for changes in Op definition 2020-02-17 09:07:58 -05:00
chentong ec43fadc3b Merge remote-tracking branch 'upstream/master' into shapeinference-pad 2020-02-17 08:27:43 -05:00
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
chentong bbdf4e3b4d Merge remote-tracking branch 'upstream/master' into shapeinference-pad
Conflicts:
	test/mlir/onnx/onnx_shape_inference.mlir
2020-02-14 15:35:47 -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
chentong 960de50b7d Merge branch 'master' of github.com:clang-ykt/ONNF into shapeinference-pad 2020-02-13 20:00:17 -05:00
chentong c3041bfb43 shape inference for pad with constant pads 2020-02-13 19:56:05 -05:00
Gheorghe-Teodor Bercea dab862e4f1
Update README.md 2020-02-13 15:52:53 -05:00
Gheorghe-Teodor Bercea ecf16c3441
Update README.md 2020-02-13 15:51:39 -05:00
Gheorghe-Teodor Bercea 8b9fb2f49f
Update README.md 2020-02-13 13:46:39 -05:00
Gheorghe-Teodor Bercea 7d5c33448e
Update README.md 2020-02-13 13:43:52 -05:00
Gheorghe-Teodor Bercea 5587870da4
Update README.md 2020-02-13 13:43:19 -05:00
Tian Jin 937bbec265
Fix scalar entry point parameter lowering issue. (#78)
* Fix scalar entry point parameter lowering issue.

* Enable scalar bias test.

* Nit. Improve comments and remove debug code.

* Make helper function static, move to upfront position.

* Move helper function to top of the file.

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-13 13:50:05 +08:00
Tung D. Le e5677bba1f
Add e2e tests related to Reduction Ops (#79) 2020-02-12 16:40:32 +08: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
Gheorghe-Teodor Bercea 094be4f37a
Add support for strides when emitting convolution loop nest. (#76)
* Add support for strides when emitting convolution loop nest.

* Only emit stride multiplication if strides is greater than one.

* Add test.
2020-02-11 11:53:13 -05:00
Tung D. Le adad9e24bd
Add support of negative dimensions (#66)
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
2020-02-11 10:37:47 -05:00
Tian Jin 181803ebf4
Using Tablegen to Generate Op Documentation (#74)
* Add dialect documentation.

* Add a step in our CI to ensure documentation is up-to-date.

* Add dialect documentation.

* Fix config file mistake, using multi-line commands.

* Fix a bug in DocCheck.
2020-02-10 14:18:54 -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