MLIR
23.0.0git
include
mlir
Dialect
OpenACC
OpenACCUtilsGPU.h
Go to the documentation of this file.
1
//===- OpenACCUtilsGPU.h - OpenACC GPU Utilities -----------------*- C++-*-===//
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 utility functions for OpenACC that depend on the GPU
10
// dialect.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef MLIR_DIALECT_OPENACC_OPENACCUTILSGPU_H_
15
#define MLIR_DIALECT_OPENACC_OPENACCUTILSGPU_H_
16
17
#include "
mlir/Dialect/GPU/IR/GPUDialect.h
"
18
#include "
mlir/IR/BuiltinOps.h
"
19
#include <optional>
20
21
namespace
mlir
{
22
namespace
acc
{
23
24
/// Default GPU module name used by OpenACC.
25
constexpr
llvm::StringLiteral
kDefaultGPUModuleName
=
"acc_gpu_module"
;
26
27
/// Get or create a GPU module in the given module.
28
///
29
/// If a GPU module with the specified name already exists, it is returned.
30
/// If `create` is true and no GPU module exists, one is created.
31
/// If `create` is false and no GPU module exists, std::nullopt is returned.
32
///
33
/// \param mod The module to search or create the GPU module in.
34
/// \param create If true (default), create the GPU module if it doesn't exist.
35
/// \param name The name for the GPU module. If empty, uses
36
/// kDefaultGPUModuleName.
37
/// \return The GPU module if found or created, std::nullopt otherwise.
38
std::optional<gpu::GPUModuleOp>
39
getOrCreateGPUModule
(ModuleOp mod,
bool
create =
true
,
40
llvm::StringRef name =
kDefaultGPUModuleName
);
41
42
}
// namespace acc
43
}
// namespace mlir
44
45
#endif
// MLIR_DIALECT_OPENACC_OPENACCUTILSGPU_H_
BuiltinOps.h
GPUDialect.h
mlir::acc
Definition
OpenACCSupport.h:65
mlir::acc::getOrCreateGPUModule
std::optional< gpu::GPUModuleOp > getOrCreateGPUModule(ModuleOp mod, bool create=true, llvm::StringRef name=kDefaultGPUModuleName)
Get or create a GPU module in the given module.
Definition
OpenACCUtilsGPU.cpp:20
mlir::acc::kDefaultGPUModuleName
constexpr llvm::StringLiteral kDefaultGPUModuleName
Default GPU module name used by OpenACC.
Definition
OpenACCUtilsGPU.h:25
mlir
Include the generated interface declarations.
Definition
AliasAnalysis.h:19
Generated on
for MLIR by
1.14.0