2019-09-27 14:49:51 +08:00
|
|
|
//===- ROCDLDialect.cpp - ROCDL IR Ops and Dialect registration -----------===//
|
|
|
|
//
|
2020-01-26 11:58:30 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
2019-12-24 01:35:36 +08:00
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2019-09-27 14:49:51 +08:00
|
|
|
//
|
2019-12-24 01:35:36 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2019-09-27 14:49:51 +08:00
|
|
|
//
|
|
|
|
// This file defines the types and operation details for the ROCDL IR dialect in
|
|
|
|
// MLIR, and the LLVM IR dialect. It also registers the dialect.
|
|
|
|
//
|
|
|
|
// The ROCDL dialect only contains GPU specific additions on top of the general
|
|
|
|
// LLVM dialect.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
|
|
|
|
|
|
|
|
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
|
|
|
#include "mlir/IR/Builders.h"
|
|
|
|
#include "mlir/IR/MLIRContext.h"
|
|
|
|
#include "mlir/IR/Operation.h"
|
|
|
|
#include "mlir/IR/StandardTypes.h"
|
|
|
|
#include "llvm/AsmParser/Parser.h"
|
|
|
|
#include "llvm/IR/Attributes.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
|
|
|
#include "llvm/IR/Type.h"
|
|
|
|
#include "llvm/Support/SourceMgr.h"
|
|
|
|
|
2019-12-13 07:31:39 +08:00
|
|
|
using namespace mlir;
|
|
|
|
using namespace ROCDL;
|
2019-09-27 14:49:51 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ROCDLDialect initialization, type parsing, and registration.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// TODO(herhut): This should be the llvm.rocdl dialect once this is supported.
|
|
|
|
ROCDLDialect::ROCDLDialect(MLIRContext *context) : Dialect("rocdl", context) {
|
|
|
|
addOperations<
|
|
|
|
#define GET_OP_LIST
|
|
|
|
#include "mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc"
|
|
|
|
>();
|
|
|
|
|
|
|
|
// Support unknown operations because not all ROCDL operations are registered.
|
|
|
|
allowUnknownOperations();
|
|
|
|
}
|
|
|
|
|
2019-12-13 07:31:39 +08:00
|
|
|
namespace mlir {
|
|
|
|
namespace ROCDL {
|
2019-09-27 14:49:51 +08:00
|
|
|
#define GET_OP_CLASSES
|
|
|
|
#include "mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc"
|
|
|
|
} // namespace ROCDL
|
|
|
|
} // namespace mlir
|
2019-12-13 07:31:39 +08:00
|
|
|
|