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 
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> class OperationPass;
20 
21 namespace gpu {
22 class GPUModuleOp;
23 }
24 
25 /// Configure target to convert from to convert from the GPU dialect to NVVM.
26 void configureGpuToNVVMConversionLegality(ConversionTarget &target);
27 
28 /// Collect a set of patterns to convert from the GPU dialect to NVVM.
29 void populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter,
30                                          OwningRewritePatternList &patterns);
31 
32 /// Creates a pass that lowers GPU dialect operations to NVVM counterparts. The
33 /// index bitwidth used for the lowering of the device side index computations
34 /// is configurable.
35 std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createLowerGpuOpsToNVVMOpsPass(
36     unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout);
37 
38 } // namespace mlir
39 
40 #endif // MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_
41