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 
11 #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
12 #include <memory>
13 
14 namespace mlir {
15 class LLVMTypeConverter;
16 class OwningRewritePatternList;
17 class ConversionTarget;
18 
19 template <typename OpT>
20 class OperationPass;
21 
22 namespace gpu {
23 class GPUModuleOp;
24 } // namespace gpu
25 
26 /// Collect a set of patterns to convert from the GPU dialect to ROCDL.
27 void populateGpuToROCDLConversionPatterns(LLVMTypeConverter &converter,
28                                           OwningRewritePatternList &patterns);
29 
30 /// Configure target to convert from the GPU dialect to ROCDL.
31 void configureGpuToROCDLConversionLegality(ConversionTarget &target);
32 
33 /// Creates a pass that lowers GPU dialect operations to ROCDL counterparts. The
34 /// index bitwidth used for the lowering of the device side index computations
35 /// is configurable.
36 std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
37 createLowerGpuOpsToROCDLOpsPass(
38     unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout);
39 
40 } // namespace mlir
41 
42 #endif // MLIR_CONVERSION_GPUTOROCDL_GPUTOROCDLPASS_H_
43