MLIR 23.0.0git
mlir::acc::OpenACCSupport Class Reference

#include "mlir/Dialect/OpenACC/Analysis/OpenACCSupport.h"

Public Member Functions

 OpenACCSupport ()=default
 OpenACCSupport (Operation *op)
template<typename AnalysisT>
void setImplementation (AnalysisT &&analysis)
 Register a custom OpenACCSupport implementation.
std::string getVariableName (Value v)
 Get the variable name for a given value.
std::string getRecipeName (RecipeKind kind, Type type, Value var)
 Get the recipe name for a given type and value.
InFlightDiagnostic emitNYI (Location loc, const Twine &message)
 Report a case that is not yet supported by the implementation.
remark::detail::InFlightRemark emitRemark (Operation *op, std::function< std::string()> messageFn, llvm::StringRef category="openacc")
 Emit an OpenACC remark with lazy message generation.
remark::detail::InFlightRemark emitRemark (Operation *op, const Twine &message, llvm::StringRef category="openacc")
 Emit an OpenACC remark.
bool isValidSymbolUse (Operation *user, SymbolRefAttr symbol, Operation **definingOpPtr=nullptr)
 Check if a symbol use is valid for use in an OpenACC region.
bool isValidValueUse (Value v, Region &region)
 Check if a value use is legal in an OpenACC region.
std::optional< gpu::GPUModuleOp > getOrCreateGPUModule (ModuleOp mod, bool create=true, llvm::StringRef name="")
 Get or optionally create a GPU module in the given module.
std::optional< TypeSizeAndAlignmentgetTypeSizeAndAlignment (Type ty, ModuleOp module)
 Returns the size and ABI alignment in bytes for ty.
bool isInvalidated (const AnalysisManager::PreservedAnalyses &pa)
 Signal that this analysis should always be preserved so that underlying implementation registration is not lost.

Detailed Description

Definition at line 237 of file OpenACCSupport.h.

Constructor & Destructor Documentation

◆ OpenACCSupport() [1/2]

mlir::acc::OpenACCSupport::OpenACCSupport ( )
default

◆ OpenACCSupport() [2/2]

mlir::acc::OpenACCSupport::OpenACCSupport ( Operation * op)
inline

Definition at line 244 of file OpenACCSupport.h.

Member Function Documentation

◆ emitNYI()

InFlightDiagnostic mlir::acc::OpenACCSupport::emitNYI ( Location loc,
const Twine & message )
inline

Report a case that is not yet supported by the implementation.

Parameters
locThe location to report the unsupported case at.
messageThe message to report.
Returns
An in-flight diagnostic object that can be used to report the unsupported case.

Definition at line 277 of file OpenACCSupport.h.

References mlir::emitError().

Referenced by getRecipeName(), and mlir::acc::getWorkerPrivateSharedMemoryNumCopies().

◆ emitRemark() [1/2]

remark::detail::InFlightRemark mlir::acc::OpenACCSupport::emitRemark ( Operation * op,
const Twine & message,
llvm::StringRef category = "openacc" )
inline

Emit an OpenACC remark.

Parameters
opThe operation to emit the remark for.
messageThe remark message.
categoryOptional category for the remark. Defaults to "openacc".
Returns
An in-flight remark object that can be used to append additional information to the remark.

Definition at line 306 of file OpenACCSupport.h.

References emitRemark().

◆ emitRemark() [2/2]

remark::detail::InFlightRemark mlir::acc::OpenACCSupport::emitRemark ( Operation * op,
std::function< std::string()> messageFn,
llvm::StringRef category = "openacc" )

Emit an OpenACC remark with lazy message generation.

The messageFn is only invoked if remarks are enabled for the given operation, allowing callers to avoid constructing expensive messages when remarks are disabled.

Parameters
opThe operation to emit the remark for.
messageFnA callable that returns the remark message.
categoryOptional category for the remark. Defaults to "openacc".
Returns
An in-flight remark object that can be used to append additional information to the remark.

Definition at line 41 of file OpenACCSupport.cpp.

References mlir::acc::emitRemark().

Referenced by emitRemark().

◆ getOrCreateGPUModule()

std::optional< gpu::GPUModuleOp > mlir::acc::OpenACCSupport::getOrCreateGPUModule ( ModuleOp mod,
bool create = true,
llvm::StringRef name = "" )

Get or optionally create a GPU module in the given module.

Parameters
modThe module to search or create the GPU module in.
createIf true (default), create the GPU module if it doesn't exist.
nameThe name for the GPU module. If empty, implementation uses its default name.
Returns
The GPU module if found or created, std::nullopt otherwise.

Definition at line 63 of file OpenACCSupport.cpp.

References mlir::acc::getOrCreateGPUModule().

◆ getRecipeName()

std::string mlir::acc::OpenACCSupport::getRecipeName ( RecipeKind kind,
Type type,
Value var )

Get the recipe name for a given type and value.

Parameters
kindThe kind of recipe to get the name for.
typeThe type to get the recipe name for. Can be null if the var is provided instead.
varThe MLIR value to get the recipe name for. Can be null if the type is provided instead.
Returns
The recipe name, or an empty string if not available.

Definition at line 27 of file OpenACCSupport.cpp.

References emitNYI(), mlir::Type::getContext(), mlir::Value::getLoc(), and mlir::acc::getRecipeName().

◆ getTypeSizeAndAlignment()

std::optional< TypeSizeAndAlignment > mlir::acc::OpenACCSupport::getTypeSizeAndAlignment ( Type ty,
ModuleOp module )
inline

Returns the size and ABI alignment in bytes for ty.

Definition at line 342 of file OpenACCSupport.h.

References mlir::acc::getTypeSizeAndAlignment(), and result.

Referenced by mlir::acc::getTypeSizeAndAlignmentHelper().

◆ getVariableName()

std::string mlir::acc::OpenACCSupport::getVariableName ( Value v)

Get the variable name for a given value.

Parameters
vThe MLIR value to get the variable name for.
Returns
The variable name, or an empty string if unavailable.

Definition at line 21 of file OpenACCSupport.cpp.

References mlir::acc::getVariableName().

◆ isInvalidated()

bool mlir::acc::OpenACCSupport::isInvalidated ( const AnalysisManager::PreservedAnalyses & pa)
inline

Signal that this analysis should always be preserved so that underlying implementation registration is not lost.

Definition at line 352 of file OpenACCSupport.h.

◆ isValidSymbolUse()

bool mlir::acc::OpenACCSupport::isValidSymbolUse ( Operation * user,
SymbolRefAttr symbol,
Operation ** definingOpPtr = nullptr )

Check if a symbol use is valid for use in an OpenACC region.

Parameters
userThe operation using the symbol.
symbolThe symbol reference being used.
definingOpPtrOptional output parameter to receive the defining op.
Returns
true if the symbol use is valid, false otherwise.

Definition at line 49 of file OpenACCSupport.cpp.

References mlir::acc::isValidSymbolUse().

◆ isValidValueUse()

bool mlir::acc::OpenACCSupport::isValidValueUse ( Value v,
Region & region )

Check if a value use is legal in an OpenACC region.

Parameters
vThe MLIR value to check for legality.
regionThe MLIR region in which the legality is checked.

Definition at line 56 of file OpenACCSupport.cpp.

References mlir::acc::isValidValueUse().

◆ setImplementation()

template<typename AnalysisT>
void mlir::acc::OpenACCSupport::setImplementation ( AnalysisT && analysis)
inline

Register a custom OpenACCSupport implementation.

Only one implementation can be registered at a time; calling this replaces any existing implementation.

Definition at line 250 of file OpenACCSupport.h.


The documentation for this class was generated from the following files: