MLIR
24.0.0git
lib
Dialect
OpenACC
Extensions
GPUInterfaces.cpp
Go to the documentation of this file.
1
//===- GPUInterfaces.cpp - OpenACC external models ------------------------===//
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
#include "
mlir/Dialect/OpenACC/Extensions/GPUInterfaces.h
"
10
#include "
mlir/Dialect/GPU/IR/GPUDialect.h
"
11
#include "
mlir/Dialect/OpenACC/OpenACC.h
"
12
#include "
mlir/IR/DialectRegistry.h
"
13
14
using namespace
mlir
;
15
using namespace
mlir::acc
;
16
17
namespace
{
18
struct
GPULaunchOffloadRegionModel
19
:
public
acc::OffloadRegionOpInterface::ExternalModel<
20
GPULaunchOffloadRegionModel, gpu::LaunchOp> {
21
mlir::Region &getOffloadRegion(mlir::Operation *op)
const
{
22
return
cast<gpu::LaunchOp>(op).getBody();
23
}
24
};
25
}
// namespace
26
27
void
mlir::acc::registerGPUInterfaces
(
DialectRegistry
®istry) {
28
registry.
addExtension
(
29
+[](
MLIRContext
*ctx, OpenACCDialect *, gpu::GPUDialect *) {
30
gpu::LaunchOp::attachInterface<GPULaunchOffloadRegionModel>(*ctx);
31
});
32
}
DialectRegistry.h
GPUDialect.h
GPUInterfaces.h
mlir::DialectRegistry
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Definition
DialectRegistry.h:150
mlir::DialectRegistry::addExtension
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
Definition
DialectRegistry.h:255
mlir::MLIRContext
MLIRContext is the top-level object for a collection of MLIR operations.
Definition
MLIRContext.h:64
OpenACC.h
mlir::acc
Definition
ACCDataRuntime.h:32
mlir::acc::registerGPUInterfaces
void registerGPUInterfaces(DialectRegistry ®istry)
Register OpenACC interfaces for GPU IR. This does not load dialects.
Definition
GPUInterfaces.cpp:27
mlir
Include the generated interface declarations.
Definition
ABIRewriteContext.h:32
Generated on
for MLIR by
1.14.0