tvm_tirx.script.parser.make_decorator#
- tvm_tirx.script.parser.make_decorator(builder, *, namespace_path, definition_kind=protocol_registry.DefinitionKind.FUNCTION)#
Create a function decorator with an explicit namespace and construction kind.
- Parameters:
builder (object) – Namespace implementing the function construction protocol.
namespace_path (str) – Canonical registered syntax key, such as “tirx.function”.
definition_kind (protocol_registry.DefinitionKind, optional) – Construction behavior registered for this syntax key. Defaults to FUNCTION; pass BUILDER for explicit Python construction without sugar lowering.
- Returns:
decorator (callable) – Callable used through a registered namespace at the definition site, such as
@T.functionor@T.function(**options). Bare callable aliases and later application to an existing function are unsupported.- Raises:
ValueError – When the returned decorator receives a non-function positional value.
SyntaxError – When application is not a qualified definition-site decorator, or source violates a parser restriction.
OSError – When the decorated function’s source cannot be recovered.
- Return type:
Callable[[…], Any]
Notes
Class members retain their Python functions until module construction. Standalone functions immediately transpile and execute a builder program. Annotations must be safe to re-evaluate: eager MissingType placeholders are not cached, and source annotations execute in declaration frames. Construction errors propagate unchanged through parse. Public options pass directly to
builder.function_; the language variant hook owns their defaults.