sgl-project/sglang · error · ValueError
Only Swizzle<2,5,2> supported for 128B_BASE32B
Error message
Only Swizzle<2,5,2> supported for 128B_BASE32B
What it means
_layout_type only accepts Swizzle<2,5,2> for the num_base==5 case, which maps to LayoutType.SWIZZLE_128B_BASE32B. Any (B, S) other than (2, 2) with M==5 raises this ValueError.
Source
Thrown at python/sglang/kernels/ops/attention/flash_attn/cute/mma_sm100_desc.py:217
def _layout_type(swizzle: cute.Swizzle) -> LayoutType:
B, M, S = swizzle.num_bits, swizzle.num_base, swizzle.num_shift
if M == 4: # Swizzle<*,4,3>
if S != 3:
raise ValueError("Unexpected swizzle shift – want S==3 for M==4")
return {
0: LayoutType.SWIZZLE_NONE,
1: LayoutType.SWIZZLE_32B,
2: LayoutType.SWIZZLE_64B,
3: LayoutType.SWIZZLE_128B,
}[
B
] # KeyError ⇒ invalid B→ raise
if M == 5: # Swizzle<2,5,2> (the only legal triple for M==5)
if (B, S) != (2, 2):
raise ValueError("Only Swizzle<2,5,2> supported for 128B_BASE32B")
return LayoutType.SWIZZLE_128B_BASE32B
# Any other (M,B,S) triple is not a UMMA-legal shared-memory layout
raise ValueError("Unsupported swizzle triple for UMMA smem descriptor")
def make_smem_desc_base(
layout: cute.Layout, swizzle: cute.Swizzle, major: Major
) -> int:
"""
Convert a 2-D *shared-memory* Cute layout into the Blackwell 64-bit
smem-descriptor, without the smem start address.
layout must correspond to layout of an uint128 tensor.
"""
# ------------------------------------------------------------------ meta
layout_type = _layout_type(swizzle) # resolve SWIZZLE_* family
VERSION = 1 # bits 46–47View on GitHub (pinned to 0132848349)
Solutions
- Use exactly Swizzle<2,5,2> for the 128B_BASE32B layout.
- Take the swizzle from a canonical cute atom (the layouts used by the shipped kernels) instead of constructing it manually.
- If you don't need base32B, use a Swizzle<*,4,3> triple instead.
Defensive patterns
Strategy: validation
Validate before calling
if swizzle.num_base == 5:
assert (swizzle.num_bits, swizzle.num_shift) == (2, 2) Prevention
- Use Swizzle<2,5,2> verbatim for 128B_BASE32B.
- Prefer building descriptors from tensors via smem_desc_base_from_tensor over manual layouts.
When it happens
Trigger: Calling make_smem_desc_base with a Swizzle whose num_base is 5 but whose num_bits/num_shift differ from 2/2 — e.g. Swizzle<3,5,2> or Swizzle<2,5,3>.
Common situations: Building 128B-base32B layouts manually with slightly-off parameters; mixing swizzle constants copied from a different atom.
Related errors
- Unexpected swizzle shift – want S==3 for M==4
- Unsupported swizzle triple for UMMA smem descriptor
- Not a canonical UMMA_MN Layout: Expected profile failure.
- SWIZZLE_128B_BASE32B is invalid for Major-K
- Not a canonical UMMA_K Layout: Expected profile failure.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5dd7992dfc253912.
Report an issue: GitHub.