summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp
AgeCommit message (Collapse)Author
2025-07-24[mlir][NFC] update `mlir/Dialect` create APIs (15/n) (#149921)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-07-13[mlir] Remove unused includes (NFC) (#148535)Kazu Hirata
2025-06-27[MLIR][ArmSVE] Add an ArmSVE dialect operation mapping to `bfmmla` (#145064)Momchil Velikov
2025-05-16[MLIR][ArmSVE] Add an ArmSVE dialect operation which maps to svusmmla (#135634)Momchil Velikov
2025-05-16[MLIR][ArmSVE] Add an ArmSVE dialect operation which maps to `svdupq_lane` ↵Momchil Velikov
(#135633)
2025-01-05[mlir][ArmSME] Remove func patterns from vector lowering (#121640)Matthias Springer
Remove `func.call` and `func.return` patterns from `populateArmSVELegalizeForLLVMExportPatterns`. This function is called from `ConvertVectorToLLVMPass::runOnOperation`. That pass should lower only `vector` dialect ops, not `func` dialect ops. These patterns also seem to be unnecessary, as no test cases are failing without them. Also note that there is no `func.func` pattern, so any application of the above-mentioned patterns produces invalid IR.
2024-10-05[mlir][NFC] Mark type converter in `populate...` functions as `const` (#111250)Matthias Springer
This commit marks the type converter in `populate...` functions as `const`. This is useful for debugging. Patterns already take a `const` type converter. However, some `populate...` functions do not only add new patterns, but also add additional type conversion rules. That makes it difficult to find the place where a type conversion was added in the code base. With this change, all `populate...` functions that only populate pattern now have a `const` type converter. Programmers can then conclude from the function signature that these functions do not register any new type conversion rules. Also some minor cleanups around the 1:N dialect conversion infrastructure, which did not always pass the type converter as a `const` object internally.
2024-06-19[mlir][ArmSVE] Add `arm_sve.psel` operation (#95764)Benjamin Maxwell
This adds a new operation for the SME/SVE2.1 psel instruction. This allows selecting a predicate based on a bit within another predicate, essentially allowing for 2-D predication. Informally, the semantics are: ```mlir %pd = arm_sve.psel %p1, %p2[%index] : vector<[4]xi1>, vector<[8]xi1> ``` => ``` if p2[index % num_elements(p2)] == 1: pd = p1 : type(p1) else: pd = all-false : type(p1) ```
2024-06-17[mlir][ArmSVE] Lower predicate-sized vector.create_masks to whilelt (#95531)Benjamin Maxwell
This produces better/more canonical codegen than the generic LLVM lowering, which is a pattern the backend currently does not recognize. See: https://github.com/llvm/llvm-project/issues/81840.
2024-02-16[mlir][ArmSVE] Add `arm_sve.zip.x2` and `arm_sve.zip.x4` ops (#81278)Benjamin Maxwell
This adds ops for the two and four-way SME 2 multi-vector zips. See: - https://developer.arm.com/documentation/ddi0602/2023-12/SME-Instructions/ZIP--two-registers---Interleave-elements-from-two-vectors-?lang=en - https://developer.arm.com/documentation/ddi0602/2023-12/SME-Instructions/ZIP--four-registers---Interleave-elements-from-four-vectors-?lang=en
2024-01-17[mlir][IR] Rename "update root" to "modify op" in rewriter API (#78260)Matthias Springer
This commit renames 4 pattern rewriter API functions: * `updateRootInPlace` -> `modifyOpInPlace` * `startRootUpdate` -> `startOpModification` * `finalizeRootUpdate` -> `finalizeOpModification` * `cancelRootUpdate` -> `cancelOpModification` The term "root" is a misnomer. The root is the op that a rewrite pattern matches against (https://mlir.llvm.org/docs/PatternRewriter/#root-operation-name-optional). A rewriter must be notified of all in-place op modifications, not just in-place modifications of the root (https://mlir.llvm.org/docs/PatternRewriter/#pattern-rewriter). The old function names were confusing and have contributed to various broken rewrite patterns. Note: The new function names use the term "modify" instead of "update" for consistency with the `RewriterBase::Listener` terminology (`notifyOperationModified`).
2023-10-12[mlir][ArmSVE] Avoid UBSAN issue with VectorType::Builder (NFC)Benjamin Maxwell
This patch just avoids the underlying bug in VectorType::Builder, which currently has incorrect copy/move constructors. See https://lab.llvm.org/buildbot/#/builders/5/builds/37355
2023-10-12[mlir][ArmSVE] Add convert_to/from_svbool ops (#68586)Benjamin Maxwell
This adds slightly higher-level ops for converting masks between svbool and SVE predicate types. The main reason to use these over the intrinsics is these ops support vectors of masks (via unrolling). E.g. ``` // Convert a svbool mask to a mask of SVE predicates: %svbool = vector.load %memref[%c0, %c0] : memref<2x?xi1>, vector<2x[16]xi1> %mask = arm_sve.convert_from_svbool %svbool : vector<2x[8]xi1> // => Results in vector<2x[8]xi1> ``` Or: ``` // Convert a mask of SVE predicates to a svbool mask: %mask = vector.create_mask %c2, %dim_size : vector<2x[2]xi1> %svbool = arm_sve.convert_to_svbool %mask : vector<2x[2]xi1> // => Results in vector<2x[16]xi1> ``` Depends on #68418
2023-10-09[mlir][ArmSVE] Restructure sources to match ArmSME dialect (NFC) (#68399)Benjamin Maxwell
This rearranges the Arm SVE dialect to have the same structure of the Arm SME dialect. So this just moves around some source files and adds a ArmSVE_IntrOp base class for SVE intrinsics. This makes later changes a little easier and more consistent other dialects.
2022-03-01[mlir] Trim a huge number of unnecessary dependencies on the Func dialectRiver Riddle
The Func has a large number of legacy dependencies carried over from the old Standard dialect, which was pervasive and contained a large number of varied operations. With the split of the standard dialect and its demise, a lot of lingering dead dependencies have survived to the Func dialect. This commit removes a large majority of then, greatly reducing the dependence surface area of the Func dialect.
2022-03-01[mlir] Rename the Standard dialect to the Func dialectRiver Riddle
The last remaining operations in the standard dialect all revolve around FuncOp/function related constructs. This patch simply handles the initial renaming (which by itself is already huge), but there are a large number of cleanups unlocked/necessary afterwards: * Removing a bunch of unnecessary dependencies on Func * Cleaning up the From/ToStandard conversion passes * Preparing for the move of FuncOp to the Func dialect See the discussion at https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061 Differential Revision: https://reviews.llvm.org/D120624
2022-01-26[mlir] Finish replacing OwningRewritePatternList with RewritePatternSetRiver Riddle
OwningRewritePatternList has been deprecated for ~10 months now, we can remove the leftover using directives at this point. Differential Revision: https://reviews.llvm.org/D118287
2022-01-24[mlir:ArmSVE][NFC] Remove dead code and unnecessary dependenciesRiver Riddle
Differential Revision: https://reviews.llvm.org/D117981
2021-12-15[mlir][RFC] Add scalable dimensions to VectorTypeJavier Setoain
With VectorType supporting scalable dimensions, we don't need many of the operations currently present in ArmSVE, like mask generation and basic arithmetic instructions. Therefore, this patch also gets rid of those. Having built-in scalable vector support also simplifies the lowering of scalable vector dialects down to LLVMIR. Scalable dimensions are indicated with the scalable dimensions between square brackets: vector<[4]xf32> Is a scalable vector of 4 single precission floating point elements. More generally, a VectorType can have a set of fixed-length dimensions followed by a set of scalable dimensions: vector<2x[4x4]xf32> Is a vector with 2 scalable 4x4 vectors of single precission floating point elements. The scale of the scalable dimensions can be obtained with the Vector operation: %vs = vector.vscale This change is being discussed in the discourse RFC: https://llvm.discourse.group/t/rfc-add-built-in-support-for-scalable-vector-types/4484 Differential Revision: https://reviews.llvm.org/D111819
2021-09-24[mlir:OpConversionPattern] Add overloads for taking an Adaptor instead of ↵River Riddle
ArrayRef This 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
2021-07-09[mlir] factor memref-to-llvm lowering out of std-to-llvmAlex Zinenko
After the MemRef has been split out of the Standard dialect, the conversion to the LLVM dialect remained as a huge monolithic pass. This is undesirable for the same complexity management reasons as having a huge Standard dialect itself, and is even more confusing given the existence of a separate dialect. Extract the conversion of the MemRef dialect operations to LLVM into a separate library and a separate conversion pass. Reviewed By: herhut, silvas Differential Revision: https://reviews.llvm.org/D105625
2021-06-09[mlir][ArmSVE] Add basic load/store operationsJavier Setoain
ArmSVE-specific memory operations are needed to generate end-to-end code for as long as MLIR core doesn't support scalable vectors. This instructions will be eventually unnecessary, for now they're required for more complex testing. Differential Revision: https://reviews.llvm.org/D103535
2021-06-09[mlir][ArmSVE] Add basic mask generation operationsJavier Setoain
These `arm_sve.cmp` functions are needed to generate scalable vector masks as long as scalable vectors are not part of the standard types. Once in standard, these can be removed and `std.cmp` can be used instead. Differential Revision: https://reviews.llvm.org/D103473
2021-06-08Revert "[mlir][ArmSVE] Add basic mask generation operations"Javier Setoain
This reverts commit 392af6a78bb7dfb87a24ed66db598c1d09ac756b
2021-06-08[mlir][ArmSVE] Add basic mask generation operationsJavier Setoain
These `arm_sve.cmp` functions are needed to generate scalable vector masks as long as scalable vectors are not part of the standard types. Once in standard, these can be removed and `std.cmp` can be used instead. Differential Revision: https://reviews.llvm.org/D103473
2021-05-05[mlir][ArmSVE] Add masked arithmetic operationsJavier Setoain
These instructions map to SVE-specific instrinsics that accept a predicate operand to support control flow in vector code. Differential Revision: https://reviews.llvm.org/D100982
2021-05-05[mlir][ArmSVE] Add basic arithmetic operationsJavier Setoain
While we figure out how to best add Standard support for scalable vectors, these instructions provide a workaround for basic arithmetic between scalable vectors. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D100837
2021-04-16[mlir][ArmSVE] Cleanup dialect registrationJavier Setoain
ArmSVE dialect is behind the recent changes in how the Vector dialect interacts with backend vector dialects and the MLIR -> LLVM IR translation module. This patch cleans up ArmSVE initialization within Vector and removes the need for an LLVMArmSVE dialect. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D100171