Class LoopOp

Inheritance Relationships

Base Type

  • public mlir::Op< LoopOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::HasParent< ProcessOp >::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::OpTrait::HasRecursiveMemoryEffects >

Class Documentation

class LoopOp : public mlir::Op<LoopOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::HasParent<ProcessOp>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::OpTrait::HasRecursiveMemoryEffects>

Public Types

using Adaptor = LoopOpAdaptor
template<typename RangeT>
using GenericAdaptor = LoopOpGenericAdaptor<RangeT>
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>
using Properties = FoldAdaptor::Properties

Public Functions

inline ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames()
inline ::mlir::StringAttr getOperandSegmentSizesAttrName()
std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index)
inline ::mlir::Operation::operand_range getODSOperands(unsigned index)
inline ::mlir::Operation::operand_range getInputChannels()
inline ::mlir::Operation::operand_range getOutputChannels()
::mlir::MutableOperandRange getInputChannelsMutable()
::mlir::MutableOperandRange getOutputChannelsMutable()
inline std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index)
inline ::mlir::Operation::result_range getODSResults(unsigned index)
inline ::mlir::Region &getBody()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
void print(::mlir::OpAsmPrinter &p)

Prints a dfg::LoopOp in the custom assembly syntax consumed by parse.

If any input channel operands are present the inputs(...) clause is emitted, followed by the outputs(...) clause for output channels. Within each clause every operand is printed as value : type. The body region is always printed since a LoopOp without a region is ill-formed.

::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verify()

Verifies that the dfg::LoopOp has a valid port mapping.

A LoopOp must monitor either all input ports of its parent ProcessOp or none of them, and likewise for output ports. Partial coverage — monitoring only a subset — is rejected to avoid ambiguity in scheduling semantics where the loop body would need to fire on an undefined subset of channels.

inline FunctionType getFunctionType()

Constructs a function type from the inputs/outputs types.

Public Static Functions

static inline ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name)
static inline constexpr ::llvm::StringLiteral getOperationName()
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static llvm::hash_code computePropertiesHash(const Properties &prop)
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputChannels, ValueRange outputChannels, function_ref<void(OpBuilder&, Location)> bodyBuilder)

Builds a LoopOp with the given input, output values, and body.

The region is always created. bodyBuilder is called immediately with the builder positioned at the entry block, so callers can populate the body inline.

Parameters:
  • inputChannels – Values that are used as inputs.

  • outputChannels – Values that are used as outputs.

  • bodyBuilder – Callback to fill the entry block, can’t be null.

static LoopOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputChannels, ValueRange outputChannels, function_ref<void(OpBuilder&, Location)> bodyBuilder)
static LoopOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputChannels, ValueRange outputChannels, function_ref<void(OpBuilder&, Location)> bodyBuilder)
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)

Parses a dfg::LoopOp from its custom assembly syntax.

The expected syntax is:

`dfg.loop`
  (`inputs` `(` operand-list `)`)?
  (`outputs` `(` operand-list `)`)?
  region

Unlike ProcessOp, where ports are declared as fresh block arguments, LoopOp refers to channel values already live in the enclosing process body. The inputs/outputs lists are therefore parsed as resolved operands (ssaName : type) rather than new argument declarations. The operandSegmentSizes attribute is derived from the parsed counts and stored automatically. The body region is mandatory and must be non-empty.

static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)

Public Static Attributes

static constexpr int odsIndex_input_channels = 0
static constexpr int odsIndex_output_channels = 1