summaryrefslogtreecommitdiffstats
path: root/mlir/lib/EDSC/Intrinsics.cpp
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.River Riddle2019-12-231-6/+6
| | | | | | ValuePtr was a temporary typedef during the transition to a value-typed Value. PiperOrigin-RevId: 286945714
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-231-13/+4
| | | | PiperOrigin-RevId: 286906740
* NFC: Introduce new ValuePtr/ValueRef typedefs to simplify the transition to ↵River Riddle2019-12-221-6/+6
| | | | | | | | | | Value being value-typed. This is an initial step to refactoring the representation of OpResult as proposed in: https://groups.google.com/a/tensorflow.org/g/mlir/c/XXzzKhqqF_0/m/v6bKb08WCgAJ This change will make it much simpler to incrementally transition all of the existing code to use value-typed semantics. PiperOrigin-RevId: 286844725
* Refactor dependencies to expose Vector transformations as patterns - NFCNicolas Vasilache2019-12-031-1/+0
| | | | | | | | | This CL refactors some of the MLIR vector dependencies to allow decoupling VectorOps, vector analysis, vector transformations and vector conversions from each other. This makes the system more modular and allows extracting VectorToVector into VectorTransforms that do not depend on vector conversions. This refactoring exhibited a bunch of cyclic library dependencies that have been cleaned up. PiperOrigin-RevId: 283660308
* Move Linalg and VectorOps dialects to the Dialect subdir - NFCNicolas Vasilache2019-08-191-1/+1
| | | | PiperOrigin-RevId: 264277760
* Use lambdas for nesting edsc constructs.Nicolas Vasilache2019-05-201-3/+3
| | | | | | | | | | | 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
* Remove unnecessary C++ specifier in CPP files. NFC.Jacques Pienaar2019-05-201-1/+1
| | | | | | | | These are only required in .h files to disambiguate between C and C++ header files. -- PiperOrigin-RevId: 248219135
* Cleanup SuperVectorization dialect printing and parsing.Nicolas Vasilache2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Replace remaining usages of the Instruction class with Operation.River Riddle2019-03-291-11/+11
| | | | PiperOrigin-RevId: 240777521
* Remove LOAD/STORE/RETURN boilerplate in declarative builders.Nicolas Vasilache2019-03-291-28/+4
| | | | | | | | | | | | | 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
* Port LowerVectorTransfers from EDSC + AST to declarative buildersNicolas Vasilache2019-03-291-0/+1
| | | | | | | | | | | | | | | 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
* [EDSC] Cleanup declarative builder insertion point with blocksNicolas Vasilache2019-03-291-16/+3
| | | | | | | | | | | | | Declarative builders want to provide the same nesting interface for blocks and loops. MLIR on the other hand has different behaviors: 1. when an AffineForOp is created the insertion point does not enter the loop body; 2. when a Block is created, the insertion point does enter the block body. Guard against the second behavior in EDSC to make the interface unsurprising. This also surfaces two places in the eager branch API where I was guarding against this behavior indirectly by creating a new ScopedContext. Instead, uniformize everything to properly reset the insertion point in the unique place that builds the mlir::Block*. PiperOrigin-RevId: 237619513
* Add support for custom ops in declarative builders.Nicolas Vasilache2019-03-291-16/+18
| | | | | | | | This CL adds support for named custom instructions in declarative builders. To allow this, it introduces a templated `CustomInstruction` class. This CL also splits ValueHandle which can capture only the **value** in single-valued instructions from InstructionHandle which can capture any instruction but provide no typing and sugaring to extract the potential Value*. PiperOrigin-RevId: 237543222
* Add helper classes to declarative builders to help write end-to-end custom ops.Nicolas Vasilache2019-03-291-0/+13
| | | | | | | | This CL adds the same helper classes that exist in the AST form of EDSCs to support a basic indexing notation and emit the proper load and store operations and capture MemRefViews as function arguments. This CL also adds a wrapper class LoopNestBuilder to allow generic rank-agnostic loops over indices. PiperOrigin-RevId: 237113755
* Hotfix for unused variable in opt modeNicolas Vasilache2019-03-291-0/+1
| | | | PiperOrigin-RevId: 237073601
* Add an eager API version for BR and COND_BRNicolas Vasilache2019-03-291-0/+54
| | | | | | | | | | When building unstructured control-flow there is a need to construct mlir::Block* before being able to fill them. This invites goto-style programming. This CL introduces an alternative eager API for BR and COND_BR in which blocks are created eagerly and captured on the fly. This allows reducing the number of calls to `BlockBuilder` from 4 to 2 in the `builder_blocks_eager` test and from 3 to 2 in the `builder_cond_branch_eager` test. PiperOrigin-RevId: 237046114
* Add support for Branches in edsc::BuilderNicolas Vasilache2019-03-291-2/+24
| | | | | | | | | This CL adds support for BranchHandle and BranchBuilder that require a slightly different abstraction since an mlir::Block is not an mlir::Value. This CL also adds support for the BR and COND_BR instructions and the relevant tests. PiperOrigin-RevId: 237034312
* Start a new implementation for edsc::BuilderNicolas Vasilache2019-03-291-0/+30
This CL reworks the design of EDSCs from first principles. It introduces a ValueHandle which can hold either: 1. an eagerly typed, delayed Value* 2. a precomputed Value* A ValueHandle can be manipulated with intrinsic operations a nested within a NestedBuilder. These NestedBuilder are a more idiomatic nested builder abstraction that should feel intuitive to program in C++. Notably, this abstraction does not require an AST to stage the construction of MLIR snippets from C++. Instead, the abstraction makes use of orderings between definition and declaration of ValueHandles and provides a NestedBuilder and a LoopBuilder helper classes to handle those orderings. All instruction creations are meant to use the templated ValueHandle::create<> which directly calls mlir::Builder.create<>. For now the EDSC AST and the builders live side-by-side until the C API is ported. PiperOrigin-RevId: 237030945
OpenPOWER on IntegriCloud