MLIR 24.0.0git
SCFTransformOps.cpp File Reference

Go to the source code of this file.

Macros

#define GET_OP_LIST
#define MLIR_IR_BUILDERS_H
#define MLIR_IR_OPDEFINITION_H
#define MLIR_IR_DIALECT_H
#define MLIR_IR_DIALECTREGISTRY_H
#define MLIR_IR_MLIRCONTEXT_H
#define MLIR_SUPPORT_LLVM_H
#define MLIR_SUPPORT_TYPEID_H
#define MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
#define MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
#define MLIR_DECLARE_EXPLICIT_FALLBACK_TYPE_ID(CLASS_NAME)
#define MLIR_DEFINE_EXPLICIT_FALLBACK_TYPE_ID(CLASS_NAME)
#define MLIR_USE_FALLBACK_TYPE_IDS   false
#define MLIR_DECLARE_EXPLICIT_TYPE_ID(CLASS_NAME)
#define MLIR_DEFINE_EXPLICIT_TYPE_ID(CLASS_NAME)
#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CLASS_NAME)
#define MLIR_IR_OPERATIONSUPPORT_H
#define MLIR_IR_ATTRIBUTES_H
#define MLIR_IR_ATTRIBUTESUPPORT_H
#define MLIR_IR_STORAGEUNIQUERSUPPORT_H
#define MLIR_IR_ATTRTYPESUBELEMENTS_H
#define MLIR_IR_VISITORS_H
#define MLIR_SUPPORT_WALKRESULT_H
#define MLIR_SUPPORT_CYCLICREPLACERCACHE_H
#define MLIR_SUPPORT_INTERFACESUPPORT_H
#define MLIR_SUPPORT_STORAGEUNIQUER_H
#define MLIR_IR_TYPES_H
#define MLIR_IR_TYPESUPPORT_H
#define MLIR_IR_BLOCKSUPPORT_H
#define MLIR_IR_VALUE_H
#define MLIR_IR_USEDEFLISTS_H
#define MLIR_IR_LOCATION_H
#define GET_ATTRDEF_CLASSES
#define MLIR_IR_BUILTINATTRIBUTES_H
#define MLIR_IR_BUILTINATTRIBUTEINTERFACES_H
#define MLIR_IR_AFFINEMAP_H
#define MLIR_IR_AFFINEEXPR_H
#define MLIR_IR_BUILTINTYPEINTERFACES_H
#define MLIR_IR_OPASMSUPPORT_H_
#define MLIR_IR_BLOCK_H
#define MLIR_SUPPORT_COMPLEX_H
#define GET_ATTRDEF_CLASSES
#define MLIR_IR_DIAGNOSTICS_H
#define MLIR_IR_TYPERANGE_H
#define MLIR_IR_VALUERANGE_H
#define MLIR_IR_ODSSUPPORT_H
#define MLIR_IR_OPERATION_H
#define MLIR_IR_REGION_H
#define MLIR_IR_BUILTINTYPES_H
#define MLIR_SUPPORT_ADTEXTRAS_H
#define GET_TYPEDEF_CLASSES
#define MLIR_IR_QuantStorageTypeInterface_H
#define MLIR_IR_OPIMPLEMENTATION_H
#define MLIR_IR_DIALECTINTERFACE_H
#define GET_OP_CLASSES

Functions

static scf::ExecuteRegionOp wrapInExecuteRegion (RewriterBase &b, Operation *op)
 Wraps the given operation op into an scf.execute_region operation.
static void loopScheduling (scf::ForOp forOp, std::vector< std::pair< Operation *, unsigned > > &schedule, unsigned iterationInterval, unsigned readLatency)
 Callback for PipeliningOption.
static void replaceOpWithRegion (RewriterBase &rewriter, Operation *op, Region &region)
 Replaces the given op with the contents of the given single-block region, using the operands of the block terminator to replace operation results.
static DiagnosedSilenceableFailure isOpSibling (Operation *target, Operation *source)
 Check if target and source are siblings, in the context that target is being fused into source.
static bool isForallWithIdenticalConfiguration (Operation *target, Operation *source)
 Check if target scf.forall can be fused into source scf.forall.
static bool isForWithIdenticalConfiguration (Operation *target, Operation *source)
 Check if target scf.for can be fused into source scf.for.

Macro Definition Documentation

◆ GET_ATTRDEF_CLASSES [1/2]

#define GET_ATTRDEF_CLASSES

◆ GET_ATTRDEF_CLASSES [2/2]

#define GET_ATTRDEF_CLASSES

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 741 of file SCFTransformOps.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

◆ MLIR_DECLARE_EXPLICIT_FALLBACK_TYPE_ID

#define MLIR_DECLARE_EXPLICIT_FALLBACK_TYPE_ID ( CLASS_NAME)
Value:
namespace mlir { \
namespace detail { \
template <> \
class TypeIDResolver<CLASS_NAME> : public FallbackTypeIDResolver { \
public: \
static TypeID resolveTypeID() { \
static_assert(is_fully_resolved<CLASS_NAME>(), \
"TypeID::get<> requires the complete definition of `T`"); \
static TypeID id = \
registerImplicitTypeID(llvm::getTypeName<CLASS_NAME>()); \
return id; \
} \
}; \
} /* namespace detail */ \
} /* namespace mlir */
This class provides an efficient unique identifier for a specific C++ type.
Definition TypeID.h:107
AttrTypeReplacer.
Include the generated interface declarations.

◆ MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID

#define MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID ( CLASS_NAME)
Value:
namespace mlir { \
namespace detail { \
template <> \
class TypeIDResolver<CLASS_NAME> { \
public: \
static TypeID resolveTypeID() { return id; } \
\
private: \
static SelfOwningTypeID id; \
}; \
} /* namespace detail */ \
} /* namespace mlir */
Defines a TypeID for each instance of this class by using a pointer to the instance.
Definition TypeID.h:369

◆ MLIR_DECLARE_EXPLICIT_TYPE_ID

#define MLIR_DECLARE_EXPLICIT_TYPE_ID ( CLASS_NAME)
Value:
#define MLIR_DECLARE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
Definition TypeID.h:262

◆ MLIR_DEFINE_EXPLICIT_FALLBACK_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_FALLBACK_TYPE_ID ( CLASS_NAME)

◆ MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID ( CLASS_NAME)
Value:
static ::mlir::TypeID resolveTypeID() { \
static ::mlir::SelfOwningTypeID id; \
return id; \
} \
static_assert( \
CLASS_NAME>::value, \
"`MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID` must be placed in a " \
"public section of `" #CLASS_NAME "`");
llvm::is_detected< has_resolve_typeid_trait, T > has_resolve_typeid
Definition TypeID.h:224

◆ MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID ( CLASS_NAME)
Value:
namespace mlir { \
namespace detail { \
SelfOwningTypeID TypeIDResolver<CLASS_NAME>::id = {}; \
} /* namespace detail */ \
} /* namespace mlir */

◆ MLIR_DEFINE_EXPLICIT_TYPE_ID

#define MLIR_DEFINE_EXPLICIT_TYPE_ID ( CLASS_NAME)
Value:
#define MLIR_DEFINE_EXPLICIT_SELF_OWNING_TYPE_ID(CLASS_NAME)
Definition TypeID.h:276

◆ MLIR_IR_AFFINEEXPR_H

#define MLIR_IR_AFFINEEXPR_H

◆ MLIR_IR_AFFINEMAP_H

#define MLIR_IR_AFFINEMAP_H

◆ MLIR_IR_ATTRIBUTES_H

#define MLIR_IR_ATTRIBUTES_H

◆ MLIR_IR_ATTRIBUTESUPPORT_H

#define MLIR_IR_ATTRIBUTESUPPORT_H

◆ MLIR_IR_ATTRTYPESUBELEMENTS_H

#define MLIR_IR_ATTRTYPESUBELEMENTS_H

◆ MLIR_IR_BLOCK_H

#define MLIR_IR_BLOCK_H

◆ MLIR_IR_BLOCKSUPPORT_H

#define MLIR_IR_BLOCKSUPPORT_H

◆ MLIR_IR_BUILDERS_H

#define MLIR_IR_BUILDERS_H

◆ MLIR_IR_BUILTINATTRIBUTEINTERFACES_H

#define MLIR_IR_BUILTINATTRIBUTEINTERFACES_H

◆ MLIR_IR_BUILTINATTRIBUTES_H

#define MLIR_IR_BUILTINATTRIBUTES_H

◆ MLIR_IR_BUILTINTYPEINTERFACES_H

#define MLIR_IR_BUILTINTYPEINTERFACES_H

◆ MLIR_IR_BUILTINTYPES_H

#define MLIR_IR_BUILTINTYPES_H

◆ MLIR_IR_DIAGNOSTICS_H

#define MLIR_IR_DIAGNOSTICS_H

◆ MLIR_IR_DIALECT_H

#define MLIR_IR_DIALECT_H

◆ MLIR_IR_DIALECTINTERFACE_H

#define MLIR_IR_DIALECTINTERFACE_H

◆ MLIR_IR_DIALECTREGISTRY_H

#define MLIR_IR_DIALECTREGISTRY_H

◆ MLIR_IR_LOCATION_H

#define MLIR_IR_LOCATION_H

◆ MLIR_IR_MLIRCONTEXT_H

#define MLIR_IR_MLIRCONTEXT_H

◆ MLIR_IR_ODSSUPPORT_H

#define MLIR_IR_ODSSUPPORT_H

◆ MLIR_IR_OPASMSUPPORT_H_

#define MLIR_IR_OPASMSUPPORT_H_

◆ MLIR_IR_OPDEFINITION_H

#define MLIR_IR_OPDEFINITION_H

◆ MLIR_IR_OPERATION_H

#define MLIR_IR_OPERATION_H

◆ MLIR_IR_OPERATIONSUPPORT_H

#define MLIR_IR_OPERATIONSUPPORT_H

◆ MLIR_IR_OPIMPLEMENTATION_H

#define MLIR_IR_OPIMPLEMENTATION_H

◆ MLIR_IR_QuantStorageTypeInterface_H

#define MLIR_IR_QuantStorageTypeInterface_H

◆ MLIR_IR_REGION_H

#define MLIR_IR_REGION_H

◆ MLIR_IR_STORAGEUNIQUERSUPPORT_H

#define MLIR_IR_STORAGEUNIQUERSUPPORT_H

◆ MLIR_IR_TYPERANGE_H

#define MLIR_IR_TYPERANGE_H

◆ MLIR_IR_TYPES_H

#define MLIR_IR_TYPES_H

◆ MLIR_IR_TYPESUPPORT_H

#define MLIR_IR_TYPESUPPORT_H

◆ MLIR_IR_USEDEFLISTS_H

#define MLIR_IR_USEDEFLISTS_H

◆ MLIR_IR_VALUE_H

#define MLIR_IR_VALUE_H

◆ MLIR_IR_VALUERANGE_H

#define MLIR_IR_VALUERANGE_H

◆ MLIR_IR_VISITORS_H

#define MLIR_IR_VISITORS_H

◆ MLIR_SUPPORT_ADTEXTRAS_H

#define MLIR_SUPPORT_ADTEXTRAS_H

◆ MLIR_SUPPORT_COMPLEX_H

#define MLIR_SUPPORT_COMPLEX_H

◆ MLIR_SUPPORT_CYCLICREPLACERCACHE_H

#define MLIR_SUPPORT_CYCLICREPLACERCACHE_H

◆ MLIR_SUPPORT_INTERFACESUPPORT_H

#define MLIR_SUPPORT_INTERFACESUPPORT_H

◆ MLIR_SUPPORT_LLVM_H

#define MLIR_SUPPORT_LLVM_H

◆ MLIR_SUPPORT_STORAGEUNIQUER_H

#define MLIR_SUPPORT_STORAGEUNIQUER_H

◆ MLIR_SUPPORT_TYPEID_H

#define MLIR_SUPPORT_TYPEID_H

◆ MLIR_SUPPORT_WALKRESULT_H

#define MLIR_SUPPORT_WALKRESULT_H

◆ MLIR_USE_FALLBACK_TYPE_IDS

#define MLIR_USE_FALLBACK_TYPE_IDS   false

Function Documentation

◆ isForallWithIdenticalConfiguration()

bool isForallWithIdenticalConfiguration ( Operation * target,
Operation * source )
static

Check if target scf.forall can be fused into source scf.forall.

This simply checks if both loops have the same bounds, steps and mapping. No attempt is made at checking that the side effects of target and source are independent of each other.

Definition at line 644 of file SCFTransformOps.cpp.

References target.

◆ isForWithIdenticalConfiguration()

bool isForWithIdenticalConfiguration ( Operation * target,
Operation * source )
static

Check if target scf.for can be fused into source scf.for.

This simply checks if both loops have the same bounds and steps. No attempt is made at checking that the side effects of target and source are independent of each other.

Definition at line 662 of file SCFTransformOps.cpp.

References target.

◆ isOpSibling()

DiagnosedSilenceableFailure isOpSibling ( Operation * target,
Operation * source )
static

Check if target and source are siblings, in the context that target is being fused into source.

This is a simple check that just checks if both operations are in the same block and some checks to ensure that the fused IR does not violate dominance.

Definition at line 573 of file SCFTransformOps.cpp.

References mlir::emitSilenceableFailure(), mlir::Operation::getBlock(), mlir::DominanceInfo::properlyDominates(), target, and mlir::visitUsedValuesDefinedAbove().

◆ loopScheduling()

void loopScheduling ( scf::ForOp forOp,
std::vector< std::pair< Operation *, unsigned > > & schedule,
unsigned iterationInterval,
unsigned readLatency )
static

Callback for PipeliningOption.

Populates schedule with the mapping from an operation to its logical time position given the iteration interval and the read latency. The latter is only relevant for vector transfers.

Definition at line 301 of file SCFTransformOps.cpp.

References mlir::getConstantIntValue().

◆ replaceOpWithRegion()

void replaceOpWithRegion ( RewriterBase & rewriter,
Operation * op,
Region & region )
static

Replaces the given op with the contents of the given single-block region, using the operands of the block terminator to replace operation results.

Definition at line 530 of file SCFTransformOps.cpp.

References mlir::RewriterBase::eraseOp(), mlir::Region::front(), mlir::Operation::getOperands(), mlir::Block::getTerminator(), mlir::Region::hasOneBlock(), mlir::RewriterBase::inlineBlockBefore(), and mlir::RewriterBase::replaceOp().

◆ wrapInExecuteRegion()

scf::ExecuteRegionOp wrapInExecuteRegion ( RewriterBase & b,
Operation * op )
static

Wraps the given operation op into an scf.execute_region operation.

Uses the provided rewriter for all operations to remain compatible with the rewriting infra, as opposed to just splicing the op in place.

Definition at line 195 of file SCFTransformOps.cpp.

References b, mlir::Region::empty(), mlir::Region::end(), mlir::Operation::getLoc(), mlir::Operation::getNumRegions(), mlir::Operation::getRegions(), mlir::Operation::getResults(), and mlir::Operation::getResultTypes().