xai-org/x-algorithm · error · ValueError

Not a canonical UMMA_MN Layout: Expected profile failure.

Error message

Not a canonical UMMA_MN Layout: Expected profile failure.

What it means

When building the UMMA smem descriptor for an MN-major operand, make_smem_desc_base logically divides the layout into the swizzle atom tile ((swizzle_atom_mn_size, 8) — or K-size 4 for 128B_BASE32B) and requires the result to be congruent to ((1,1),(1,1)), i.e. a perfectly hierarchical row-major-within-atom layout. If the divided layout still has interleaved/mixed strides, the layout does not match what the tcgen05 descriptor encoding can express, so it is rejected.

Source

Thrown at phoenix/xrex/cutedsl/ranker_fa4/mma_sm100_desc.py:248

    layout_type = _layout_type(swizzle)

    VERSION = 1
    LBO_MODE = 0
    BASE_OFFSET = 0

    swizzle_atom_mn_size = {
        LayoutType.SWIZZLE_NONE: 1,
        LayoutType.SWIZZLE_32B: 2,
        LayoutType.SWIZZLE_64B: 4,
        LayoutType.SWIZZLE_128B: 8,
        LayoutType.SWIZZLE_128B_BASE32B: 8,
    }[layout_type]

    if major is Major.MN:
        swizzle_atom_k_size = 4 if layout_type is LayoutType.SWIZZLE_128B_BASE32B else 8
        canonical_layout = cute.logical_divide(layout, (swizzle_atom_mn_size, swizzle_atom_k_size))
        if not cute.is_congruent(canonical_layout, ((1, 1), (1, 1))):
            raise ValueError("Not a canonical UMMA_MN Layout: Expected profile failure.")
        stride_00 = canonical_layout.stride[0][0]
        if layout_type is not LayoutType.SWIZZLE_NONE and stride_00 != 1:
            raise ValueError("Not a canonical UMMA_MN Layout: Expected stride failure.")
        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))):

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Rebuild the operand smem layout as tile_to_shape of the swizzle atom matching your swizzle mode so the atom tile is exactly (atom_mn, atom_k)
  2. Check that the K extent is divisible by swizzle_atom_k_size (8, or 4 for SWIZZLE_128B_BASE32B) and M/N extent divisible by swizzle_atom_mn_size
  3. Verify major: this branch expects Major.MN — if the tensor is K-major pass Major.K
  4. Inspect cute.logical_divide(layout,(atom_mn,atom_k)) shape/stride hierarchy manually to find the non-hierarchical dimension

Example fix

# before
smem_layout = cute.make_layout((M,K), stride=(1,M))  # K-major-ish atom, fails congruence
# after
atom = cute.tile_to_shape(cute.make_layout((8,8),stride=(1,64)), (M,K))
desc = make_smem_desc_base(atom_layout, cute.Swizzle(3,4,3), Major.MN)
Defensive patterns

Strategy: validation

Validate before calling

atom_mn = {0:1,1:8,2:8,4:4,6:2}[lt]
atom_k = 4 if lt == 1 else 8
cl = cute.logical_divide(layout, (atom_mn, atom_k))
assert cute.is_congruent(cl, ((1,1),(1,1))), 'layout will fail UMMA_MN profile check'

Prevention

When it happens

Trigger: Passing an MN-major cute.Layout whose inner MN/K atom is not a compact rectangular tile of the swizzle atom size — e.g. stride order swapped, a nested layout like ((8,m),(8,k)) with non-uniform strides, or K extent not divisible by the atom K-size (8, or 4 for BASE32B).

Common situations: Using an smem tensor tiled from a non-standard atom or with padding in K; mixing a 64B swizzle atom with a layout tiled for 128B; K-dimension size (e.g. K=4 with fp8 and 128B swizzle) not divisible by 8; layouts produced by cute.composition with an arbitrary value layout.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/5198f3ddcde38828. Report an issue: GitHub.