tvm_tirx.script.ir_builder.parser_protocol.arg_

Contents

tvm_tirx.script.ir_builder.parser_protocol.arg_#

tvm_tirx.script.ir_builder.parser_protocol.arg_(name, annotation, *, loc=None)#

Add a parameter to the active native function signature.

Parameters:
  • name (str) – Source parameter name.

  • annotation (Type, Var or callable) – Concrete rewritten annotation or existing native parameter. A callable annotation is evaluated; an existing variable retains identity.

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

_ir.Var – The created or retained parameter variable (buffers are native variables).

Return type:

Var

Notes

Requires an active function signature frame. Existing variables retain identity; type annotations create fresh variables. TIRx handles buffer layout according to its function policy; Relax converts its type annotation. Invalid annotations or context raise TypeError/native builder errors.

# Source
def f(a: T.int32):
    pass
# Generated builder, inside the signature frame
a = X.arg_("a", X.int32)