{"record":{"id":"0985e9e15c951612","repo":"sgl-project/sglang","slug":"unsupported-nvfp4-gemm-swiglu-nvfp4-quant-configur","errorCode":null,"errorMessage":"Unsupported nvfp4_gemm_swiglu_nvfp4_quant configuration: shape=(M={m}, N={n}, K={k}), mma_tiler_mn={mma_tiler_mn}, cluster_shape_mn={cluster_shape_mn}","messagePattern":"Unsupported nvfp4_gemm_swiglu_nvfp4_quant configuration: shape=\\(M=(.+?), N=(.+?), K=(.+?)\\), mma_tiler_mn=(.+?), cluster_shape_mn=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/quantization/nvfp4_gemm_swiglu_nvfp4_quant.py","lineNumber":2916,"sourceCode":"    else:\n        mma_tiler_mn, cluster_shape_mn = (256, 128), (2, 1)\n\n    if not Sm100BlockScaledPersistentDenseGemmKernel.can_implement(\n        ab_dtype_cutlass,\n        sf_dtype_cutlass,\n        sf_vec_size,\n        c_dtype_cutlass,\n        mma_tiler_mn,\n        cluster_shape_mn,\n        m,\n        n,\n        k,\n        l,\n        a_major=\"k\",\n        b_major=\"k\",\n        c_major=\"n\",\n    ):\n        raise ValueError(\n            \"Unsupported nvfp4_gemm_swiglu_nvfp4_quant configuration: \"\n            f\"shape=(M={m}, N={n}, K={k}), mma_tiler_mn={mma_tiler_mn}, \"\n            f\"cluster_shape_mn={cluster_shape_mn}\"\n        )\n\n    if out is None:\n        out = torch.empty((m, n_out // 2), dtype=torch.uint8, device=a.device)\n    if out_scale is None:\n        out_scale = torch.empty(\n            (padded_m, padded_scale_n),\n            dtype=torch.float8_e4m3fn,\n            device=a.device,\n        )\n\n    if alpha.dim() == 0 or alpha.dim() == 1:\n        alpha = alpha.view(1, 1)\n    if output_global_scale.dim() == 0:\n        output_global_scale = output_global_scale.view(1)","sourceCodeStart":2898,"sourceCodeEnd":2934,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/quantization/nvfp4_gemm_swiglu_nvfp4_quant.py#L2898-L2934","documentation":"Before launching, the op validates the problem shape against the CUTLASS MMA tiler and cluster shape (e.g. requires N/K to be coverable by the chosen tile/cluster geometry on SM100). If the M,N,K combination cannot be tiled by mma_tiler_mn with cluster_shape_mn, the configuration is unsupported and it refuses to launch rather than computing garbage.","triggerScenarios":"Calling with shape values not divisible by the tile requirements — commonly K or N not a multiple of the tiler span (e.g. 256) implied by mma_tiler_mn and cluster_shape_mn, or extreme shapes like M=0.","commonSituations":"Custom layer geometries with unaligned hidden/intermediate sizes, overriding mma_tiler_mn/cluster_shape_mn for tuning without matching shape alignment, or very small N/K leftovers after packing.","solutions":["Round or pad K and N to multiples required by the tiler (commonly 256 for the tiler_mn used)","Use the default mma_tiler_mn/cluster_shape_mn unless you have verified shape compatibility","If geometry is fixed and unaligned, use a non-fused GEMM path for that layer"],"exampleFix":"# before\nout = nvfp4_gemm_swiglu_nvfp4_quant(a, b, sf_a, sf_b, mma_tiler_mn=(256,128), ...)\n# after\n# pick a tiler whose spans divide K and N, or pad K/N to alignment\nout = nvfp4_gemm_swiglu_nvfp4_quant(a_padded, b_padded, ... )","handlingStrategy":"validation","validationCode":"m, k, n = a.shape[0], a.shape[1]*2, b.shape[0]\n# check divisibility by your tiler spans, e.g. 256\nassert k % 256 == 0 and n % tiler_n == 0, (m, n, k)","typeGuard":"def shape_supported(m, n, k, tiler_mn, cluster_mn):\n    return n % (tiler_mn[0]*cluster_mn[0]) == 0 and k % (tiler_mn[1]*cluster_mn[1]) == 0","tryCatchPattern":"try:\n    out = nvfp4_gemm_swiglu_nvfp4_quant(...)\nexcept ValueError:\n    out = fallback_gemm_swiglu_quant(...)","preventionTips":["Use default tiler/cluster settings","Pad K/N to tile alignment when geometry allows"],"tags":["nvfp4","cutlass","tiling","shape-alignment","sm100"],"backgroundTag":"gpu-kernel-configuration-unsupported","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}