Lei Zhang [Wed, 27 Mar 2019 21:09:19 +0000 (14:09 -0700)]
[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
River Riddle [Wed, 27 Mar 2019 21:02:26 +0000 (14:02 -0700)]
Add support for multi-threaded pass timing.
When multi-threading is enabled in the pass manager the meaning of the display
slightly changes. First, a new timing column is added, `User Time`, that
displays the total time spent across all threads. Secondly, the `Wall Time`
column displays the longest individual time spent amongst all of the threads.
This means that the `Wall Time` column will continue to give an indicator on the
perceived time, or clock time, whereas the `User Time` will display the total
cpu time.
Example:
$ mlir-opt foo.mlir -experimental-mt-pm -cse -canonicalize -convert-to-llvmir -pass-timing
===-------------------------------------------------------------------------===
... Pass execution timing report ...
===-------------------------------------------------------------------------===
Total Execution Time: 0.0078 seconds
---User Time--- ---Wall Time--- --- Name ---
0.0175 ( 88.3%) 0.0055 ( 70.4%) Function Pipeline
0.0018 ( 9.3%) 0.0006 ( 8.1%) CSE
0.0013 ( 6.3%) 0.0004 ( 5.8%) (A) DominanceInfo
0.0017 ( 8.7%) 0.0006 ( 7.1%) FunctionVerifier
0.0128 ( 64.6%) 0.0039 ( 50.5%) Canonicalizer
0.0011 ( 5.7%) 0.0004 ( 4.7%) FunctionVerifier
0.0004 ( 2.1%) 0.0004 ( 5.2%) ModuleVerifier
0.0010 ( 5.3%) 0.0010 ( 13.4%) LLVMLowering
0.0009 ( 4.3%) 0.0009 ( 11.0%) ModuleVerifier
0.0198 (100.0%) 0.0078 (100.0%) Total
PiperOrigin-RevId:
240636269
River Riddle [Wed, 27 Mar 2019 21:02:02 +0000 (14:02 -0700)]
Replace usages of Instruction with Operation in the Transforms/ directory.
PiperOrigin-RevId:
240636130
Mehdi Amini [Wed, 27 Mar 2019 20:57:02 +0000 (13:57 -0700)]
Simplify API uses of `getContext()` (NFC)
The Pass base class is providing a convenience getContext() accessor.
PiperOrigin-RevId:
240634961
Mehdi Amini [Wed, 27 Mar 2019 20:38:48 +0000 (13:38 -0700)]
Allow to mutate the type of MLIR Value in-place
This avoid trashing memory by cloning and replaceAllUseswith when
performing type inference.
PiperOrigin-RevId:
240631137
Jacques Pienaar [Wed, 27 Mar 2019 20:24:05 +0000 (13:24 -0700)]
Fix include path in test pass.
PiperOrigin-RevId:
240628260
Jacques Pienaar [Wed, 27 Mar 2019 19:36:57 +0000 (12:36 -0700)]
Initialize std::atomic directly.
Avoids error in OSS build:
error: copying variable of type 'std::atomic<unsigned int>' invokes deleted constructor
PiperOrigin-RevId:
240618765
Mehdi Amini [Wed, 27 Mar 2019 19:20:51 +0000 (12:20 -0700)]
Add a method to swap the type of a function in-place
This is motivated by the need to translate function across dialect which
requires morphing their type, as well as the Toy tutorial part on interprocedural
shape inference.
The alternative is cloning the function, but it is heavy and it seems like an
arbitrary restriction to forbid morphing the function type.
PiperOrigin-RevId:
240615755
Jacques Pienaar [Wed, 27 Mar 2019 18:36:36 +0000 (11:36 -0700)]
Use dereference instead of implicit conversion for IndexedValue to Value*.
Avoids ambiguous constructor error on some compilers.
PiperOrigin-RevId:
240606838
Jacques Pienaar [Wed, 27 Mar 2019 17:38:23 +0000 (10:38 -0700)]
Add missing numeric header for std::accumulate.
PiperOrigin-RevId:
240593135
Alex Zinenko [Wed, 27 Mar 2019 16:39:31 +0000 (09:39 -0700)]
LLVM IR Conversion: support zero-dimensional memrefs
The spec allows zero-dimensional memrefs to exist and treats them essentially
as single-element buffers. Unlike single-dimensional memrefs of static shape
<1xTy>, zero-dimensional memrefs do not require indices to access the only
element they store. Add support of zero-dimensional memrefs to the LLVM IR
conversion. In particular, such memrefs are converted into bare pointers, and
accesses to them are converted to bare loads and stores, without the overhead
of `getelementptr %buffer, 0`.
PiperOrigin-RevId:
240579456
Alex Zinenko [Wed, 27 Mar 2019 16:16:27 +0000 (09:16 -0700)]
LLVM IR Conversion: keep LLVM dialect types as is during conversion
When converting to the LLVM IR Dialect, it is possible for the input IR to
contain LLVM IR Dialect operation and/or types, for example, some functions may
have been coverted to the LLVM IR Dialect already, or may have been created
using this dialect directly. Make sure that type conversion keeps LLVM IR
Dialect types unmodified and does not error out. Operations are already kept
as is.
PiperOrigin-RevId:
240574972
River Riddle [Wed, 27 Mar 2019 15:55:17 +0000 (08:55 -0700)]
Replace usages of Instruction with Operation in the /Analysis directory.
PiperOrigin-RevId:
240569775
Nicolas Vasilache [Wed, 27 Mar 2019 13:45:18 +0000 (06:45 -0700)]
Port api-test::tile_2d to the edsc::Builder API
The AST-based EDSCs implementation will be retired soon, this test was missing from the builders API.
PiperOrigin-RevId:
240547453
Alex Zinenko [Wed, 27 Mar 2019 12:11:58 +0000 (05:11 -0700)]
Introduce affine terminator
Due to legacy reasons (ML/CFG function separation), regions in affine control
flow operations require contained blocks not to have terminators. This is
inconsistent with the notion of the block and may complicate code motion
between regions of affine control operations and other regions.
Introduce `affine.terminator`, a special terminator operation that must be used
to terminate blocks inside affine operations and transfers the control back to
he region enclosing the affine operation. For brevity and readability reasons,
allow `affine.for` and `affine.if` to omit the `affine.terminator` in their
regions when using custom printing and parsing format. The custom parser
injects the `affine.terminator` if it is missing so as to always have it
present in constructed operations.
Update transformations to account for the presence of terminator. In
particular, most code motion transformation between loops should leave the
terminator in place, and code motion between loops and non-affine blocks should
drop the terminator.
PiperOrigin-RevId:
240536998
River Riddle [Wed, 27 Mar 2019 04:15:54 +0000 (21:15 -0700)]
Add experimental support for multi-threading the pass manager. This adds support for running function pipelines on functions across multiple threads, and is guarded by an off-by-default flag 'experimental-mt-pm'. There are still quite a few things that need to be done before multi-threading is ready for general use(e.g. pass-timing), but this allows for those things to be tested in a multi-threaded environment.
PiperOrigin-RevId:
240489002
Jacques Pienaar [Wed, 27 Mar 2019 00:28:18 +0000 (17:28 -0700)]
Include numeric header for std::accumulate.
PiperOrigin-RevId:
240462910
River Riddle [Wed, 27 Mar 2019 00:05:09 +0000 (17:05 -0700)]
Replace usages of Instruction with Operation in the /IR directory.
This is step 2/N to renaming Instruction to Operation.
PiperOrigin-RevId:
240459216
Jacques Pienaar [Tue, 26 Mar 2019 23:58:43 +0000 (16:58 -0700)]
Update header notices.
PiperOrigin-RevId:
240457737
Feng Liu [Tue, 26 Mar 2019 22:31:15 +0000 (15:31 -0700)]
Add a trait to set the result type by attribute
Before this CL, the result type of the pattern match results need to be as same
as the first operand type, operand broadcast type or a generic tensor type.
This CL adds a new trait to set the result type by attribute. For example, the
TFL_ConstOp can use this to set the output type to its value attribute.
PiperOrigin-RevId:
240441249
River Riddle [Tue, 26 Mar 2019 21:45:38 +0000 (14:45 -0700)]
Rename the Instruction class to Operation. This just renames the class, usages of Instruction will still refer to a typedef in the interim.
This is step 1/N to renaming Instruction to Operation.
PiperOrigin-RevId:
240431520
Mehdi Amini [Tue, 26 Mar 2019 19:49:08 +0000 (12:49 -0700)]
Add a getContext() utility to the Module/FunctionPass class (NFC)
This is just a convenience for reducing boilerplate when writing a pass.
PiperOrigin-RevId:
240407564
River Riddle [Tue, 26 Mar 2019 19:22:52 +0000 (12:22 -0700)]
Add a utility Instruction::getDialect method to return the dialect an operation is associated with, or nullptr if the associated dialect has not been registered.
PiperOrigin-RevId:
240402300
River Riddle [Tue, 26 Mar 2019 19:02:04 +0000 (12:02 -0700)]
Update the canonicalization patterns for AffineApply and AffineForOp to use matchAndRewrite.
PiperOrigin-RevId:
240398220
Nicolas Vasilache [Tue, 26 Mar 2019 18:03:16 +0000 (11:03 -0700)]
Fix createAffineComputationSlice comments
PiperOrigin-RevId:
240384796
Rob Suderman [Tue, 26 Mar 2019 17:48:24 +0000 (10:48 -0700)]
Tablegen changes to add support for tuples.
PiperOrigin-RevId:
240380512
Nicolas Vasilache [Tue, 26 Mar 2019 17:06:49 +0000 (10:06 -0700)]
Add an IndexedValue::operator Value*
This avoids the need to explicitly convert to a ValueHandle when using an Indexed where a Value* is expected.
PiperOrigin-RevId:
240371014
Alex Zinenko [Tue, 26 Mar 2019 16:55:06 +0000 (09:55 -0700)]
Allow creating standalone Regions
Currently, regions can only be constructed by passing in a `Function` or an
`Instruction` pointer referencing the parent object, unlike `Function`s or
`Instruction`s themselves that can be created without a parent. It leads to a
rather complex flow in operation construction where one has to create the
operation first before being able to work with its regions. It may be
necessary to work with the regions before the operation is created. In
particular, in `build` and `parse` functions that are executed _before_ the
operation is created in cases where boilerplate region manipulation is required
(for example, inserting the hypothetical default terminator in affine regions).
Allow creating standalone regions. Such regions are meant to own a list of
blocks and transfer them to other regions on demand.
Each instruction stores a fixed number of regions as trailing objects and has
ownership of them. This decreases the size of the Instruction object for the
common case of instructions without regions. Keep this behavior intact. To
allow some flexibility in construction, make OperationState store an owning
vector of regions. When the Builder creates an Instruction from
OperationState, the bodies of the regions are transferred into the
instruction-owned regions to minimize copying. Thus, it becomes possible to
fill standalone regions with blocks and move them to an operation when it is
constructed, or move blocks from a region to an operation region, e.g., for
inlining.
PiperOrigin-RevId:
240368183
Chris Lattner [Tue, 26 Mar 2019 01:02:49 +0000 (18:02 -0700)]
Make FunctionPass::getFunction() return a reference to the function, instead of
a pointer. This makes it consistent with all the other methods in
FunctionPass, as well as with ModulePass::getModule(). NFC.
PiperOrigin-RevId:
240257910
River Riddle [Mon, 25 Mar 2019 20:49:45 +0000 (13:49 -0700)]
Replace remaining usages of "Op::operator->" with "." and remove it.
PiperOrigin-RevId:
240210336
River Riddle [Mon, 25 Mar 2019 20:02:06 +0000 (13:02 -0700)]
Replace usages of "Op::operator->" with ".".
This is step 2/N of removing the temporary operator-> method as part of the de-const transition.
PiperOrigin-RevId:
240200792
Jacques Pienaar [Mon, 25 Mar 2019 18:54:37 +0000 (11:54 -0700)]
Qualify string in OpDefinitionsGen. NFC.
PiperOrigin-RevId:
240188138
River Riddle [Mon, 25 Mar 2019 18:53:03 +0000 (11:53 -0700)]
Refactor the Pattern framework to allow for combined match/rewrite patterns. This is done by adding a new 'matchAndRewrite' function to RewritePattern that performs the match and rewrite in one step. The default behavior simply calls into the existing 'match' and 'rewrite' functions. The 'PatternMatcher' class has now been specialized for RewritePatterns and has been rewritten to make use of the new matchAndRewrite functionality.
This combined match/rewrite functionality allows simplifying the majority of existing RewritePatterns, as they do not benefit from separate match and rewrite functions.
Some of the existing canonicalization patterns in StandardOps have been modified to take advantage of this functionality.
PiperOrigin-RevId:
240187856
River Riddle [Mon, 25 Mar 2019 18:13:31 +0000 (11:13 -0700)]
Replace usages of "operator->" with "." for the AffineOps.
Note: The "operator->" method is a temporary helper for the de-const transition and is gradually being phased out.
PiperOrigin-RevId:
240179439
River Riddle [Mon, 25 Mar 2019 17:14:34 +0000 (10:14 -0700)]
NFC: Rename the 'for' operation in the AffineOps dialect to 'affine.for' and set the namespace of the AffineOps dialect to 'affine'.
PiperOrigin-RevId:
240165792
Lei Zhang [Mon, 25 Mar 2019 13:09:26 +0000 (06:09 -0700)]
[TableGen] Consolidate constraint related concepts
Previously we have multiple mechanisms to specify op definition and match constraints:
TypeConstraint, AttributeConstraint, Type, Attr, mAttr, mAttrAnyOf, mPat. These variants
are not added because there are so many distinct cases we need to model; essentially,
they are all carrying a predicate. It's just an artifact of implementation.
It's quite confusing for users to grasp these variants and choose among them. Instead,
as the OpBase TableGen file, we need to strike to provide an unified mechanism. Each
dialect has the flexibility to define its own aliases if wanted.
This CL removes mAttr, mAttrAnyOf, mPat. A new base class, Constraint, is added. Now
TypeConstraint and AttrConstraint derive from Constraint. Type and Attr further derive
from TypeConstraint and AttrConstraint, respectively.
Comments are revised and examples are added to make it clear how to use constraints.
PiperOrigin-RevId:
240125076
Mehdi Amini [Mon, 25 Mar 2019 07:29:00 +0000 (00:29 -0700)]
Using getContext() instead of getInstruction()->getContext() on Operation (NFC)
PiperOrigin-RevId:
240088209
River Riddle [Mon, 25 Mar 2019 06:51:05 +0000 (23:51 -0700)]
Update some of the derived type classes to use getImpl instead of a static_cast.
PiperOrigin-RevId:
240084937
Chris Lattner [Mon, 25 Mar 2019 06:26:39 +0000 (23:26 -0700)]
Various small cleanups to the code, mostly removing const_cast's.
PiperOrigin-RevId:
240083489
Mehdi Amini [Mon, 25 Mar 2019 05:09:41 +0000 (22:09 -0700)]
Add a `getImpl()` utility method to the `TypeBase` class as a convenience for derived class to access their associated TypeStorage (NFC)
PiperOrigin-RevId:
240077874
Mehdi Amini [Mon, 25 Mar 2019 04:52:49 +0000 (21:52 -0700)]
Change TypeStorage from a struct into a class (NFC)
By coding standard, we try to keep struct as pure storage without method or other logic attached to it.
PiperOrigin-RevId:
240076419
Mehdi Amini [Mon, 25 Mar 2019 04:41:36 +0000 (21:41 -0700)]
Move TypeStorage out of the detail namespace
Dialect implementer are expected to inherit from this class when implementing their types. It does not seems right when using MLIR "from the outside" to use directly something from `mlir::detail::`.
PiperOrigin-RevId:
240075769
River Riddle [Mon, 25 Mar 2019 03:35:07 +0000 (20:35 -0700)]
NFC: Rename the 'if' operation in the AffineOps dialect to 'affine.if'.
PiperOrigin-RevId:
240071154
Mehdi Amini [Mon, 25 Mar 2019 03:34:16 +0000 (20:34 -0700)]
Remove `alignas(8) from TypeStorage class
This is here from history at a time where it was bit-packed and storage was dependent on this.
PiperOrigin-RevId:
240071093
Chris Lattner [Mon, 25 Mar 2019 02:53:05 +0000 (19:53 -0700)]
Remove OpPointer, cleaning up a ton of code. This also moves Ops to using
inherited constructors, which is cleaner and means you can now use DimOp()
to get a null op, instead of having to use Instruction::getNull<DimOp>().
This removes another 200 lines of code.
PiperOrigin-RevId:
240068113
Jacques Pienaar [Mon, 25 Mar 2019 02:35:20 +0000 (19:35 -0700)]
Fix missing parenthesis around negation.
This should probably be changed to instead use the negated form (e.g., get predicate + negate it + get resulting template), but this fixes it locally.
PiperOrigin-RevId:
240067116
Mehdi Amini [Mon, 25 Mar 2019 01:48:21 +0000 (18:48 -0700)]
Add a routine to allow registering a dialect without relying on global constructors.
Using global constructors should not be mandatory when possible, clients should be able to register a dialect explicitly when they want.
PiperOrigin-RevId:
240064244
Chris Lattner [Sun, 24 Mar 2019 20:02:43 +0000 (13:02 -0700)]
Push a bunch of 'consts' out of the *Op structure, in prep for removing
OpPointer.
PiperOrigin-RevId:
240044712
Nicolas Vasilache [Sun, 24 Mar 2019 17:45:22 +0000 (10:45 -0700)]
Cleanup ValueHandleArray
We just need a way to unpack ArrayRef<ValueHandle> to ArrayRef<Value*>.
No need to expose this to the user.
This reduces the cognitive overhead for the tutorial.
PiperOrigin-RevId:
240037425
Chris Lattner [Sat, 23 Mar 2019 23:42:01 +0000 (16:42 -0700)]
Deconst-ify MLIRContext, and detemplatize some stuff now that const is gone.
PiperOrigin-RevId:
239976764
Mehdi Amini [Sat, 23 Mar 2019 22:19:51 +0000 (15:19 -0700)]
Add a convenience getContext() method in OpState to reduce boilerplate on clients.
PiperOrigin-RevId:
239972907
Chris Lattner [Sat, 23 Mar 2019 22:09:06 +0000 (15:09 -0700)]
Remove const from Value, Instruction, Argument, and the various methods on the
*Op classes. This is a net reduction by almost 400LOC.
PiperOrigin-RevId:
239972443
Jacques Pienaar [Sat, 23 Mar 2019 17:36:55 +0000 (10:36 -0700)]
Return operand_range instead for generated variadic operands accessor.
PiperOrigin-RevId:
239959381
River Riddle [Sat, 23 Mar 2019 17:12:31 +0000 (10:12 -0700)]
Clarify the comment on valid data during DenseElementsAttr construction.
PiperOrigin-RevId:
239958211
Chris Lattner [Sat, 23 Mar 2019 16:03:07 +0000 (09:03 -0700)]
Now that ConstOpPointer is gone, we can change the various methods generated by
tblgen be non-const. This requires introducing some const_cast's at the
moment, but those (and lots more stuff) will disappear in subsequent patches.
This significantly simplifies those patches because the various tblgen op emitters
get adjusted.
PiperOrigin-RevId:
239954566
Jacques Pienaar [Sat, 23 Mar 2019 12:05:20 +0000 (05:05 -0700)]
Verify first body is not empty before testing last character.
Avoids sigabrt where body is empty.
PiperOrigin-RevId:
239942200
River Riddle [Sat, 23 Mar 2019 07:40:25 +0000 (00:40 -0700)]
Cleanup the construction of attributes and fix a opt-mode bug in DenseElementsAttr when allocating an empty array buffer.
PiperOrigin-RevId:
239926824
Mehdi Amini [Sat, 23 Mar 2019 05:26:01 +0000 (22:26 -0700)]
At missing mlir:: namespace qualifier in front of function definition
This was defining a function in the global namespace instead of the mlir one.
PiperOrigin-RevId:
239918509
Mehdi Amini [Sat, 23 Mar 2019 05:17:10 +0000 (22:17 -0700)]
Add a parserSourceFile function that takes a file path directly
This avoids adding boilerplate around the SourceMgr on the client.
PiperOrigin-RevId:
239918122
Geoffrey Martin-Noble [Sat, 23 Mar 2019 01:03:58 +0000 (18:03 -0700)]
Add tablegen aliases for OpTraits ResultsAreFloatLike and SameOperandsAndResultShape
Startblock:
cl/
239891224 is submitted
PiperOrigin-RevId:
239899356
River Riddle [Sat, 23 Mar 2019 00:54:26 +0000 (17:54 -0700)]
Remove "<label>" from the llvm basic block CHECK names.
PiperOrigin-RevId:
239898185
Jacques Pienaar [Fri, 22 Mar 2019 22:26:05 +0000 (15:26 -0700)]
Start elemental type constraint specification modelling.
Enable users specifying operand type constraint combinations (e.g., considering multiple operands). Some of these will be refactored (particularly the OpBase change and that should also not be needed to be done by most users), but the focus is more on user side (shown in test). The generated code for this does not take any known facts into account or perform any simplification.
Start with 2 primities to specify 1) whether an operand has a specific element type, and 2) whether an operand's element type matches another operands element type.
PiperOrigin-RevId:
239875712
Feng Liu [Fri, 22 Mar 2019 18:22:20 +0000 (11:22 -0700)]
Define the base class for attributes containing types
This attribute has checks for verifying it is an mlir::TypeAttr and the
subclass can specify the mlir::Type as the value.
PiperOrigin-RevId:
239830412
Nicolas Vasilache [Fri, 22 Mar 2019 16:10:01 +0000 (09:10 -0700)]
Rename edsc::EDSCxxxBuilder to edsc::xxxBuilder - NFC
PiperOrigin-RevId:
239805692
Nicolas Vasilache [Fri, 22 Mar 2019 14:31:00 +0000 (07:31 -0700)]
Support composition of symbols in AffineApplyOp
This CL revisits the composition of AffineApplyOp for the special case where a symbol
itself comes from an AffineApplyOp.
This is achieved by rewriting such symbols into dims to allow composition to occur mathematically.
The implementation is also refactored to improve readability.
Rationale for locally rewriting symbols as dims:
================================================
The mathematical composition of AffineMap must always concatenate symbols
because it does not have enough information to do otherwise. For example,
composing `(d0)[s0] -> (d0 + s0)` with itself must produce
`(d0)[s0, s1] -> (d0 + s0 + s1)`.
The result is only equivalent to `(d0)[s0] -> (d0 + 2 * s0)` when
applied to the same mlir::Value* for both s0 and s1.
As a consequence mathematical composition of AffineMap always concatenates
symbols.
When AffineMaps are used in AffineApplyOp however, they may specify
composition via symbols, which is ambiguous mathematically. This corner case
is handled by locally rewriting such symbols that come from AffineApplyOp
into dims and composing through dims.
PiperOrigin-RevId:
239791597
Mehdi Amini [Fri, 22 Mar 2019 06:18:11 +0000 (23:18 -0700)]
Remove declaration and unused reference to non-existent type `TensorTypeStorage` (NFC)
PiperOrigin-RevId:
239743070
Chris Lattner [Fri, 22 Mar 2019 00:53:00 +0000 (17:53 -0700)]
Remove const from mlir::Block.
This also eliminates some incorrect reinterpret_cast logic working around it, and numerous const-incorrect issues (like block argument iteration).
PiperOrigin-RevId:
239712029
Chris Lattner [Thu, 21 Mar 2019 18:57:14 +0000 (11:57 -0700)]
Remove const support from mlir::Region
PiperOrigin-RevId:
239642194
Chris Lattner [Thu, 21 Mar 2019 18:39:22 +0000 (11:39 -0700)]
Continue pushing const out of the core IR types - in this case, remove const
from Function.
PiperOrigin-RevId:
239638635
River Riddle [Thu, 21 Mar 2019 17:03:40 +0000 (10:03 -0700)]
Add support for building a DenseIntElementsAttr with ArrayRef<int64_t> values.
PiperOrigin-RevId:
239616595
Nicolas Vasilache [Thu, 21 Mar 2019 16:59:57 +0000 (09:59 -0700)]
Better document TemplatedIndexedValue
PiperOrigin-RevId:
239615534
Nicolas Vasilache [Thu, 21 Mar 2019 15:44:20 +0000 (08:44 -0700)]
Make edsc::IndexedValue templated - NFC
This allows the indexing sugar to just work naturally with other type of load and store ops than the affine ones we currently have.
This is needed for the EuroLLVM tutorial.
PiperOrigin-RevId:
239602257
Mehdi Amini [Thu, 21 Mar 2019 15:42:06 +0000 (08:42 -0700)]
Add 10 "private" kind ranges for MLIR type kind.
This is useful when developing one or multiple dialects in a private context without having to register them with MLIR Core.
PiperOrigin-RevId:
239601844
Nicolas Vasilache [Thu, 21 Mar 2019 15:25:51 +0000 (08:25 -0700)]
Reserve type range for the Linalg dialect
PiperOrigin-RevId:
239599147
Mehdi Amini [Thu, 21 Mar 2019 15:21:21 +0000 (08:21 -0700)]
Fix class description for Attributes: the instance of the class aren't uniqued, the class has reference semantics.
PiperOrigin-RevId:
239598522
Nicolas Vasilache [Thu, 21 Mar 2019 15:07:15 +0000 (08:07 -0700)]
Add intrinsics for constants
PiperOrigin-RevId:
239596595
Nicolas Vasilache [Thu, 21 Mar 2019 14:32:51 +0000 (07:32 -0700)]
Improve comment for `augmentMapAndBounds`
Followup from a previous CL.
PiperOrigin-RevId:
239591775
Mehdi Amini [Thu, 21 Mar 2019 05:34:49 +0000 (22:34 -0700)]
Add comment describing what IREE (IR Execution Engine) stands for in the dialect registration.
PiperOrigin-RevId:
239539263
Chris Lattner [Thu, 21 Mar 2019 04:14:59 +0000 (21:14 -0700)]
Continue pushing const out of the IR types - removing the notion of a 'const
Module'. NFC.
PiperOrigin-RevId:
239532885
Jacques Pienaar [Thu, 21 Mar 2019 03:28:58 +0000 (20:28 -0700)]
Add contributing file.
Initially no external contributions will be accepted (until post dev meeting at
least).
PiperOrigin-RevId:
239528594
Chris Lattner [Thu, 21 Mar 2019 00:48:43 +0000 (17:48 -0700)]
Move to new `const` model, part 1: remove ConstOpPointer.
This eliminate ConstOpPointer (but keeps OpPointer for now) by making OpPointer
implicitly launder const in a const incorrect way. It will eventually go away
entirely, this is a progressive step towards the new const model.
PiperOrigin-RevId:
239512640
Chris Lattner [Thu, 21 Mar 2019 00:32:52 +0000 (17:32 -0700)]
Add a nice quote from Bjarke to summarize the const situation.
PiperOrigin-RevId:
239510578
Lei Zhang [Thu, 21 Mar 2019 00:25:34 +0000 (17:25 -0700)]
[TableGen] Generate op declaration and definition into different files
Previously we emit both op declaration and definition into one file and include it
in *Ops.h. That pulls in lots of implementation details in the header file and we
cannot hide symbols local to implementation. This CL splits them to provide a cleaner
interface.
The way how we define custom builders in TableGen is changed accordingly because now
we need to distinguish signatures and implementation logic. Some custom builders with
complicated logic now can be moved to be implemented in .cpp entirely.
PiperOrigin-RevId:
239509594
Chris Lattner [Wed, 20 Mar 2019 20:32:39 +0000 (13:32 -0700)]
Add a "Usage of Const in MLIR" doc, explaining the rationale for the design
point we're moving the compiler to.
PiperOrigin-RevId:
239462779
Nicolas Vasilache [Wed, 20 Mar 2019 17:23:04 +0000 (10:23 -0700)]
Properly propagate induction variable in tiling
This CL fixes an issue where cloned loop induction variables were not properly
propagated and beefs up the corresponding test.
PiperOrigin-RevId:
239422961
Lei Zhang [Wed, 20 Mar 2019 16:01:58 +0000 (09:01 -0700)]
Change getBroadcastedShape() to return result shape via parameter
This is a more efficient way than returning SmallVector directly.
PiperOrigin-RevId:
239407024
Jacques Pienaar [Tue, 19 Mar 2019 19:05:11 +0000 (12:05 -0700)]
Cleanup for changes failing with std=c++11
The static constexpr were failing with undefined reference due to lacking definition at namespace scope.
PiperOrigin-RevId:
239241157
River Riddle [Tue, 19 Mar 2019 17:59:02 +0000 (10:59 -0700)]
Add support for a standard TupleType. Though this is a standard type, it merely provides a common mechanism for representing tuples in MLIR. It is up to dialect authors to provides operations for manipulating them, e.g. extract_tuple_element.
TupleType has the following form:
tuple-type ::= `tuple` `<` (type (`,` type)*)? `>`
Example:
// Empty tuple.
tuple<>
// Single element.
tuple<i32>
// Multi element.
tuple<i32, tuple<f32>, i16>
PiperOrigin-RevId:
239226021
Jacques Pienaar [Tue, 19 Mar 2019 15:45:06 +0000 (08:45 -0700)]
Remove some statements that required >C++11, add includes and qualify names. NFC.
PiperOrigin-RevId:
239197784
Dimitrios Vytiniotis [Tue, 19 Mar 2019 08:19:01 +0000 (01:19 -0700)]
Avoiding allocations during argument attribute conversion.
PiperOrigin-RevId:
239144675
Jacques Pienaar [Tue, 19 Mar 2019 02:26:04 +0000 (19:26 -0700)]
Remove index free function
Avoids including function in C++ side that resulted in OSS C++ errors:
include/mlir-c/Core.h:228:16: error: functions that differ only in their
return type cannot be overloaded
edsc_indexed_t index(edsc_indexed_t indexed, edsc_expr_list_t indices);
~~~~~~~~~~~~~~ ^
/usr/include/string.h:484:14: note: previous declaration is here
extern char *index (const char *__s, int __c)
And as these are going away soon, just removing the function requires the least changes.
PiperOrigin-RevId:
239110470
River Riddle [Mon, 18 Mar 2019 20:42:55 +0000 (13:42 -0700)]
Add support for parsing true/false inside of a splat tensor literal.
PiperOrigin-RevId:
239052061
River Riddle [Mon, 18 Mar 2019 18:56:18 +0000 (11:56 -0700)]
Give PassInstrumentor a SmartMutex to lock access to the held instrumentations.
PiperOrigin-RevId:
239031524
Jacques Pienaar [Mon, 18 Mar 2019 17:21:57 +0000 (10:21 -0700)]
Change trait verification to support older clang & gcc.
This was resulting in an error:
explicit specialization of 'BaseProperties' in class scope
pre clang-7.0 (C++ DR 275).
PiperOrigin-RevId:
239010696
Jacques Pienaar [Mon, 18 Mar 2019 16:26:20 +0000 (09:26 -0700)]
Cleanups for OSS build.
PiperOrigin-RevId:
238999629
Nicolas Vasilache [Mon, 18 Mar 2019 15:07:19 +0000 (08:07 -0700)]
Cleanups Vectorize and SliceAnalysis - NFC
This CL cleans up and refactors super-vectorization and slice analysis.
PiperOrigin-RevId:
238986866
Jacques Pienaar [Mon, 18 Mar 2019 14:54:20 +0000 (07:54 -0700)]
Change Value to NamedTypeConstraint and use TypeConstraint.
Previously Value was a pair of name & Type, but for operands/result a TypeConstraint rather then a Type is specified. Update C++ side to match declarative side.
PiperOrigin-RevId:
238984799
Nicolas Vasilache [Mon, 18 Mar 2019 13:52:23 +0000 (06:52 -0700)]
Port Tablegen'd reference implementation of Add to declarative builders.
PiperOrigin-RevId:
238977252
Nicolas Vasilache [Mon, 18 Mar 2019 13:26:05 +0000 (06:26 -0700)]
Remove LOAD/STORE/RETURN boilerplate in declarative builders.
This CL introduces a ValueArrayHandle helper to manage the implicit conversion
of ArrayRef<ValueHandle> -> ArrayRef<Value*> by converting first to ValueArrayHandle.
Without this, boilerplate operations that take ArrayRef<Value*> cannot be removed easily.
This all seems to boil down to decoupling Value from Type.
Alternative solutions exist (e.g. MLIR using Value by value everywhere) but they would be very intrusive. This seems to be the lowest impedance change.
Intrinsics are also lowercased by popular demand.
PiperOrigin-RevId:
238974125
Nicolas Vasilache [Mon, 18 Mar 2019 13:03:00 +0000 (06:03 -0700)]
Port LowerVectorTransfers from EDSC + AST to declarative builders
This CL removes the dependency of LowerVectorTransfers on the AST version of EDSCs which will be retired.
This exhibited a pretty fundamental staging difference in AST-based vs declarative based emission.
Since the delayed creation with an AST was staged, the loop order came into existence after the clipping expressions were computed.
This now changes as the loops first need to be created declaratively in fixed order and then the clipping expressions are created.
Also, due to lack of staging, coalescing cannot be done on the fly anymore and
needs to be done either as a pre-pass (current implementation) or as a local transformation on the generated IR (future work).
Tests are updated accordingly.
PiperOrigin-RevId:
238971631