MLIR  19.0.0git
VectorToGPU.h
Go to the documentation of this file.
1 //===- VectorToGPU.h - Convert vector to GPU dialect ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef MLIR_CONVERSION_VECTORTOGPU_VECTORTOGPU_H
10 #define MLIR_CONVERSION_VECTORTOGPU_VECTORTOGPU_H
11 
12 #include "mlir/IR/PatternMatch.h"
13 
14 namespace mlir {
15 struct LogicalResult;
16 class MLIRContext;
17 class Pass;
18 class RewritePatternSet;
19 
20 #define GEN_PASS_DECL_CONVERTVECTORTOGPU
21 #include "mlir/Conversion/Passes.h.inc"
22 
23 /// Patterns to transform vector ops into a canonical form to convert to MMA
24 /// matrix operations. If `useNvGpu` is true, then the patterns will populated
25 /// will prepare for conversion to `nvgpu` mma operations rather than the `gpu`
26 /// dialect WMMA operations.
27 void populatePrepareVectorToMMAPatterns(RewritePatternSet &patterns,
28  bool useNvGpu = false);
29 
30 /// Convert vector ops to MMA matrix operations nested under `rootOp`. This will
31 /// convert slice of operations that can be legally converted to MMA operations.
32 /// The rest of the vector operations are left untouched.
33 LogicalResult convertVectorToMMAOps(RewriterBase &rewriter, Operation *rootOp);
34 
35 /// Convert vector ops ops nested under `rootOp` to vector and GPU operaitons
36 /// compatible with the `nvvm.mma.sync` lowering path. This will convert a slice
37 /// of operations that can be legally lowered on this path while the rest of
38 /// the vector operations are left untouched.
39 LogicalResult convertVectorToNVVMCompatibleMMASync(RewriterBase &rewriter,
40  Operation *rootOp);
41 
42 /// Convert from vector to GPU ops.
43 std::unique_ptr<Pass> createConvertVectorToGPUPass(bool useNvGpu = false);
44 
45 } // namespace mlir
46 
47 #endif // MLIR_CONVERSION_VECTORTOGPU_VECTORTOGPU_H
Include the generated interface declarations.
void populatePrepareVectorToMMAPatterns(RewritePatternSet &patterns, bool useNvGpu=false)
Patterns to transform vector ops into a canonical form to convert to MMA matrix operations.
LogicalResult convertVectorToNVVMCompatibleMMASync(RewriterBase &rewriter, Operation *rootOp)
Convert vector ops ops nested under rootOp to vector and GPU operaitons compatible with the nvvm....
std::unique_ptr< Pass > createConvertVectorToGPUPass(bool useNvGpu=false)
Convert from vector to GPU ops.
LogicalResult convertVectorToMMAOps(RewriterBase &rewriter, Operation *rootOp)
Convert vector ops to MMA matrix operations nested under rootOp.