Nicolas Vasilache [Fri, 5 Apr 2019 02:57:42 +0000 (19:57 -0700)]
Linalg portion of the tutorial - part 4
This CL adds declarative tiling support in the linalg dialect by providing:
1. loop tiling on linalg ops by simply calling into mlir::tile
2. view tiling on linalg ops by:
a. computing the subview between for each tile dimension based on the loop tile size and the mapping of loops to operand ranges.
b. declaring that the tiled form of a tensorcontraction is the same tensorcontraction on subviews, which essentially gives us a recursive form.
Point 2.b is potentially subject to change in the future.
--
PiperOrigin-RevId:
242058658
River Riddle [Fri, 5 Apr 2019 01:34:41 +0000 (18:34 -0700)]
NFC: Fix a few typos in the tutorials and one in the comment of FunctionAttr::dropFunctionReference.
--
PiperOrigin-RevId:
242050934
Mehdi Amini [Fri, 5 Apr 2019 01:31:31 +0000 (18:31 -0700)]
Add Chapter 4 for the Toy tutorial: shape inference, function specialization, and basic combines
--
PiperOrigin-RevId:
242050514
Mehdi Amini [Fri, 5 Apr 2019 01:22:17 +0000 (18:22 -0700)]
Add mention that we don't (yet) accept contributions in the README
--
PiperOrigin-RevId:
242049527
Nicolas Vasilache [Fri, 5 Apr 2019 00:54:41 +0000 (17:54 -0700)]
Linalg portion of the tutorial - part 3-3
This CL adds the last bit to convert from linalg.LoadOp and linalg.StoreOp to the affine dialect, as well as a unit test to exercise the conversion.
--
PiperOrigin-RevId:
242045826
River Riddle [Thu, 4 Apr 2019 23:24:10 +0000 (16:24 -0700)]
NFC: Replace usages of iterator_range<operand_iterator> with operand_range.
--
PiperOrigin-RevId:
242031201
River Riddle [Thu, 4 Apr 2019 23:01:45 +0000 (16:01 -0700)]
Introduce a new class, MultiOperandTraitBase, to deduplicate the operand accessors for traits with multiple operands.
As part of this cleanup, NOperands<0>::Impl and NOperands<1>::Impl are typedef'd to ZeroOperands and OneOperand respectively.
--
PiperOrigin-RevId:
242027189
River Riddle [Thu, 4 Apr 2019 22:30:34 +0000 (15:30 -0700)]
NFC: Fix erroneous use of 'OpaqueType' with 'Type' when setting the ToyTypeKind, as well as a few mistakes in Chapter 2 of the Toy tutorial.
--
PiperOrigin-RevId:
242021477
MLIR Team [Thu, 4 Apr 2019 22:19:17 +0000 (15:19 -0700)]
Create a LoopUtil function to return perfectly nested loop set
--
PiperOrigin-RevId:
242019230
River Riddle [Thu, 4 Apr 2019 21:42:18 +0000 (14:42 -0700)]
Iterate on the operations to fold in TestConstantFold in reverse to remove the need for ConstantFoldHelper to have a flag for insertion at the head of the entry block. This also fixes an asan bug in TestConstantFold due to the iteration order of operations and ConstantFoldHelper's constant insertion placement.
Note: This now means that we cannot fold chains of operations, i.e. where constant foldable operations feed into each other. Given that this is a testing pass solely for constant folding, this isn't really something that we want anyways. Constant fold tests should be simple and direct, with more advanced folding/feeding being tested with the canonicalizer.
--
PiperOrigin-RevId:
242011744
River Riddle [Thu, 4 Apr 2019 20:25:29 +0000 (13:25 -0700)]
Fix a few warnings for missing parentheses around '||' and extra semicolons.
--
PiperOrigin-RevId:
241994767
Lei Zhang [Thu, 4 Apr 2019 18:40:57 +0000 (11:40 -0700)]
Deduplicate constant folding logic in ConstantFold and GreedyPatternRewriteDriver
There are two places containing constant folding logic right now: the ConstantFold
pass and the GreedyPatternRewriteDriver. The logic was not shared and started to
drift apart. We were testing constant folding logic using the ConstantFold pass,
but lagged behind the GreedyPatternRewriteDriver, where we really want the constant
folding to happen.
This CL pulled the logic into utility functions and classes for sharing between
these two places. A new ConstantFoldHelper class is created to help constant fold
and de-duplication.
Also, renamed the ConstantFold pass to TestConstantFold to make it clear that it is
intended for testing purpose.
--
PiperOrigin-RevId:
241971681
River Riddle [Thu, 4 Apr 2019 18:13:02 +0000 (11:13 -0700)]
Remove the non-postorder walk functions from Function/Block/Instruction and rename walkPostOrder to walk.
--
PiperOrigin-RevId:
241965239
Andy Davis [Thu, 4 Apr 2019 17:42:45 +0000 (10:42 -0700)]
Fix bug in LoopTiling where creation of tile-space loop upper bound did not handle symbol operands correctly.
--
PiperOrigin-RevId:
241958502
Andy Davis [Thu, 4 Apr 2019 17:35:51 +0000 (10:35 -0700)]
Adds dependence analysis support for iteration domains with local variables (enables dependence analysis of loops with non-unit step).
--
PiperOrigin-RevId:
241957023
Lei Zhang [Thu, 4 Apr 2019 16:25:38 +0000 (09:25 -0700)]
[TableGen] Enforce constraints on attributes
Previously, attribute constraints are basically unused: we set true for almost
anything. This CL refactors common attribute kinds and sets constraints on
them properly. And fixed verification failures found by this change.
A noticeable one is that certain TF ops' attributes are required to be 64-bit
integer, but the corresponding TFLite ops expect 32-bit integer attributes.
Added bitwidth converters to handle this difference.
--
PiperOrigin-RevId:
241944008
Lei Zhang [Thu, 4 Apr 2019 12:44:58 +0000 (05:44 -0700)]
[TableGen] Add PatternSymbolResolver for resolving symbols bound in patterns
We can bind symbols to op arguments/results in source pattern and op results in
result pattern. Previously resolving these symbols is scattered across
RewriterGen.cpp. This CL aggregated them into a `PatternSymbolResolver` class.
While we are here, this CL also cleans up tests for patterns to make them more
focused. Specifically, one-op-one-result.td is superseded by pattern.td;
pattern-tAttr.td is simplified; pattern-bound-symbol.td is added for the change
in this CL.
--
PiperOrigin-RevId:
241913973
Lei Zhang [Thu, 4 Apr 2019 11:29:58 +0000 (04:29 -0700)]
[TableGen] Rework verifier generation and error messages
Previously we bundle the existence check and the MLIR attribute kind check
in one call. Further constraints (like element bitwidth) have to be split
into following checks. That is not a nice separation given that we have more
checks for constraints. Instead, this CL changes to generate a local variable
for every attribute, check its existence first, then check the constraints.
Creating a local variable for each attribute also avoids querying it multiple
times using the raw getAttr() API. This is a win for both performance the
readability of the generated code.
This CL also changed the error message to be more greppable by delimiting
the error message from constraints with boilerplate part with colon.
--
PiperOrigin-RevId:
241906132
Alex Zinenko [Thu, 4 Apr 2019 08:43:21 +0000 (01:43 -0700)]
Example Linalg3: support Load/Store conversion from Linalg to LLVM IR dialect
Load and Store Linalg operations are converter to their LLVM IR counterparts
preceded by a sequence of operations that recover the effective address of the
accessed element. The address is computed given the subscripts and the view
descriptor as
base_pointer + base_offset + SUM_i subscript_i * stride_i.
Manual testing shows that the resulting LLVM IR for the matrix multiplication
example can be compiled and executed, producing correct results.
--
PiperOrigin-RevId:
241889003
Mehdi Amini [Thu, 4 Apr 2019 02:16:32 +0000 (19:16 -0700)]
Fix Toy Ch3 testing with CMake
Mainly a missing dependency caused the tests to pass if one already built
the repo, but not from a clean (or incremental) build.
--
PiperOrigin-RevId:
241852313
Mehdi Amini [Thu, 4 Apr 2019 01:45:01 +0000 (18:45 -0700)]
Chapter 3 for Toy tutorial: introduction of a dialect
--
PiperOrigin-RevId:
241849162
Dan Zheng [Thu, 4 Apr 2019 01:27:23 +0000 (18:27 -0700)]
[README] Fix links, minor edits.
Fix links without breaking g3doc.
Minor stylistic edits.
--
PiperOrigin-RevId:
241846985
Dan Zheng [Thu, 4 Apr 2019 00:50:41 +0000 (17:50 -0700)]
[README] Minor edits.
Minor stylistic edits.
Use standard "TensorFlow" spelling.
--
PiperOrigin-RevId:
241842272
Stella Laurenzo [Thu, 4 Apr 2019 00:43:00 +0000 (17:43 -0700)]
Add CMakeLists.txt for Quantization and FxpMathOps dialects (and misc fixes to build with OSS setup).
Tested:
cmake -G Ninja ../llvm/ -DLLVM_BUILD_EXAMPLES=ON
ninja check-mlir
--
PiperOrigin-RevId:
241841296
Mehdi Amini [Wed, 3 Apr 2019 23:49:01 +0000 (16:49 -0700)]
Rename UnknownType to OpaqueType (NFC)
This came up in a review of the tutorial, it was suggested that "opaque" is more
descriptive than "unknown" here.
--
PiperOrigin-RevId:
241832927
Mehdi Amini [Wed, 3 Apr 2019 23:38:53 +0000 (16:38 -0700)]
Move the top-level `tutorial` as `Linalg` nested in the examples folder
--
PiperOrigin-RevId:
241831176
Stella Laurenzo [Wed, 3 Apr 2019 23:07:37 +0000 (16:07 -0700)]
Split the Quantization dialect.
- Retains Quantization types and predicates.
- Retains utilities and example (testable) passes/ops.
- Retains unit tests for example passes/ops.
- Moves fixed point ops (and corresponding real ops) to FxpMathOps.
- Moves real -> fixed point pass to FxpMathOps.
- Sever the dependency on the TF dialect from Quantization. These dialects should now be open-sourcable.
--
PiperOrigin-RevId:
241825598
Feng Liu [Wed, 3 Apr 2019 22:19:56 +0000 (15:19 -0700)]
Fix the alignment issue in the DenseElementsAttr buffer allocation
Currently, we only make the initial address aligned with 64-bit address but
allocate the buffer with the real size. This can cause issue when we extract
the value by the `readBits` method, which needs to read the memory in the
granularity of APINT_WORD_SIZE. In this CL, we rounded the allocation size to
the multiplies of APINT_WORD_SIZE to fix the issue.
--
PiperOrigin-RevId:
241816656
Rob Suderman [Wed, 3 Apr 2019 21:30:17 +0000 (14:30 -0700)]
Added memref to OpBase.td as specific memref types should be supported by default.
--
PiperOrigin-RevId:
241806461
Smit Hinsu [Wed, 3 Apr 2019 21:05:23 +0000 (14:05 -0700)]
Remove links to internal google docs, updating them to point to GitHub.
PiperOrigin-RevId:
241801638
Chris Lattner [Wed, 3 Apr 2019 21:00:30 +0000 (14:00 -0700)]
Remove links to internal google docs, updating them to point to GitHub.
--
PiperOrigin-RevId:
241800478
Stella Laurenzo [Wed, 3 Apr 2019 19:40:30 +0000 (12:40 -0700)]
Refactor Quantization.md to separate TFLite native quantization scheme from the more experimental, generalized scheme.
PiperOrigin-RevId:
241785572
Nicolas Vasilache [Wed, 3 Apr 2019 19:33:01 +0000 (12:33 -0700)]
Linalg portion of the tutorial - part 3-2
This CL adds support for lowering tensor contractions to loops declaratively.
This is done thanks to two properties of the such operations:
1. the definition of an AffineMap getLoopsToOperandRangesMap for each op which maps iteration space dimensions to ranges of the view operands, in their order of occurrence;
2. the definition of a scalar implementation for each op which creates the computation inside the loops given enclosing parallel and reduction loops,
All the other properties are derived in a generic fashion from these 2 properties and a few analyses.
A lowerToLoops transformation is added as well as a test that exercises it.
--
PiperOrigin-RevId:
241783992
Lei Zhang [Wed, 3 Apr 2019 19:29:14 +0000 (12:29 -0700)]
[TableGen] Allow additional result patterns not directly used for replacement
This CL looses the requirement that all result patterns in a rewrite rule must
replace a result of the root op in the source pattern. Now only the last N
result pattern-generated ops are used to replace a N-result source op.
This allows to generate additional ops to aid building up final ops used to
replace the source op.
--
PiperOrigin-RevId:
241783192
Stella Laurenzo [Wed, 3 Apr 2019 18:16:32 +0000 (11:16 -0700)]
Initial release of the Quantization dialect
Includes a draft of documentation for the quantization setup.
Given how many comments such docs have garnered in the past, I've biased towards a lightly edited first-draft so that people can argue about terminology, approach and structure without having spent too much time on it.
Note that the sections under "Uniform quantization" were cribbed nearly verbatim from internal documentation that Daniel wrote.
PiperOrigin-RevId:
241768668
Lei Zhang [Wed, 3 Apr 2019 17:48:07 +0000 (10:48 -0700)]
[TableGen] Fix convertFromStorage for OptionalAttr
OptionalAttr is just wrapping around the actual attribute; so it should just use
the actual attribute's `convertFromStorage` to read the value and wrap it around
with `Optional<>` to return. Previously it was mandating how the actual attribute
reads the value with `{0}.getValue()`.
--
PiperOrigin-RevId:
241762355
Alex Zinenko [Wed, 3 Apr 2019 17:38:47 +0000 (10:38 -0700)]
Tutorial Linalg1: implement conversion to the LLVM Dialect
Implement conversion from the Linalg dialect to the LLVM dialect using a simple
set of DialectOpConverters and by plugging them into the dialect conversion
infrastructure. View and Range Linalg types are converted into descriptors
that store the dynamic values in an LLVM aggregate type, similarly to memrefs.
Slice operations create new descriptors based on the original descriptors and
thus remove the constraint on ViewTypes not being acceptable as function
arguments.
--
PiperOrigin-RevId:
241760189
Mehdi Amini [Wed, 3 Apr 2019 16:40:08 +0000 (09:40 -0700)]
Add mention of the TensorFlow Code of Conduct in the Readme
PiperOrigin-RevId:
241748009
Mehdi Amini [Wed, 3 Apr 2019 16:29:52 +0000 (09:29 -0700)]
Add missing source file in CMakeLists.txt
--
PiperOrigin-RevId:
241746122
Lei Zhang [Wed, 3 Apr 2019 16:29:25 +0000 (09:29 -0700)]
[TableGen] Remove asserts for attributes in aggregate builders
Attributes can have default values or be optional. Checking the validity of
attributes in aggregate builder should consider that. And to be accurate,
we should check all required attributes are indeed provided in the list.
This is actually duplicating the work done by verifier. Checking the validity
of attributes should be the responsiblity of verifiers. This CL removes
the assertion for attributes in aggregate builders for the above reason.
(Assertions for operands/results are still kept since they are trivial.)
Also added more tests for aggregate builders.
--
PiperOrigin-RevId:
241746059
Mehdi Amini [Wed, 3 Apr 2019 16:20:26 +0000 (09:20 -0700)]
Fix CMake build
Some files were not built anymore internally but still referenced
from CMake. Delete them and unreference them in the CMake files.
--
PiperOrigin-RevId:
241744718
Mehdi Amini [Wed, 3 Apr 2019 15:28:29 +0000 (08:28 -0700)]
Update Readme to mention that the TensorFlow specific will be upstreamed later
--
PiperOrigin-RevId:
241735845
Alex Zinenko [Wed, 3 Apr 2019 13:11:03 +0000 (06:11 -0700)]
Drop MLIREmitter-based version of the EDSC
This version has been deprecated and can now be removed completely since the
last remaining user (Python bindings) migrated to declarative builders.
Several functions in lib/EDSC/Types.cpp construct core IR objects for the C
bindings. Move these functions into lib/EDSC/CoreAPIs.cpp until we decide
where they should live.
This completes the migration from the delayed-construction EDSC to Declarative
Builders.
--
PiperOrigin-RevId:
241716729
Alex Zinenko [Wed, 3 Apr 2019 12:43:44 +0000 (05:43 -0700)]
Python bindings: drop MLIREmitter and related functionality
This completes the transition of Python bindings to use the declarative
builders infrastructure instead of the now-deprecated EDSC emitter
infrastructure. The relevant unit tests have been replicated using the new
functionality and the remaining end-to-end compilation tests have been updated
accordingly. The latter show an improvement in brevity and readability.
--
PiperOrigin-RevId:
241713489
Alex Zinenko [Wed, 3 Apr 2019 12:39:02 +0000 (05:39 -0700)]
Python bindings: support __floordiv__ for index types
The original reimplementation of EDSC as declarative builders and the
subsequent rework of Python bindings forbade to use the (true) division
operator for values of the index types without providing an alternative. Index
types only support floor and ceil division through affine maps. Expose this to
Python bindings through a `__floordiv__` function on `ValueHandle`s.
--
PiperOrigin-RevId:
241713093
Mehdi Amini [Wed, 3 Apr 2019 08:47:13 +0000 (01:47 -0700)]
Remove section of the README copied from the Rationale document, it does not fit here.
--
PiperOrigin-RevId:
241687723
Nicolas Vasilache [Wed, 3 Apr 2019 07:46:40 +0000 (00:46 -0700)]
Fix test that fails on non-determinism in LowerVectorTransfers
This CL fixes the non-determinism across compilers in an edsc::select expression used in LowerVectorTransfers. This is achieved by factoring the expression out of the function call to ensure a deterministic order of evaluation.
Since the expression is now factored out, fewer IR is generated and the test is updated accordingly.
--
PiperOrigin-RevId:
241679962
Mehdi Amini [Wed, 3 Apr 2019 01:14:56 +0000 (18:14 -0700)]
Fix path for the examples in Toy tutorial Ch1
PiperOrigin-RevId:
241643625
Mehdi Amini [Wed, 3 Apr 2019 01:07:26 +0000 (18:07 -0700)]
Add link to the Toy tutorial in the Readme
--
PiperOrigin-RevId:
241642739
River Riddle [Tue, 2 Apr 2019 22:50:51 +0000 (15:50 -0700)]
Add fake-use for variable in LLVMDialect.cpp to fix opt build.
--
PiperOrigin-RevId:
241620442
Mehdi Amini [Tue, 2 Apr 2019 22:41:22 +0000 (15:41 -0700)]
Fix minor typo (triggered a GCC warning, NFC)
--
PiperOrigin-RevId:
241618796
Alex Zinenko [Tue, 2 Apr 2019 22:33:54 +0000 (15:33 -0700)]
Introduce custom format for the LLVM IR Dialect
Historically, the LLVM IR dialect has been using the generic form of MLIR
operation syntax. It is verbose and often redundant. Introduce the custom
printing and parsing for all existing operations in the LLVM IR dialect.
Update the relevant documentation and tests.
--
PiperOrigin-RevId:
241617393
Mehdi Amini [Tue, 2 Apr 2019 22:15:20 +0000 (15:15 -0700)]
Add -DLLVM_BUILD_EXAMPLES to the mlir build instruction: this enables the tutorial examples
Seems like a better default for getting started.
--
PiperOrigin-RevId:
241614043
Mehdi Amini [Tue, 2 Apr 2019 22:13:26 +0000 (15:13 -0700)]
Fix Toy tutorial gcc 7 build (NFC)
--
PiperOrigin-RevId:
241613710
Nicolas Vasilache [Tue, 2 Apr 2019 21:35:09 +0000 (14:35 -0700)]
Linalg portion of the tutorial - part 3
This CL starts the third part of the Linalg tutorial by adding support for ops to declare how they lower themselves to other ops.
Tests are added that demonstrate matmul lowering to a loop over matvec and matvec lowering to a loop over dot.
This is part of a list of CLs that add new Transforms and Analyses to Linalg3: it iseasier to integrate in small chunks.
As part of working with the TensorContractionBase template class and in an effort to add pieces incrementally without copying code, it is easiest to define operations ahead of time in Linalg2/TensorOps.h and gradually implement them as needed. This CL performs the necessary refactoring for this to happen.
--
PiperOrigin-RevId:
241605869
River Riddle [Tue, 2 Apr 2019 21:02:32 +0000 (14:02 -0700)]
Update the dialect attribute verification hooks to return LogicalResult instead of bool. This updates Function::emitError to return LogicalResult as well.
--
PiperOrigin-RevId:
241598892
Mehdi Amini [Tue, 2 Apr 2019 20:32:53 +0000 (13:32 -0700)]
Provide default `affineMapComposition` and memory space on `MemRefType::get()` (NFC)
This matches the builder API.
--
PiperOrigin-RevId:
241592869
Mehdi Amini [Tue, 2 Apr 2019 20:11:20 +0000 (13:11 -0700)]
Chapter 2 of the Toy tutorial
This introduces a basic MLIRGen through straight AST traversal,
without dialect registration at this point.
--
PiperOrigin-RevId:
241588354
River Riddle [Tue, 2 Apr 2019 20:09:34 +0000 (13:09 -0700)]
Rewrite the verify hooks on operations to use LogicalResult instead of bool. This also changes the return of Operation::emitError/emitOpError to LogicalResult as well.
--
PiperOrigin-RevId:
241588075
Nicolas Vasilache [Tue, 2 Apr 2019 17:32:18 +0000 (10:32 -0700)]
Linalg portion of the tutorial - part 2
The second part of the Linalg tutorial introduces:
1. the TensorContractionBase type from which all tensor contractions derive;
2. a basic set of operations DotOp, MatvecOp and MatmulOp;
3. a helper function `createFullyComposedView` that walks the producers of a SliceOp up until the root ViewOp and returns a single ViewOp;
4. programmatic examples to test MLIR construction involving these types.
This CL also refactors file organization so that:
1. clients only need to include Ops.h and Types.h while keeping independent small files separate for the purpose of the tutorial;
2. each step of the tutorial has its own linalgxxx include directory and each include explicitly states in which part of the tutorial a particular concept was introduced.
Lastly the following cleanups are applied:
1. ValueOrSliceOp is removed in favor of simpler helper function.
2. methods that walk back the chain of ops are removed from the core ops and added to a separate Analysis.
3. various additional cleanups.
--
PiperOrigin-RevId:
241555769
River Riddle [Tue, 2 Apr 2019 17:24:11 +0000 (10:24 -0700)]
Update the Function and Module verifiers to return LogicalResult instead of bool.
--
PiperOrigin-RevId:
241553930
Mehdi Amini [Tue, 2 Apr 2019 17:02:07 +0000 (10:02 -0700)]
Initial version for chapter 1 of the Toy tutorial
--
PiperOrigin-RevId:
241549247
Andy Davis [Tue, 2 Apr 2019 13:37:40 +0000 (06:37 -0700)]
Enable producer-consumer fusion for liveout memrefs if consumer read region matches producer write region.
--
PiperOrigin-RevId:
241517207
River Riddle [Tue, 2 Apr 2019 10:48:45 +0000 (03:48 -0700)]
Update the pass ir-printing test to not rely on rtti type pretty printing.
--
PiperOrigin-RevId:
241498090
River Riddle [Tue, 2 Apr 2019 03:43:13 +0000 (20:43 -0700)]
Remove MLPatternLoweringPass and rewrite LowerVectorTransfers to use RewritePattern instead.
--
PiperOrigin-RevId:
241455472
Lei Zhang [Tue, 2 Apr 2019 00:40:58 +0000 (17:40 -0700)]
[TableGen] Add Confined, IntMinValue, and ArrayMinCount for attribute constraints
This CL introduces Confined as a general mechanism to compose complex attribute
constraints out of more primitive ones. It's particularly useful for automatically
generating op definitions from some external source, where we can have random
combinations of primitive constraints and it would be impractical to define a case
for each of such combination.
Two primitive attribute constraints, IntMinValue and ArrayMinCount, are added to be
used together with Confined.
--
PiperOrigin-RevId:
241435955
Nicolas Vasilache [Mon, 1 Apr 2019 22:15:09 +0000 (15:15 -0700)]
Linalg portion of the tutorial - part 1
The first part of the Linalg tutorial introduces:
1. the RangeType and ViewType;
2. operations on those, namely RangeOp, ViewOp and SliceOp;
3. programmatic examples to test MLIR construction involving these types, ops and affine.for loops (with a mock custom op called "some_consumer").
--
PiperOrigin-RevId:
241409949
Mehdi Amini [Mon, 1 Apr 2019 18:28:27 +0000 (11:28 -0700)]
Use `this->` to access inherited member from dependent type (Fix GCC7 build, NFC)
--
PiperOrigin-RevId:
241364505
Mehdi Amini [Mon, 1 Apr 2019 18:19:02 +0000 (11:19 -0700)]
Minor fixes to README.md (NFC)
In particular fix the links to work on GitHub, and do not include RTTI to build.
--
PiperOrigin-RevId:
241362244
Mehdi Amini [Mon, 1 Apr 2019 17:42:34 +0000 (10:42 -0700)]
Add a getLoc() method on mlir::Value that returns the loc of the defining Operations if any, otherwise an unknown location
--
PiperOrigin-RevId:
241354085
Mehdi Amini [Mon, 1 Apr 2019 17:36:50 +0000 (10:36 -0700)]
Add a getContext() convenient accessor on mlir::Value (NFC)
--
PiperOrigin-RevId:
241352789
Mehdi Amini [Mon, 1 Apr 2019 17:17:45 +0000 (10:17 -0700)]
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
River Riddle [Mon, 1 Apr 2019 17:03:18 +0000 (10:03 -0700)]
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
Feng Liu [Mon, 1 Apr 2019 17:01:47 +0000 (10:01 -0700)]
Support 0-d tensor type attributes
This CL fixes the parser and printer to support the 0-d tensor type attributes.
--
PiperOrigin-RevId:
241345329
Feng Liu [Mon, 1 Apr 2019 16:39:59 +0000 (09:39 -0700)]
Minor fixes on the typo/naming/style in the Pattern.cpp file
--
PiperOrigin-RevId:
241341334
Lei Zhang [Mon, 1 Apr 2019 15:58:53 +0000 (08:58 -0700)]
[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
River Riddle [Mon, 1 Apr 2019 06:30:22 +0000 (23:30 -0700)]
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
River Riddle [Mon, 1 Apr 2019 05:08:12 +0000 (22:08 -0700)]
Update variable in PassTiming to refer to system_clock instead of high_resolution_clock.
--
PiperOrigin-RevId:
241260071
River Riddle [Sat, 30 Mar 2019 05:30:54 +0000 (22:30 -0700)]
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
Chris Lattner [Sat, 30 Mar 2019 05:23:34 +0000 (22:23 -0700)]
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
Jacques Pienaar [Sat, 30 Mar 2019 05:10:12 +0000 (22:10 -0700)]
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
River Riddle [Fri, 29 Mar 2019 21:18:08 +0000 (14:18 -0700)]
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
River Riddle [Fri, 29 Mar 2019 21:06:51 +0000 (14:06 -0700)]
Remove the MLIRContext parameter from Dialect::parseType. Dialects already have access to the context via Dialect::getContext.
--
PiperOrigin-RevId:
241047077
River Riddle [Fri, 29 Mar 2019 20:59:28 +0000 (13:59 -0700)]
Update TypeBase::verifyConstructionInvariants to use a LogicalResult return instead of bool.
--
PiperOrigin-RevId:
241045568
River Riddle [Fri, 29 Mar 2019 20:15:06 +0000 (13:15 -0700)]
Replace usages of instruction with operation in the g3 documents.
PiperOrigin-RevId:
241037784
Nicolas Vasilache [Fri, 29 Mar 2019 18:48:20 +0000 (11:48 -0700)]
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
Feng Liu [Fri, 29 Mar 2019 16:54:11 +0000 (09:54 -0700)]
remove the const quantifier before temp variable
PiperOrigin-RevId:
240997262
Nicolas Vasilache [Fri, 29 Mar 2019 16:47:30 +0000 (09:47 -0700)]
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
Feng Liu [Fri, 29 Mar 2019 16:36:09 +0000 (09:36 -0700)]
[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
Nicolas Vasilache [Fri, 29 Mar 2019 16:34:06 +0000 (09:34 -0700)]
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
River Riddle [Fri, 29 Mar 2019 16:18:45 +0000 (09:18 -0700)]
Slight rewording of TupleType rationale.
PiperOrigin-RevId:
240991400
River Riddle [Fri, 29 Mar 2019 15:59:20 +0000 (08:59 -0700)]
Update the QuickstartRewrites document to include information about the new 'matchAndRewrite' functionality in RewritePatterns.
PiperOrigin-RevId:
240987764
River Riddle [Fri, 29 Mar 2019 15:52:06 +0000 (08:52 -0700)]
[PassManager] Add a utility class, PrettyStackTraceParallelDiagnosticEntry, to emit any queued up diagnostics in the event of a crash when multi-threading.
PiperOrigin-RevId:
240986566
MLIR Team [Fri, 29 Mar 2019 15:06:25 +0000 (08:06 -0700)]
Enable input-reuse fusion to search function arguments for fusion candidates (takes care of a TODO, enables another tutorial test case).
PiperOrigin-RevId:
240979894
River Riddle [Fri, 29 Mar 2019 02:53:02 +0000 (19:53 -0700)]
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
MLIR Team [Fri, 29 Mar 2019 02:49:31 +0000 (19:49 -0700)]
Support for type constraints across operand and results
--
PiperOrigin-RevId:
240905555
Tatiana Shpeisman [Fri, 29 Mar 2019 01:28:14 +0000 (18:28 -0700)]
Fixed a few instances of inconsistent grammar.
PiperOrigin-RevId:
240896336
Jacques Pienaar [Fri, 29 Mar 2019 01:00:57 +0000 (18:00 -0700)]
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
Jacques Pienaar [Fri, 29 Mar 2019 00:37:29 +0000 (17:37 -0700)]
Add README file for MLIR.
PiperOrigin-RevId:
240889350
River Riddle [Fri, 29 Mar 2019 00:36:06 +0000 (17:36 -0700)]
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