MLIR 22.0.0git
mlir::acc Namespace Reference

Namespaces

namespace  detail
namespace  impl

Classes

struct  ACCImplicitDataOptions
struct  ACCImplicitRoutineOptions
struct  ConstructResource
struct  CurrentDeviceIdResource
struct  LegalizeDataValuesInRegionOptions
class  OpenACCSupport
struct  RuntimeCounters

Enumerations

enum  OpenACCExecMapping { NONE = 0 , VECTOR = 1 , WORKER = 2 , GANG = 4 }
 Enumeration used to encode the execution mapping on a loop construct. More...

Functions

bool isValidSymbolUse (Operation *user, SymbolRefAttr symbol, Operation **definingOpPtr)
mlir::Value getVar (mlir::Operation *accDataClauseOp)
 Used to obtain the var from a data clause operation.
mlir::TypedValue< mlir::acc::PointerLikeType > getVarPtr (mlir::Operation *accDataClauseOp)
 Used to obtain the var from a data clause operation if it implements PointerLikeType.
mlir::Type getVarType (mlir::Operation *accDataClauseOp)
 Used to obtains the varType from a data clause operation which records the type of variable.
mlir::Value getAccVar (mlir::Operation *accDataClauseOp)
 Used to obtain the accVar from a data clause operation.
mlir::TypedValue< mlir::acc::PointerLikeType > getAccPtr (mlir::Operation *accDataClauseOp)
 Used to obtain the accVar from a data clause operation if it implements PointerLikeType.
mlir::Value getVarPtrPtr (mlir::Operation *accDataClauseOp)
 Used to obtain the varPtrPtr from a data clause operation.
mlir::SmallVector< mlir::ValuegetBounds (mlir::Operation *accDataClauseOp)
 Used to obtain bounds from an acc data clause operation.
mlir::SmallVector< mlir::ValuegetAsyncOperands (mlir::Operation *accDataClauseOp)
 Used to obtain async operands from an acc data clause operation.
mlir::ArrayAttr getAsyncOperandsDeviceType (mlir::Operation *accDataClauseOp)
 Returns an array of acc:DeviceTypeAttr attributes attached to an acc data clause operation, that correspond to the device types associated with the async clauses with an async-value.
mlir::ArrayAttr getAsyncOnly (mlir::Operation *accDataClauseOp)
 Returns an array of acc:DeviceTypeAttr attributes attached to an acc data clause operation, that correspond to the device types associated with the async clauses without an async-value.
std::optional< llvm::StringRef > getVarName (mlir::Operation *accOp)
 Used to obtain the name from an acc operation.
std::optional< mlir::acc::DataClause > getDataClause (mlir::Operation *accDataEntryOp)
 Used to obtain the dataClause from a data entry operation.
bool getImplicitFlag (mlir::Operation *accDataEntryOp)
 Used to find out whether data operation is implicit.
mlir::ValueRange getDataOperands (mlir::Operation *accOp)
 Used to get an immutable range iterating over the data operands.
mlir::MutableOperandRange getMutableDataOperands (mlir::Operation *accOp)
 Used to get a mutable range iterating over the data operands.
mlir::SymbolRefAttr getRecipe (mlir::Operation *accOp)
 Used to get the recipe attribute from a data clause operation.
bool isPointerLikeType (mlir::Type type)
 Used to check whether the provided type implements the PointerLikeType interface.
bool isMappableType (mlir::Type type)
 Used to check whether the provided type implements the MappableType interface.
static constexpr StringLiteral getDeclareAttrName ()
 Used to obtain the attribute name for declare.
static constexpr StringLiteral getDeclareActionAttrName ()
static constexpr StringLiteral getRoutineInfoAttrName ()
static constexpr StringLiteral getSpecializedRoutineAttrName ()
bool isAccRoutine (mlir::Operation *op)
 Used to check whether the current operation is marked with acc routine.
bool isSpecializedAccRoutine (mlir::Operation *op)
 Used to check whether this is a specialized accelerator version of acc routine function.
static constexpr StringLiteral getFromDefaultClauseAttrName ()
static constexpr StringLiteral getVarNameAttrName ()
static constexpr StringLiteral getCombinedConstructsAttrName ()
mlir::OperationgetEnclosingComputeOp (mlir::Region &region)
 Used to obtain the enclosing compute construct operation that contains the provided region.
bool isOnlyUsedByPrivateClauses (mlir::Value val, mlir::Region &region)
 Returns true if this value is only used by acc.private operations in the region.
bool isOnlyUsedByReductionClauses (mlir::Value val, mlir::Region &region)
 Returns true if this value is only used by acc.reduction operations in the region.
std::optional< ClauseDefaultValue > getDefaultAttr (mlir::Operation *op)
 Looks for an OpenACC default attribute on the current operation op or in a parent operation which encloses op.
mlir::acc::VariableTypeCategory getTypeCategory (mlir::Value var)
 Get the type category of an OpenACC variable.
std::string getVariableName (mlir::Value v)
 Attempts to extract the variable name from a value by walking through view-like operations until an acc.var_name attribute is found.
std::string getRecipeName (mlir::acc::RecipeKind kind, mlir::Type type)
 Get the recipe name for a given recipe kind and type.
mlir::Value getBaseEntity (mlir::Value val)
bool isValidSymbolUse (mlir::Operation *user, mlir::SymbolRefAttr symbol, mlir::Operation **definingOpPtr=nullptr)
 Check if a symbol use is valid for use in an OpenACC region.
llvm::SmallVector< mlir::ValuegetDominatingDataClauses (mlir::Operation *computeConstructOp, mlir::DominanceInfo &domInfo, mlir::PostDominanceInfo &postDomInfo)
 Collects all data clauses that dominate the compute construct.
std::unique_ptr<::mlir::PasscreateACCImplicitData ()
std::unique_ptr<::mlir::PasscreateACCImplicitData (ACCImplicitDataOptions options)
std::unique_ptr<::mlir::PasscreateACCImplicitDeclare ()
std::unique_ptr<::mlir::PasscreateACCImplicitRoutine ()
std::unique_ptr<::mlir::PasscreateACCImplicitRoutine (ACCImplicitRoutineOptions options)
std::unique_ptr<::mlir::PasscreateACCLegalizeSerial ()
std::unique_ptr<::mlir::PasscreateLegalizeDataValuesInRegion ()
std::unique_ptr<::mlir::PasscreateLegalizeDataValuesInRegion (LegalizeDataValuesInRegionOptions options)
void registerACCImplicitData ()
void registerACCImplicitDataPass ()
void registerACCImplicitDeclare ()
void registerACCImplicitDeclarePass ()
void registerACCImplicitRoutine ()
void registerACCImplicitRoutinePass ()
void registerACCLegalizeSerial ()
void registerACCLegalizeSerialPass ()
void registerLegalizeDataValuesInRegion ()
void registerLegalizeDataValuesInRegionPass ()
void registerOpenACCPasses ()

Enumeration Type Documentation

◆ OpenACCExecMapping

Enumeration used to encode the execution mapping on a loop construct.

They refer directly to the OpenACC 3.3 standard: 2.9.2. gang 2.9.3. worker 2.9.4. vector

Value can be combined bitwise to reflect the mapping applied to the construct. e.g. acc.loop gang vector, the gang and vector could be combined and the final mapping value would be 5 (4 | 1).

Enumerator
NONE 
VECTOR 
WORKER 
GANG 

Definition at line 85 of file OpenACC.h.

Function Documentation

◆ createACCImplicitData() [1/2]

std::unique_ptr<::mlir::Pass > mlir::acc::createACCImplicitData ( )

Definition at line 101 of file ACCImplicitData.cpp.

◆ createACCImplicitData() [2/2]

std::unique_ptr<::mlir::Pass > mlir::acc::createACCImplicitData ( ACCImplicitDataOptions options)

Definition at line 105 of file ACCImplicitData.cpp.

◆ createACCImplicitDeclare()

std::unique_ptr<::mlir::Pass > mlir::acc::createACCImplicitDeclare ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 180 of file ACCImplicitDeclare.cpp.

◆ createACCImplicitRoutine() [1/2]

std::unique_ptr<::mlir::Pass > mlir::acc::createACCImplicitRoutine ( )

Definition at line 277 of file ACCImplicitRoutine.cpp.

◆ createACCImplicitRoutine() [2/2]

std::unique_ptr<::mlir::Pass > mlir::acc::createACCImplicitRoutine ( ACCImplicitRoutineOptions options)

Definition at line 281 of file ACCImplicitRoutine.cpp.

◆ createACCLegalizeSerial()

std::unique_ptr<::mlir::Pass > mlir::acc::createACCLegalizeSerial ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 357 of file ACCLegalizeSerial.cpp.

◆ createLegalizeDataValuesInRegion() [1/2]

std::unique_ptr<::mlir::Pass > mlir::acc::createLegalizeDataValuesInRegion ( )

Definition at line 451 of file LegalizeDataValues.cpp.

◆ createLegalizeDataValuesInRegion() [2/2]

std::unique_ptr<::mlir::Pass > mlir::acc::createLegalizeDataValuesInRegion ( LegalizeDataValuesInRegionOptions options)

Definition at line 455 of file LegalizeDataValues.cpp.

◆ getAccPtr()

mlir::TypedValue< mlir::acc::PointerLikeType > mlir::acc::getAccPtr ( mlir::Operation * accDataClauseOp)

Used to obtain the accVar from a data clause operation if it implements PointerLikeType.

Definition at line 4729 of file OpenACC.cpp.

◆ getAccVar()

mlir::Value mlir::acc::getAccVar ( mlir::Operation * accDataClauseOp)

Used to obtain the accVar from a data clause operation.

When a data entry operation, it obtains its result accVar value. If a data exit operation, it obtains its operand accVar value. Returns empty value if not a data clause operation.

Definition at line 4741 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS, and ACC_DATA_EXIT_OPS.

◆ getAsyncOnly()

mlir::ArrayAttr mlir::acc::getAsyncOnly ( mlir::Operation * accDataClauseOp)

Returns an array of acc:DeviceTypeAttr attributes attached to an acc data clause operation, that correspond to the device types associated with the async clauses without an async-value.

Definition at line 4796 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS, and ACC_DATA_EXIT_OPS.

◆ getAsyncOperands()

mlir::SmallVector< mlir::Value > mlir::acc::getAsyncOperands ( mlir::Operation * accDataClauseOp)

Used to obtain async operands from an acc data clause operation.

Returns an empty vector if there are no such operands.

Definition at line 4774 of file OpenACC.cpp.

◆ getAsyncOperandsDeviceType()

mlir::ArrayAttr mlir::acc::getAsyncOperandsDeviceType ( mlir::Operation * accDataClauseOp)

Returns an array of acc:DeviceTypeAttr attributes attached to an acc data clause operation, that correspond to the device types associated with the async clauses with an async-value.

Definition at line 4788 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS, and ACC_DATA_EXIT_OPS.

◆ getBaseEntity()

mlir::Value mlir::acc::getBaseEntity ( mlir::Value val)

Definition at line 154 of file OpenACCUtils.cpp.

References mlir::Value::getDefiningOp().

◆ getBounds()

mlir::SmallVector< mlir::Value > mlir::acc::getBounds ( mlir::Operation * accDataClauseOp)

Used to obtain bounds from an acc data clause operation.

Returns an empty vector if there are no bounds.

Definition at line 4759 of file OpenACC.cpp.

◆ getCombinedConstructsAttrName()

constexpr StringLiteral mlir::acc::getCombinedConstructsAttrName ( )
staticconstexpr

Definition at line 207 of file OpenACC.h.

◆ getDataClause()

std::optional< mlir::acc::DataClause > mlir::acc::getDataClause ( mlir::Operation * accDataEntryOp)

Used to obtain the dataClause from a data entry operation.

Returns empty optional if not a data entry operation.

Definition at line 4814 of file OpenACC.cpp.

Referenced by checkDeclareOperands().

◆ getDataOperands()

mlir::ValueRange mlir::acc::getDataOperands ( mlir::Operation * accOp)

Used to get an immutable range iterating over the data operands.

Definition at line 4832 of file OpenACC.cpp.

References ACC_COMPUTE_AND_DATA_CONSTRUCT_OPS.

◆ getDeclareActionAttrName()

constexpr StringLiteral mlir::acc::getDeclareActionAttrName ( )
staticconstexpr

Definition at line 175 of file OpenACC.h.

◆ getDeclareAttrName()

constexpr StringLiteral mlir::acc::getDeclareAttrName ( )
staticconstexpr

Used to obtain the attribute name for declare.

Definition at line 171 of file OpenACC.h.

Referenced by isValidSymbolUse().

◆ getDefaultAttr()

std::optional< mlir::acc::ClauseDefaultValue > mlir::acc::getDefaultAttr ( mlir::Operation * op)

Looks for an OpenACC default attribute on the current operation op or in a parent operation which encloses op.

This is useful because OpenACC specification notes that a visible default clause is the nearest default clause appearing on the compute construct or a lexically containing data construct.

Definition at line 55 of file OpenACCUtils.cpp.

References mlir::Operation::getParentOp().

◆ getDominatingDataClauses()

llvm::SmallVector< mlir::Value > mlir::acc::getDominatingDataClauses ( mlir::Operation * computeConstructOp,
mlir::DominanceInfo & domInfo,
mlir::PostDominanceInfo & postDomInfo )

Collects all data clauses that dominate the compute construct.

This includes data clauses from:

  • The compute construct itself
  • Enclosing data constructs
  • Applicable declare directives (those that dominate and post-dominate) This is used to determine if a variable is already covered by an existing data clause.
    Parameters
    computeConstructOpThe compute construct operation
    domInfoDominance information
    postDomInfoPost-dominance information
    Returns
    Vector of data clause values that dominate the compute construct

Definition at line 212 of file OpenACCUtils.cpp.

References mlir::DominanceInfo::dominates(), mlir::Operation::getParentOfType(), and mlir::Operation::getParentOp().

◆ getEnclosingComputeOp()

mlir::Operation * mlir::acc::getEnclosingComputeOp ( mlir::Region & region)

Used to obtain the enclosing compute construct operation that contains the provided region.

Returns nullptr if no compute construct operation is found. The returned operation is one of types defined by ACC_COMPUTE_CONSTRUCT_OPS.

Definition at line 21 of file OpenACCUtils.cpp.

References mlir::Operation::getParentOp(), and mlir::Region::getParentOp().

◆ getFromDefaultClauseAttrName()

constexpr StringLiteral mlir::acc::getFromDefaultClauseAttrName ( )
staticconstexpr

Definition at line 199 of file OpenACC.h.

◆ getImplicitFlag()

bool mlir::acc::getImplicitFlag ( mlir::Operation * accDataEntryOp)

Used to find out whether data operation is implicit.

Returns false if not a data operation or if it is a data operation without implicit flag.

Definition at line 4824 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS.

◆ getMutableDataOperands()

mlir::MutableOperandRange mlir::acc::getMutableDataOperands ( mlir::Operation * accOp)

Used to get a mutable range iterating over the data operands.

Definition at line 4842 of file OpenACC.cpp.

References ACC_COMPUTE_AND_DATA_CONSTRUCT_OPS.

◆ getRecipe()

mlir::SymbolRefAttr mlir::acc::getRecipe ( mlir::Operation * accOp)

Used to get the recipe attribute from a data clause operation.

Definition at line 4851 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS.

◆ getRecipeName()

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

Get the recipe name for a given recipe kind and type.

Returns an empty string if not possible to generate a recipe name.

Definition at line 116 of file OpenACCUtils.cpp.

References mlir::Type::print().

Referenced by mlir::acc::OpenACCSupport::getRecipeName().

◆ getRoutineInfoAttrName()

constexpr StringLiteral mlir::acc::getRoutineInfoAttrName ( )
staticconstexpr

Definition at line 179 of file OpenACC.h.

Referenced by isAccRoutine(), and isValidSymbolUse().

◆ getSpecializedRoutineAttrName()

constexpr StringLiteral mlir::acc::getSpecializedRoutineAttrName ( )
staticconstexpr

Definition at line 183 of file OpenACC.h.

Referenced by isSpecializedAccRoutine().

◆ getTypeCategory()

mlir::acc::VariableTypeCategory mlir::acc::getTypeCategory ( mlir::Value var)

Get the type category of an OpenACC variable.

Definition at line 76 of file OpenACCUtils.cpp.

References mlir::Value::getType().

◆ getVar()

mlir::Value mlir::acc::getVar ( mlir::Operation * accDataClauseOp)

Used to obtain the var from a data clause operation.

Returns empty value if not a data clause operation or is a data exit operation with no var.

Definition at line 4710 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS.

Referenced by checkDeclareOperands().

◆ getVariableName()

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

Attempts to extract the variable name from a value by walking through view-like operations until an acc.var_name attribute is found.

Returns empty string if no name is found.

Definition at line 89 of file OpenACCUtils.cpp.

References mlir::Value::getDefiningOp(), getVarName(), and getVarNameAttrName().

Referenced by mlir::acc::OpenACCSupport::getVariableName().

◆ getVarName()

std::optional< llvm::StringRef > mlir::acc::getVarName ( mlir::Operation * accOp)

Used to obtain the name from an acc operation.

Definition at line 4803 of file OpenACC.cpp.

Referenced by getVariableName().

◆ getVarNameAttrName()

constexpr StringLiteral mlir::acc::getVarNameAttrName ( )
staticconstexpr

Definition at line 203 of file OpenACC.h.

Referenced by getVariableName().

◆ getVarPtr()

mlir::TypedValue< mlir::acc::PointerLikeType > mlir::acc::getVarPtr ( mlir::Operation * accDataClauseOp)

Used to obtain the var from a data clause operation if it implements PointerLikeType.

Definition at line 4696 of file OpenACC.cpp.

◆ getVarPtrPtr()

mlir::Value mlir::acc::getVarPtrPtr ( mlir::Operation * accDataClauseOp)

Used to obtain the varPtrPtr from a data clause operation.

Returns empty value if not a data clause operation.

Definition at line 4749 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS.

◆ getVarType()

mlir::Type mlir::acc::getVarType ( mlir::Operation * accDataClauseOp)

Used to obtains the varType from a data clause operation which records the type of variable.

When var is PointerLikeType, this returns the type of the pointer target.

Definition at line 4718 of file OpenACC.cpp.

References ACC_DATA_ENTRY_OPS.

◆ isAccRoutine()

bool mlir::acc::isAccRoutine ( mlir::Operation * op)
inline

Used to check whether the current operation is marked with acc routine.

The operation passed in should be a function.

Definition at line 189 of file OpenACC.h.

References getRoutineInfoAttrName(), and mlir::Operation::hasAttr().

◆ isMappableType()

bool mlir::acc::isMappableType ( mlir::Type type)
inline

Used to check whether the provided type implements the MappableType interface.

Definition at line 166 of file OpenACC.h.

Referenced by checkRecipe().

◆ isOnlyUsedByPrivateClauses()

bool mlir::acc::isOnlyUsedByPrivateClauses ( mlir::Value val,
mlir::Region & region )

Returns true if this value is only used by acc.private operations in the region.

Definition at line 44 of file OpenACCUtils.cpp.

References isOnlyUsedByOpClauses().

◆ isOnlyUsedByReductionClauses()

bool mlir::acc::isOnlyUsedByReductionClauses ( mlir::Value val,
mlir::Region & region )

Returns true if this value is only used by acc.reduction operations in the region.

Definition at line 49 of file OpenACCUtils.cpp.

References isOnlyUsedByOpClauses().

◆ isPointerLikeType()

bool mlir::acc::isPointerLikeType ( mlir::Type type)
inline

Used to check whether the provided type implements the PointerLikeType interface.

Definition at line 160 of file OpenACC.h.

◆ isSpecializedAccRoutine()

bool mlir::acc::isSpecializedAccRoutine ( mlir::Operation * op)
inline

Used to check whether this is a specialized accelerator version of acc routine function.

Definition at line 195 of file OpenACC.h.

References getSpecializedRoutineAttrName(), and mlir::Operation::hasAttr().

◆ isValidSymbolUse() [1/2]

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

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

This includes looking for various attributes such as acc.routine_info and acc.declare attributes.

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 164 of file OpenACCUtils.cpp.

References getDeclareAttrName(), getRoutineInfoAttrName(), mlir::Operation::hasAttr(), mlir::SymbolTable::lookupNearestSymbolFrom(), and mlir::SymbolTable::Private.

◆ isValidSymbolUse() [2/2]

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

◆ registerACCImplicitData()

void mlir::acc::registerACCImplicitData ( )
inline

Definition at line 474 of file Passes.h.

◆ registerACCImplicitDataPass()

void mlir::acc::registerACCImplicitDataPass ( )
inline

Definition at line 481 of file Passes.h.

◆ registerACCImplicitDeclare()

void mlir::acc::registerACCImplicitDeclare ( )
inline

Definition at line 495 of file Passes.h.

◆ registerACCImplicitDeclarePass()

void mlir::acc::registerACCImplicitDeclarePass ( )
inline

Definition at line 502 of file Passes.h.

◆ registerACCImplicitRoutine()

void mlir::acc::registerACCImplicitRoutine ( )
inline

Definition at line 516 of file Passes.h.

◆ registerACCImplicitRoutinePass()

void mlir::acc::registerACCImplicitRoutinePass ( )
inline

Definition at line 523 of file Passes.h.

◆ registerACCLegalizeSerial()

void mlir::acc::registerACCLegalizeSerial ( )
inline

Definition at line 537 of file Passes.h.

◆ registerACCLegalizeSerialPass()

void mlir::acc::registerACCLegalizeSerialPass ( )
inline

Definition at line 544 of file Passes.h.

◆ registerLegalizeDataValuesInRegion()

void mlir::acc::registerLegalizeDataValuesInRegion ( )
inline

Definition at line 558 of file Passes.h.

◆ registerLegalizeDataValuesInRegionPass()

void mlir::acc::registerLegalizeDataValuesInRegionPass ( )
inline

Definition at line 565 of file Passes.h.

◆ registerOpenACCPasses()

void mlir::acc::registerOpenACCPasses ( )
inline

Definition at line 579 of file Passes.h.

Referenced by mlir::registerAllPasses().