tvm_tirx.script.ir_builder.constexpr

Contents

tvm_tirx.script.ir_builder.constexpr#

tvm_tirx.script.ir_builder.constexpr(value)#

Mark host control syntax or a JIT specialization annotation.

Parameters:

value (object) – Source expression to evaluate with ordinary Python semantics in a supported control-flow position. The marker itself can also appear as an annotation identifying a JIT specialization parameter.

Raises:

TypeError – If invoked directly instead of being recognized in parsed source.

Return type:

NoReturn

Notes

The parser recognizes this marker through its fixed namespace path and removes it before execution. Host operators retain ordinary Python behavior. Direct invocation raises TypeError; no builder frame or IR is constructed.

# Source
if I.constexpr(enabled):
    T.evaluate(1)
# Builder
if enabled:
    X.emit_(X.evaluate(1))