summaryrefslogtreecommitdiffstats
path: root/mlir/test/Examples
Commit message (Collapse)AuthorAgeFilesLines
* Fixed typo in Toy tutorial (second var e -> var f)Aart Bik2019-11-277-14/+14
| | | | PiperOrigin-RevId: 282810649
* Add Ch-7 of the toy tutorial detailing how to define new types.River Riddle2019-11-0710-0/+369
| | | | | | This chapter adds a new composite type to Toy, and shows the process of adding a new type to the IR, adding and updating operations to use it, and constant folding operations producing it. PiperOrigin-RevId: 279107885
* Cleanup and rewrite Ch-4.md.River Riddle2019-10-213-15/+9
| | | | | | This change rewrites Ch-4.md to introduced interfaces in a detailed step-by-step manner, adds examples, and fixes some errors. PiperOrigin-RevId: 275887017
* NFC: Fix remaining usages of MulOp as matrix multiplication.River Riddle2019-10-2114-131/+149
| | | | | | MulOp now represents an element-wise multiplication instead of a matrix multiplication. PiperOrigin-RevId: 275886774
* NFC: Fix typo : Retur -> ReturnRiver Riddle2019-10-206-6/+6
| | | | PiperOrigin-RevId: 275745931
* NFC: Delete the Linalg tutorial.River Riddle2019-10-171-169/+0
| | | | | | This part of the tutorial is now covered by a new flow in Toy. This also removes a point of confusion as there is also a proper Linalg dialect. PiperOrigin-RevId: 275338933
* Add Ch.6 of the Toy tutorial.River Riddle2019-10-177-0/+246
| | | | | | This chapters introduces the notion of a full conversion, and adds support for lowering down to the LLVM dialect, LLVM IR, and thus code generation. PiperOrigin-RevId: 275337786
* Fix invalid transpose in example and add proper verification.River Riddle2019-10-161-36/+36
| | | | | | The transpose in the example had the same result type as its input, which is incorrect. PiperOrigin-RevId: 275186568
* Add Ch.5 of the toy tutorial.River Riddle2019-10-1610-139/+174
| | | | | | This chapter adds a partial lowering of toy operations, all but PrintOp, to a combination of the Affine and Std dialects. This chapter focuses on introducing the conversion framework, the benefits of partial lowering, and how easily dialects may co-exist in the IR. PiperOrigin-RevId: 275150649
* Add support for inlining toy call operations.River Riddle2019-10-161-0/+30
| | | | | | The GenericCallOp needed to have the CallOpInterface to be picked up by the inliner. This also adds a CastOp to perform shape casts that are generated during inlining. The casts generated by the inliner will be folded away after shape inference. PiperOrigin-RevId: 275150438
* Update Chapter 4 of the Toy tutorialSana Damani2019-10-166-67/+21
| | | | | | | | | | This Chapter now introduces and makes use of the Interface concept in MLIR to demonstrate ShapeInference. END_PUBLIC Closes tensorflow/mlir#191 PiperOrigin-RevId: 275085151
* Update comments in ast.toyJacques Pienaar2019-10-163-84/+87
| | | | PiperOrigin-RevId: 275084969
* Update Chapter 3 to demonstrate pattern match and rewrite optimizationsSana Damani2019-10-153-23/+20
| | | | | | | | | This is using Table-driven Declarative Rewrite Rules (DRR), the previous version of the tutorial only showed the C++ patterns. Closes tensorflow/mlir#187 PiperOrigin-RevId: 274852321
* Merge Ch3 of the Toy tutorial into chapter 2.River Riddle2019-10-142-5/+17
| | | | | | This effectively rewrites Ch.2 to introduce dialects, operations, and registration instead of deferring to Ch.3. This allows for introducing the best practices up front(using ODS, registering operations, etc.), and limits the opaque API to the chapter document instead of the code. PiperOrigin-RevId: 274724289
* Emit LLVM IR equivalent of sizeof when lowering alloc operationsAlex Zinenko2019-10-111-1/+1
| | | | | | | | | | | | | | | | | Originally, the lowering of `alloc` operations has been computing the number of bytes to allocate when lowering based on the properties of MLIR type. This does not take into account type legalization that happens when compiling LLVM IR down to target assembly. This legalization can widen the type, potentially leading to out-of-bounds accesses to `alloc`ed data due to mismatches between address computation that takes the widening into account and allocation that does not. Use the LLVM IR's equivalent of `sizeof` to compute the number of bytes to be allocated: %0 = getelementptr %type* null, %indexType 0 %1 = ptrtoint %type* %0 to %indexType adapted from http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt PiperOrigin-RevId: 274159900
* Normalize MemRefType lowering to LLVM as strided MemRef descriptorNicolas Vasilache2019-09-301-6/+6
| | | | | | | | | | | | | | | | | | | | | This CL finishes the implementation of the lowering part of the [strided memref RFC](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). Strided memrefs correspond conceptually to the following templated C++ struct: ``` template <typename Elem, size_t Rank> struct { Elem *ptr; int64_t offset; int64_t sizes[Rank]; int64_t strides[Rank]; }; ``` The linearization procedure for address calculation for strided memrefs is the same as for linalg views: `base_offset + SUM_i index_i * stride_i`. The following CL will unify Linalg and Standard by removing !linalg.view in favor of strided memrefs. PiperOrigin-RevId: 272033399
* Remove spurious debug spew in testsNicolas Vasilache2019-09-271-1/+0
| | | | PiperOrigin-RevId: 271624731
* Promote MemRefDescriptor to a pointer to struct when passing function ↵Nicolas Vasilache2019-09-271-89/+93
| | | | | | | | | | | | | boundaries in LLVMLowering. The strided MemRef RFC discusses a normalized descriptor and interaction with library calls (https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). Lowering of nested LLVM structs as value types does not play nicely with externally compiled C/C++ functions due to ABI issues. Solving the ABI problem generally is a very complex problem and most likely involves taking a dependence on clang that we do not want atm. A simple workaround is to pass pointers to memref descriptors at function boundaries, which this CL implement. PiperOrigin-RevId: 271591708
* Normalize lowering of MemRef typesNicolas Vasilache2019-09-241-4/+4
| | | | | | | | | | | | | | | | The RFC for unifying Linalg and Affine compilation passes into an end-to-end flow with a predictable ABI and linkage to external function calls raised the question of why we have variable sized descriptors for memrefs depending on whether they have static or dynamic dimensions (https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). This CL standardizes the ABI on the rank of the memrefs. The LLVM struct for a memref becomes equivalent to: ``` template <typename Elem, size_t Rank> struct { Elem *ptr; int64_t sizes[Rank]; }; ``` PiperOrigin-RevId: 270947276
* LLVM dialect: prefix auxiliary operations with "mlir."Alex Zinenko2019-09-031-9/+9
| | | | | | | | | | Some of the operations in the LLVM dialect are required to model the LLVM IR in MLIR, for example "constant" operations are needed to declare a constant value since MLIR, unlike LLVM, does not support immediate values as operands. To avoid confusion with actual LLVM operations, we prefix such axuiliary operations with "mlir.". PiperOrigin-RevId: 266942838
* Update Ch.2 of the Toy tutorial.River Riddle2019-08-271-16/+15
| | | | | | | | The code and documentation for this chapter of the tutorial have been updated to follow the new flow. The toy 'array' type has been replaced by usages of the MLIR tensor type. The code has also been cleaned up and modernized. Closes tensorflow/mlir#101 PiperOrigin-RevId: 265744086
* Standardize the value numbering in the AsmPrinter.River Riddle2019-07-091-11/+11
| | | | | | Change the AsmPrinter to number values breadth-first so that values in adjacent regions can have the same name. This allows for ModuleOp to contain operations that produce results. This also standardizes the special name of region entry arguments to "arg[0-9+]" now that Functions are also operations. PiperOrigin-RevId: 257225069
* Change the attribute dictionary syntax to separate name and value with '='.River Riddle2019-06-258-31/+31
| | | | | | | | | | | The current syntax separates the name and value with ':', but ':' is already overloaded by several other things(e.g. trailing types). This makes the syntax difficult to parse in some situtations: Old: "foo: 10 : i32" New: "foo = 10 : i32" PiperOrigin-RevId: 255097928
* Modify the syntax of the the ElementsAttrs to print the type as a colon type.River Riddle2019-06-257-11/+11
| | | | | | | | | This is the standard syntax for types on operations, and is also already used by IntegerAttr and FloatAttr. Example: dense<5> : tensor<i32> dense<[3]> : tensor<1xi32> PiperOrigin-RevId: 255069157
* Remove unnecessary -verify-diagnosticsGeoffrey Martin-Noble2019-06-191-2/+2
| | | | | | These were likely added in error because of confusion about the flag when it was just called "-verify". The extra flag doesn't cause much harm, but it does make mlir-opt do more work and clutter the RUN line PiperOrigin-RevId: 254037016
* Rename -verify mlir-opt flag to -verify-expected-diagnosticsGeoffrey Martin-Noble2019-06-191-2/+2
| | | | | | This name has caused some confusion because it suggests that it's running op verification (and that this verification isn't getting run by default). PiperOrigin-RevId: 254035268
* Update the Parser to support parsing/printing DenseElementAttrs with a splat ↵River Riddle2019-06-193-3/+3
| | | | | | | | | value. The syntax for this is the same as 0-D tensors: dense<tensor<100x100x100xi32>, 10> dense<tensor<1x1x1xi64>, -5> PiperOrigin-RevId: 252907880
* Remove the Toy/* file path from the location check lines. This assumes a ↵River Riddle2019-06-015-135/+135
| | | | | | | | specific file path format that breaks on MSVC. -- PiperOrigin-RevId: 250549223
* Parsing support for Range, View and Slice operationsNicolas Vasilache2019-05-061-0/+166
| | | | | | | | | | | 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
* Toy tutorial Chapter 5: Lowering to Linalg and LLVMMehdi Amini2019-04-087-0/+189
| | | | | | -- PiperOrigin-RevId: 242606796
* Change the asmprinter to use pretty syntax for dialect types when it can,Chris Lattner2019-04-078-42/+42
| | | | | | | | | | | | making the IR dumps much nicer. This is part 2/3 of the path to making dialect types more nice. Part 3/3 will slightly generalize the set of characters allowed in pretty types and make it more principled. -- PiperOrigin-RevId: 242249955
* NFC: Fix a few typos in the tutorials and one in the comment of ↵River Riddle2019-04-053-3/+3
| | | | | | | | FunctionAttr::dropFunctionReference. -- PiperOrigin-RevId: 242050934
* Add Chapter 4 for the Toy tutorial: shape inference, function ↵Mehdi Amini2019-04-056-0/+173
| | | | | | | | specialization, and basic combines -- PiperOrigin-RevId: 242050514
* Fix Toy Ch3 testing with CMakeMehdi Amini2019-04-031-0/+2
| | | | | | | | | 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
* Chapter 3 for Toy tutorial: introduction of a dialectMehdi Amini2019-04-036-3/+131
| | | | | | -- PiperOrigin-RevId: 241849162
* Chapter 2 of the Toy tutorialMehdi Amini2019-04-024-32/+150
| | | | | | | | | This introduces a basic MLIRGen through straight AST traversal, without dialect registration at this point. -- PiperOrigin-RevId: 241588354
* Initial version for chapter 1 of the Toy tutorialMehdi Amini2019-04-022-0/+73
-- PiperOrigin-RevId: 241549247
OpenPOWER on IntegriCloud