Commit Graph

1334 Commits

Author SHA1 Message Date
Mehdi Amini 51f6c0ea60 Add a getLoc() method on mlir::Value that returns the loc of the defining Operations if any, otherwise an unknown location
--

PiperOrigin-RevId: 241354085
2019-04-01 11:00:58 -07:00
Mehdi Amini 005d54329e Add a getContext() convenient accessor on mlir::Value (NFC)
--

PiperOrigin-RevId: 241352789
2019-04-01 11:00:43 -07:00
Mehdi Amini b3a407fa68 Fix MacOS build
This is making up for some differences in standard library and linker flags.
    It also get rid of the requirement to build with RTTI.

--

PiperOrigin-RevId: 241348845
2019-04-01 11:00:30 -07:00
River Riddle 62cd7511f3 Rewrite ResultTypeIterator to be a mapped_iterator instead of an IndexedAccessorIterator. IndexedAccessorIterator makes some assumptions about the element type that do not hold for the result type, i.e. pointer elements. A mapped_iterator also better models the behavior of a ResultTypeIterator.
--

PiperOrigin-RevId: 241345949
2019-04-01 11:00:15 -07:00
Feng Liu 191aaa82ef Support 0-d tensor type attributes
This CL fixes the parser and printer to support the 0-d tensor type attributes.

--

PiperOrigin-RevId: 241345329
2019-04-01 10:59:59 -07:00
Feng Liu a0606ca717 Minor fixes on the typo/naming/style in the Pattern.cpp file
--

PiperOrigin-RevId: 241341334
2019-04-01 10:59:45 -07:00
Lei Zhang b9e38a7972 [TableGen] Add EnumAttrCase and EnumAttr
This CL adds EnumAttr as a general mechanism for modelling enum attributes. Right now
    it is using StringAttr under the hood since MLIR does not have native support for enum
    attributes.

--

PiperOrigin-RevId: 241334043
2019-04-01 10:59:31 -07:00
River Riddle 082016d43a Add a flag to Dialect that allows for dialects to enable support for unregistered operations. This flag is off by default and can be toggled via the 'allowUnknownOperations(...)' method. This means that moving forward an error will be emitted for unknown operations if the dialect does not explicitly allow it.
Example:

    func @unknown_std_op() {
      %0 = "std.foo_bar_op"() : () -> index
      return
    }

    Will result in:

    error: unregistered operation 'std.foo_bar_op' found in dialect ('std') that does not allow unknown operations

--

PiperOrigin-RevId: 241266009
2019-04-01 10:59:17 -07:00
River Riddle ff05e9da19 Update variable in PassTiming to refer to system_clock instead of high_resolution_clock.
--

PiperOrigin-RevId: 241260071
2019-04-01 10:58:59 -07:00
River Riddle dfc58742a2 Rename the 'namePrefix' field in the Dialect class to 'name' and tidy some comments to make it clear that 'name' refers to the dialect namespace.
--

PiperOrigin-RevId: 241103116
2019-03-30 11:23:55 -07:00
Chris Lattner 0fb905c070 Implement basic IR support for a builtin complex<> type. As with tuples, we
have no standard ops for working with these yet, this is simply enough to
    represent and round trip them in the printer and parser.

--

PiperOrigin-RevId: 241102728
2019-03-30 11:23:39 -07:00
Jacques Pienaar 1273af232c Add build files and update README.
* Add initial version of build files;
    * Update README with instructions to download and build MLIR from github;

--

PiperOrigin-RevId: 241102092
2019-03-30 11:23:22 -07:00
River Riddle 6f24bf82f9 Assert that registered dialects have unique names. This creates a guarantee that the namespace of a dialect can be used a unique key.
--

PiperOrigin-RevId: 241049578
2019-03-29 17:57:41 -07:00
River Riddle 0ae68a3ccf Remove the MLIRContext parameter from Dialect::parseType. Dialects already have access to the context via Dialect::getContext.
--

PiperOrigin-RevId: 241047077
2019-03-29 17:57:27 -07:00
River Riddle 258dbdafa8 Update TypeBase::verifyConstructionInvariants to use a LogicalResult return instead of bool.
--

PiperOrigin-RevId: 241045568
2019-03-29 17:57:12 -07:00
River Riddle 90d2e16e63 Replace usages of instruction with operation in the g3 documents.
PiperOrigin-RevId: 241037784
2019-03-29 17:56:57 -07:00
Nicolas Vasilache c9d5f3418a Cleanup SuperVectorization dialect printing and parsing.
On the read side,
```
%3 = vector_transfer_read %arg0, %i2, %i1, %i0 {permutation_map: (d0, d1, d2)->(d2, d0)} : (memref<?x?x?xf32>, index, index, index) -> vector<32x256xf32>
```

becomes:

```
%3 = vector_transfer_read %arg0[%i2, %i1, %i0] {permutation_map: (d0, d1, d2)->(d2, d0)} : memref<?x?x?xf32>, vector<32x256xf32>
```

On the write side,

```
vector_transfer_write %0, %arg0, %c3, %c3 {permutation_map: (d0, d1)->(d0)} : vector<128xf32>, memref<?x?xf32>, index, index
```

becomes

```
vector_transfer_write %0, %arg0[%c3, %c3] {permutation_map: (d0, d1)->(d0)} : vector<128xf32>, memref<?x?xf32>
```

Documentation will be cleaned up in a followup commit that also extracts a proper .md from the top of the file comments.

PiperOrigin-RevId: 241021879
2019-03-29 17:56:42 -07:00
Feng Liu a38792f7d1 remove the const quantifier before temp variable
PiperOrigin-RevId: 240997262
2019-03-29 17:56:27 -07:00
Nicolas Vasilache f93a5be65f Make createMaterializeVectorsPass take a vectorSize parameter - NFC
This CL allows the programmatic control of the target hardware vector size when creating a MaterializeVectorsPass.
This is useful for registering passes for the tutorial.

PiperOrigin-RevId: 240996136
2019-03-29 17:56:12 -07:00
Feng Liu 5303587448 [TableGen] Support benefit score in pattern definition.
A integer number can be specified in the pattern definition and used as the
adjustment to the default benefit score in the generated rewrite pattern C++
definition.

PiperOrigin-RevId: 240994192
2019-03-29 17:55:55 -07:00
Nicolas Vasilache 094ca64ab0 Refactor vectorization patterns
This CL removes the reliance of the vectorize pass on the specification of a `fastestVaryingDim` parameter. This parameter is a restriction meant to more easily target a particular loop/memref combination for vectorization and is mainly used for testing.

This also had the side-effect of restricting vectorization patterns to only the ones in which all memrefs were contiguous along the same loop dimension. This simple restriction prevented matmul to vectorize in 2-D.

this CL removes the restriction and adds the matmul test which vectorizes in 2-D along the parallel loops. Support for reduction loops is left for future work.

PiperOrigin-RevId: 240993827
2019-03-29 17:55:36 -07:00
River Riddle 3ddd0411d0 Slight rewording of TupleType rationale.
PiperOrigin-RevId: 240991400
2019-03-29 17:55:21 -07:00
River Riddle d16213bf66 Update the QuickstartRewrites document to include information about the new 'matchAndRewrite' functionality in RewritePatterns.
PiperOrigin-RevId: 240987764
2019-03-29 17:55:05 -07:00
River Riddle 8a0622c986 [PassManager] Add a utility class, PrettyStackTraceParallelDiagnosticEntry, to emit any queued up diagnostics in the event of a crash when multi-threading.
PiperOrigin-RevId: 240986566
2019-03-29 17:54:51 -07:00
MLIR Team 9d30b36aaf Enable input-reuse fusion to search function arguments for fusion candidates (takes care of a TODO, enables another tutorial test case).
PiperOrigin-RevId: 240979894
2019-03-29 17:54:36 -07:00
River Riddle 106dd08e99 Change the vectorizer test pass to output via diagnostics instead of llvm::outs. This allows for the output to be deterministic when multi-threading is enabled.
PiperOrigin-RevId: 240905858
2019-03-29 17:54:21 -07:00
MLIR Team dd0029e4f6 Support for type constraints across operand and results
--

PiperOrigin-RevId: 240905555
2019-03-29 17:54:06 -07:00
Tatiana Shpeisman 65a5f73ab3 Fixed a few instances of inconsistent grammar.
PiperOrigin-RevId: 240896336
2019-03-29 17:53:50 -07:00
Jacques Pienaar e7111fd62c Address some errors from g++
These fail with:

could not convert ‘module’ from ‘llvm::orc::ThreadSafeModule’ to
 ‘llvm::Expected<llvm::orc::ThreadSafeModule>’

PiperOrigin-RevId: 240892583
2019-03-29 17:53:36 -07:00
Jacques Pienaar b633fcf9c0 Add README file for MLIR.
PiperOrigin-RevId: 240889350
2019-03-29 17:53:21 -07:00
River Riddle 76181a7b38 Remove the LowerEDSCTestPass.
Most of the tests have been ported to be unit-tests and this pass is problematic in the way it depends on TableGen-generated files. This pass is also non-deterministic during multi-threading and a blocker to turning it on by default.

PiperOrigin-RevId: 240889154
2019-03-29 17:53:05 -07:00
River Riddle 909a63d8bf Tidy up a few comments and error messages related to parsing multi-result operations.
PiperOrigin-RevId: 240876306
2019-03-29 17:52:51 -07:00
Jacques Pienaar cd0b925dc2 Remove extra qualification
PiperOrigin-RevId: 240875432
2019-03-29 17:52:36 -07:00
Alex Zinenko 85bbde483d LLVM IR Dialect: separate the conversion tool from the conversion pass
Originally, the conversion to the LLVM IR dialect had been implemented as pass.
The common conversion infrastructure was factored into DialectConversion from
which the conversion pass inherited.  The conversion being a pass is
undesirable for callers that only need the conversion done, for example as a
part of sequence of conversions or outside the pass manager infrastructure.
Split the LLVM IR Dialect conversion into the conversion proper and the
conversion pass, where the latter contains the former instead of inheriting.
NFC.

PiperOrigin-RevId: 240874740
2019-03-29 17:52:20 -07:00
Alex Zinenko 3173a63f3f Dialect Conversion: convert regions of operations when cloning them
Dialect conversion currently clones the operations that did not match any
pattern.  This includes cloning any regions that belong to these operations.
Instead, apply conversion recursively to the nested regions.

Note that if an operation matched one of the conversion patterns, it is up to
the pattern rewriter to fill in the regions of the converted operation.  This
may require calling back to the converter and is left for future work.

PiperOrigin-RevId: 240872410
2019-03-29 17:52:04 -07:00
Nicolas Vasilache abe881d565 NFC - Handle IndexedValue corner case
Implicit conversion don't play nicely in expressions such as:
`C() = A(i) * B(i)`.

Make `C()` return an IndexedValue instead of casting to ValueHandle.
This prevents double capture errors and is useful for the tutorial.

PiperOrigin-RevId: 240863223
2019-03-29 17:51:48 -07:00
River Riddle 01140bd137 Change the muli-return syntax for operations. The name of the operation result now contains the number of results that it refers to if the number of results is greater than 1.
Example:
    %call:2 = call @multi_return() : () -> (f32, i32)
    use(%calltensorflow/mlir#0, %calltensorflow/mlir#1)

This cl also adds parser support for uniquely named result values. This means that a test writer can now write something like:
    %foo, %bar = call @multi_return() : () -> (f32, i32)
    use(%foo, %bar)

Note: The printer will still print the collapsed form.
PiperOrigin-RevId: 240860058
2019-03-29 17:51:32 -07:00
MLIR Team 9d9675fc8f Remove overly conservative check in LoopFusion pass (enables fusion in tutorial example).
PiperOrigin-RevId: 240859227
2019-03-29 17:51:16 -07:00
River Riddle 07c1a96abf [PassManager] Define a ParallelDiagnosticHandler to ensure that diagnostics are still produced in a deterministic order when multi-threading.
PiperOrigin-RevId: 240817922
2019-03-29 17:50:59 -07:00
River Riddle 213b8d4d3b Rename InstOperand to OpOperand.
PiperOrigin-RevId: 240814651
2019-03-29 17:50:41 -07:00
Dimitrios Vytiniotis 79bd6badb2 Remove global LLVM CLI variables from library code
Plus move parsing code into the MLIR CPU runner binary.

PiperOrigin-RevId: 240786709
2019-03-29 17:50:23 -07:00
River Riddle af9760fe18 Replace remaining usages of the Instruction class with Operation.
PiperOrigin-RevId: 240777521
2019-03-29 17:50:04 -07:00
Nicolas Vasilache 31442a66ef Cleanup vectorize_1d.mlir test - NFC
This CL splits a large monolithic test function into smaller ones that are each CHECK-LABEL'd

PiperOrigin-RevId: 240684979
2019-03-29 17:49:45 -07:00
Nicolas Vasilache 4dc7af9da8 Make vectorization aware of loop semantics
Now that we have a dependence analysis, we can check that loops are indeed parallel and make vectorization correct.

PiperOrigin-RevId: 240682727
2019-03-29 17:49:30 -07:00
River Riddle 21547ace87 Update the multi-threaded pass timing to not assume that total time will be different from user time.
PiperOrigin-RevId: 240681618
2019-03-29 17:49:14 -07:00
Jacques Pienaar 8f1e744169 Move test of trait using dialect ops, to dialects of ops.
PiperOrigin-RevId: 240680010
2019-03-29 17:48:59 -07:00
MLIR Team b8874c679f Small edit for clarity. ("Zero dimensions" reads to me as "rank of zero.")
PiperOrigin-RevId: 240664300
2019-03-29 17:48:44 -07:00
Jacques Pienaar d7e386cea9 Move TF dialect test to dialect.
PiperOrigin-RevId: 240646586
2019-03-29 17:48:28 -07:00
Nicolas Vasilache c3742d20b5 Give the Vectorize pass a virtualVectorSize argument.
This CL allows vectorization to be called and configured in other ways than just via command line arguments.
This allows triggering vectorization programmatically.

PiperOrigin-RevId: 240638208
2019-03-29 17:48:12 -07:00
Lei Zhang d5524388ab [TableGen] Change names for Builder* and OperationState* parameters to avoid collision
The `Builder*` parameter is unused in both generated build() methods so that we can
leave it unnamed. Changed stand-alone parameter build() to take `_tblgen_state` instead
of `result` to allow `result` to avoid having name collisions with op operand,
attribute, or result.

PiperOrigin-RevId: 240637700
2019-03-29 17:47:57 -07:00