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