MLIR  21.0.0git
GPUToNVVMPass.h
Go to the documentation of this file.
1 //===- GPUToNVVMPass.h - Convert GPU kernel to NVVM 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 #ifndef MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_
9 #define MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_
10 
13 #include "mlir/IR/PatternMatch.h"
14 #include <memory>
15 
16 namespace mlir {
17 class LLVMTypeConverter;
18 class ConversionTarget;
19 class RewritePatternSet;
20 class Pass;
21 
22 namespace gpu {
23 class GPUModuleOp;
24 class MMAMatrixType;
25 } // namespace gpu
26 
27 #define GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS
28 #include "mlir/Conversion/Passes.h.inc"
29 
30 LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type);
31 
32 /// Configure target to convert from the GPU dialect to NVVM.
33 void configureGpuToNVVMConversionLegality(ConversionTarget &target);
34 
35 /// Configure the LLVM type convert to convert types and address spaces from the
36 /// GPU dialect to NVVM.
37 void configureGpuToNVVMTypeConverter(LLVMTypeConverter &converter);
38 
39 /// Populate patterns that lower certain arith and math dialect ops to
40 /// libdevice calls.
41 void populateLibDeviceConversionPatterns(const LLVMTypeConverter &converter,
42  RewritePatternSet &patterns,
43  PatternBenefit benefit = 1);
44 
45 /// Collect a set of patterns to convert from the GPU dialect to NVVM.
46 void populateGpuToNVVMConversionPatterns(const LLVMTypeConverter &converter,
47  RewritePatternSet &patterns,
48  PatternBenefit benefit = 1);
49 
50 /// Populate GpuSubgroupReduce pattern to NVVM. It generates a specific nvvm
51 /// op that is not available on every GPU.
53  const LLVMTypeConverter &converter, RewritePatternSet &patterns,
54  PatternBenefit benefit = 1);
55 
56 /// Collect a set of patterns to convert WMMA ops from GPU dialect to NVVM.
57 void populateGpuWMMAToNVVMConversionPatterns(const LLVMTypeConverter &converter,
58  RewritePatternSet &patterns,
59  PatternBenefit benefit = 1);
60 } // namespace mlir
61 
62 #endif // MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_
Include the generated interface declarations.
LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type)
Return the LLVMStructureType corresponding to the MMAMatrixType type.
void configureGpuToNVVMTypeConverter(LLVMTypeConverter &converter)
Configure the LLVM type convert to convert types and address spaces from the GPU dialect to NVVM.
void configureGpuToNVVMConversionLegality(ConversionTarget &target)
Configure target to convert from the GPU dialect to NVVM.
const FrozenRewritePatternSet & patterns
void populateGpuSubgroupReduceOpLoweringPattern(const LLVMTypeConverter &converter, RewritePatternSet &patterns, PatternBenefit benefit=1)
Populate GpuSubgroupReduce pattern to NVVM.
void populateGpuToNVVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, PatternBenefit benefit=1)
Collect a set of patterns to convert from the GPU dialect to NVVM.
void populateLibDeviceConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, PatternBenefit benefit=1)
Populate patterns that lower certain arith and math dialect ops to libdevice calls.
void populateGpuWMMAToNVVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, PatternBenefit benefit=1)
Collect a set of patterns to convert WMMA ops from GPU dialect to NVVM.