MLIR  20.0.0git
GPUToROCDLPass.h
Go to the documentation of this file.
1 //===- GPUToROCDLPass.h - Convert GPU kernel to ROCDL 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_GPUTOROCDL_GPUTOROCDLPASS_H_
9 #define MLIR_CONVERSION_GPUTOROCDL_GPUTOROCDLPASS_H_
10 
13 #include <memory>
14 
15 namespace mlir {
16 class LLVMTypeConverter;
17 class ConversionTarget;
18 class RewritePatternSet;
19 
20 template <typename OpT>
21 class OperationPass;
22 
23 namespace gpu {
24 class GPUModuleOp;
25 } // namespace gpu
26 
27 #define GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS
28 #include "mlir/Conversion/Passes.h.inc"
29 
30 /// Collect a set of patterns to convert from the GPU dialect to ROCDL.
31 /// If `runtime` is Unknown, gpu.printf will not be lowered
32 /// The resulting pattern set should be run over a gpu.module op
33 void populateGpuToROCDLConversionPatterns(const LLVMTypeConverter &converter,
34  RewritePatternSet &patterns,
35  gpu::amd::Runtime runtime);
36 
37 /// Configure target to convert from the GPU dialect to ROCDL.
38 void configureGpuToROCDLConversionLegality(ConversionTarget &target);
39 
40 /// Creates a pass that lowers GPU dialect operations to ROCDL counterparts. The
41 /// index bitwidth used for the lowering of the device side index computations
42 /// is configurable.
43 std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
45  const std::string &chipset = "gfx900",
46  unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout,
47  bool useBarePtrCallConv = false,
48  gpu::amd::Runtime runtime = gpu::amd::Runtime::Unknown);
49 
50 } // namespace mlir
51 
52 #endif // MLIR_CONVERSION_GPUTOROCDL_GPUTOROCDLPASS_H_
Runtime
Potential runtimes for AMD GPU kernels.
Definition: Runtimes.h:15
Include the generated interface declarations.
static constexpr unsigned kDeriveIndexBitwidthFromDataLayout
Value to pass as bitwidth for the index type when the converter is expected to derive the bitwidth fr...
void populateGpuToROCDLConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, gpu::amd::Runtime runtime)
Collect a set of patterns to convert from the GPU dialect to ROCDL.
void configureGpuToROCDLConversionLegality(ConversionTarget &target)
Configure target to convert from the GPU dialect to ROCDL.
std::unique_ptr< OperationPass< gpu::GPUModuleOp > > createLowerGpuOpsToROCDLOpsPass(const std::string &chipset="gfx900", unsigned indexBitwidth=kDeriveIndexBitwidthFromDataLayout, bool useBarePtrCallConv=false, gpu::amd::Runtime runtime=gpu::amd::Runtime::Unknown)
Creates a pass that lowers GPU dialect operations to ROCDL counterparts.
const FrozenRewritePatternSet & patterns