tvm_tirx.script.ir_builder.parser_protocol.while_#
- tvm_tirx.script.ir_builder.parser_protocol.while_(condition, *, loc=None)#
Create a native while-loop frame.
- Parameters:
condition (Expr or bool) – Loop predicate expression, constructed once and evaluated by the IR at runtime.
loc (LocationEntry, Location or None, optional) – Location for the constructed result. None (the default) leaves explicit location unspecified; active source-call provenance is composed by the builder. Frames retain their location until finalization.
- Returns:
IRBuilderFrame – A context manager whose exit completes the loop body.
- Return type:
IRBuilderFrame
Notes
TIRx requires an active function region. Invalid predicate/context produces native errors; Relax raises TypeError. This does not repeatedly execute the Python body. The frame owns its stored source location.
# Source while condition: T.evaluate(1) # Generated builder with X.while_(condition): X.emit_(X.evaluate(1))