{"record":{"id":"66c067a2a38f7bb9","repo":"xai-org/x-algorithm","slug":"n-must-be-a-multiple-of-8-in-the-range-8-256","errorCode":null,"errorMessage":"N must be a multiple of 8 in the range 8…256","messagePattern":"N must be a multiple of 8 in the range 8…256","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/cutedsl/ranker_fa4/mma_sm100_desc.py","lineNumber":166,"sourceCode":"    c_type,\n    M: int,\n    N: int,\n    a_major: Major,\n    b_major: Major,\n    a_neg: ScaleIn = ScaleIn.One,\n    b_neg: ScaleIn = ScaleIn.One,\n    c_sat: Saturate = Saturate.False_,\n    is_sparse: bool = False,\n    max_shift: MaxShift = MaxShift.NoShift,\n) -> int:\n    a_fmt = int(to_UMMA_format(a_type))\n    b_fmt = int(to_UMMA_format(b_type))\n    c_fmt = int(to_C_format(c_type))\n\n    if M not in (64, 128, 256):\n        raise ValueError(\"M must be 64, 128 or 256\")\n    if N < 8 or N > 256 or (N & 7):\n        raise ValueError(\"N must be a multiple of 8 in the range 8…256\")\n\n    m_dim = M >> 4\n    n_dim = N >> 3\n\n    desc = 0\n    desc |= (0 & 0x3) << 0\n    desc |= (int(is_sparse) & 0x1) << 2\n    desc |= (int(c_sat) & 0x1) << 3\n    desc |= (c_fmt & 0x3) << 4\n    desc |= (a_fmt & 0x7) << 7\n    desc |= (b_fmt & 0x7) << 10\n    desc |= (int(a_neg) & 0x1) << 13\n    desc |= (int(b_neg) & 0x1) << 14\n    desc |= (int(a_major) & 0x1) << 15\n    desc |= (int(b_major) & 0x1) << 16\n    desc |= (n_dim & 0x3F) << 17\n    desc |= (m_dim & 0x1F) << 24\n    desc |= (int(max_shift) & 0x3) << 30","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/cutedsl/ranker_fa4/mma_sm100_desc.py#L148-L184","documentation":"make_instr_desc validates that the UMMA N dimension is between 8 and 256 inclusive and a multiple of 8 (N & 7 == 0), encoding N>>3 into the descriptor. Violating any of these raises ValueError.","triggerScenarios":"Calling make_instr_desc / mma_op_to_idesc with N such as 96 (not a multiple of 8), 264 (>256), or 4 (<8), often N derived from head_dim or a heuristic tile size.","commonSituations":"Using unusual head dimensions (e.g. 96 is fine, 100 is not), porting tile configs from another arch, or computing N from a runtime value that can drift outside the legal range.","solutions":["Round N up/down to the nearest multiple of 8 within [8, 256] (e.g. 100 -> 104) and pad the tensor accordingly","Clamp N to 256 and split wider dimensions into multiple MMA calls","Validate head_dim-based N before building the op and raise a clearer config error at setup time"],"exampleFix":"# before\ndesc = make_instr_desc(a, b, c, M=128, N=100)\n# after\nN = (100 + 7) & ~7  # 104\nassert 8 <= N <= 256\ndesc = make_instr_desc(a, b, c, M=128, N=N)","handlingStrategy":"validation","validationCode":"if not (8 <= N <= 256 and N % 8 == 0):\n    raise ValueError(f'N={N} illegal; need multiple of 8 in [8, 256]')","typeGuard":"def is_legal_umma_n(n: int) -> bool:\n    return 8 <= n <= 256 and (n & 7) == 0","tryCatchPattern":null,"preventionTips":["Round head-dim-derived N up to a multiple of 8 when configuring tiles","Clamp N to 256 and split wider operands across multiple MMAs"],"tags":["cutlass","tcgen05","mma","tile-shape","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}