| 1 | //===- AMDGPUDialect.cpp - MLIR AMDGPU dialect implementation --------===// |
| 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 implements the AMDGPU dialect and its operations. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h" |
| 14 | |
| 15 | #include "mlir/Dialect/Arith/IR/Arith.h" |
| 16 | #include "mlir/Dialect/GPU/IR/GPUDialect.h" |
| 17 | #include "mlir/Dialect/LLVMIR/ROCDLDialect.h" |
| 18 | #include "mlir/Dialect/MemRef/IR/MemoryAccessOpInterfaces.h" |
| 19 | #include "mlir/IR/BuiltinTypes.h" |
| 20 | #include "mlir/IR/DialectImplementation.h" |
| 21 | #include "mlir/Transforms/InliningUtils.h" |
| 22 | |
| 23 | using namespace mlir; |
| 24 | using namespace mlir::amdgpu; |
| 25 | |
| 26 | #include "mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc" |
| 27 | |
| 28 | namespace { |
| 29 | struct AMDGPUInlinerInterface final : DialectInlinerInterface { |
| 30 | using DialectInlinerInterface::DialectInlinerInterface; |
| 31 | bool isLegalToInline(Operation *, Region *, bool, IRMapping &) const final { |
| 32 | return true; |
| 33 | } |
| 34 | }; |
| 35 | } // namespace |
| 36 | |
| 37 | void AMDGPUDialect::initialize() { |
| 38 | addOperations< |
| 39 | #define GET_OP_LIST |
| 40 | #include "mlir/Dialect/AMDGPU/IR/AMDGPU.cpp.inc" |
| 41 | >(); |
| 42 | registerTypes(); |
| 43 | registerAttributes(); |
| 44 | addInterfaces<AMDGPUInlinerInterface>(); |
| 45 | declarePromisedInterfaces< |
| 46 | memref::IndexedAccessOpInterface, TransposeLoadOp, GlobalTransposeLoadOp, |
| 47 | MakeDmaDescriptorOp, MakeGatherDmaDescriptorOp, DsBarrierInitOp, |
| 48 | DsBarrierPollStateOp, DsAsyncBarrierArriveOp, DsBarrierArriveOp>(); |
| 49 | declarePromisedInterfaces<memref::IndexedMemCopyOpInterface, GatherToLDSOp, |
| 50 | GlobalLoadAsyncToLDSOp, MakeDmaBaseOp, |
| 51 | MakeGatherDmaBaseOp>(); |
| 52 | } |
| 53 | |