sgl-project/sglang · error · ValueError
TGV cute_ext tactic {tactic} out of range [0, {len(_TGV_CUTE
Error message
TGV cute_ext tactic {tactic} out of range [0, {len(_TGV_CUTE_EXT_TACTIC_CONFIGS)}). What it means
TGV tactic ids index into _TGV_CUTE_EXT_TACTIC_CONFIGS; a tactic >= len(configs) (or an explicitly non-negative out-of-range id) is invalid. Negative tactics are replaced by the default tactic.
Source
Thrown at python/sglang/kernels/ops/gemm/cutedsl_bf16_gemm.py:1256
# bias is per-output-feature in PyTorch terms. After the A↔B swap the
# kernel's M-axis maps to PyTorch's N-axis, which is exactly what the
# bias indexes — so this is a direct (0, 1, 0) broadcast.
L = c_swap.shape[0]
M_ce = c_swap.shape[1] # == PyTorch N
N_ce = c_swap.shape[2] # == PyTorch M
bias_3d = bias_pt.as_strided(size=(L, M_ce, N_ce), stride=(0, 1, 0))
bias_ = from_dlpack(bias_3d.detach(), assumed_align=2).mark_layout_dynamic(
leading_dim=1
)
return a_, b_, c_, bias_, layout
def _resolve_tactic(tactic: int) -> Tuple[int, int, int, bool]:
"""Return (cta_m, cta_n, num_ab_stage, use_2cta) for the given tactic id."""
if tactic < 0:
tactic = _TGV_CUTE_EXT_DEFAULT_TACTIC
if tactic >= len(_TGV_CUTE_EXT_TACTIC_CONFIGS):
raise ValueError(
f"TGV cute_ext tactic {tactic} out of range [0, {len(_TGV_CUTE_EXT_TACTIC_CONFIGS)})."
)
return _TGV_CUTE_EXT_TACTIC_CONFIGS[tactic]
def _run_tgv(
a: torch.Tensor,
b: torch.Tensor,
bias: Optional[torch.Tensor],
out: torch.Tensor,
pdl: bool,
tactic: int,
) -> torch.Tensor:
"""Dispatch one TGV GEMM: a (M, K) @ b (K, N) -> out (M, N), bias (N,)."""
cta_m, cta_n, num_ab_stage, use_2cta = _resolve_tactic(tactic)
has_bias = bias is not None
a_, b_, c_, bias_, (a_leading, b_leading, c_leading) = _to_cute_swap(View on GitHub (pinned to 0132848349)
Solutions
- Clamp tactic to the valid range: 0 <= tactic < len(_TGV_CUTE_EXT_TACTIC_CONFIGS).
- Pass -1 (or omit) to use the default tactic.
- Regenerate tactic lists after upgrading the kernel module.
Example fix
// before _run_tgv(x, w, bias, tactic=999) // after _run_tgv(x, w, bias, tactic=-1) # default tactic
Defensive patterns
Strategy: validation
Validate before calling
assert -1 <= tactic < len(_TGV_CUTE_EXT_TACTIC_CONFIGS)
Prevention
- Use -1 for the default tactic.
- Validate tactic lists after kernel upgrades.
When it happens
Trigger: Calling _run_tgv with a user-supplied tactic integer larger than the number of hardcoded tactic configs.
Common situations: Porting tactic ids from a newer/older kernel version where the config table changed size, or autotuning sweeps that assume more tactics exist.
Related errors
- TGV cute_ext backend supports {list(_TORCH_TO_CUTLASS_DTYPE)
- TGV cute_ext output supports {list(_TORCH_TO_CUTLASS_OUT_DTY
- cta_n={cta_n} invalid for use_2cta={use_2cta}: bf16 K-major
- cutedsl_bf16_gemm requires an SM10x GPU
- dsv3_fused_a_gemm requires SM90 (Hopper) or later
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/51e154b93d83b4ba.
Report an issue: GitHub.