* Specialize the op lowering logic for elementwise operations
* Fix clang-format error.
* Update tests for LSTM since LSTM uses element-wise ops
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* Support importing tensor proto.
* Use signed types, use template.
* Resotre using signless integer types because Reshape faults with integer signs; using traits to declare/define attribute types.
* Simplify attribute importing logic.
* Use existing code to import TensorProto.
* nit.
* Specify in linking stage, where runtime shared library is located.
* Cite & make comment a full sentence.
* Fix error communicating runtime dir to ld.
* Run clang-format on all source code.
* Add Clang-Format Github Action.
* Apply patch produced by Clang-Format Bot.
* nit.
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Support dilations and enable e2e tests
* Fix allocating memory for dynamic shape
* Edit comments
* Do dilation by computing an offset from kernel index
* Correct dilation formula, add an example of out-of-bound, and add a test for dilation
* Import optional outputs as NoneType
* Shape inference for ONNXLSTM
* Edit ONNXLSTM::inferShape()
* Shape inference for ONNXLSTMOp
* Create a common function for inferring shape for RNN ops
* CheckInsertDeallocation for a specific result
* Allocate memory for LSTM
* First round of lowering
* Allocate memory for hidden and cell states
* Test with custom Tanh
* Fix an error in Ct's formula
* Add E2E tests
* Return outputs
* Refactor the code
* Enable E2E tests
* Support reverse and bidirectional directions
* Minor revision
* Return all intermediate hidden states
* Call existing activation functions
* Structs for activation functions
* Call existing activations in ONNX
* Minor revision
* Compare strings ignoring case
* Use memreftype of rank 0 for calling activation functions
* Fix getActivationPack()
* Revise the code
* Add one MLIR test
* Add MLIR tests for reverse and bidirectional modes
* Make the order of emiting instructions deterministic
* Use OperandAdaptor instead of directly use an operand index
* Use literal assignments
* Change some variable names
* Use literal assignments
* Use literal assignments
* Format the code
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Implement shape inference for SplitOp
* Change spitOpt to SplitAttribute and check the axis range before updating the axis attribute
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* target_link_libraries(OMElideKrnlGlobalConstants ...) adds duplicated
../lib/libOMKrnlOps.a ../lib/libOMONNXOps.a at end of linkage for onnx-mlir
and breaks shared library build
* Fix .buildbot/z13.sh to prepare for zLinux Jenkins build bot
Co-authored-by: Gong Su <gong_su@hotmail.com>
* Make onnx-mlir work with latest mlir.
* Bump CircleCI cache version.
* Fix missing passes in onnx-mlir-opt.
* Fix backend test failure.
* Fix doc.
* Fix doc and exclude the generated _site directory from DocCheck.
* Remove debug code.
* Do not hard code target name, on Mac shared lib can end with .dylib.
* FunctionPass -> PassWrapper.
* Reorganize main function.
* Follow review comments.
* Emit constants are globals in Krnl and LLVM dialects.
* Output of non-value constants. Write full source to file.
* Fix e2e tests.
* Output constant free and full code in separate files.
* Emit separate files.
* Move file output management to utils.
* Elide the values of glotbal krnl constants.
* Add dual file output for Basic flag.
* Add tests.
* Add passes to cmake file.
* Move to more recent LLVM commit ID
* Update LLVM cache version from V9 to V10
* Update to latest LLVM commit id from master, roll back conditions in util scripts
* Update circlci LLVM cache tag to ensure ci updates builds with latest LLVM commit id
* Update README.md to have matching LLVM commit id
* Update doc/Dialtects/onnx.md
* Enable onnx-mlir for VS builds on Windows
* Update README to include lit
* Update build command for Windows to include config
* Update build instructions, add cmd files for windows, enable single source of truth for MLIR commit-id (clone-mlir.sh)
* Add Visual Studio workload info
* Update ONNX op definitions
* Revert onnx submodule back to previous commit, disable warnings in CMakeLists to work around build issues with MSVC
* Update environment for path to PDcurses on Windows
* Fix directory strings to be compatible with Windows or Linux style slashes
* Fix install-mlir.sh so it works when sourced
* Ensure README and cmd files match and have correct paths
* Properly quote ONNX_MLIR_SRC_DIR
* Address PR feedback: Use llvm_unreachable to indicate failure to convert attribute proto to name/value pair
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* Create a template for pooling and add support for AveragePool
* Edit MLIR tests for MaxPool according to the new lowering template for pooling
* Dealloc temporary variables
* Support count_include_pad for AveragePool
* Add MLIR tests for AveragePool lowering
* Make changes according to Tian's comments
* Push AffineMap as upper bound for KrnlIterateOp
* Test AffineMap to use in Pooling
* Replace the old implementaion by a new one using AffineMap
* Fix the computation when dilations are non-unit
* Clean up the old code
* Remove AveragePool from Canonicalization pass
* Fix computing the end indices of a filter window
* Refactor the code for pooling
* Revise pushAffineMapBound
* Add MLIR tests
* Remove unused functions
* Fix check-onnx-backend build on x86 Linux. (#91)
* Add the split marker to test files (#90)
Co-authored-by: Tian Jin <tjingrant@gmail.com>
Co-authored-by: gongsu832 <gong_su@hotmail.com>
Co-authored-by: Tian Jin <tjingrant@gmail.com>
* Specify each lib only once; allow llvm build in shared libs mode.
* Remove debug code.
* For library targets, retain dependency information using add_dependencies, but do not link using taget_link_libraries.
* Do not set LD_PRELOAD by default.
Co-authored-by: Gong Su <gongsu@us.ibm.com>
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* implement shape inference for concat
* better checking of axis being concatenated: constant values only
* lowering of Concat with lit and backend tests
* fixes
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Bug fix, ensure krnl.iterate can lower in the degenerate case.
* Fix parser issue with degenerate iterate op.
* Add a test case.
* Remove dead code.
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Setup documentation server, move doc files from /doc to /docs as per Github Pages convention.
* Include deleted files in patch.
* /doc -> /docs
* /doc -> /docs
* Update documentation on importing ONNX spec into ONNX Dialect; provide documentation on how to add new documentation pages.
* Generate ONNX Dialect TableGen Inc files & operation importing inc files when necessary.
* Ensure TableGen inc file is generated before TableGen is invoked.
* Nit: capitalize builder -> Builder.
* Use file-same-as-stdout directive to ensure generated files are always up-to-date in our codebase.
* Use more up-to-date version of ONNXOps.td.inc.
* Do not automatically invoke gen_doc.py.
* Support dry run in gen_doc.py.
* Fix case.
* Remove debug code.
* Add test for new doc_check primitive.
* Add documentation for file-same-as-stdout.
* Provide more comments.
* Add DocCheck to DocCheck README.
* Nit: format CMake script.
* Update comments.
Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
* Move to more recent LLVM commit ID
* Update LLVM cache version from V9 to V10
* Update to latest LLVM commit id from master, roll back conditions in util scripts
* Update circlci LLVM cache tag to ensure ci updates builds with latest LLVM commit id
* Update README.md to have matching LLVM commit id
* Update doc/Dialtects/onnx.md
* 1.Break down CMake scripts to smaller libraries per-directory.
2. Move some transformations and interfaces to the right folder.
3. Fix minor merge failure of the patch renaming files to use LLVM convention.
* Link OMBuilder with OMONNXOps.
* 1. Update the src location of generated ONNX dialect definition.
2. Link OMONNXRewrite with OMONNXOps.
* Fix path to tablegen for add_onnx_mlir_dialect_doc.
* Update build script for onnx_mlir_transform.
* 1. Remove comment code.
2. onnx_mlir_attribute_promotion -> OMAttributePromotion.
* Name tablegen generated files with LLVM convention.
* Nit: reorder libraries to link against.
* Nit: Link against MLIR first.
* Support attribute promotion.
* Simplify op interface name.
* 1. Add more comments to Attribute Promotion Pass.
2. Move Promotable Const Operand Interface to src/interface, and link against it.
* Complete NFC change onnx -> onnx-mlir.
* Move attribute_promotion pass to src/transform.
* Nit: reword comment.
* Support Attribute Promotion in gen_doc.py.
* Add test.
* Update ONNX doc.
* Add negative test.
* Rename onnxop.inc -> onnx_ops.td.inc.
* Include onnx_ops.td.inc.
* Nit: better comments.
* Prettify CMake.
* Remove original attribute_promotion code, improve comments.
* Append '_op_interface' to op interface decl/defs.
* Namespace cmake targets using onnx_mlir_ prefix.
* Use updated header name.
* Use new body file name.
* Fix dependency.
* Use new CMake target name.
* Make attribute promotion self-contained by removing redundant constant operaions inside the pass execution.
* Remove canonicalization pass.
* Increase comments.
* Use stricter checks.
* Add one more test case.
* Remove %arg1 as it's never used.
* Support dilations and enable e2e tests
* Fix allocating memory for dynamic shape
* Edit comments
* Do dilation by computing an offset from kernel index
* Correct dilation formula, add an example of out-of-bound, and add a test for dilation
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Fix reshape when a dynamic shape is given.
* Fix default attributes for ConvNoBias.
* Fix comment.
* Resolve comment.
* Improve checks.
* Handle zero dim case.
* Add helper to fetch constants. Add test for dynamic reshape.
* Add test for zero.
* Use shortcut method for size.
* Support Pads for MaxPoolSingleOut
* Regenerate onnx.md to include the new op
* Edit comments
* Undo redundant parts that were unintentionally changed
* Move declarative rewriting rules into canonicalize to avoid creating a new op
* Reformat the rewriting rule pattern of MaxPoolSingleOut
* Put ONNXPadConstantValuePadOp's build method into a .cpp file instead of a tablegen file
* Use the same helper function as the one in inferShape for the ONNXPadConstantValuePadOp's build method
* Change function names and fix padding for the spatial dimensions
* Call shape-inference again after canonicalization to infer shape for newly added ops during canonicalization.
* Fix typos
* emitConstantOp with a given type
* Helper functions to create infinity constants
* Use new constant helper functions for MaxPoolSingleOut
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* Lower MaxPoolSingleOutOp to Krnl dialect
* Edit comments
* Update changes according to the new folder structure
* Add MLIR tests
* Support ceil_mode
* Merge the first two krnl loops into one krnl loop; remove attribute checks
* Dynamically allocate memory for the result if the result has unknown dimensions
Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
* 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>
* 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
* 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.
* 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>
* 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>
* 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>
* 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
* 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>
* 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>
* 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
* 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.
* 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
* 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.