13 #ifndef MLIR_DIALECT_OPENACC_OPENACC_H_
14 #define MLIR_DIALECT_OPENACC_OPENACC_H_
23 #include "mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc"
24 #include "mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc"
25 #include "mlir/Dialect/OpenACC/OpenACCOpsInterfaces.h.inc"
26 #include "mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc"
34 #define GET_TYPEDEF_CLASSES
35 #include "mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc"
37 #define GET_ATTRDEF_CLASSES
38 #include "mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc"
42 #define GET_OP_CLASSES
43 #include "mlir/Dialect/OpenACC/OpenACCOps.h.inc"
45 #define ACC_DATA_ENTRY_OPS \
46 mlir::acc::CopyinOp, mlir::acc::CreateOp, mlir::acc::PresentOp, \
47 mlir::acc::NoCreateOp, mlir::acc::AttachOp, mlir::acc::DevicePtrOp, \
48 mlir::acc::GetDevicePtrOp, mlir::acc::PrivateOp, \
49 mlir::acc::FirstprivateOp, mlir::acc::UpdateDeviceOp, \
50 mlir::acc::UseDeviceOp, mlir::acc::ReductionOp, \
51 mlir::acc::DeclareDeviceResidentOp, mlir::acc::DeclareLinkOp, \
53 #define ACC_DATA_EXIT_OPS \
54 mlir::acc::CopyoutOp, mlir::acc::DeleteOp, mlir::acc::DetachOp, \
55 mlir::acc::UpdateHostOp
56 #define ACC_DATA_CLAUSE_OPS ACC_DATA_ENTRY_OPS, ACC_DATA_EXIT_OPS
57 #define ACC_COMPUTE_CONSTRUCT_OPS \
58 mlir::acc::ParallelOp, mlir::acc::KernelsOp, mlir::acc::SerialOp
59 #define ACC_COMPUTE_CONSTRUCT_AND_LOOP_OPS \
60 ACC_COMPUTE_CONSTRUCT_OPS, mlir::acc::LoopOp
61 #define ACC_DATA_CONSTRUCT_STRUCTURED_OPS \
62 mlir::acc::DataOp, mlir::acc::DeclareOp, mlir::acc::HostDataOp
63 #define ACC_DATA_CONSTRUCT_UNSTRUCTURED_OPS \
64 mlir::acc::EnterDataOp, mlir::acc::ExitDataOp, mlir::acc::UpdateOp, \
65 mlir::acc::DeclareEnterOp, mlir::acc::DeclareExitOp
66 #define ACC_DATA_CONSTRUCT_OPS \
67 ACC_DATA_CONSTRUCT_STRUCTURED_OPS, ACC_DATA_CONSTRUCT_UNSTRUCTURED_OPS
68 #define ACC_COMPUTE_AND_DATA_CONSTRUCT_OPS \
69 ACC_COMPUTE_CONSTRUCT_OPS, ACC_DATA_CONSTRUCT_OPS
70 #define ACC_COMPUTE_LOOP_AND_DATA_CONSTRUCT_OPS \
71 ACC_COMPUTE_CONSTRUCT_AND_LOOP_OPS, ACC_DATA_CONSTRUCT_OPS
141 std::optional<mlir::acc::DataClause>
164 return mlir::isa<mlir::acc::PointerLikeType>(type);
170 return mlir::isa<mlir::acc::MappableType>(type);
175 return StringLiteral(
"acc.declare");
179 return StringLiteral(
"acc.declare_action");
183 return StringLiteral(
"acc.routine_info");
187 return CombinedConstructsTypeAttr::name;
192 mlir::StringRef
getName() final {
return "AccRuntimeCounters"; }
197 mlir::StringRef
getName() final {
return "AccConstructResource"; }
202 mlir::StringRef
getName() final {
return "AccCurrentDeviceIdResource"; }
This class provides a mutable adaptor for a range of operands.
Operation is the basic unit of execution within MLIR.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This base class is used for derived effects that are non-parametric.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
mlir::Value getAccVar(mlir::Operation *accDataClauseOp)
Used to obtain the accVar from a data clause operation.
mlir::Value getVar(mlir::Operation *accDataClauseOp)
Used to obtain the var 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.
std::optional< mlir::acc::DataClause > getDataClause(mlir::Operation *accDataEntryOp)
Used to obtain the dataClause from a data entry operation.
bool isPointerLikeType(mlir::Type type)
Used to check whether the provided type implements the PointerLikeType interface.
mlir::MutableOperandRange getMutableDataOperands(mlir::Operation *accOp)
Used to get a mutable range iterating over the data operands.
mlir::SmallVector< mlir::Value > getBounds(mlir::Operation *accDataClauseOp)
Used to obtain bounds from an acc data clause operation.
OpenACCExecMapping
Enumeration used to encode the execution mapping on a loop construct.
mlir::ValueRange getDataOperands(mlir::Operation *accOp)
Used to get an immutable range iterating over the data operands.
std::optional< llvm::StringRef > getVarName(mlir::Operation *accOp)
Used to obtain the name from an acc operation.
static constexpr StringLiteral getRoutineInfoAttrName()
mlir::Operation * getEnclosingComputeOp(mlir::Region ®ion)
Used to obtain the enclosing compute construct operation that contains the provided region.
bool getImplicitFlag(mlir::Operation *accDataEntryOp)
Used to find out whether data operation is implicit.
mlir::SmallVector< mlir::Value > getAsyncOperands(mlir::Operation *accDataClauseOp)
Used to obtain async operands from an acc data clause operation.
bool isMappableType(mlir::Type type)
Used to check whether the provided type implements the MappableType interface.
static constexpr StringLiteral getCombinedConstructsAttrName()
mlir::Value getVarPtrPtr(mlir::Operation *accDataClauseOp)
Used to obtain the varPtrPtr from a data clause operation.
mlir::ArrayAttr getAsyncOnly(mlir::Operation *accDataClauseOp)
Returns an array of acc:DeviceTypeAttr attributes attached to an acc data clause operation,...
static constexpr StringLiteral getDeclareAttrName()
Used to obtain the attribute name for declare.
static constexpr StringLiteral getDeclareActionAttrName()
mlir::Type getVarType(mlir::Operation *accDataClauseOp)
Used to obtains the varType from a data clause operation which records the type of variable.
mlir::TypedValue< mlir::acc::PointerLikeType > getVarPtr(mlir::Operation *accDataClauseOp)
Used to obtain the var from a data clause operation if it implements PointerLikeType.
mlir::ArrayAttr getAsyncOperandsDeviceType(mlir::Operation *accDataClauseOp)
Returns an array of acc:DeviceTypeAttr attributes attached to an acc data clause operation,...
Include the generated interface declarations.
std::conditional_t< std::is_same_v< Ty, mlir::Type >, mlir::Value, detail::TypedValue< Ty > > TypedValue
If Ty is mlir::Type this will select Value instead of having a wrapper around it.
mlir::StringRef getName() final
Return a string name of the resource.
mlir::StringRef getName() final
Return a string name of the resource.
mlir::StringRef getName() final
Return a string name of the resource.