summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/AffineOps
Commit message (Collapse)AuthorAgeFilesLines
* Make helper functions static or move them into anonymous namespaces. NFC.Benjamin Kramer2020-01-141-5/+7
|
* [mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is ↵River Riddle2020-01-111-50/+49
| | | | | | | | | | properly value-typed. Summary: These were temporary methods used to simplify the transition. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72548
* NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.River Riddle2019-12-231-63/+61
| | | | | | ValuePtr was a temporary typedef during the transition to a value-typed Value. PiperOrigin-RevId: 286945714
* Resubmit: ReImplement the Value classes as value-typed objects wrapping an ↵River Riddle2019-12-231-3/+3
| | | | | | | | internal pointer storage. This will enable future commits to reimplement the internal implementation of OpResult without needing to change all of the existing users. This is part of a chain of commits optimizing the size of operation results. PiperOrigin-RevId: 286930047
* Automated rollback of commit f603a50109107b447b835dac11f0eb541288393eMLIR Team2019-12-231-3/+3
| | | | PiperOrigin-RevId: 286924059
* ReImplement the Value classes as value-typed objects wrapping an internal ↵River Riddle2019-12-231-3/+3
| | | | | | | | pointer storage. This will enable future commits to reimplement the internal implementation of OpResult without needing to change all of the existing users. This is part of a chain of commits optimizing the size of operation results. PiperOrigin-RevId: 286919966
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-232-26/+8
| | | | PiperOrigin-RevId: 286906740
* NFC: Introduce new ValuePtr/ValueRef typedefs to simplify the transition to ↵River Riddle2019-12-221-73/+74
| | | | | | | | | | Value being value-typed. This is an initial step to refactoring the representation of OpResult as proposed in: https://groups.google.com/a/tensorflow.org/g/mlir/c/XXzzKhqqF_0/m/v6bKb08WCgAJ This change will make it much simpler to incrementally transition all of the existing code to use value-typed semantics. PiperOrigin-RevId: 286844725
* fix isValidDim for block arg caseUday Bondhugula2019-12-201-7/+7
| | | | | | | | | | | | | - a block argument associated with an arbitrary op can't be a valid dimensional identifier; it has to be the block argument of either a function op or an affine.for. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#331 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/331 from bondhugula:valid_dim 3273b4fcbaa31fb7b6671d93c9e42a6b2a6a4e4c PiperOrigin-RevId: 286593693
* Introduce prefetch op: affine -> std -> llvm intrinsicUday Bondhugula2019-12-181-0/+116
| | | | | | | | | | | | | | | | | | | Introduce affine.prefetch: op to prefetch using a multi-dimensional subscript on a memref; similar to affine.load but has no effect on semantics, but only on performance. Provide lowering through std.prefetch, llvm.prefetch and map to llvm's prefetch instrinsic. All attributes reflected through the lowering - locality hint, rw, and instr/data cache. affine.prefetch %0[%i, %j + 5], false, 3, true : memref<400x400xi32> Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#225 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/225 from bondhugula:prefetch 4c3b4e93bc64d9a5719504e6d6e1657818a2ead0 PiperOrigin-RevId: 286212997
* NFC: Remove unnecessary 'llvm::' prefix from uses of llvm symbols declared ↵River Riddle2019-12-181-8/+7
| | | | | | | | in `mlir` namespace. Aside from being cleaner, this also makes the codebase more consistent. PiperOrigin-RevId: 286206974
* Refactor various canonicalization patterns as in-place folds.River Riddle2019-12-131-154/+124
| | | | | | This is more efficient, and allows for these to fire in more situations: e.g. createOrFold, DialectConversion, etc. PiperOrigin-RevId: 285476837
* Try to fold operations in DialectConversion when trying to legalize.River Riddle2019-12-131-0/+8
| | | | | | This change allows for DialectConversion to attempt folding as a mechanism to legalize illegal operations. This also expands folding support in OpBuilder::createOrFold to generate new constants when folding, and also enables it to work in the context of a PatternRewriter. PiperOrigin-RevId: 285448440
* NFC: Cleanup the various Op::print methods.River Riddle2019-12-121-11/+5
| | | | | | This cleans up the implementation of the various operation print methods. This is done via a combination of code cleanup, adding new streaming methods to the printer(e.g. operand ranges), etc. PiperOrigin-RevId: 285285181
* Update the builder API to take ValueRange instead of ArrayRef<Value *>River Riddle2019-12-071-18/+16
| | | | | | This allows for users to provide operand_range and result_range in builder.create<> calls, instead of requiring an explicit copy into a separate data structure like SmallVector/std::vector. PiperOrigin-RevId: 284360710
* Add a new ValueRange class.River Riddle2019-12-061-16/+7
| | | | | | | | This class represents a generic abstraction over the different ways to represent a range of Values: ArrayRef<Value *>, operand_range, result_range. This class will allow for removing the many instances of explicit SmallVector<Value *, N> construction. It has the same memory cost as ArrayRef, and only suffers cost from indexing(if+elsing the different underlying representations). This change only updates a few of the existing usages, with more to be changed in followups; e.g. 'build' API. PiperOrigin-RevId: 284307996
* NFC - update doc, comments, vim syntax fileUday Bondhugula2019-12-061-1/+8
| | | | | | | | | | | - for the symbol rules, the code was updated but the doc wasn't. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#284 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/284 from bondhugula:doc 9aad8b8a715559f7ce61265f3da3f8a3c11b45ea PiperOrigin-RevId: 284283712
* Relax restriction on affine_apply dim and symbol operandsNicolas Vasilache2019-11-261-5/+0
| | | | | | | | | | | | | | | | | | The affine_apply operation is currently "doubly" affine and conflates two things: 1. it applies an affine map to a list of values of type `index` that are defined as either dim or symbol 2. it restricts (and propagates constraints on) the provenance of dims and symbols to a small subset of ops for which more restrictive polyhedral constraints apply. Point 2. is related to the ability to form so-called static control parts and is related to dependence analysis and legality of transformations. Point 1. however is completely independent, the only local implication of dims and symbol for affine_apply is that dims compose while symbols concatenate as well as the structural constraint that dims may not be multiplied. The properties of composition and canonicalization in affine_apply are more generally useful. This CL relaxes the verifier on affine_apply so it can be used more generally. The relevant affine.for/if/load/store op verifiers already implement the dim and symbol checking. See this thread for the related discussion: https://groups.google.com/a/tensorflow.org/g/mlir/c/HkwCbV8D9N0/m/8srUNrX6CAAJ PiperOrigin-RevId: 282562517
* Make isValidSymbol more powerfulUday Bondhugula2019-11-221-10/+42
| | | | | | | | | | | | | | | | | The check in isValidSymbol, as far as a DimOp result went, checked if the dim op was on a top-level memref. However, any alloc'ed, view, or subview memref would be fine as long as the corresponding dimension of that memref is either a static one or was in turn created using a valid symbol in the case of dynamic dimensions. Reported-by: Jose Gomez Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#252 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/252 from bondhugula:symbol 7b57dc394df9375e651f497231c6e4525a32a662 PiperOrigin-RevId: 282097114
* Adds affine.min operation which returns the minimum value from a ↵Andy Davis2019-11-121-0/+75
| | | | | | multi-result affine map. This operation is useful for things like computing the dynamic value of affine loop bounds, and is trivial to constant fold. PiperOrigin-RevId: 279959714
* NFC: Rename parseOptionalAttributeDict -> parseOptionalAttrDict to match the ↵River Riddle2019-11-051-5/+5
| | | | | | name of the print method. PiperOrigin-RevId: 278696668
* Add a utility accessor 'has_single_element' for ranges.River Riddle2019-10-301-2/+1
| | | | | | This provides an easy way to check if a range has a single element. PiperOrigin-RevId: 277544647
* Use new eraseOp instead of replaceOp with empty valuesGeoffrey Martin-Noble2019-10-191-1/+1
| | | | PiperOrigin-RevId: 275631166
* NFC: Remove trivial builder get methods.River Riddle2019-10-171-15/+13
| | | | | | These don't add any value, and some are even more restrictive than the respective static 'get' method. PiperOrigin-RevId: 275391240
* Fix CMake configuration after introduction of LICM and LoopLikeInterfaceMehdi Amini2019-10-161-1/+5
| | | | | | | b843cc5d5a introduced a new op LICM transformation and a LoopLike interface, but missed the CMake aspects of it. This should fix the build. PiperOrigin-RevId: 275038533
* Implement simple loop-invariant-code-motion based on dialect interfaces.Stephan Herhut2019-10-161-1/+28
| | | | PiperOrigin-RevId: 275004258
* Fix typos, NFC.Christian Sigg2019-10-041-1/+1
| | | | PiperOrigin-RevId: 272851237
* NFC - clean up op accessor usage, std.load/store op verify, other stale infoUday Bondhugula2019-09-271-17/+17
| | | | | | | | | | | - also remove stale terminology/references in docs Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#148 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/148 from bondhugula:cleanup e846b641a3c2936e874138aff480a23cdbf66591 PiperOrigin-RevId: 271618279
* NFC: Pass OpAsmPrinter by reference instead of by pointer.River Riddle2019-09-201-63/+63
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270401378
* NFC: Pass OperationState by reference instead of by pointer.River Riddle2019-09-201-118/+118
| | | | | | MLIR follows the LLVM convention of passing by reference instead of by pointer. PiperOrigin-RevId: 270396945
* NFC: Pass OpAsmParser by reference instead of by pointer.River Riddle2019-09-201-116/+116
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270315612
* Add rewrite pattern to compose maps into affine load/storesUday Bondhugula2019-09-171-30/+73
| | | | | | | | | | | | | | | | | | | | | | | | - add canonicalization pattern to compose maps into affine loads/stores; templatize the pattern and reuse it for affine.apply as well - rename getIndices -> getMapOperands() (getIndices is confusing since these are no longer the indices themselves but operands to the map whose results are the indices). This also makes the accessor uniform across affine.apply/load/store. Change arg names on the affine load/store builder to avoid confusion. Drop an unused confusing build method on AffineStoreOp. - update incomplete doc comment for canonicalizeMapAndOperands (this was missed from a previous update). Addresses issue tensorflow/mlir#121 Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#122 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/122 from bondhugula:compose-load-store e71de1771e56a85c4282c10cb43f30cef0701c4f PiperOrigin-RevId: 269619540
* Clean up build trip count analysis method - avoid mutating IRUday Bondhugula2019-09-141-70/+12
| | | | | | | | | | | | | | | | | | | | | | | | - NFC - on any pass/utility logic/output. - Resolve TODO; the method building loop trip count maps was creating and deleting affine.apply ops (transforming IR from under analysis!, strictly speaking). Introduce AffineValueMap::difference to do this correctly (without the need to create any IR). - Move AffineApplyNormalizer out so that its methods are reusable from AffineStructures.cpp; add a helper method 'normalize' to it. Fix AffineApplyNormalize::renumberOneDim (Issue tensorflow/mlir#89). - Trim includes on files touched. - add test case on a scenario previously not covered Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#133 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/133 from bondhugula:trip-count-build 7fc34d857f7788f98b641792cafad6f5bd50e47b PiperOrigin-RevId: 269101118
* Add pattern to canonicalize for loop boundsUday Bondhugula2019-09-131-2/+35
| | | | | | | | | | | | | | - add pattern to canonicalize affine.for loop bounds (using canonicalizeMapAndOperands) - rename AffineForLoopBoundFolder -> AffineForLoopBoundFolder for consistency Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#111 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/111 from bondhugula:bound-canonicalize ee8fb7f43a7ffd45f6df3f53c95098d8b7e494c7 PiperOrigin-RevId: 269041220
* Restrict affine inlining to just Function operations.River Riddle2019-09-061-4/+6
| | | | | | The current restrictions on dim/symbols require a top-level symbol for the conservative case of a non-affine region. This should be relaxed in the future. PiperOrigin-RevId: 267641838
* Add custom builder for AffineIfOpNagy Mostafa2019-09-061-0/+11
| | | | | | | Closes tensorflow/mlir#109 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/109 from nmostafa:nmostafa/AffineIfOp 7dbf2115f0092ffab26381ea8704aa05a0253971 PiperOrigin-RevId: 267633077
* Integer set + operands / affine if op canonicalizationUday Bondhugula2019-09-051-35/+91
| | | | | | | | | | | | | | | | | | | | | | - turn canonicalizeMapAndOperands into a template that works on both sets and maps, and use it to introduce a utility to canonicalize an affine integer set and its operands - add pattern to canonicalize affine if op's. - rename IntegerSet::getNumOperands -> IntegerSet::getNumInputs to be consistent with AffineMap - add missing accessors for IntegerSet Doesn't need extensive testing since canonicalizeSetAndOperands just reuses canonicalizeMapAndOperands' logic, and the latter is tested on affine.apply map + operands; the new method works the same way on an integer set + operands of an affine if op for example. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#112 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/112 from bondhugula:set-canonicalize eff72f23250b96fa7d9f5caff3877440f5de2cec PiperOrigin-RevId: 267532876
* Add support for conservatively inlining Affine operations.River Riddle2019-09-051-0/+39
| | | | | | This commit defines an initial implementation of the DialectInlinerInterface for the AffineOps dialect. This change allows for affine operations to be inlined into any region that is not an affine region. Inlining into affine regions requires special handling for dimension/symbol identifiers that will be added in followups. PiperOrigin-RevId: 267467078
* Add a canonicalization to erase empty AffineForOps.River Riddle2019-08-301-1/+16
| | | | | | AffineForOp themselves are pure and can be removed if there are no internal operations. PiperOrigin-RevId: 266481293
* Extend map canonicalization to propagate constant operandsUday Bondhugula2019-08-291-11/+23
| | | | | | | | | | | | | | | | | | | - extend canonicalizeMapAndOperands to propagate constant operands into the map's expressions (and thus drop those operands). - canonicalizeMapAndOperands previously only dropped duplicate and unused operands; however, operands that were constants were retained. This change makes IR maps/expressions generated by various utilities/passes even simpler; also makes some of the test checks more accurate and simpler -- for eg., 0' instead of symbol(%{{.*}}). Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#107 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/107 from bondhugula:canonicalize-maps c889a51486d14fbf7db489f224f881e7e1ff7d72 PiperOrigin-RevId: 266085289
* NFC: Move AffineOps dialect to the Dialect sub-directory.River Riddle2019-08-203-0/+1796
PiperOrigin-RevId: 264482571
OpenPOWER on IntegriCloud