CIRCT

Circuit IR Compilers and Tools

'loopschedule' Dialect

Representation of scheduled loops

Operations

loopschedule.pipeline (::circt::loopschedule::LoopSchedulePipelineOp)

LoopSchedule dialect pipeline-loop.

The loopschedule.pipeline operation represents a statically scheduled pipeline stucture that executes while a condition is true. For more details, see: https://llvm.discourse.group/t/rfc-representing-pipelined-loops/4171.

A pipeline captures the result of scheduling, and is not generally safe to transform, besides lowering to hardware dialects. For more discussion about relaxing this, see: https://github.com/llvm/circt/issues/2204.

This is the top-level operation representing a high-level pipeline. It is not isolated from above, but could be if this is helpful. A pipeline contains two regions: condition and stages.

The pipeline may accept an optional iter_args, similar to the SCF dialect, for representing loop-carried values like induction variables or reductions. When the pipeline starts execution, the registers indicated as iter_args by pipeline.terminator should be initialized to the initial values specified in the iter_args section here. The iter_args relate to the initiation interval of the loop. The maximum distance in stages between where an iter_arg is used and where that iter_arg is registered must be less than the loop’s initiation interval. For example, with II=1, each iter_arg must be used and registered in the same stage.

The single-block condition region dictates the condition under which the pipeline should execute. It has a register terminator, and the pipeline initiates new iterations while the registered value is true : i1. It may access SSA values dominating the pipeline, as well as iter_args, which are block arguments. The body of the block may only contain “combinational” operations, which are currently defined to be simple arithmetic, comparisons, and selects from the Standard dialect.

The single-block stages region wraps loopschedule.pipeline.stage operations. It has a loopschedule.terminator terminator, which can both return results from the pipeline and register iter_args. Stages may access SSA values dominating the pipeline, as well as iter_args, which are block arguments.

Attributes:

AttributeMLIR TypeDescription
II::mlir::IntegerAttr64-bit signless integer attribute
tripCount::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
iterArgsvariadic of any type

Results:

ResultDescription
resultsvariadic of any type

loopschedule.pipeline.stage (::circt::loopschedule::LoopSchedulePipelineStageOp)

LoopSchedule dialect pipeline stage.

Syntax:

operation ::= `loopschedule.pipeline.stage` `start` `=` $start (`when` $when^)? $body (`:` qualified(type($results))^)? attr-dict

This operation has a single-block region which dictates the operations that may occur concurrently.

It has a start attribute, which indicates the start cycle for this stage.

It may have an optional when predicate, which supports conditional execution for each stage. This is in addition to the condition region that controls the execution of the whole pipeline. A stage with a when predicate should only execute when the predicate is true : i1, and push a bubble through the pipeline otherwise.

It has a register terminator, which passes the concurrently computed values forward to the next stage.

Any stage may access iter_args. If a stage accesses an iter_arg after the stage in which it is defined, it is up to lowering passes to preserve this value until the last stage that needs it.

Other than iter_args, stages may only access SSA values dominating the pipeline or SSA values computed by any previous stage. This ensures the stages capture the coarse-grained schedule of the pipeline and how values feed forward and backward.

Traits: HasParent<LoopSchedulePipelineOp>

Attributes:

AttributeMLIR TypeDescription
start::mlir::IntegerAttr64-bit signed integer attribute

Operands:

OperandDescription
when1-bit signless integer

Results:

ResultDescription
resultsvariadic of any type

loopschedule.register (::circt::loopschedule::LoopScheduleRegisterOp)

LoopSchedule dialect loop register.

Syntax:

operation ::= `loopschedule.register` $operands (`:` qualified(type($operands))^)? attr-dict

The loopschedule.register terminates a pipeline stage and “registers” the values specified as operands. These values become the results of the stage.

Traits: HasParent<LoopSchedulePipelineOp, LoopSchedulePipelineStageOp>, Terminator

Operands:

OperandDescription
operandsvariadic of any type

loopschedule.terminator (::circt::loopschedule::LoopScheduleTerminatorOp)

LoopSchedule dialect terminator.

Syntax:

operation ::= `loopschedule.terminator` `iter_args` `(` $iter_args `)` `,`
              `results` `(` $results `)` `:`
              functional-type($iter_args, $results) attr-dict

The loopschedule.terminator operation represents the terminator of a loopschedule.pipeline.

The results section accepts a variadic list of values which become the pipeline’s return values. These must be results of a stage, and their types must match the pipeline’s return types. The results need not be defined in the final stage, and it is up to lowering passes to preserve these values until the final stage is complete.

The iter_args section accepts a variadic list of values which become the next iteration’s iter_args. These may be the results of any stage, and their types must match the pipeline’s iter_args types.

Traits: AttrSizedOperandSegments, HasParent<LoopSchedulePipelineOp>, Terminator

Operands:

OperandDescription
iter_argsvariadic of any type
resultsvariadic of any type

'loopschedule' Dialect Docs