diff options
| author | James Newling <james.newling@gmail.com> | 2025-05-15 07:52:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-15 07:52:53 -0700 |
| commit | 3d6d5dfed2b303e9fba74586993df3fa85058991 (patch) | |
| tree | 44f09593c91ae9417d41c5ef72a981a71d3e1a8e /mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp | |
| parent | b7d6a54703823bfba2b437e4b764ceb16b73c2af (diff) | |
[mlir][vector] Address linearization comments (post commit) (#138075)
This PR adds some documentation to address comments in
https://github.com/llvm/llvm-project/pull/136581
This PR adds a test for linearization across scf.for. This new test
might be considered redundant by more experienced MLIRers, but might
help newer users understand how to linearize scf/cf/func operations
easily
The documentation added in this PR also tightens our definition of
linearization, to now exclude unrolling (which creates multiple ops from
1 op). We hadn't really specified what linearization meant before.
Diffstat (limited to 'mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp')
| -rw-r--r-- | mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp index 54defd949c26..ccba2e280686 100644 --- a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp +++ b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp @@ -17,6 +17,7 @@ #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h" #include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/SCF/Transforms/Patterns.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Dialect/Vector/IR/VectorOps.h" #include "mlir/Dialect/Vector/Transforms/LoweringPatterns.h" @@ -836,9 +837,6 @@ struct TestVectorEmulateMaskedLoadStore final } }; -// TODO: move this code into the user project. -namespace vendor { - /// Get the set of operand/result types to check for sufficiently /// small inner-most dimension size. static SmallVector<std::pair<Type, unsigned>> @@ -960,8 +958,6 @@ struct TestVectorBitWidthLinearize final } }; -} // namespace vendor - struct TestVectorLinearize final : public PassWrapper<TestVectorLinearize, OperationPass<>> { MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestVectorLinearize) @@ -987,6 +983,8 @@ struct TestVectorLinearize final vector::populateVectorLinearizeBasePatterns(converter, target, patterns); vector::populateVectorLinearizeShuffleLikeOpsPatterns(converter, target, patterns); + mlir::scf::populateSCFStructuralTypeConversionsAndLegality( + converter, patterns, target); if (failed(applyPartialConversion(getOperation(), target, std::move(patterns)))) @@ -1067,7 +1065,7 @@ void registerTestVectorLowerings() { PassRegistration<TestVectorLinearize>(); - PassRegistration<vendor::TestVectorBitWidthLinearize>(); + PassRegistration<TestVectorBitWidthLinearize>(); PassRegistration<TestEliminateVectorMasks>(); } |
