1 //===- ROCDLIR.h - MLIR to LLVM + ROCDL IR conversion -----------*- 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 // 9 // This file declares the entry point for the MLIR to LLVM + ROCDL IR 10 // conversion. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MLIR_TARGET_ROCDLIR_H 15 #define MLIR_TARGET_ROCDLIR_H 16 17 #include "llvm/ADT/StringRef.h" 18 #include <memory> 19 20 // Forward-declare LLVM classes. 21 namespace llvm { 22 class LLVMContext; 23 class Module; 24 } // namespace llvm 25 26 namespace mlir { 27 class Operation; 28 29 /// Convert the given LLVM-module-like operation into ROCDL IR. This conversion 30 /// requires the registration of the LLVM IR dialect and will extract the LLVM 31 /// context from the registered LLVM IR dialect. In case of error, report it to 32 /// the error handler registered with the MLIR context, if any (obtained from 33 /// the MLIR module), and return `nullptr`. 34 std::unique_ptr<llvm::Module> 35 translateModuleToROCDLIR(Operation *m, llvm::LLVMContext &llvmContext, 36 llvm::StringRef name = "LLVMDialectModule"); 37 38 } // namespace mlir 39 40 #endif // MLIR_TARGET_ROCDLIR_H 41