low.scf.while
← low dialect
Condition-controlled target-low loop with explicit condition and body regions and loop-carried register state.
Operation contract
| Property |
Value |
| Semantic phase |
executable |
| Traits |
StorageRelation |
| Interfaces |
LoopLike |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Operand |
iter_args |
register |
variadic |
Initial loop-carried register values. |
| Result |
results |
register |
variadic |
— |
| Region |
before |
region |
required |
Runs before each condition check. Terminated by low.scf.condition. (single block, terminator low.scf.condition.) |
| Region |
after |
region |
required |
Runs while the condition is true. Terminated by low.scf.yield. (single block, terminator low.scf.yield.) |
Verification constraints
IterArgsMatchResults(iter_args, results)
BlockArgCount(before, iter_args)
BlockArgsMatchTypes(before, iter_args)
BlockArgCount(after, iter_args)
BlockArgsMatchTypes(after, iter_args)
ConditionForwardedCountMatchesBlockArgs(before, after, iter_args)
ConditionForwardedTypesMatchBlockArgs(before, after, iter_args)
YieldCountMatchesResults(after, results)
YieldTypesMatchResults(after, results)
Examples
low.scf.while {
low.scf.condition %condition : reg<spirv.id : i1>
} do {
low.scf.yield
}
%result = low.scf.while(%before = %initial : reg<spirv.id : i32>) -> (reg<spirv.id : i32>) {
low.scf.condition %keep_going, %before : reg<spirv.id : i1>, reg<spirv.id : i32>
} do(%body: reg<spirv.id : i32>) {
low.scf.yield %body : reg<spirv.id : i32>
}