Commit graph

27 commits

Author SHA1 Message Date
Nicolas Vasilache
fdbbb3c274 Use lambdas for nesting edsc constructs.
Using ArrayRef introduces issues with the order of evaluation between a constructor and
    the arguments of the subsequent calls to the `operator()`.
    As a consequence the order of captures is not well-defined can go wrong with certain compilers (e.g. gcc-6.4).
    This CL fixes the issue by using lambdas in lieu of ArrayRef.

--

PiperOrigin-RevId: 249114775
2019-05-20 13:50:28 -07:00
River Riddle
68250edbfa NFC: Tidy up DialectConversion.cpp and rename DialectOpConversion to DialectConversionPattern.
--

PiperOrigin-RevId: 248980810
2019-05-20 13:48:19 -07:00
River Riddle
3090a651b7 Update the rewrite methods of each of the DialectConversion patterns to notify the PatternRewriter that the operation is being replaced.
--

PiperOrigin-RevId: 248965082
2019-05-20 13:47:44 -07:00
River Riddle
1966d34da4 Move the ConversionListBuilder utility to PatternMatch.h and rename it to RewriteListBuilder. It has no specific functionality for DialectOpConversion patterns and can be useful for RewritePatterns in general.
--

PiperOrigin-RevId: 248884466
2019-05-20 13:47:28 -07:00
River Riddle
3de0c7696b Rewrite the DialectOpConversion patterns to inherit from RewritePattern instead of Pattern. This simplifies the infrastructure a bit by being able to reuse PatternRewriter and the RewritePatternMatcher, but also starts to lay the groundwork for a more generalized legalization framework that can operate on DialectOpConversions as well as normal RewritePatterns.
--

PiperOrigin-RevId: 248836492
2019-05-20 13:47:01 -07:00
River Riddle
1a100849c4 Add support for saving and restoring the insertion point of a FuncBuilder. This also updates the edsc::ScopedContext to use a single builder that saves/restores insertion points. This is necessary for using edscs within RewritePatterns.
--

PiperOrigin-RevId: 248812645
2019-05-20 13:46:35 -07:00
River Riddle
d5b60ee840 Replace Operation::isa with llvm::isa.
--

PiperOrigin-RevId: 247789235
2019-05-20 13:37:52 -07:00
River Riddle
adca3c2edc Replace Operation::cast with llvm::cast.
--

PiperOrigin-RevId: 247785983
2019-05-20 13:37:42 -07:00
River Riddle
c5ecf9910a Add support for using llvm::dyn_cast/cast/isa for operation casts and replace usages of Operation::dyn_cast with llvm::dyn_cast.
--

PiperOrigin-RevId: 247780086
2019-05-20 13:37:31 -07:00
MLIR Team
41d90a85bd Automated rollback of changelist 247778391.
PiperOrigin-RevId: 247778691
2019-05-20 13:37:20 -07:00
River Riddle
02e03b9bf4 Add support for using llvm::dyn_cast/cast/isa for operation casts and replace usages of Operation::dyn_cast with llvm::dyn_cast.
--

PiperOrigin-RevId: 247778391
2019-05-20 13:37:10 -07:00
River Riddle
b7dc252683 NFC: Make ParseResult public and update the OpAsmParser(and thus all of the custom operation parsers) to use it instead of bool.
--

PiperOrigin-RevId: 246955523
2019-05-10 19:23:24 -07:00
River Riddle
4ea887be41 Namespaceify a few explicit template specializations to appease errors caused by a bug in gcc versions < 7.0.
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480)

--

PiperOrigin-RevId: 246664463
2019-05-06 08:29:09 -07:00
Geoffrey Martin-Noble
45c8245cca Substitute getI64IntegerAttr for the more verbose code it replaces.
--

PiperOrigin-RevId: 246227344
2019-05-06 08:24:12 -07:00
Nicolas Vasilache
56c7a957bf Parsing support for Range, View and Slice operations
This CL implements the previously unsupported parsing for Range, View and Slice operations.
    A pass is introduced to lower to the LLVM.
    Tests are moved out of C++ land and into mlir/test/Examples.
    This allows better fitting within standard developer workflows.

--

PiperOrigin-RevId: 245796600
2019-05-06 08:20:55 -07:00
Lei Zhang
0836f670f1 Add missing dependencies for EDSC and linalg libraries
This solves the missing "mlir/StandardOps/Ops.h.inc" issue when building
    a fresh checkout on macOS.

--

PiperOrigin-RevId: 243120388
2019-04-11 12:35:29 -07:00
Mehdi Amini
a43f216fd5 Automated rollback of changelist 242546977.
PiperOrigin-RevId: 242604949
2019-04-08 23:26:46 -07:00
Nicolas Vasilache
1ee07e7fde De-templatize TensorContractionBase (Linalg example/tutorial)
TensorContractionBase has become too unwieldy with all the CRTP manipulation once less trivial transformations are implemented.
    This CL drops CRTP for inheritance and uses the same name comparison trick to figure out what to cast into.
    As a byproduct, all the -inl.h files disappear.
    To maintain the separation between directories, a LINALG_STEP variable is introduced

--

PiperOrigin-RevId: 242546977
2019-04-08 19:17:56 -07:00
Nicolas Vasilache
046a993967 Add CMakeLists rules for Linalg
--

PiperOrigin-RevId: 242454319
2019-04-08 19:17:56 -07:00
Alex Zinenko
8e193e617c Change initialization syntax for ScopedContext in examples
For some reason, the OSS build on macOS was not happy with the initialization
    syntax and was attempting to call a copy constructor.  Hotfix it to use a
    different syntax pending further investigation.

--

PiperOrigin-RevId: 242432634
2019-04-08 19:17:56 -07:00
Mehdi Amini
fea0560816 Fix Linalg3 lowering to use the floating point element type matching the view
It used to be hardcoded to f32, but Toy tutorial is using f64.

--

PiperOrigin-RevId: 242370172
2019-04-07 18:22:34 -07:00
Nicolas Vasilache
a1b4cae30a Post commit cleanups to the Linalg dialect
--

PiperOrigin-RevId: 242181687
2019-04-07 18:20:19 -07:00
Nicolas Vasilache
92df395068 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
2019-04-05 07:43:14 -07:00
Nicolas Vasilache
623e4b9711 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
2019-04-05 07:42:38 -07:00
River Riddle
6fa3181329 Remove the non-postorder walk functions from Function/Block/Instruction and rename walkPostOrder to walk.
--

PiperOrigin-RevId: 241965239
2019-04-05 07:41:23 -07:00
Alex Zinenko
8b790434e5 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
2019-04-05 07:40:21 -07:00
Mehdi Amini
a261ce5b40 Move the top-level tutorial as Linalg nested in the examples folder
--

PiperOrigin-RevId: 241831176
2019-04-03 19:21:38 -07:00