1 //===- ROCDLDialect.cpp - ROCDL IR Ops and Dialect registration -----------===// 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 defines the types and operation details for the ROCDL IR dialect in 10 // MLIR, and the LLVM IR dialect. It also registers the dialect. 11 // 12 // The ROCDL dialect only contains GPU specific additions on top of the general 13 // LLVM dialect. 14 // 15 //===----------------------------------------------------------------------===// 16 17 #include "mlir/Dialect/LLVMIR/ROCDLDialect.h" 18 19 #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 20 #include "mlir/IR/Builders.h" 21 #include "mlir/IR/MLIRContext.h" 22 #include "mlir/IR/Operation.h" 23 #include "mlir/IR/StandardTypes.h" 24 #include "llvm/AsmParser/Parser.h" 25 #include "llvm/IR/Attributes.h" 26 #include "llvm/IR/Function.h" 27 #include "llvm/IR/Type.h" 28 #include "llvm/Support/SourceMgr.h" 29 30 using namespace mlir; 31 using namespace ROCDL; 32 33 //===----------------------------------------------------------------------===// 34 // ROCDLDialect initialization, type parsing, and registration. 35 //===----------------------------------------------------------------------===// 36 37 // TODO(herhut): This should be the llvm.rocdl dialect once this is supported. 38 ROCDLDialect::ROCDLDialect(MLIRContext *context) : Dialect("rocdl", context) { 39 addOperations< 40 #define GET_OP_LIST 41 #include "mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc" 42 >(); 43 44 // Support unknown operations because not all ROCDL operations are registered. 45 allowUnknownOperations(); 46 } 47 48 namespace mlir { 49 namespace ROCDL { 50 #define GET_OP_CLASSES 51 #include "mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc" 52 } // namespace ROCDL 53 } // namespace mlir 54 55