summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [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-032-2/+24
| | | | | | | | | | | | 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][spirv] Fix shader ABI attribute prefix and add verificationLei Zhang2020-01-032-2/+62
| | | | | | | | | | 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] Rewrite the internal representation of OpResult to be optimized for ↵River Riddle2020-01-023-44/+158
| | | | | | | | | | | | | | 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][Linalg] Extend generic ops to allow tensorsNicolas Vasilache2020-01-025-38/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-023-0/+9
| | | | | | | | | | | | | | 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-021-0/+5
| | | | | | * 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.
* [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-021-3/+3
| | | | | | | | | | | | | | | | | | 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 LinalgGeneric -> GenericLinalgNicolas Vasilache2020-01-021-6/+6
| | | | | | | | | | 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-014-41/+54
| | | | | | | | | 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] Fix -Wrange-loo-analysis warningsFangrui Song2020-01-016-8/+8
| | | | | | | | | | | | 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-011-1/+2
| | | | | | 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 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] Make code blocks more consistentJacques Pienaar2019-12-311-1/+1
| | | | Use the same form specification for the same type of code.
* [mlir] Refactor operation results to use a single use list for all results ↵River Riddle2019-12-303-90/+73
| | | | | | | | | | 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] Fix the wrong computation of dynamic strides for lowering AllocOp to LLVMTung Le Duc2019-12-281-4/+5
| | | | | 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-272-52/+48
| | | | | | | | 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
* [mlir][spirv] Add basic definitions for supporting availabilityLei Zhang2019-12-272-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | SPIR-V has a few mechanisms to control op availability: version, extension, and capabilities. These mechanisms are considered as different availability classes. This commit introduces basic definitions for modelling SPIR-V availability classes. Specifically, an `Availability` class is added to SPIRVBase.td, along with two subclasses: MinVersion and MaxVersion for versioning. SPV_Op is extended to take a list of `Availability`. Each `Availability` instance carries information for generating op interfaces for the corresponding availability class and also the concrete availability requirements. With the availability spec on ops, we can now auto-generate the op interfaces of all SPIR-V availability classes and also synthesize the op's implementations of these interfaces. The interface generation is done via new TableGen backends -gen-avail-interface-{decls|defs}. The op's implementation is done via -gen-spirv-avail-impls. Differential Revision: https://reviews.llvm.org/D71930
* [mlir] Convert std.and/std.or ops to spv.LogicalAnd/spv.LogicalOrMaheshRavishankar2019-12-271-7/+9
| | | | | | | | | The conversion from std.and/std.or to spv.LogicalAnd/spv.LogicalOr is only valid for boolean (i1) types. Modify BinaryOpPattern in StandardToSPIRV.td to allow limiting the type of the operands for which the pattern is applied. Differential Revision: https://reviews.llvm.org/D71881
* [MLIR] [NFC] fix unused var warningUday Bondhugula2019-12-271-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Fix this warning: ` [69/106] Building CXX object tools/mlir/lib/Dialect/StandardOps/CMakeFiles/MLIRStandardOps.dir/Ops.cpp.o /home/uday/llvm-project/mlir/lib/Dialect/StandardOps/Ops.cpp: In member function ‘virtual mlir::PatternMatchResult {anonymous}::ViewOpShapeFolder::matchAndRewrite(mlir::ViewOp, mlir::PatternRewriter&) const’: /home/uday/llvm-project/mlir/lib/Dialect/StandardOps/Ops.cpp:2575:14: warning: variable ‘dynamicOffsetOperandCount’ set but not used [-Wunused-but-set-variable] 2575 | unsigned dynamicOffsetOperandCount = 0; ` Reviewers: rriddle, mehdi_amini, ftynse Reviewed By: ftynse Subscribers: jpienaar, burmako, shauheen, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71922
* [mlir] Floating constants for import-llvmAlex Zinenko2019-12-271-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: `mlir-translate -import-llvm test.ll` was going into segmentation fault if `test.ll` had `float` or `double` constants. For example, ``` %3 = fadd double 3.030000e+01, %0 ``` Now, it is handled in `Importer::getConstantAsAttr` (similar behaviour as normal integers) Added tests for FP arithmetic Reviewers: ftynse, mehdi_amini Reviewed By: ftynse, mehdi_amini Subscribers: shauheen, mehdi_amini, rriddle, jpienaar, burmako, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71912
* Remove an unused static function.Eric Christopher2019-12-261-15/+0
|
* Fix a -Wcovered-switch-default warning by moving the unreachable out of theEric Christopher2019-12-261-2/+1
| | | | covered switch.
* Remove unused static function.Eric Christopher2019-12-261-15/+0
|
* Refactor the way that pass options are specified.River Riddle2019-12-233-26/+76
| | | | | | | | | This change refactors pass options to be more similar to how statistics are modeled. More specifically, the options are specified directly on the pass instead of in a separate options class. (Note that the behavior and specification for pass pipelines remains the same.) This brings about several benefits: * The specification of options is much simpler * The round-trip format of a pass can be generated automatically * This gives a somewhat deeper integration with "configuring" a pass, which we could potentially expose to users in the future. PiperOrigin-RevId: 286953824
* NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.River Riddle2019-12-2381-1416/+1366
| | | | | | ValuePtr was a temporary typedef during the transition to a value-typed Value. PiperOrigin-RevId: 286945714
* Change the `notifyRootUpdated` API to be transaction based.River Riddle2019-12-236-73/+157
| | | | | | This means that in-place, or root, updates need to use explicit calls to `startRootUpdate`, `finalizeRootUpdate`, and `cancelRootUpdate`. The major benefit of this change is that it enables in-place updates in DialectConversion, which simplifies the FuncOp pattern for example. The major downside to this is that the cases that *may* modify an operation in-place will need an explicit cancel on the failure branches(assuming that they started an update before attempting the transformation). PiperOrigin-RevId: 286933674
* Resubmit: ReImplement the Value classes as value-typed objects wrapping an ↵River Riddle2019-12-2314-45/+47
| | | | | | | | internal pointer storage. This will enable future commits to reimplement the internal implementation of OpResult without needing to change all of the existing users. This is part of a chain of commits optimizing the size of operation results. PiperOrigin-RevId: 286930047
* Automated rollback of commit f603a50109107b447b835dac11f0eb541288393eMLIR Team2019-12-2314-47/+45
| | | | PiperOrigin-RevId: 286924059
* ReImplement the Value classes as value-typed objects wrapping an internal ↵River Riddle2019-12-2314-45/+47
| | | | | | | | pointer storage. This will enable future commits to reimplement the internal implementation of OpResult without needing to change all of the existing users. This is part of a chain of commits optimizing the size of operation results. PiperOrigin-RevId: 286919966
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-23201-2613/+804
| | | | PiperOrigin-RevId: 286906740
* NFC: Introduce new ValuePtr/ValueRef typedefs to simplify the transition to ↵River Riddle2019-12-2286-1529/+1549
| | | | | | | | | | 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
* Add integer bit-shift operations to the standard dialect.Manuel Freiberger2019-12-227-32/+51
| | | | | | | | | | | | | | | | | | | Rename the 'shlis' operation in the standard dialect to 'shift_left'. Add tests for this operation (these have been missing so far) and add a lowering to the 'shl' operation in the LLVM dialect. Add also 'shift_right_signed' (lowered to LLVM's 'ashr') and 'shift_right_unsigned' (lowered to 'lshr'). The original plan was to name these operations 'shift.left', 'shift.right.signed' and 'shift.right.unsigned'. This works if the operations are prefixed with 'std.' in MLIR assembly. Unfortunately during import the short form is ambigous with operations from a hypothetical 'shift' dialect. The best solution seems to omit dots in standard operations for now. Closes tensorflow/mlir#226 PiperOrigin-RevId: 286803388
* [VectorOps] unify vector dialect "subscripts"Aart Bik2019-12-202-19/+19
| | | | PiperOrigin-RevId: 286650682
* fix isValidDim for block arg caseUday Bondhugula2019-12-201-7/+7
| | | | | | | | | | | | | - a block argument associated with an arbitrary op can't be a valid dimensional identifier; it has to be the block argument of either a function op or an affine.for. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#331 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/331 from bondhugula:valid_dim 3273b4fcbaa31fb7b6671d93c9e42a6b2a6a4e4c PiperOrigin-RevId: 286593693
* Add gpu.shuffle op.Christian Sigg2019-12-202-2/+101
| | | | | | | | This will allow us to lower most of gpu.all_reduce (when all_reduce doesn't exist in the target dialect) within the GPU dialect, and only do target-specific lowering for the shuffle op. PiperOrigin-RevId: 286548256
* Allow dialect to create friendly names for region argumentsFrank Laub2019-12-191-0/+15
| | | | | | | | | This is the block argument equivalent of the existing `getAsmResultNames` hook. Closes tensorflow/mlir#329 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/329 from plaidml:flaub-region-arg-names fc7876f2d1335024e441083cd25263fd6247eb7d PiperOrigin-RevId: 286523299
* Unique trait list during ODS Operator trait constructionJacques Pienaar2019-12-191-6/+13
| | | | | | Concatting lists in TableGen is easy, creating unique lists less so. There is no reason for duplicated op traits so we could throw an error instead but duplicates could occur due to concatting different list of traits in ODS (e.g., for convenience reasons), so just dedup them during Operator trait construction instead. PiperOrigin-RevId: 286488423
* [VectorOps] Update vector transfer_read/write ops to operatate on memrefs ↵Andy Davis2019-12-191-34/+87
| | | | | | | | | with vector element type. Update vector transfer_read/write ops to operatate on memrefs with vector element type. This handle cases where the memref vector element type represents the minimal memory transfer unit (or multiple of the minimal memory transfer unit). PiperOrigin-RevId: 286482115
* Restructure and update Linalg ODS and documentation - NFCNicolas Vasilache2019-12-194-10/+10
| | | | | | | | This CL allows specifying an additional name for specifying the .td file that is used to generate the doc for a dialect. This is necessary for a dialect like Linalg which has different "types" of ops that are used in different contexts. This CL also restructures the Linalg documentation and renames LinalgLibraryOps -> LinalgStructuredOps but is otherwise NFC. PiperOrigin-RevId: 286450414
* [VectorOps] Add vector ReshapeOp to the VectorOps dialect.Andy Davis2019-12-191-0/+117
| | | | | | Adds vector ReshapeOp to the VectorOps dialect. An aggregate vector reshape operation, which aggregates multiple hardware vectors, can enable optimizations during decomposition (e.g. loading one input hardware vector and performing multiple rotate and scatter store operations to the vector output). PiperOrigin-RevId: 286440658
* LLVMFuncOp: implement addEntryBlockAlex Zinenko2019-12-191-1/+15
| | | | | | | | | This function has been declared as a part of the LLVMFuncOp interface but never implemented. Closes tensorflow/mlir#325. PiperOrigin-RevId: 286439619
* [VectorOps] minor cleanup: vector dialect "subscripts" are i32Aart Bik2019-12-191-3/+12
| | | | | | | | Introduces some centralized methods to move towards consistent use of i32 as vector subscripts. Note: sizes/strides/offsets attributes are still i64 PiperOrigin-RevId: 286434133
* Detemplatize ModuleTranslation::lookupValuesAlex Zinenko2019-12-191-0/+10
| | | | | | | | | This function template has been introduced in the early days of MLIR to work around the absence of common type for ranges of values (operands, block argumeents, vectors, etc). Core IR now provides ValueRange for exactly this purpose. Use it instead of the template parameter. PiperOrigin-RevId: 286431338
* Add a couple useful LLVM_DEBUG's to the inliner.Sean Silva2019-12-182-1/+14
| | | | | | This makes it easier to narrow down on ops that are preventing inlining. PiperOrigin-RevId: 286243868
* Move the specializations of VectorTransferRewriter::matchAndRewrite back ↵River Riddle2019-12-181-80/+80
| | | | | | | | into the anonymous namespace. This appeases the GCC bug related to specializations in a different namespace. PiperOrigin-RevId: 286234667
* Added LLVM ops and lowering phases from standard dialect for FAbs, FCeil, ↵Marcel Koester2019-12-181-0/+21
| | | | | | | | | | | Cos, FNeg, CopySign. Added test cases for the newly added LLVM operations and lowering features. Closes tensorflow/mlir#300 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/300 from dfki-jugr:std_to_llvm da6168bbc1a369ae2e99ad3881fdddd82f075dd4 PiperOrigin-RevId: 286231169
* [VectorOps] Add vector.print definition, with lowering supportAart Bik2019-12-182-2/+141
| | | | | | | | | | | | | | | | Examples: vector.print %f : f32 vector.print %x : vector<4xf32> vector.print %y : vector<3x4xf32> vector.print %z : vector<2x3x4xf32> LLVM lowering replaces these with fully unrolled calls into a small runtime support library that provides some basic printing operations (single value, opening closing bracket, comma, newline). PiperOrigin-RevId: 286230325
OpenPOWER on IntegriCloud