summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
...
* [mlir][Linalg] Lower linalg.reshape to LLVM for the static caseNicolas Vasilache2020-01-082-2/+110
| | | | | | | | | | | | | | | | | | | | | | Summary: This diff adds lowering of the linalg.reshape op to LLVM. A new descriptor is created with fields initialized as follows: 1. allocatedPTr, alignedPtr and offset are copied from the source descriptor 2. sizes are copied from the static destination shape 3. strides are copied from the static strides collected with `getStridesAndOffset` Only the static case in which the target view conforms to strided memref semantics is supported. Other cases are left for future work and will be added on a per-need basis. Reviewers: ftynse, mravishankar Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72316
* [mlir][spirv] Add lowering for std.fpext, std.fptrunc, std.sitofp.Denis Khalikov2020-01-072-0/+41
| | | | Differential Revision: https://reviews.llvm.org/D72137
* Revert "[mlir][spirv] Add lowering for std.fpext, std.fptrunc, std.sitofp."Lei Zhang2020-01-072-41/+0
| | | | | This reverts commit 7e7f849a6d94f77f1a29630419acb7226051f4b6 because it recorded the wrong commit author.
* [mlir][spirv] Add lowering for std cmp ops.Denis Khalikov2020-01-073-4/+123
| | | | Differential Revision: https://reviews.llvm.org/D72296
* [mlir][spirv] Add lowering for standard bit opsDenis Khalikov2020-01-073-18/+65
| | | | Differential Revision: https://reviews.llvm.org/D72205
* [mlir][spirv] Add lowering for std.fpext, std.fptrunc, std.sitofp.Lei Zhang2020-01-072-0/+41
| | | | Differential Revision: https://reviews.llvm.org/D72137
* [mlir][Linalg] Add a linalg.reshape opNicolas Vasilache2020-01-068-15/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This diff adds a new operation to linalg to allow reshaping of an existing view into a new view in the same buffer at the same offset. More specifically: The `linalg.reshape` op produces a new view whose sizes are a reassociation of the original `view`. Depending on whether or not the reassociated MemRefType is contiguous, the resulting memref may require explicit alloc and copies. A reassociation is defined as a continous grouping of dimensions and is represented with a affine map array attribute. In the future, non-continous groupings may be allowed (i.e. permutations, reindexings etc). For now, it is assumed that either: 1. a reassociation produces and consumes contiguous MemRefType or, 2. the reshape op will be folded into its consumers (by changing the shape of the computations). All other cases are undefined behavior and a reshape op may not lower to LLVM if it cannot be proven statically that it does not require alloc+copy. A reshape may either collapse or expand dimensions, depending on the relationship between source and target memref ranks. The verification rule is that the reassociation maps are applied to the memref with the larger rank to obtain the memref with the smaller rank. In the case of a dimension expansion, the reassociation maps can be interpreted as inverse maps. Examples: ```mlir // Dimension collapse (i, j) -> i' and k -> k' %1 = linalg.reshape %0 [(i, j, k) -> (i, j), (i, j, k) -> (k)] : memref<?x?x?xf32, stride_spec> into memref<?x?xf32, stride_spec_2> ``` ```mlir // Dimension expansion i -> (i', j') and (k) -> (k') %1 = linalg.reshape %0 [(i, j, k) -> (i, j), (i, j, k) -> (k)] : memref<?x?xf32, stride_spec> into memref<?x?x?xf32, stride_spec_2> ``` The relevant invalid and roundtripping tests are added. Reviewers: AlexEichenberger, ftynse, rriddle, asaadaldien, yangjunpro Subscribers: kiszk, merge_guards_bot, mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72168
* [NFC] Fixes -Wrange-loop-analysis warningsMark de Wever2020-01-061-1/+1
| | | | | | This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D72210
* [mlir][Linalg] Reimplement and extend getStridesAndOffsetNicolas Vasilache2020-01-062-130/+126
| | | | | | | | | | | | | | | | | | Summary: This diff reimplements getStridesAndOffset in a significantly simpler way by operating on the AffineExpr and calling into simplifyAffineExpr instead of rolling its own saturating arithmetic. As a consequence it becomes quite simple to extend the behavior of getStridesAndOffset to encompass more cases by manipulating the AffineExpr more directly. The divisions are still filtered out and continue to yield fully dynamic strides. Simplifying the divisions is left for a later time if compelling use cases arise. Relevant tests are added. Reviewers: ftynse Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72098
* [mlir] Update mlir/CMakeLists.txt to install *.def filesKern Handa2020-01-061-0/+1
| | | | | | | This is needed to consume mlir after it has been installed of the source tree. Without this, consuming mlir results a build error. Differential Revision: https://reviews.llvm.org/D72232
* [mlir][spirv] Update SPIR-V documentation with information aboutMaheshRavishankar2020-01-051-6/+113
| | | | | | | | | lowering to SPIR-V dialect. Add information about - SPIRVTypeConverter - SPIRVOpLowering - Utility functions used in lowering to SPIR-V dialect.
* Add missing mlir-headers target and add tablegen'd deps to it.Stella Laurenzo2020-01-031-0/+5
| | | | | | | | | | | | | Summary: Prior to this, "ninja install-mlir-headers" failed with an error indicating the missing target. Verified that from a clean build, the installed headers include generated files. Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72045
* [mlir] Compilation fix: use LLVM_ATTRIBUTE_UNUSED following ↵Alexandre Ganea2020-01-031-6/+2
| | | | | | 6656e961c08393c3949412ef945ade0272b66fca Differential Revision: https://reviews.llvm.org/D72124
* [mlir] Fix indexed_accessor_range to properly forward the derived class.River Riddle2020-01-036-25/+70
| | | | | | | | Summary: This fixes the return value of helper methods on the base range class. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72127
* [mlir] Enhance classof() checks in StructsGenLei Zhang2020-01-033-6/+34
| | | | | | | | | | | Previously we only check that each field is of the correct mlir::Attribute subclass. This commit enhances to also consider the attribute's types, by leveraging the constraints already encoded in TableGen attribute definitions. Reviewed By: rsuderman Differential Revision: https://reviews.llvm.org/D72162
* [mlir][Linalg] NFC - Post-commit format fixNicolas Vasilache2020-01-031-2/+3
|
* [mlir][Linalg] NFC - Hotfix GenericLoopNestBuilder compilation error on ↵Nicolas Vasilache2020-01-031-2/+7
| | | | | | | | | | | | older gcc (-fpermissive) This fixes the error: ``` mlir/include/mlir/Dialect/Linalg/Utils/Utils.h:72:3: error: from definition of 'template<class LoopTy> mlir::edsc::GenericLoopNestRangeBuilder<LoopTy>::GenericLoopNestRangeBuilder(llvm::ArrayRef<mlir::edsc::ValueHandle*>, llvm::ArrayRef<mlir::Value>)' [-fpermissive] GenericLoopNestRangeBuilder(ArrayRef<edsc::ValueHandle *> ivs, ``` This was tested independently on a Docker image with gcc-5 by jpienaar@
* [mlir][spirv] Fix ADDITIONAL_HEADER_DIRS for SPIR-V librariesLei Zhang2020-01-033-2/+5
| | | | | | | | SPIRV/ headers live under mlir/Dialect/. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D72141
* [mlir][Linalg] NFC - Hotfix GenericLoopNestBuilder compilation error ↵Nicolas Vasilache2020-01-031-4/+6
| | | | | | | | | | (-fpermissive) This should fix the error: ``` mlir/include/mlir/Dialect/Linalg/Utils/Utils.h:72:3: error: from definition of 'template<class LoopTy> mlir::edsc::GenericLoopNestRangeBuilder<LoopTy>::GenericLoopNestRangeBuilder(llvm::ArrayRef<mlir::edsc::ValueHandle*>, llvm::ArrayRef<mlir::Value>)' [-fpermissive] GenericLoopNestRangeBuilder(ArrayRef<edsc::ValueHandle *> ivs, ```
* [mlir][linalg] Lower linalg to affine loopsAhmed Taei2020-01-034-2/+94
| | | | | | | | | | | | Reviewers: nicolasvasilache Reviewed By: nicolasvasilache Subscribers: mgester, lucyrfox, merge_guards_bot, AlexEichenberger, mravishankar, ftynse, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72094
* [mlir][Vector] NFC - Add documentation for the VectorOps dialect.Nicolas Vasilache2020-01-031-7/+486
|
* [mlir][spirv] Fix shader ABI attribute prefix and add verificationLei Zhang2020-01-038-41/+219
| | | | | | | | | | This commit fixes shader ABI attributes to use `spv.` as the prefix so that they match the dialect's namespace. This enables us to add verification hooks in the SPIR-V dialect to verify them. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D72062
* [mlir] NFC: Fix broken links in docsKazuaki Ishizaki2020-01-034-9/+9
| | | | | | | | | | | | | | Summary: This commit fixes missing links that are caused by the repository movement. Reviewers: Jim, rriddle, jpienaar Reviewed By: Jim, rriddle, jpienaar Subscribers: arpith-jacob, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72065
* [mlir] Rewrite the internal representation of OpResult to be optimized for ↵River Riddle2020-01-028-167/+369
| | | | | | | | | | | | | | memory. Summary: This changes the implementation of OpResult to have some of the results be represented inline in Value, via a pointer int pair of Operation*+result number, and the rest being trailing objects on the main operation. The full details of the new representation is detailed in the proposal here: https://groups.google.com/a/tensorflow.org/g/mlir/c/XXzzKhqqF_0/m/v6bKb08WCgAJ The only difference between here and the above proposal is that we only steal 2-bits for the Value kind instead of 3. This means that we can only fit 2-results inline instead of 6. This allows for other users to steal the final bit for PointerUnion/etc. If necessary, we can always steal this bit back in the future to save more space if 3-6 results are common enough. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72020
* [mlir] Only generate default for uncovered casesJacques Pienaar2020-01-021-0/+4
| | | | Have to explicitly check if all cases are covered instead.
* [mlir] Revert default case that was neededJacques Pienaar2020-01-021-0/+2
| | | | This one isn't always complete.
* [mlir] Add parenthesis to avoid -WparenthesesJacques Pienaar2020-01-021-4/+4
|
* [mlir] Remove redudant default casesJacques Pienaar2020-01-021-4/+0
| | | | These provide no value and trigger -Wcovered-switch-default.
* [mlir][spirv] Update SPIR-V enums and ops with availability specLei Zhang2020-01-025-320/+1843
| | | | | | | | | | This commit updates gen_spirv_dialect.py to query the grammar and generate availability spec for various enum attribute definitions and all defined ops. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D72095
* [mlir][Linalg] Extend generic ops to allow tensorsNicolas Vasilache2020-01-0216-135/+408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This diff adds support to allow `linalg.generic` and `linalg.indexed_generic` to take tensor input and output arguments. The subset of output tensor operand types must appear verbatim in the result types after an arrow. The parser, printer and verifier are extended to accomodate this behavior. The Linalg operations now support variadic ranked tensor return values. This extension exhibited issues with the current handling of NativeCall in RewriterGen.cpp. As a consequence, an explicit cast to `SmallVector<Value, 4>` is added in the proper place to support the new behavior (better suggestions are welcome). Relevant cleanups and name uniformization are applied. Relevant invalid and roundtrip test are added. Reviewers: mehdi_amini, rriddle, jpienaar, antiagainst, ftynse Subscribers: burmako, shauheen, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72022
* [mlir][spirv] Allow specifying availability on enum attribute casesLei Zhang2020-01-0210-18/+328
| | | | | | | | | | | | | | Lots of SPIR-V ops take enum attributes and certain enum cases need extra capabilities or extensions to be available. This commit extends to allow specifying availability spec on enum cases. Extra utility functions are generated for the corresponding enum classes to return the availability requirement. The availability interface implemention for a SPIR-V op now goes over all enum attributes to collect the availability requirements. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D71947
* Fix some corner cases missed by D71955River Riddle2020-01-022-4/+12
| | | | | | * replaceAllUsesWith may be supplied with a null value. * some compilers fail to implicitly convert single result operations to OpaqueValue, so add an explicit OpOperand::set(Value) method.
* fix doc grammar-o to cycle botsNico Weber2020-01-021-1/+1
|
* [mlir][Linalg] NFC - Make consistent use of op.emitOpErrorNicolas Vasilache2020-01-022-31/+31
| | | | | | | | | | | | Summary: This is part of an ongoing cleanup and uniformization work. Reviewers: ftynse Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72084
* [mlir][Linalg] NFC - Cleanup Linalg Declarative TransformationsNicolas Vasilache2020-01-024-79/+80
| | | | | | | | | | | | | | | | | | Summary: This is part of an ongoing cleanup and uniformization work. This diff performs 3 types of cleanups: 1. Uniformize transformation names. 2. Replace all pattern operands that need not be captured by `$_` 3. Replace all usage of pattern captured op by the normalized `op` name (instead of positional parameters such as `$0`) Reviewers: ftynse Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72081
* [mlir][Linalg] NFC - Rename ViewTraits -> StructuredOpTraitsNicolas Vasilache2020-01-022-3/+4
| | | | | | | | | | | | Summary: This is part of an ongoing cleanup and uniformization work. Reviewers: ftynse Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72079
* [mlir][Linalg] NFC - Rename LinalgGeneric -> GenericLinalgNicolas Vasilache2020-01-022-9/+9
| | | | | | | | | | Summary: This is part of an ongoing cleanup and uniformization work. Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72078
* [mlir][spirv] NFC: Move shader ABI attributes to a new fileLei Zhang2020-01-018-73/+113
| | | | | | | | | This allows us to include the definitions of these attributes in other files without pulling in all dependencies for lowering. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D72054
* [mlir][spirv] Fix links in docs and update dialect docsLei Zhang2020-01-012-27/+29
| | | | | | | | | | | Summary: This commit fixes links to code directories and uses doc links on mlir.llvm.org where possible. The docs in TableGen dialect definition is also updated to reflect recent developments. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D72051
* [mlir] Fix -Wrange-loo-analysis warningsFangrui Song2020-01-017-9/+9
| | | | | | | | | | | | for (const auto &x : llvm::zip(..., ...)) -> for (auto x : llvm::zip(..., ...)) The return type of zip() is a wrapper that wraps a tuple of references. > warning: loop variable 'p' is always a copy because the range of type 'detail::zippy<detail::zip_shortest, ArrayRef<long> &, ArrayRef<long> &>' does not return a reference [-Wrange-loop-analysis]
* [mlir] Fix compilation warningsAlexandre Ganea2020-01-012-3/+7
| | | | | | Fixes: - (MSVC) F:\llvm-project\mlir\lib\Dialect\Linalg\Analysis\DependenceAnalysis.cpp(103): warning C4551: function call missing argument list - (Clang) tools\mlir\lib\Dialect\SPIRV\SPIRVCanonicalization.inc(232,1): warning: unused function 'populateWithGenerated' [-Wunused-function]
* [mlir] Fix linking with LLDAlexandre Ganea2020-01-011-1/+1
| | | | The issue is that /WHOLEARCHIVE is interpreted differently in LLD, which needs the same exact path as the .lib; whereas link.exe can take the library name, withoutout a path or extension, if that was already supplied on the cmd-line. I'll write a follow-up patch to fix the issue in LLD.
* [mlir] Fix warnings when compiling with Clang 9.0Alexandre Ganea2020-01-011-2/+2
| | | | Fixes: warning: comparison of integers of different signs: 'const unsigned int' and '(anonymous namespace)::OperationPrinter::(anonymous enum at F:\llvm-project\mlir\lib\IR\AsmPrinter.cpp:1444:3)' [-Wsign-compare]
* [mlir][docs] Remove redundant path prefixJacques Pienaar2019-12-311-1/+1
| | | | ./ is not needed.
* [mlir] Make code blocks more consistentJacques Pienaar2019-12-319-44/+43
| | | | Use the same form specification for the same type of code.
* [mlir][Linalg] Delete unused LinalgLibraryOps.tdNicolas Vasilache2019-12-311-616/+0
| | | | | | | | | | | | Summary: This has been previously renamed to LinalgStructuredOps.td Reviewers: ftynse Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits, ftynse Tags: #llvm Differential Revision: https://reviews.llvm.org/D72013
* [mlir] Refactor operation results to use a single use list for all results ↵River Riddle2019-12-307-264/+365
| | | | | | | | | | of the operation. Summary: A new class is added, IRMultiObjectWithUseList, that allows for representing an IR use list that holds multiple sub values(used in this case for OpResults). This class provides all of the same functionality as the base IRObjectWithUseList, but for specific sub-values. This saves a word per operation result and is a necessary step in optimizing the layout of operation results. For now the use list is placed on the operation itself, so zero-result operations grow by a word. When the work for optimizing layout is finished, this can be moved back to being a trailing object based on memory/runtime benchmarking. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D71955
* [mlir] Update mlir/CMakeLists.txt to install *.td filesKern Handa2019-12-291-0/+1
| | | | | | | | | | Currently when you build the `install` target, TableGen files don't get installed. TableGen files are needed when authoring new MLIR dialects, but right now they're missing when using the pre-built binaries. Differential Revision: https://reviews.llvm.org/D71958
* [mlir] Fix the wrong computation of dynamic strides for lowering AllocOp to LLVMTung Le Duc2019-12-282-7/+8
| | | | | Leftover change from before the MLIR merge, reviewed at accepted at https://github.com/tensorflow/mlir/pull/338.
* [mlir] Merge the successor operand count into BlockOperand.River Riddle2019-12-275-79/+98
| | | | | | | | Summary: The successor operand counts are directly tied to block operands anyways, and this simplifies the trailing objects of Operation(i.e. one less computation to perform). Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D71949
OpenPOWER on IntegriCloud