FLANG
CUFCommon.h
1//===-- CUFCommon.h -------------------------------------------------------===//
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#ifndef FORTRAN_OPTIMIZER_TRANSFORMS_CUFCOMMON_H_
10#define FORTRAN_OPTIMIZER_TRANSFORMS_CUFCOMMON_H_
11
12#include "flang/Optimizer/Dialect/FIROps.h"
13#include "mlir/Dialect/GPU/IR/GPUDialect.h"
14#include "mlir/IR/BuiltinOps.h"
15
16static constexpr llvm::StringRef cudaDeviceModuleName = "cuda_device_mod";
17static constexpr llvm::StringRef cudaSharedMemSuffix = "__shared_mem";
18
19namespace fir {
20class FirOpBuilder;
21} // namespace fir
22
23namespace cuf {
24
26mlir::gpu::GPUModuleOp getOrCreateGPUModule(mlir::ModuleOp mod,
27 mlir::SymbolTable &symTab);
28
29bool isCUDADeviceContext(mlir::Operation *op);
30bool isCUDADeviceContext(mlir::Region &,
31 bool isDoConcurrentOffloadEnabled = false);
32bool isRegisteredDeviceGlobal(fir::GlobalOp op);
33bool isRegisteredDeviceAttr(std::optional<cuf::DataAttribute> attr);
34
35void genPointerSync(const mlir::Value box, fir::FirOpBuilder &builder);
36
37} // namespace cuf
38
39#endif // FORTRAN_OPTIMIZER_TRANSFORMS_CUFCOMMON_H_
Definition FIRBuilder.h:55
Definition ConvertVariable.h:26
mlir::gpu::GPUModuleOp getOrCreateGPUModule(mlir::ModuleOp mod, mlir::SymbolTable &symTab)
Retrieve or create the CUDA Fortran GPU module in the given mod.
Definition CUFCommon.cpp:18
Definition AbstractConverter.h:34