summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Move AffineApplyOp to the AffineOps dialect. This also moves the ↵River Riddle2019-03-2913-316/+310
| | | | | | isValidDim/isValidSymbol methods from Value to the AffineOps dialect. PiperOrigin-RevId: 232386632
* Refactor common code getting memref access in getMemRefRegion - NFCUday Bondhugula2019-03-2910-110/+104
| | | | | | | | | | | | | | | - use getAccessMap() instead of repeating it - fold getMemRefRegion into MemRefRegion ctor (more natural, avoid heap allocation and unique_ptr where possible) - change extractForInductionVars - MutableArrayRef -> ArrayRef for the arguments. Since the method is just returning copies of 'Value *', the client can't mutate the pointers themselves; it's fine to mutate the 'Value''s themselves, but that doesn't mutate the pointers to those. - change the way extractForInductionVars returns (see b/123437690) PiperOrigin-RevId: 232359277
* Update MemRefAccess::getAccessMap to always canonicalize map + operandsUday Bondhugula2019-03-291-0/+1
| | | | | | | | | | - with this we won't see duplicate / unused operands when getting access maps, or when constructing FlatAffineConstraints based on such maps - we can probably change fullyComposeAffineMapAndOperands to ensure this TODO(b/123879896). PiperOrigin-RevId: 232356600
* Remove the OwnerTy template parameter of IROperandImpl and ValueUseIterator ↵River Riddle2019-03-295-20/+18
| | | | | | as it is no longer necessary now that all instructions are operations. PiperOrigin-RevId: 232356323
* Add option print functions with the generic form.Jacques Pienaar2019-03-292-0/+12
| | | | | | | | The generic form may be more desirable even when there is a custom form specified so add option to enable emitting it. This also exposes a current bug when round tripping constant with function attribute. PiperOrigin-RevId: 232350712
* No need to specify default behavior. NFC.Jacques Pienaar2019-03-291-9/+1
| | | | | | This avoids overriding the class members + setting the printer/parser hooks only to fall back to generic. PiperOrigin-RevId: 232348307
* Remove the forward definition of OperationInst now that no references remain.River Riddle2019-03-291-7/+0
| | | | PiperOrigin-RevId: 232325321
* Remove remaining usages of OperationInst in lib/Transforms.River Riddle2019-03-2920-317/+251
| | | | PiperOrigin-RevId: 232323671
* Remove remaining references to OperationInst in all directories except for ↵River Riddle2019-03-2912-83/+75
| | | | | | lib/Transforms. PiperOrigin-RevId: 232322771
* Replace the walkOps/visitOperationInst variants from the InstWalkers with ↵River Riddle2019-03-2925-133/+61
| | | | | | the Instruction variants. PiperOrigin-RevId: 232322030
* Exposing logical operators in EDSC all the way up to Python.Dimitrios Vytiniotis2019-03-296-30/+113
| | | | PiperOrigin-RevId: 232299839
* Update dma-generate pass to (1) work on blocks of instructions (instead of justUday Bondhugula2019-03-2912-153/+451
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loops), (2) take into account fast memory space capacity and lower 'dmaDepth' to fit, (3) add location information for debug info / errors - change dma-generate pass to work on blocks of instructions (start/end iterators) instead of 'for' loops; complete TODOs - allows DMA generation for straightline blocks of operation instructions interspersed b/w loops - take into account fast memory capacity: check whether memory footprint fits in fastMemoryCapacity parameter, and recurse/lower the depth at which DMA generation is performed until it does fit in the provided memory - add location information to MemRefRegion; any insufficient fast memory capacity errors or debug info w.r.t dma generation shows location information - allow DMA generation pass to be instantiated with a fast memory capacity option (besides command line flag) - change getMemRefRegion to return unique_ptr's - change getMemRefFootprintBytes to work on a 'Block' instead of 'ForInst' - other helper methods; add postDomInstFilter option for replaceAllMemRefUsesWith; drop forInst->walkOps, add Block::walkOps methods Eg. output $ mlir-opt -dma-generate -dma-fast-mem-capacity=1 /tmp/single.mlir /tmp/single.mlir:9:13: error: Total size of all DMA buffers' for this block exceeds fast memory capacity for %i3 = (d0) -> (d0)(%i1) to (d0) -> (d0 + 32)(%i1) { ^ $ mlir-opt -debug-only=dma-generate -dma-generate -dma-fast-mem-capacity=400 /tmp/single.mlir /tmp/single.mlir:9:13: note: 8 KiB of DMA buffers in fast memory space for this block for %i3 = (d0) -> (d0)(%i1) to (d0) -> (d0 + 32)(%i1) { PiperOrigin-RevId: 232297044
* Begin the process of fully removing OperationInst. This patch cleans up ↵River Riddle2019-03-2944-446/+356
| | | | | | references to OperationInst in the /include, /AffineOps, and lib/Analysis. PiperOrigin-RevId: 232199262
* Fold the functionality of OperationInst into Instruction. OperationInst ↵River Riddle2019-03-2938-1100/+980
| | | | | | still exists as a forward declaration and will be removed incrementally in a set of followup cleanup patches. PiperOrigin-RevId: 232198540
* Merge OpProperty and Traits into OpTraitLei Zhang2019-03-295-96/+76
| | | | | | | | | | | | | | | They are essentially both modelling MLIR OpTrait; the former achieves the purpose via introducing corresponding symbols in TableGen, while the latter just uses plain strings. Unify them to provide a single mechanism to avoid confusion and to better reflect the definitions on MLIR C++ side. Ideally we should be able to deduce lots of these traits automatically via other bits of op definitions instead of manually specifying them; but not for now though. PiperOrigin-RevId: 232191401
* Define NumericAttr as the base class for BoolAttr, IntegerAttr, FloatAttr, ↵Lei Zhang2019-03-295-25/+56
| | | | | | | | | | | | | | and ElementsAttr These attribute kinds are different from the rest in the sense that their types are defined in MLIR's type hierarchy and we can build constant op out of them. By defining this middle-level base class, we have a unified way to test and query the type of these attributes, which will be useful when constructing constant ops of various dialects. This CL also added asserts to reject non-NumericAttr in constant op's build() method. PiperOrigin-RevId: 232188178
* Fix the handling of the resizable operands bit of OperationState in a few ↵River Riddle2019-03-292-3/+3
| | | | | | places. PiperOrigin-RevId: 232163738
* Fold IROperandOwner into Instruction.River Riddle2019-03-296-71/+36
| | | | PiperOrigin-RevId: 232159334
* When parsing, treat an IntegerSet with no constraints as a degenerate true ↵River Riddle2019-03-294-16/+19
| | | | | | case. Also update the spec to note that affine constraints are optional. PiperOrigin-RevId: 232158673
* Emit an error when parsing an affine structure if '->' or ':' is not foundRiver Riddle2019-03-292-1/+9
| | | | | | after the dim/symbol id list. PiperOrigin-RevId: 232094789
* Promote local buffers created post fusion to higher memory spaceUday Bondhugula2019-03-291-8/+54
| | | | | | | | | | | | | - fusion already includes the necessary analysis to create small/local buffers post fusion; allocate these buffers in a higher memory space if the necessary pass parameters are provided (threshold size, memory space id) - although there will be a separate utility at some point to directly detect and promote small local buffers to higher memory spaces, doing it while fusion when possible is much less expensive, comes free with fusion analysis, and covers a key common case. PiperOrigin-RevId: 232063894
* Minor fix to the lexer whitespace loop.Stella Laurenzo2019-03-291-1/+4
| | | | | | | | | | | | Nothing in the loop can (legally) cause curPtr -> nullptr. And if it did, we would null dereference right below anyway. This loop still reads funny to me but doesn't make me stare at it and wonder what I am missing anymore. -- PiperOrigin-RevId: 232062076
* Define the AffineForOp and replace ForInst with it. This patch is largely ↵River Riddle2019-03-2952-1730/+1569
| | | | | | mechanical, i.e. changing usages of ForInst to OpPointer<AffineForOp>. An important difference is that upon construction an AffineForOp no longer automatically creates the body and induction variable. To generate the body/iv, 'createBody' can be called on an AffineForOp with no body. PiperOrigin-RevId: 232060516
* [TableGen] Use tblgen::DagLeaf to model DAG argumentsLei Zhang2019-03-297-144/+292
| | | | | | | | | | This CL added a tblgen::DagLeaf wrapper class with several helper methods for handling DAG arguments. It helps to refactor the rewriter generation logic to be more higher level. This CL also added a tblgen::ConstantAttr wrapper class for constant attributes. PiperOrigin-RevId: 232050683
* Update linkJacques Pienaar2019-03-291-1/+1
| | | | PiperOrigin-RevId: 232049075
* Fix Block::getNumSuccessors()Uday Bondhugula2019-03-291-1/+6
| | | | | | | | - getTerminator() on a block can return nullptr; moreover, blocks that are improperly constructed/transformed by utilities/passes may not have terminators even for the top-level blocks PiperOrigin-RevId: 232025963
* Fix use of llvm::Module::getOrInsertFunction after the upstream opaque ↵River Riddle2019-03-292-7/+9
| | | | | | pointer type changes. PiperOrigin-RevId: 232002583
* Cleanup EDSCs and start a functional auto-generated library of custom OpsNicolas Vasilache2019-03-2911-379/+390
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL applies the following simplifications to EDSCs: 1. Rename Block to StmtList because an MLIR Block is a different, not yet supported, notion; 2. Rework Bindable to drop specific storage and just use it as a simple wrapper around Expr. The only value of Bindable is to force a static cast when used by the user to bind into the emitter. For all intended purposes, Bindable is just a lightweight check that an Expr is Unbound. This simplifies usage and reduces the API footprint. After playing with it for some time, it wasn't worth the API cognition overhead; 3. Replace makeExprs and makeBindables by makeNewExprs and copyExprs which is more explicit and less easy to misuse; 4. Add generally useful functionality to MLIREmitter: a. expose zero and one for the ubiquitous common lower bounds and step; b. add support to create already bound Exprs for all function arguments as well as shapes and views for Exprs bound to memrefs. 5. Delete Stmt::operator= and replace by a `Stmt::set` method which is more explicit. 6. Make Stmt::operator Expr() explicit. 7. Indexed.indices assertions are removed to pave the way for expressing slices and views as well as to work with 0-D memrefs. The CL plugs those simplifications with TableGen and allows emitting a full MLIR function for pointwise add. This "x.add" op is both type and rank-agnostic (by allowing ArrayRef of Expr passed to For loops) and opens the door to spinning up a composable library of existing and custom ops that should automate a lot of the tedious work in TF/XLA -> MLIR. Testing needs to be significantly improved but can be done in a separate CL. PiperOrigin-RevId: 231982325
* Define an detail::OperandStorage class to handle managing instruction ↵River Riddle2019-03-297-97/+344
| | | | | | operands. This class stores operands in a similar way to SmallVector except for two key differences. The first is the inline storage, which is a trailing objects array. The second is that being able to dynamically resize the operand list is optional. This means that we can enable the cases where operations need to change the number of operands after construction without losing the spatial locality benefits of the common case (operation instructions / non-control flow instructions with a lifetime fixed number of operands). PiperOrigin-RevId: 231910497
* Add fallback to native code op builder specification for patterns.Jacques Pienaar2019-03-294-14/+81
| | | | | | | | This allow for arbitrarily complex builder patterns which is meant to cover initial cases while the modelling is improved and long tail cases/cases for which expanding the DSL would result in worst overall system. NFC just sorting the emit replace methods alphabetical in the class and file body. PiperOrigin-RevId: 231890352
* Enable using constant attribute as matchers.Jacques Pienaar2019-03-292-1/+15
| | | | | | Straight roll-forward of cl/231322019 that got accidentally reverted in the move. PiperOrigin-RevId: 231791464
* Post commit fixesNicolas Vasilache2019-03-291-4/+6
| | | | | | | | | | | | This CL introduces a hotfix post refactoring of NestedMatchers: - fix uninitialized read to skip - avoid bumpptr allocating with 0 elements Interestingly the latter issue only surfaced in fastbuild mode with no-san and manifested itself by a SIGILL. All other combinations that were tried failed to reproduce the issue (dbg, opt, fastbuild with asan) PiperOrigin-RevId: 231787642
* Address Performance issue in NestedMatcherNicolas Vasilache2019-03-296-320/+291
| | | | | | | | | | | | | | | | | | | | | | A performance issue was reported due to the usage of NestedMatcher in ComposeAffineMaps. The main culprit was the ubiquitous copies that were occuring when appending even a single element in `matchOne`. This CL generally simplifies the implementation and removes one level of indirection by getting rid of auxiliary storage as well as simplifying the API. The users of the API are updated accordingly. The implementation was tested on a heavily unrolled example with ComposeAffineMaps and is now close in performance with an implementation based on stateless InstWalker. As a reminder, the whole ComposeAffineMaps pass is slated to disappear but the bug report was very useful as a stress test for NestedMatchers. Lastly, the following cleanups reported by @aminim were addressed: 1. make NestedPatternContext scoped within runFunction rather than at the Pass level. This was caused by a previous misunderstanding of Pass lifetime; 2. use defensive assertions in the constructor of NestedPatternContext to make it clear a unique such locally scoped context is allowed to exist. PiperOrigin-RevId: 231781279
* Address cleanups from previous CLNicolas Vasilache2019-03-292-25/+20
| | | | | | | | | This CL addresses some cleanups that were leftover after an incorrect rebase: 1. use StringSwitch 2. use // NOLINTNEXTLINE 3. remove a dead line of code PiperOrigin-RevId: 231726640
* Fix ASAN issue: snapshot edge list before loop which can modify this list.MLIR Team2019-03-291-3/+15
| | | | PiperOrigin-RevId: 231686040
* LoopFusion: insert the source loop nest slice at a depth in the destination ↵MLIR Team2019-03-292-43/+184
| | | | | | loop nest which preserves dependences (above any loop carried or other dependences). This is accomplished by updating the maximum destination loop depth based on dependence checks between source loop nest loads and stores which access the memref on which the source loop nest has a store op. In addition, prevent fusing in source loop nests which write to memrefs which escape or are live out. PiperOrigin-RevId: 231684492
* Update tests using affine maps to not rely on specific map numbers in the ↵River Riddle2019-03-299-267/+303
| | | | | | output IR. This is necessary to remove the dependency on ForInst not numbering the AffineMap bounds it has custom formatting for. PiperOrigin-RevId: 231634812
* 3000x speed improvement on compose-affine-maps by dropping NestedMatcher forUday Bondhugula2019-03-291-28/+32
| | | | | | | | | | | | | | | | | | | | a trivial inst walker :-) (reduces pass time from several minutes non-terminating to 120ms) - (fixes b/123541184) - use a simple 7-line inst walker to collect affine_apply op's instead of the nested matcher; -compose-affine-maps pass runs in 120ms now instead of 5 minutes + (non- terminating / out of memory) - on a realistic test case that is 20,000 lines 12-d loop nest - this CL is also pushing for simple existing/standard patterns unless there is a real efficiency issue (OTOH, fixing nested matcher to address this issue requires cl/231400521) - the improvement is from swapping out the nested walker as opposed to from a bug or anything else that this CL changes - update stale comment PiperOrigin-RevId: 231623619
* Standardize the spelling of debug info to "debuginfo" in opt flags.River Riddle2019-03-292-3/+2
| | | | PiperOrigin-RevId: 231610337
* [tablegen] Use tblgen:: classes for NamedAttribute and Operand fieldsLei Zhang2019-03-299-52/+42
| | | | | | This is another step towards hiding raw TableGen API calls. PiperOrigin-RevId: 231580827
* [doc] Use table to list all attributesLei Zhang2019-03-291-2/+7
| | | | | | For each attribute, list its MLIR type and description. PiperOrigin-RevId: 231580353
* [doc] Generate more readable description for attributesLei Zhang2019-03-295-25/+35
| | | | | | | This CL added "description" field to AttrConstraint and Attr, like what we have for type classes. PiperOrigin-RevId: 231579853
* [doc] Generate more readable description for operandsLei Zhang2019-03-297-28/+34
| | | | | | | | This CL mandated TypeConstraint and Type to provide descriptions and fixed various subclasses and definitions to provide so. The purpose is to enforce good documentation; using empty string as the default just invites oversight. PiperOrigin-RevId: 231579629
* Fold CallIndirectOp to CallOp when the callee operand is a known constant ↵River Riddle2019-03-293-0/+85
| | | | | | function. PiperOrigin-RevId: 231511697
* Use formatv for the error instead of string stream.Jacques Pienaar2019-03-291-5/+3
| | | | PiperOrigin-RevId: 231507680
* Include op results in generate TensorFlow/TFLite op docsLei Zhang2019-03-292-12/+27
| | | | | | | | | | | * Emitted result lists for ops. * Changed to allow empty summary and description for ops. * Avoided indenting description to allow proper MarkDown rendering of formatting markers inside description content. * Used fixed width font for operand/attribute names. * Massaged TensorFlow op docs and generated dialect op doc. PiperOrigin-RevId: 231427574
* Fix getFullMemRefAsRegion() and FlatAffineConstraints::resetUday Bondhugula2019-03-292-12/+22
| | | | PiperOrigin-RevId: 231426734
* TableGen: Use DAG for op resultsLei Zhang2019-03-297-22/+49
| | | | | | | | | Similar to op operands and attributes, use DAG to specify operation's results. This will allow us to provide names and matchers for outputs. Also Defined `outs` as a marker to indicate the start of op result list. PiperOrigin-RevId: 231422455
* Support fusing loop nests which require insertion into a new instruction ↵MLIR Team2019-03-292-193/+485
| | | | | | | | Block position while preserving dependences, opening up additional fusion opportunities. - Adds SSA Value edges to the data dependence graph used in the loop fusion pass. PiperOrigin-RevId: 231417649
* Prefix Operator getter methods with "get" to be consistentLei Zhang2019-03-295-10/+10
| | | | PiperOrigin-RevId: 231416230
OpenPOWER on IntegriCloud