1edd9515bSthomasraoux //===- VectorToGPU.cpp - Convert vector to GPU dialect ----------*- C++ -*-===//
2edd9515bSthomasraoux //
3edd9515bSthomasraoux // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4edd9515bSthomasraoux // See https://llvm.org/LICENSE.txt for license information.
5edd9515bSthomasraoux // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6edd9515bSthomasraoux //
7edd9515bSthomasraoux //===----------------------------------------------------------------------===//
8edd9515bSthomasraoux //
9edd9515bSthomasraoux // This file implements lowering of vector operations to GPU dialect ops.
10edd9515bSthomasraoux //
11edd9515bSthomasraoux //===----------------------------------------------------------------------===//
12edd9515bSthomasraoux 
13edd9515bSthomasraoux #include <type_traits>
14edd9515bSthomasraoux 
15edd9515bSthomasraoux #include "mlir/Conversion/VectorToGPU/VectorToGPU.h"
16edd9515bSthomasraoux 
17edd9515bSthomasraoux #include "../PassDetail.h"
18edd9515bSthomasraoux #include "mlir/Analysis/SliceAnalysis.h"
19edd9515bSthomasraoux #include "mlir/Dialect/GPU/GPUDialect.h"
20*66f878ceSMatthias Springer #include "mlir/Dialect/MemRef/IR/MemRef.h"
21edd9515bSthomasraoux #include "mlir/Dialect/Utils/StructuredOpsUtils.h"
22edd9515bSthomasraoux #include "mlir/Dialect/Vector/VectorOps.h"
23edd9515bSthomasraoux #include "mlir/Dialect/Vector/VectorUtils.h"
24edd9515bSthomasraoux #include "mlir/IR/Builders.h"
25edd9515bSthomasraoux #include "mlir/Pass/Pass.h"
26edd9515bSthomasraoux #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
27edd9515bSthomasraoux #include "mlir/Transforms/Passes.h"
28edd9515bSthomasraoux 
29edd9515bSthomasraoux using namespace mlir;
30edd9515bSthomasraoux 
31edd9515bSthomasraoux // Return true if the contract op can be convert to MMA matmul.
32edd9515bSthomasraoux static bool contractSupportsMMAMatrixType(vector::ContractionOp contract) {
33edd9515bSthomasraoux   if (llvm::size(contract.masks()) != 0)
34edd9515bSthomasraoux     return false;
35edd9515bSthomasraoux 
36edd9515bSthomasraoux   using MapList = ArrayRef<ArrayRef<AffineExpr>>;
37edd9515bSthomasraoux   auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); };
38edd9515bSthomasraoux   AffineExpr m, n, k;
39edd9515bSthomasraoux   bindDims(contract.getContext(), m, n, k);
40edd9515bSthomasraoux   auto iteratorTypes = contract.iterator_types().getValue();
41edd9515bSthomasraoux   if (!(isParallelIterator(iteratorTypes[0]) &&
42edd9515bSthomasraoux         isParallelIterator(iteratorTypes[1]) &&
43edd9515bSthomasraoux         isReductionIterator(iteratorTypes[2])))
44edd9515bSthomasraoux     return false;
45edd9515bSthomasraoux 
46edd9515bSthomasraoux   // The contract needs to represent a matmul to be able to convert to
47edd9515bSthomasraoux   // MMAMatrix matmul.
48edd9515bSthomasraoux   if (contract.getIndexingMaps() != infer({{m, k}, {k, n}, {m, n}}))
49edd9515bSthomasraoux     return false;
50edd9515bSthomasraoux 
51edd9515bSthomasraoux   // Check that the size matches what is natively supported.
52edd9515bSthomasraoux   VectorType lhsType = contract.lhs().getType().cast<VectorType>();
53edd9515bSthomasraoux   VectorType rhsType = contract.rhs().getType().cast<VectorType>();
54edd9515bSthomasraoux   VectorType accType = contract.acc().getType().cast<VectorType>();
55edd9515bSthomasraoux 
56edd9515bSthomasraoux   std::tuple<int, int, int> dim(lhsType.getDimSize(0), rhsType.getDimSize(1),
57edd9515bSthomasraoux                                 lhsType.getDimSize(1));
58edd9515bSthomasraoux   if (lhsType.getElementType().isInteger(8) &&
59edd9515bSthomasraoux       rhsType.getElementType().isInteger(8) &&
60edd9515bSthomasraoux       accType.getElementType().isInteger(32) &&
61edd9515bSthomasraoux       (dim == std::make_tuple(8, 8, 32) || dim == std::make_tuple(16, 16, 32) ||
62edd9515bSthomasraoux        dim == std::make_tuple(16, 8, 32)))
63edd9515bSthomasraoux     return true;
64edd9515bSthomasraoux 
65edd9515bSthomasraoux   if (lhsType.getElementType().isF16() && rhsType.getElementType().isF16() &&
66edd9515bSthomasraoux       (accType.getElementType().isF16() || accType.getElementType().isF32()) &&
67edd9515bSthomasraoux       (dim == std::make_tuple(8, 8, 16) || dim == std::make_tuple(16, 16, 16) ||
68edd9515bSthomasraoux        dim == std::make_tuple(16, 8, 16)))
69edd9515bSthomasraoux     return true;
70edd9515bSthomasraoux   return false;
71edd9515bSthomasraoux }
72edd9515bSthomasraoux 
73edd9515bSthomasraoux // Return the stide for the dimension 0 of |type| if it is a memref and has a
74edd9515bSthomasraoux // constant stride.
75edd9515bSthomasraoux static llvm::Optional<int64_t>
76edd9515bSthomasraoux getMemrefConstantHorizontalStride(ShapedType type) {
77edd9515bSthomasraoux   auto memrefType = type.dyn_cast<MemRefType>();
78edd9515bSthomasraoux   if (!memrefType)
79edd9515bSthomasraoux     return false;
80edd9515bSthomasraoux   int64_t offset = 0;
81edd9515bSthomasraoux   SmallVector<int64_t, 2> strides;
82edd9515bSthomasraoux   if (failed(getStridesAndOffset(memrefType, strides, offset)))
83edd9515bSthomasraoux     return llvm::None;
84edd9515bSthomasraoux   if (strides[0] == ShapedType::kDynamicStrideOrOffset)
85edd9515bSthomasraoux     return llvm::None;
86edd9515bSthomasraoux   return strides[0];
87edd9515bSthomasraoux }
88edd9515bSthomasraoux 
89edd9515bSthomasraoux // Return true if the transfer op can be converted to a MMA matrix load.
90edd9515bSthomasraoux static bool transferReadSupportsMMAMatrixType(vector::TransferReadOp readOp) {
91edd9515bSthomasraoux   if (readOp.mask() || readOp.hasOutOfBoundsDim() ||
92edd9515bSthomasraoux       readOp.getVectorType().getRank() != 2)
93edd9515bSthomasraoux     return false;
94edd9515bSthomasraoux   if (!getMemrefConstantHorizontalStride(readOp.getShapedType()))
95edd9515bSthomasraoux     return false;
96edd9515bSthomasraoux   // TODO: Support transpose once it is added to GPU dialect ops.
97edd9515bSthomasraoux   if (!readOp.permutation_map().isMinorIdentity())
98edd9515bSthomasraoux     return false;
99edd9515bSthomasraoux   return true;
100edd9515bSthomasraoux }
101edd9515bSthomasraoux 
102edd9515bSthomasraoux // Return true if the transfer op can be converted to a MMA matrix store.
103edd9515bSthomasraoux static bool
104edd9515bSthomasraoux transferWriteSupportsMMAMatrixType(vector::TransferWriteOp writeOp) {
105edd9515bSthomasraoux   if (writeOp.mask() || writeOp.hasOutOfBoundsDim() ||
106edd9515bSthomasraoux       writeOp.getVectorType().getRank() != 2)
107edd9515bSthomasraoux     return false;
108edd9515bSthomasraoux   if (!getMemrefConstantHorizontalStride(writeOp.getShapedType()))
109edd9515bSthomasraoux     return false;
110edd9515bSthomasraoux   // TODO: Support transpose once it is added to GPU dialect ops.
111edd9515bSthomasraoux   if (!writeOp.permutation_map().isMinorIdentity())
112edd9515bSthomasraoux     return false;
113edd9515bSthomasraoux   return true;
114edd9515bSthomasraoux }
115edd9515bSthomasraoux 
116edd9515bSthomasraoux static bool supportsMMaMatrixType(Operation *op) {
117edd9515bSthomasraoux   if (auto transferRead = dyn_cast<vector::TransferReadOp>(op))
118edd9515bSthomasraoux     return transferReadSupportsMMAMatrixType(transferRead);
119edd9515bSthomasraoux   if (auto transferWrite = dyn_cast<vector::TransferWriteOp>(op))
120edd9515bSthomasraoux     return transferWriteSupportsMMAMatrixType(transferWrite);
121edd9515bSthomasraoux   if (auto contract = dyn_cast<vector::ContractionOp>(op))
122edd9515bSthomasraoux     return contractSupportsMMAMatrixType(contract);
123edd9515bSthomasraoux   return false;
124edd9515bSthomasraoux }
125edd9515bSthomasraoux 
126edd9515bSthomasraoux // Analyze slice of operations based on convert op to figure out if the whole
127edd9515bSthomasraoux // slice can be converted to MMA operations.
128edd9515bSthomasraoux static SetVector<Operation *> getOpToConvert(mlir::Operation *op) {
129edd9515bSthomasraoux   auto hasVectorDest = [](Operation *op) {
130edd9515bSthomasraoux     return op->getNumResults() == 0 ||
131edd9515bSthomasraoux            llvm::any_of(op->getResultTypes(),
132edd9515bSthomasraoux                         [](Type t) { return t.isa<VectorType>(); });
133edd9515bSthomasraoux   };
134edd9515bSthomasraoux   SetVector<Operation *> opToConvert;
135edd9515bSthomasraoux   op->walk([&](vector::ContractionOp contract) {
136edd9515bSthomasraoux     if (opToConvert.contains(contract.getOperation()))
137edd9515bSthomasraoux       return;
138edd9515bSthomasraoux     SetVector<Operation *> dependentOps =
139edd9515bSthomasraoux         getSlice(contract, hasVectorDest, hasVectorDest);
140edd9515bSthomasraoux     // If any instruction cannot use MMA matrix type drop the whole
141edd9515bSthomasraoux     // chaine. MMA matrix are stored in an opaque type so they cannot be used
142edd9515bSthomasraoux     // by all operations.
143edd9515bSthomasraoux     if (llvm::any_of(dependentOps,
144edd9515bSthomasraoux                      [](Operation *op) { return !supportsMMaMatrixType(op); }))
145edd9515bSthomasraoux       return;
146edd9515bSthomasraoux     opToConvert.insert(dependentOps.begin(), dependentOps.end());
147edd9515bSthomasraoux   });
148edd9515bSthomasraoux   return opToConvert;
149edd9515bSthomasraoux }
150edd9515bSthomasraoux 
151edd9515bSthomasraoux namespace {
152edd9515bSthomasraoux // Transform contract into (m, k)x(k, n)x(m, n) form so that it can be converted
153edd9515bSthomasraoux // to MMA matmul.
154edd9515bSthomasraoux struct PrepareContractToGPUMMA
155edd9515bSthomasraoux     : public OpRewritePattern<vector::ContractionOp> {
156edd9515bSthomasraoux   using OpRewritePattern<vector::ContractionOp>::OpRewritePattern;
157edd9515bSthomasraoux 
158edd9515bSthomasraoux   LogicalResult matchAndRewrite(vector::ContractionOp op,
159edd9515bSthomasraoux                                 PatternRewriter &rewriter) const override {
160edd9515bSthomasraoux     Location loc = op.getLoc();
161edd9515bSthomasraoux     Value lhs = op.lhs(), rhs = op.rhs(), res = op.acc();
162edd9515bSthomasraoux 
163edd9515bSthomasraoux     // Set up the parallel/reduction structure in right form.
164edd9515bSthomasraoux     using MapList = ArrayRef<ArrayRef<AffineExpr>>;
165edd9515bSthomasraoux     auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); };
166edd9515bSthomasraoux     AffineExpr m, n, k;
167edd9515bSthomasraoux     bindDims(rewriter.getContext(), m, n, k);
168edd9515bSthomasraoux     static constexpr std::array<int64_t, 2> perm = {1, 0};
169edd9515bSthomasraoux     auto iteratorTypes = op.iterator_types().getValue();
170edd9515bSthomasraoux     SmallVector<AffineMap, 4> maps = op.getIndexingMaps();
171edd9515bSthomasraoux     if (!(isParallelIterator(iteratorTypes[0]) &&
172edd9515bSthomasraoux           isParallelIterator(iteratorTypes[1]) &&
173edd9515bSthomasraoux           isReductionIterator(iteratorTypes[2])))
174edd9515bSthomasraoux       return failure();
175edd9515bSthomasraoux     //
176edd9515bSthomasraoux     // Two outer parallel, one inner reduction (matmat flavor).
177edd9515bSthomasraoux     //
178edd9515bSthomasraoux     if (maps == infer({{m, k}, {k, n}, {m, n}})) {
179edd9515bSthomasraoux       // This is the classical row-major matmul, nothing to do.
180edd9515bSthomasraoux       return failure();
181edd9515bSthomasraoux     }
182edd9515bSthomasraoux     if (maps == infer({{m, k}, {n, k}, {m, n}})) {
183edd9515bSthomasraoux       rhs = rewriter.create<vector::TransposeOp>(loc, rhs, perm);
184edd9515bSthomasraoux     } else if (maps == infer({{k, m}, {k, n}, {m, n}})) {
185edd9515bSthomasraoux       lhs = rewriter.create<vector::TransposeOp>(loc, lhs, perm);
186edd9515bSthomasraoux     } else if (maps == infer({{k, m}, {n, k}, {m, n}})) {
187edd9515bSthomasraoux       rhs = rewriter.create<vector::TransposeOp>(loc, rhs, perm);
188edd9515bSthomasraoux       lhs = rewriter.create<vector::TransposeOp>(loc, lhs, perm);
189edd9515bSthomasraoux     } else if (maps == infer({{m, k}, {k, n}, {n, m}})) {
190edd9515bSthomasraoux       std::swap(rhs, lhs);
191edd9515bSthomasraoux       rhs = rewriter.create<vector::TransposeOp>(loc, rhs, perm);
192edd9515bSthomasraoux       lhs = rewriter.create<vector::TransposeOp>(loc, lhs, perm);
193edd9515bSthomasraoux     } else if (maps == infer({{m, k}, {n, k}, {n, m}})) {
194edd9515bSthomasraoux       std::swap(rhs, lhs);
195edd9515bSthomasraoux       rhs = rewriter.create<vector::TransposeOp>(loc, rhs, perm);
196edd9515bSthomasraoux     } else if (maps == infer({{k, m}, {k, n}, {n, m}})) {
197edd9515bSthomasraoux       std::swap(lhs, rhs);
198edd9515bSthomasraoux       lhs = rewriter.create<vector::TransposeOp>(loc, lhs, perm);
199edd9515bSthomasraoux     } else if (maps == infer({{k, m}, {n, k}, {n, m}})) {
200edd9515bSthomasraoux       std::swap(lhs, rhs);
201edd9515bSthomasraoux     } else {
202edd9515bSthomasraoux       return failure();
203edd9515bSthomasraoux     }
204edd9515bSthomasraoux     rewriter.replaceOpWithNewOp<vector::ContractionOp>(
205edd9515bSthomasraoux         op, lhs, rhs, res,
206edd9515bSthomasraoux         rewriter.getAffineMapArrayAttr(infer({{m, k}, {k, n}, {m, n}})),
207edd9515bSthomasraoux         op.iterator_types());
208edd9515bSthomasraoux     return success();
209edd9515bSthomasraoux   }
210edd9515bSthomasraoux };
211edd9515bSthomasraoux 
212edd9515bSthomasraoux // Merge transpose op into the transfer read op. Transpose are not supported on
213edd9515bSthomasraoux // MMA types but MMA load can transpose the matrix when loading.
214edd9515bSthomasraoux struct CombineTransferReadOpTranspose final
215edd9515bSthomasraoux     : public OpRewritePattern<vector::TransposeOp> {
216edd9515bSthomasraoux   using OpRewritePattern<vector::TransposeOp>::OpRewritePattern;
217edd9515bSthomasraoux 
218edd9515bSthomasraoux   LogicalResult matchAndRewrite(vector::TransposeOp op,
219edd9515bSthomasraoux                                 PatternRewriter &rewriter) const override {
220edd9515bSthomasraoux     auto transferReadOp = op.vector().getDefiningOp<vector::TransferReadOp>();
221edd9515bSthomasraoux     if (!transferReadOp)
222edd9515bSthomasraoux       return failure();
223edd9515bSthomasraoux     if (transferReadOp.mask() || transferReadOp.hasOutOfBoundsDim())
224edd9515bSthomasraoux       return failure();
225edd9515bSthomasraoux     SmallVector<int64_t, 2> perm;
226edd9515bSthomasraoux     op.getTransp(perm);
227edd9515bSthomasraoux     SmallVector<unsigned, 2> permU;
228edd9515bSthomasraoux     for (int64_t o : perm)
229edd9515bSthomasraoux       permU.push_back(unsigned(o));
230edd9515bSthomasraoux     AffineMap permutationMap =
231edd9515bSthomasraoux         AffineMap::getPermutationMap(permU, op.getContext());
232edd9515bSthomasraoux     AffineMap newMap = permutationMap.compose(transferReadOp.permutation_map());
233edd9515bSthomasraoux     rewriter.replaceOpWithNewOp<vector::TransferReadOp>(
234edd9515bSthomasraoux         op, op.getType(), transferReadOp.source(), transferReadOp.indices(),
235edd9515bSthomasraoux         newMap, transferReadOp.padding(), transferReadOp.mask(),
236edd9515bSthomasraoux         transferReadOp.in_boundsAttr());
237edd9515bSthomasraoux     return success();
238edd9515bSthomasraoux   }
239edd9515bSthomasraoux };
240edd9515bSthomasraoux 
241edd9515bSthomasraoux } // namespace
242edd9515bSthomasraoux 
243edd9515bSthomasraoux // MMA types have different layout based on how they are used in matmul ops.
244edd9515bSthomasraoux // Figure the right layout to use by looking at Transfer op uses.
245edd9515bSthomasraoux // TODO: Change the GPU dialect to abstract the layout at the this level and
246edd9515bSthomasraoux // only care about it during lowering to NVVM.
247edd9515bSthomasraoux static const char *inferFragType(vector::TransferReadOp op) {
248edd9515bSthomasraoux   for (Operation *users : op->getUsers()) {
249edd9515bSthomasraoux     auto contract = dyn_cast<vector::ContractionOp>(users);
250edd9515bSthomasraoux     if (!contract)
251edd9515bSthomasraoux       continue;
252edd9515bSthomasraoux     if (contract.lhs() == op.getResult())
253edd9515bSthomasraoux       return "AOp";
254edd9515bSthomasraoux     if (contract.rhs() == op.getResult())
255edd9515bSthomasraoux       return "BOp";
256edd9515bSthomasraoux   }
257edd9515bSthomasraoux   return "COp";
258edd9515bSthomasraoux }
259edd9515bSthomasraoux 
260edd9515bSthomasraoux static void convertTransferReadOp(vector::TransferReadOp op,
261edd9515bSthomasraoux                                   llvm::DenseMap<Value, Value> &valueMapping) {
262edd9515bSthomasraoux   assert(transferReadSupportsMMAMatrixType(op));
263edd9515bSthomasraoux   Optional<int64_t> stride =
264edd9515bSthomasraoux       getMemrefConstantHorizontalStride(op.getShapedType());
265edd9515bSthomasraoux   assert(stride);
266edd9515bSthomasraoux   const char *fragType = inferFragType(op);
267edd9515bSthomasraoux   gpu::MMAMatrixType type =
268edd9515bSthomasraoux       gpu::MMAMatrixType::get(op.getVectorType().getShape(),
269edd9515bSthomasraoux                               op.getVectorType().getElementType(), fragType);
270edd9515bSthomasraoux   OpBuilder b(op);
271edd9515bSthomasraoux   Value load = b.create<gpu::SubgroupMmaLoadMatrixOp>(
272edd9515bSthomasraoux       op.getLoc(), type, op.source(), op.indices(), b.getIndexAttr(*stride));
273edd9515bSthomasraoux   valueMapping[op.getResult()] = load;
274edd9515bSthomasraoux }
275edd9515bSthomasraoux 
276edd9515bSthomasraoux static void convertTransferWriteOp(vector::TransferWriteOp op,
277edd9515bSthomasraoux                                    llvm::DenseMap<Value, Value> &valueMapping) {
278edd9515bSthomasraoux   assert(transferWriteSupportsMMAMatrixType(op));
279edd9515bSthomasraoux   Optional<int64_t> stride =
280edd9515bSthomasraoux       getMemrefConstantHorizontalStride(op.getShapedType());
281edd9515bSthomasraoux   assert(stride);
282edd9515bSthomasraoux   OpBuilder b(op);
283edd9515bSthomasraoux   Value matrix = valueMapping.find(op.vector())->second;
284edd9515bSthomasraoux   b.create<gpu::SubgroupMmaStoreMatrixOp>(
285edd9515bSthomasraoux       op.getLoc(), matrix, op.source(), op.indices(), b.getIndexAttr(*stride));
286edd9515bSthomasraoux   op.erase();
287edd9515bSthomasraoux }
288edd9515bSthomasraoux 
289edd9515bSthomasraoux static void convertContractOp(vector::ContractionOp op,
290edd9515bSthomasraoux                               llvm::DenseMap<Value, Value> &valueMapping) {
291edd9515bSthomasraoux   OpBuilder b(op);
292edd9515bSthomasraoux   Value opA = valueMapping.find(op.lhs())->second;
293edd9515bSthomasraoux   Value opB = valueMapping.find(op.rhs())->second;
294edd9515bSthomasraoux   Value opC = valueMapping.find(op.acc())->second;
295edd9515bSthomasraoux   Value matmul = b.create<gpu::SubgroupMmaComputeOp>(op.getLoc(), opC.getType(),
296edd9515bSthomasraoux                                                      opA, opB, opC);
297edd9515bSthomasraoux   valueMapping[op.getResult()] = matmul;
298edd9515bSthomasraoux }
299edd9515bSthomasraoux 
300edd9515bSthomasraoux namespace mlir {
301edd9515bSthomasraoux 
302edd9515bSthomasraoux void populatePrepareVectorToMMAPatterns(RewritePatternSet &patterns) {
303edd9515bSthomasraoux   patterns.add<PrepareContractToGPUMMA, CombineTransferReadOpTranspose>(
304edd9515bSthomasraoux       patterns.getContext());
305edd9515bSthomasraoux }
306edd9515bSthomasraoux 
307edd9515bSthomasraoux void convertVectorToMMAOps(FuncOp funcOp) {
308edd9515bSthomasraoux   SetVector<Operation *> ops = getOpToConvert(funcOp);
309edd9515bSthomasraoux   llvm::DenseMap<Value, Value> valueMapping;
310edd9515bSthomasraoux   for (Operation *op : ops) {
311edd9515bSthomasraoux     if (auto transferRead = dyn_cast<vector::TransferReadOp>(op)) {
312edd9515bSthomasraoux       convertTransferReadOp(transferRead, valueMapping);
313edd9515bSthomasraoux     } else if (auto transferWrite = dyn_cast<vector::TransferWriteOp>(op)) {
314edd9515bSthomasraoux       convertTransferWriteOp(transferWrite, valueMapping);
315edd9515bSthomasraoux     } else if (auto contractOp = dyn_cast<vector::ContractionOp>(op)) {
316edd9515bSthomasraoux       convertContractOp(contractOp, valueMapping);
317edd9515bSthomasraoux     }
318edd9515bSthomasraoux   }
319edd9515bSthomasraoux }
320edd9515bSthomasraoux 
321edd9515bSthomasraoux } // namespace mlir
322edd9515bSthomasraoux namespace {
323edd9515bSthomasraoux 
324edd9515bSthomasraoux struct ConvertVectorToGPUPass
325edd9515bSthomasraoux     : public ConvertVectorToGPUBase<ConvertVectorToGPUPass> {
326edd9515bSthomasraoux   void runOnFunction() override {
327edd9515bSthomasraoux     RewritePatternSet patterns(getFunction().getContext());
328edd9515bSthomasraoux     populatePrepareVectorToMMAPatterns(patterns);
329edd9515bSthomasraoux     (void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
330edd9515bSthomasraoux 
331edd9515bSthomasraoux     convertVectorToMMAOps(getFunction());
332edd9515bSthomasraoux   }
333edd9515bSthomasraoux };
334edd9515bSthomasraoux 
335edd9515bSthomasraoux } // namespace
336edd9515bSthomasraoux 
337edd9515bSthomasraoux std::unique_ptr<Pass> mlir::createConvertVectorToGPUPass() {
338edd9515bSthomasraoux   return std::make_unique<ConvertVectorToGPUPass>();
339edd9515bSthomasraoux }
340