xai-org/x-algorithm · error · ValueError
Not a canonical UMMA_K Layout: Expected stride failure.
Error message
Not a canonical UMMA_K Layout: Expected stride failure.
What it means
In the K-major branch, stride_00 — the stride of the first mode of the M-divided (8,m) hierarchy — must equal swizzle_atom_mn_size (8 for 128B/BASE32B, 4 for 64B, 2 for 32B). This binds the layout's inner M repetition stride to the swizzle period; a mismatch means the declared swizzle does not describe how the layout repeats in M.
Source
Thrown at phoenix/xrex/cutedsl/ranker_fa4/mma_sm100_desc.py:270
stride_10 = canonical_layout.stride[1][0]
if stride_10 != swizzle_atom_mn_size:
raise ValueError("Not a canonical UMMA_MN Layout: Expected stride failure.")
stride_01, stride_11 = canonical_layout.stride[0][1], canonical_layout.stride[1][1]
if layout_type is LayoutType.SWIZZLE_NONE:
stride_byte_offset, leading_byte_offset = stride_01, stride_11
else:
stride_byte_offset, leading_byte_offset = stride_11, stride_01
else:
if layout_type == LayoutType.SWIZZLE_128B_BASE32B:
raise ValueError("SWIZZLE_128B_BASE32B is invalid for Major-K")
if not cute.size(layout.shape[0]) % 8 == 0:
raise ValueError("Not a canonical UMMA_K Layout: Expected MN-size multiple of 8.")
canonical_layout = cute.logical_divide(layout, (8, 2))
if not cute.is_congruent(canonical_layout, ((1, 1), (1, 1))):
raise ValueError("Not a canonical UMMA_K Layout: Expected profile failure.")
stride_00 = canonical_layout.stride[0][0]
if stride_00 != swizzle_atom_mn_size:
raise ValueError("Not a canonical UMMA_K Layout: Expected stride failure.")
stride_10 = canonical_layout.stride[1][0]
if layout_type is not LayoutType.SWIZZLE_NONE and stride_10 != 1:
raise ValueError("Not a canonical UMMA_K Layout: Expected stride failure.")
stride_01 = canonical_layout.stride[0][1]
stride_byte_offset, leading_byte_offset = stride_01, stride_10
desc = 0
desc |= (leading_byte_offset & 0x3FFF) << 16
desc |= (stride_byte_offset & 0x3FFF) << 32
desc |= (VERSION & 0x3) << 46
desc |= (BASE_OFFSET & 0x7) << 49
desc |= (LBO_MODE & 0x1) << 52
desc |= (int(layout_type) & 0x7) << 61
return desc & 0xFFFF_FFFF_FFFF_FFFF
def make_smem_desc_start_addr(start_addr: cute.Pointer) -> cutlass.Int32:View on GitHub (pinned to 24c60942c5)
Solutions
- Align the swizzle with the layout's M atom stride using the swizzle_atom_mn_size table (NONE:1, 32B:2, 64B:4, 128B:8)
- Rebuild the layout via tile_to_shape from the same swizzle atom used in the descriptor call
- Log canonical_layout.stride[0][0] to see the actual value and adjust one side
Example fix
# before desc = make_smem_desc_base(layout_with_m_stride_8, cute.Swizzle(2,4,3), Major.K) # 64B # after desc = make_smem_desc_base(layout_with_m_stride_4, cute.Swizzle(2,4,3), Major.K)
Defensive patterns
Strategy: validation
Validate before calling
expected = {0:1,1:8,2:8,4:4,6:2}[layout_type]
assert cute.logical_divide(layout,(8,2)).stride[0][0] == expected Prevention
- Regenerate layouts whenever the dtype (and thus atom width) changes
- Assert stride_00 equals the swizzle atom table value in kernel tests
When it happens
Trigger: Passing a 64B swizzle (atom 4) with a layout tiled with M-stride 8, or any K-major layout whose stride_00 differs from the table entry for the swizzle's LayoutType.
Common situations: Changing dtype (fp16 -> fp8 changes the natural atom width) without changing the swizzle constant; reusing a descriptor helper with a layout built for a different swizzle atom.
Related errors
- Not a canonical UMMA_MN Layout: Expected stride failure.
- 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 MN-size multiple of
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/f2c78e02b2c0fb6f.
Report an issue: GitHub.