{"record":{"id":"649641fc23429a51","repo":"sgl-project/sglang","slug":"not-a-canonical-umma-k-layout-expected-mn-size-mu","errorCode":null,"errorMessage":"Not a canonical UMMA_K Layout: Expected MN-size multiple of 8.","messagePattern":"Not a canonical UMMA_K Layout: Expected MN-size multiple of 8\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/attention/flash_attn/cute/mma_sm100_desc.py","lineNumber":275,"sourceCode":"        stride_00 = canonical_layout.stride[0][0]\n        if layout_type is not LayoutType.SWIZZLE_NONE and stride_00 != 1:\n            raise ValueError(\"Not a canonical UMMA_MN Layout: Expected stride failure.\")\n        stride_10 = canonical_layout.stride[1][0]\n        if stride_10 != swizzle_atom_mn_size:\n            raise ValueError(\"Not a canonical UMMA_MN Layout: Expected stride failure.\")\n        stride_01, stride_11 = (\n            canonical_layout.stride[0][1],\n            canonical_layout.stride[1][1],\n        )\n        if layout_type is LayoutType.SWIZZLE_NONE:\n            stride_byte_offset, leading_byte_offset = stride_01, stride_11\n        else:\n            stride_byte_offset, leading_byte_offset = stride_11, stride_01\n    else:\n        if layout_type == LayoutType.SWIZZLE_128B_BASE32B:\n            raise ValueError(\"SWIZZLE_128B_BASE32B is invalid for Major-K\")\n        if not cute.size(layout.shape[0]) % 8 == 0:\n            raise ValueError(\n                \"Not a canonical UMMA_K Layout: Expected MN-size multiple of 8.\"\n            )\n        canonical_layout = cute.logical_divide(layout, (8, 2))\n        if not cute.is_congruent(canonical_layout, ((1, 1), (1, 1))):\n            raise ValueError(\"Not a canonical UMMA_K Layout: Expected profile failure.\")\n        stride_00 = canonical_layout.stride[0][0]\n        if stride_00 != swizzle_atom_mn_size:\n            raise ValueError(\"Not a canonical UMMA_K Layout: Expected stride failure.\")\n        stride_10 = canonical_layout.stride[1][0]\n        if layout_type is not LayoutType.SWIZZLE_NONE and stride_10 != 1:\n            raise ValueError(\"Not a canonical UMMA_K Layout: Expected stride failure.\")\n        stride_01 = canonical_layout.stride[0][1]\n        stride_byte_offset, leading_byte_offset = stride_01, stride_10\n\n    # ------------------------------------------------------------------ pack\n    desc = 0\n    # leading_byte_offset_  [16:30)\n    desc |= (leading_byte_offset & 0x3FFF) << 16","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/attention/flash_attn/cute/mma_sm100_desc.py#L257-L293","documentation":"On the Major-K path, make_smem_desc_base requires the MN-mode extent (layout.shape[0]) to be a multiple of 8 so it can be divided into (8, 2) canonical atoms. Otherwise the descriptor bit-fields cannot represent the layout.","triggerScenarios":"Calling make_smem_desc_base with major=Major.K and an MN extent such as 4, 6, 12, or 20 (not divisible by 8).","commonSituations":"Non-standard head dims or tile N/M sizes when building K-major operand descriptors; shapes ported from SM90 kernels with different alignment requirements.","solutions":["Pad or round the MN extent up to a multiple of 8 and predicate the unused columns/rows.","Choose standard tile sizes (64/128/256) that are inherently 8-aligned.","Verify which mode of your layout is mode 0 for Major.K before computing extents."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if major is Major.K:\n    assert cute.size(layout.shape[0]) % 8 == 0, \"MN extent must be multiple of 8 for Major-K\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep MN extents 8-aligned in K-major operand tiles.","Pad to alignment with predication instead of odd sizes."],"tags":["cutlass","sm100","layout","alignment"],"backgroundTag":"invalid-canonical-layout","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}