tvm_tirx.script.ir_builder.parser_protocol.set_mutable_cell_

tvm_tirx.script.ir_builder.parser_protocol.set_mutable_cell_#

tvm_tirx.script.ir_builder.parser_protocol.set_mutable_cell_(target, value, *, loc=None)#

Emit an update through an existing mutable handle without rebinding it.

Parameters:
  • target (TensorLoad, scalar wrapper or one-element buffer Var) – Storage handle returned by an explicit mutable declaration. Its identity is retained; this argument is not a source name or a new declaration.

  • value (Expr or scalar convertible to Expr) – Once-evaluated value to store. Native store checking validates its type and indices against the target.

  • loc (LocationEntry, Location or None, optional) – Location of the emitted store. None (the default) leaves explicit location unspecified; existing source-call provenance is retained.

Returns:

AlreadyEmitted[Any] – Receipt retaining the exact emitted statement; consuming it emits nothing again.

Return type:

AlreadyEmitted[Any]

Notes

TIRx requires an active primitive function/statement region and appends a native store to that region. Scalar wrappers are unwrapped, TensorLoad indices are preserved, and one-element buffer targets use index zero. Unsupported targets raise TypeError; native type/index checks propagate. Relax always raises TypeError because its bindings are immutable. No new allocation or immutable binding is created.

# Source
x: T.int32 = 0
x = value
# Generated builder
x = X.decl_mutable_cell_(0, ty=X.int32, name="x")
X.set_mutable_cell_(x, value)