asc.experimental.asctile.static_assert

asc.experimental.asctile.static_assert(test: Any, message: str | None = None) → None

Check a condition during JIT compilation on the host.

If the condition is false, raises AssertionError and aborts compilation.

Parameters:
  • test – Condition to check (must be a compile-time value, not an IR value).

  • message – Optional error message for the exception.

Note

Always runs during compilation, regardless of the debug option. The built-in assert statement does NOT dispatch to this function — it dispatches to device_assert() instead. Use this function explicitly for compile-time checks.

Examples

Validate a tile size constant at compile time:

@asctile.jit
def kernel(TILE: asc.ConstExpr[int]):
    asctile.static_assert(TILE % 16 == 0, "TILE must be a multiple of 16")