tvm_tirx.script.ir_builder.parser_protocol.decl_mutable_cell_

tvm_tirx.script.ir_builder.parser_protocol.decl_mutable_cell_#

tvm_tirx.script.ir_builder.parser_protocol.decl_mutable_cell_(value=MISSING, *, ty=None, name=None, loc=None, name_loc=None)#

Introduce explicitly declared mutable storage.

Parameters:
  • value (Any, optional) – Once-evaluated storage handle for a call declaration, or initializer for an annotation declaration. MISSING (the default) means no initializer.

  • ty (Type or annotation callable, optional) – Scalar or vector storage annotation. None (the default) identifies an already- created storage handle.

  • name (str, optional) – Source target name. None (the default) requests no source-derived name.

  • 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.

  • name_loc (LocationEntry, Location or None, optional) – Location of the target identifier. None (the default) uses loc; it can differ from the emitted statement location.

Returns:

Any – The same declared storage handle, or the handle allocated for the annotation.

Return type:

Any

Notes

TIRx requires an active primitive function; scalar primitive annotations allocate local storage and may initialize it. Vector annotations allocate storage but reject an initializer. Invalid handle/type combinations raise TypeError or ValueError. Relax always rejects mutable storage with TypeError. Declaration syntax takes precedence over any outer mutable target name.

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