//===- ROCDLToLLVMIRTranslation.cpp - Translate ROCDL to LLVM IR ----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements a translation between the MLIR ROCDL dialect and // LLVM IR. // //===----------------------------------------------------------------------===// #include "mlir/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.h" #include "mlir/Dialect/LLVMIR/ROCDLDialect.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/Operation.h" #include "mlir/Target/LLVMIR/ModuleTranslation.h" #include "llvm/IR/ConstantRange.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/IntrinsicsAMDGPU.h" #include "llvm/Support/raw_ostream.h" usingnamespacemlir; usingnamespacemlir::LLVM; createIntrinsicCall; // Create a call to ROCm-Device-Library function that returns an ID. // This is intended to specifically call device functions that fetch things like // block or grid dimensions, and so is limited to functions that take one // integer parameter. static llvm::Value *createDimGetterFunctionCall(llvm::IRBuilderBase &builder, Operation *op, StringRef fnName, int parameter) { … } namespace { /// Implementation of the dialect interface that converts operations belonging /// to the ROCDL dialect to LLVM IR. class ROCDLDialectLLVMIRTranslationInterface : public LLVMTranslationDialectInterface { … }; } // namespace void mlir::registerROCDLDialectTranslation(DialectRegistry ®istry) { … } void mlir::registerROCDLDialectTranslation(MLIRContext &context) { … }