{"record":{"id":"c7ac9b73301eace7","repo":"sgl-project/sglang","slug":"unknown-absorbed-bmm-k-variant-variant-r","errorCode":null,"errorMessage":"unknown absorbed-bmm K variant: {variant!r}","messagePattern":"unknown absorbed-bmm K variant: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/kvcache/cache_ops.py","lineNumber":709,"sourceCode":"                k1 & (k1 - 1) == 0 and k1 >= 16\n            ), \"two_dot needs K = pow2 + pow2 with both halves >= 16\"\n            k_mode = 2\n        elif v == \"three_dot\":\n            blk_k = k_dim // 3\n            assert (\n                k_dim % 3 == 0 and blk_k & (blk_k - 1) == 0 and blk_k >= 16\n            ), \"three_dot needs K = 3 * pow2 with pow2 >= 16\"\n            k_mode = 3\n        elif v == \"pad\":\n            blk_k = 1 << k_dim.bit_length()  # next power of 2 above K\n            k_mode = 4\n        elif v == \"single_k\":\n            # Non-power-of-2 BLOCK_K == K: compiles only on Triton builds\n            # that allow non-power-of-2 tl.arange (not 3.5.x).\n            blk_k = k_dim\n            k_mode = 0\n        else:\n            raise ValueError(f\"unknown absorbed-bmm K variant: {variant!r}\")\n    extra = {\"num_stages\": num_stages} if num_stages else {}\n    grid = (triton.cdiv(num_tokens, block_m), num_heads)\n    absorbed_bmm_concat_cast_q_fp8_kernel[grid](\n        q_fp8_pad,\n        q_nope,\n        w_kc,\n        q_rope,\n        num_tokens,\n        q_fp8_pad.stride(0),\n        q_fp8_pad.stride(1),\n        q_nope.stride(0),\n        q_nope.stride(1),\n        w_kc.stride(0),\n        w_kc.stride(1),\n        w_kc.stride(2),\n        q_rope.stride(0),\n        q_rope.stride(1),\n        K=k_dim,","sourceCodeStart":691,"sourceCodeEnd":727,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/kvcache/cache_ops.py#L691-L727","documentation":"Inside the same function, once the Triton kernel path is taken, the K-block splitting strategy string must be one of the recognized modes ('two_dot','three_dot','pad','single_k', etc.). Reaching the else branch means a variant passed the top-level validation but the K-variant parser does not know it — typically an internal inconsistency after editing the variant lists.","triggerScenarios":"The variant passed the _valid tuple check but the if/elif chain over K variants (power-of-2 blocks, single_k, etc.) fell through to else, e.g. after someone added a new variant to _valid without implementing its K handling.","commonSituations":"Patching cache_ops.py to add a variant name without adding its branch; version skew where _valid and the parser were updated independently.","solutions":["Use one of the already-implemented variants ('auto' avoids manual selection)","If you added a variant to _valid, also implement its blk_k/k_mode branch above the else","Revert local edits to cache_ops.py or update to a consistent sglang version"],"exampleFix":"# before\n_valid = (..., \"my_variant\")  # added but unimplemented\n# after\n# remove \"my_variant\" from _valid, or add:\n# elif v == \"my_variant\": blk_k, k_mode = ..., ...","handlingStrategy":"validation","validationCode":"assert variant in ('auto','cuda','loop','two_dot','three_dot','pad','single_k')\nabsorbed_bmm_concat_cast_q_fp8(...)","typeGuard":"def qprep_variant_valid(v: str) -> bool:\n    return v in ('auto','cuda','loop','two_dot','three_dot','pad','single_k')","tryCatchPattern":null,"preventionTips":["Use 'auto' to avoid manual variant selection","Keep _valid and the K-variant parser in sync when patching this file"],"tags":["q8kv8","triton","variant-selection","internal-invariant"],"backgroundTag":"unhandled-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}