[mlir] Don't use Optional::getValue (NFC)
[mlir] (NFC) Clean up bazel and CMake target namesAll dialect targets in bazel have been named *Dialect and all dialecttargets in CMake have been named MLIR*Dialect.
[mlir][gpu] Move GPU headers into IR/ and Transforms/Depends on D127350Reviewed By: rriddleDifferential Revision: https://reviews.llvm.org/D127352
[mlir:FunctionOpInterface] Rename the "type" attribute to "function_type"This removes any potential confusion with the `getType` accessorswhich correspond to SSA results of an operation, and makes
[mlir:FunctionOpInterface] Rename the "type" attribute to "function_type"This removes any potential confusion with the `getType` accessorswhich correspond to SSA results of an operation, and makes itclear what the intent is (i.e. to represent the type of the function).Differential Revision: https://reviews.llvm.org/D121762
show more ...
[mlir][gpu] Introduce gpu.global_id opIntroduce OpenCL-style global_id op and corresponding spirv lowering.Differential Revision: https://reviews.llvm.org/D121548
[mlir][spirv] Make EntryPointABIAttr.local_size optional* It doesn't required by OpenCL/Intel Level Zero and can be set programmatically.* Add GPU to spirv lowering in case when attribute is not p
[mlir][spirv] Make EntryPointABIAttr.local_size optional* It doesn't required by OpenCL/Intel Level Zero and can be set programmatically.* Add GPU to spirv lowering in case when attribute is not present.* Set higher benefit to WorkGroupSizeConversion pattern so it will always try to lower first from the attribute.Differential Revision: https://reviews.llvm.org/D120399
[mlir][SPIRV] Split up StandardToSPIRV now that the Standard dialect is goneStandardToSPIRV currently contains an assortment of patterns converting fromdifferent dialects to SPIRV. This commit spl
[mlir][SPIRV] Split up StandardToSPIRV now that the Standard dialect is goneStandardToSPIRV currently contains an assortment of patterns converting fromdifferent dialects to SPIRV. This commit splits up StandardToSPIRV into separateconversions for each of the dialects involved (some of which already exist).Differential Revision: https://reviews.llvm.org/D120767
[mlir][spirv] Convert gpu.barrier to spv.ControlBarrierReviewed By: ThomasRaouxDifferential Revision: https://reviews.llvm.org/D120722
[mlir] Convert OpTrait::FunctionLike to FunctionOpInterfaceThis commit refactors the FunctionLike trait into an interface (FunctionOpInterface).FunctionLike as it is today is already a pseudo-inte
[mlir] Convert OpTrait::FunctionLike to FunctionOpInterfaceThis commit refactors the FunctionLike trait into an interface (FunctionOpInterface).FunctionLike as it is today is already a pseudo-interface, with many users checking thepresence of the trait and then manually into functionality implemented in thefunction_like_impl namespace. By transitioning to an interface, these accesses are muchcleaner (ideally with no direct calls to the impl namespace outside of the implementationof the derived function operations, e.g. for parsing/printing utilities).I've tried to maintain as much compatability with the current state as possible, whilealso trying to clean up as much of the cruft as possible. The general migration plan forcurrent users of FunctionLike is as follows:* function_like_impl -> function_interface_implRealistically most user calls should remove references to functions within this namespaceoutside of a vary narrow set (e.g. parsing/printing utilities). Calls to the attribute nameaccessors should be migrated to the `FunctionOpInterface::` equivalent, most everythingelse should be updated to be driven through an instance of the interface.* OpTrait::FunctionLike -> FunctionOpInterface`hasTrait` checks will need to be moved to isa, along with the other various Trait vsInterface API differences.* populateFunctionLikeTypeConversionPattern -> populateFunctionOpInterfaceTypeConversionPatternFixes #52917Differential Revision: https://reviews.llvm.org/D117272
[mlir] Replace StrEnumAttr -> EnumAttr in core dialectsRemoves uses of `StrEnumAttr` in core dialectsReviewed By: mehdi_amini, rriddleDifferential Revision: https://reviews.llvm.org/D117514
Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC)
[mlir] Convert NamedAttribute to be a classNamedAttribute is currently represented as an std::pair, but thiscreates an extremely clunky .first/.second API. This commitconverts it to a class, with
[mlir] Convert NamedAttribute to be a classNamedAttribute is currently represented as an std::pair, but thiscreates an extremely clunky .first/.second API. This commitconverts it to a class, with better accessors (getName/getValue)and also opens the door for more convenient API in the future.Differential Revision: https://reviews.llvm.org/D113956
[mlir][NFC] Replace references to Identifier with StringAttrThis is part of the replacement of Identifier with StringAttr.Differential Revision: https://reviews.llvm.org/D113953
[mlir] Refactor ElementsAttr's value access APIThere are several aspects of the API that either aren't easy to use, or aredeceptively easy to do the wrong thing. The main change of this commitis
[mlir] Refactor ElementsAttr's value access APIThere are several aspects of the API that either aren't easy to use, or aredeceptively easy to do the wrong thing. The main change of this commitis to remove all of the `getValue<T>`/`getFlatValue<T>` from ElementsAttrand instead provide operator[] methods on the ranges returned by`getValues<T>`. This provides a much more convenient API for the valueranges. It also removes the easy-to-be-inefficient nature ofgetValue/getFlatValue, which under the hood would construct a new range forthe type `T`. Constructing a range is not necessarily cheap in all cases, andcould lead to very poor performance if used within a loop; i.e. if you were tonaively write something like:```DenseElementsAttr attr = ...;for (int i = 0; i < size; ++i) { // We are internally rebuilding the APFloat value range on each iteration!! APFloat it = attr.getFlatValue<APFloat>(i);}```Differential Revision: https://reviews.llvm.org/D113229
[MLIR] Replace std ops with arith dialect opsPrecursor: https://reviews.llvm.org/D110200Removed redundant ops from the standard dialect that were moved to the`arith` or `math` dialects.Renamed
[MLIR] Replace std ops with arith dialect opsPrecursor: https://reviews.llvm.org/D110200Removed redundant ops from the standard dialect that were moved to the`arith` or `math` dialects.Renamed all instances of operations in the codebase and in tests.Reviewed By: rriddle, jpienaarDifferential Revision: https://reviews.llvm.org/D110797
[mlir:OpConversionPattern] Add overloads for taking an Adaptor instead of ArrayRefThis has been a TODO for a long time, and it brings about many advantages (namely nice accessors, and less fragile
[mlir:OpConversionPattern] Add overloads for taking an Adaptor instead of ArrayRefThis has been a TODO for a long time, and it brings about many advantages (namely nice accessors, and less fragile code). The existing overloads that accept ArrayRef are now treated as deprecated and will be removed in a followup (after a small grace period). Most of the upstream MLIR usages have been fixed by this commit, the rest will be handled in a followup.Differential Revision: https://reviews.llvm.org/D110293
[mlir][spirv] Initial support for 64 bit index type and builtinsDifferential Revision: https://reviews.llvm.org/D108516
[mlir] NFC: split MemRef to SPIR-V conversion into their own filesReviewed By: hanchungDifferential Revision: https://reviews.llvm.org/D107094
[mlir][spirv] Fix a few issues in ModuleCombiner- Fixed symbol insertion into `symNameToModuleMap`. Insertion needs to happen whether symbols are renamed or not.- Added check for the VCE triple
[mlir][spirv] Fix a few issues in ModuleCombiner- Fixed symbol insertion into `symNameToModuleMap`. Insertion needs to happen whether symbols are renamed or not.- Added check for the VCE triple and avoid dropping it.- Disabled function deduplication. It requires more careful rules. Right now it can remove different functions.- Added tests for symbol rename listener.- And some other code/comment cleanups.Reviewed By: ergawyDifferential Revision: https://reviews.llvm.org/D106886
[MLIR] Split out GPU ops library from TransformsSplit out GPU ops library from GPU transforms. This allows libraries todepend on GPU Ops without needing/building its transforms.Differential Revi
[MLIR] Split out GPU ops library from TransformsSplit out GPU ops library from GPU transforms. This allows libraries todepend on GPU Ops without needing/building its transforms.Differential Revision: https://reviews.llvm.org/D105472
[mlir][spirv] Use SingleBlock + NoTerminator for spv.moduleThis allows us to remove the `spv.mlir.endmodule` op andall the code associated with it.Along the way, tightened the APIs for `spv.modu
[mlir][spirv] Use SingleBlock + NoTerminator for spv.moduleThis allows us to remove the `spv.mlir.endmodule` op andall the code associated with it.Along the way, tightened the APIs for `spv.module` a bitby removing some aliases. Now we use `getRegion` to getthe only region, and `getBody` to get the region's onlyblock.Reviewed By: mravishankar, hanchungDifferential Revision: https://reviews.llvm.org/D103265
[mlir] Refactor the representation of function-like argument/result attributes.The current design uses a unique entry for each argument/result attribute, with the name of the entry being something
[mlir] Refactor the representation of function-like argument/result attributes.The current design uses a unique entry for each argument/result attribute, with the name of the entry being something like "arg0". This provides for a somewhat sparse design, but ends up being much more expensive (from a runtime perspective) in-practice. The design requires building a string every time we lookup the dictionary for a specific arg/result, and also requires N attribute lookups when collecting all of the arg/result attribute dictionaries.This revision restructures the design to instead have an ArrayAttr that contains all of the attribute dictionaries for arguments and another for results. This design reduces the number of attribute name lookups to 1, and allows for O(1) lookup for individual element dictionaries. The major downside is that we can end up with larger memory usage, as the ArrayAttr contains an entry for each element even if that element has no attributes. If the memory usage becomes too problematic, we can experiment with a more sparse structure that still provides a lot of the wins in this revision.This dropped the compilation time of a somewhat large TensorFlow model from ~650 seconds to ~400 seconds.Differential Revision: https://reviews.llvm.org/D102035
[mlir][spirv] Add utilities for push constant valueThis commit add utility functions for creating push constantstorage variable and loading values from it.Along the way, performs some clean up:
[mlir][spirv] Add utilities for push constant valueThis commit add utility functions for creating push constantstorage variable and loading values from it.Along the way, performs some clean up:* Deleted `setABIAttrs`, which is just a 4-liner function with one user.* Moved `SPIRVConverstionTarget` into `mlir` namespace, to be consistent with `SPIRVTypeConverter` and `LLVMConversionTarget`.Reviewed By: mravishankarDifferential Revision: https://reviews.llvm.org/D99725
[PatternMatch] Big mechanical rename OwningRewritePatternList -> RewritePatternSet and insert -> add. NFCThis doesn't change APIs, this just cleans up the many in-tree uses of thesenames to use t
[PatternMatch] Big mechanical rename OwningRewritePatternList -> RewritePatternSet and insert -> add. NFCThis doesn't change APIs, this just cleans up the many in-tree uses of thesenames to use the new preferred names. We'll keep the old names around for acouple weeks to help transitions.Differential Revision: https://reviews.llvm.org/D99127
Remove the extraneous MLIRContext argument from populateWithGenerated. NFC.
12345