summaryrefslogtreecommitdiffstats
path: root/mlir/test/lib/TestDialect
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor region type signature conversion to be explicit via patterns.River Riddle2019-07-201-3/+6
| | | | | | This cl enforces that the conversion of the type signatures for regions, and thus their entry blocks, is handled via ConversionPatterns. A new hook 'applySignatureConversion' is added to the ConversionPatternRewriter to perform the desired conversion on a region. This also means that the handling of rewriting the signature of a FuncOp is moved to a pattern. A default implementation is provided via 'mlir::populateFuncOpTypeConversionPattern'. This removes the hacky implicit 'dynamically legal' status of FuncOp that was present previously, and leaves it up to the user to decide when/how to convert the signature of a function. PiperOrigin-RevId: 259161999
* Merge TypeUtilities library into the IR libraryAlex Zinenko2019-07-202-3/+3
| | | | | | | | | | The TypeUtilities.{cpp,h}, currently living in {lib,include/mlir}/Support, do not belong to the Support library. Instead, they form a separate utility library that depends on the IR library. The operations it provides relate to standard types (tensors, memrefs) as well as to operation manipulation, making them a better fit for the main IR library. PiperOrigin-RevId: 259108314
* Add missing MLIRDialect dependency for MLIRDialectLei Zhang2019-07-191-0/+1
| | | | | | | Tests for the Broadcastable trait was added in a previous CL, which makes MLIRDialect depend on MLIRDialect now. PiperOrigin-RevId: 258967332
* Add support for providing a legality callback for dynamic legality in ↵River Riddle2019-07-191-14/+10
| | | | | | | | | | | | | | | | | | DialectConversion. This allows for providing specific handling for dynamically legal operations/dialects without overriding the general 'isDynamicallyLegal' hook. This also means that a derived ConversionTarget class need not always be defined when some operations are dynamically legal. Example usage: ConversionTarget target(...); target.addDynamicallyLegalOp<ReturnOp>([](ReturnOp op) { return ... }; target.addDynamicallyLegalDialect<StandardOpsDialect>([](Operation *op) { return ... }; PiperOrigin-RevId: 258884753
* NFC: Expose a ConversionPatternRewriter for use with ConversionPatterns.River Riddle2019-07-191-8/+12
| | | | | | This specific PatternRewriter will allow for exposing hooks in the future that are only useful for the conversion framework, e.g. type conversions. PiperOrigin-RevId: 258818122
* Refactor the conversion of block argument types in DialectConversion.River Riddle2019-07-192-6/+30
| | | | | | | | This cl begins a large refactoring over how signature types are converted in the DialectConversion infrastructure. The signatures of blocks are now converted on-demand when an operation held by that block is being converted. This allows for handling the case where a region is created as part of a pattern, something that wasn't possible previously. This cl also generalizes the region signature conversion used by FuncOp to work on any region of any operation. This generalization allows for removing the 'apply*Conversion' functions that were specific to FuncOp/ModuleOp. The implementation currently uses a new hook on TypeConverter, 'convertRegionSignature', but this should ideally be removed in favor of using Patterns. That depends on adding support to the PatternRewriter used by ConversionPattern to allow applying signature conversions to regions, which should be coming in a followup. PiperOrigin-RevId: 258645733
* Add tests for broadcastable traitSmit Hinsu2019-07-192-0/+6
| | | | PiperOrigin-RevId: 258637509
* Add support for explicitly marking dialects and operations as illegal.River Riddle2019-07-192-0/+2
| | | | | | | | This explicit tag is useful is several ways: *) This simplifies how to mark sub sections of a dialect as explicitly unsupported, e.g. my target supports all operations in the foo dialect except for these select few. This is useful for partial lowerings between dialects. *) Partial conversions will now verify that operations that were explicitly marked as illegal must be converted. This provides some guarantee that the operations that need to be lowered by a specific pass will be. PiperOrigin-RevId: 258582879
* Refactor DialectConversion to support different conversion modes.River Riddle2019-07-161-2/+2
| | | | | | | | | | | Users generally want several different modes of conversion. This cl refactors DialectConversion to provide two: * Partial (applyPartialConversion) - This mode allows for illegal operations to exist in the IR, and does not fail if an operation fails to be legalized. * Full (applyFullConversion) - This mode fails if any operation is not properly legalized to the conversion target. This allows for ensuring that the IR after a conversion only contains operations legal for the target. PiperOrigin-RevId: 258412243
* Add a TypeIsPred.Jacques Pienaar2019-07-161-0/+9
| | | | | | | | Mostly one would use the type specification directly on the operand, but for cases where the type of the operand depends on other operand types, `TypeIs` attribute can be used to construct verification methods. PiperOrigin-RevId: 258411758
* Fix a bug in DialectConversion when using RewritePattern.River Riddle2019-07-161-0/+5
| | | | | | When using a RewritePattern and replacing an operation with an existing value, that value may have already been replaced by something else. This cl ensures that only the final value is used when applying rewrites. PiperOrigin-RevId: 258058488
* Add missing override.Jacques Pienaar2019-07-081-1/+2
| | | | PiperOrigin-RevId: 257024265
* Migrate NativeCodeCall and AllAttrConstraintsOf tests to use TestDialectLei Zhang2019-07-052-0/+58
| | | | PiperOrigin-RevId: 256685260
* Migrate pattern attribute matching tests to use TestDialectLei Zhang2019-07-051-26/+48
| | | | | | | This CL also reorders op definitions and tests a bit to make them group more logically. PiperOrigin-RevId: 256682105
* [TableGen] Support creating multi-result ops in result patternsLei Zhang2019-07-031-0/+74
| | | | | | | | | | This CL introduces a new syntax for creating multi-result ops and access their results in result patterns. Specifically, if a multi-result op is unbound or bound to a name without a trailing `__N` suffix, it will act as a value pack and expand to all its values. If a multi-result op is bound to a symbol with `__N` suffix, only the N-th result will be extracted and used. PiperOrigin-RevId: 256465208
* [ODS] NFC: Rename EnumAttr to StrEnumAttr to be consistent with IntEnumAttrLei Zhang2019-07-021-6/+6
| | | | PiperOrigin-RevId: 256169019
* [ODS] Introduce IntEnumAttrLei Zhang2019-07-011-0/+39
| | | | | | | | | | | | | | | | | | | In ODS, right now we use StringAttrs to emulate enum attributes. It is suboptimal if the op actually can and wants to store the enum as a single integer value; we are paying extra cost on storing and comparing the attribute value. This CL introduces a new enum attribute subclass that are backed by IntegerAttr. The downside with IntegerAttr-backed enum attributes is that the assembly form now uses integer values, which is less obvious than the StringAttr-backed ones. However, that can be remedied by defining custom assembly form with the help of the conversion utility functions generated via EnumsGen. Choices are given to the dialect writers to decide which one to use for their enum attributes. PiperOrigin-RevId: 255935542
* Refactor DialectConversion to use 'materializeConversion' when a type ↵River Riddle2019-06-282-1/+17
| | | | | | | | conversion must persist after the conversion has finished. During conversion, if a type conversion has dangling uses a type conversion must persist after conversion has finished to maintain valid IR. In these cases, we now query the TypeConverter to materialize a conversion for us. This allows for the default case of a full conversion to continue working as expected, but also handle the degenerate cases more robustly. PiperOrigin-RevId: 255637171
* Respect the user provided type when parsing StringAttr.River Riddle2019-06-272-0/+11
| | | | PiperOrigin-RevId: 255532918
* Split test-specific passes out of mlir-optNicolas Vasilache2019-06-246-0/+522
Instead put their impl in test/lib and link them into mlir-test-opt PiperOrigin-RevId: 254837439
OpenPOWER on IntegriCloud