{"record":{"id":"3c548a562ba2cb30","repo":"sgl-project/sglang","slug":"block-sparsity-paged-kv-not-supported-on-sm100","errorCode":null,"errorMessage":"Block sparsity + paged KV not supported on SM100","messagePattern":"Block sparsity \\+ paged KV not supported on SM100","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/attention/flash_attn/cute/flash_fwd_sm100.py","lineNumber":1552,"sourceCode":"                softmax_scale, self.score_mod\n            )\n        window_size_left = (\n            Int32(window_size_left) if window_size_left is not None else None\n        )\n        window_size_right = (\n            Int32(window_size_right) if window_size_right is not None else None\n        )\n        fastdiv_mods = utils.compute_fastdiv_mods(\n            mQ, mK, self.qhead_per_kvhead, self.pack_gqa, aux_data.tensors, mPageTable\n        )\n\n        head_divmod = None\n        if cutlass.const_expr(self.pack_gqa):\n            head_divmod = FastDivmodDivisor(self.qhead_per_kvhead)\n\n        self.use_block_sparsity = cutlass.const_expr(blocksparse_tensors is not None)\n        if cutlass.const_expr(self.use_block_sparsity and mPageTable is not None):\n            raise NotImplementedError(\n                \"Block sparsity + paged KV not supported on SM100\"\n            )\n        if cutlass.const_expr(self.use_block_sparsity and self.is_varlen_q):\n            assert const_expr(\n                blocksparse_tensors.cu_total_m_blocks is not None\n            ), \"blocksparse_tensors.cu_total_m_blocks must be provided for varlen blocksparsity\"\n\n        # Launch the kernel synchronously\n        self.kernel(\n            mQ,\n            mK,\n            mV,\n            mO,\n            mLSE,\n            mCuSeqlensQ,\n            mCuSeqlensK,\n            mSeqUsedQ,\n            mSeqUsedK,","sourceCodeStart":1534,"sourceCodeEnd":1570,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/attention/flash_attn/cute/flash_fwd_sm100.py#L1534-L1570","documentation":"The SM100 (Blackwell) FA4 kernel cannot combine block-sparse attention with paged KV cache (a page table). These two KV-access schemes are mutually exclusive in the current implementation.","triggerScenarios":"Calling the SM100 kernel with both blocksparse_tensors and mPageTable (a KV cache page table) supplied, i.e. block-sparse attention on top of a paged KV cache.","commonSituations":"Serving with a paged KV cache (SGLang/vLLM-style) while enabling block-sparse attention (e.g. moe/blocksparse attention models) on B200/GB200.","solutions":["Disable block sparsity when using paged KV","Or run with a non-paged (dense/varlen) KV layout for this layer/model","Track the upstream FA4 repo for blocksparse+paged support"],"exampleFix":"// before\nattn(..., blocksparse_tensors=bs, page_table=pt)\n// after\nattn(..., page_table=pt)  # drop blocksparse_tensors","handlingStrategy":"type-guard","validationCode":"if blocksparse_tensors is not None and page_table is not None:\n    raise ValueError('blocksparse + paged KV unsupported on SM100')  # fail early","typeGuard":"def blocksparse_paged_supported(blocksparse_tensors, page_table, arch) -> bool:\n    return not (blocksparse_tensors is not None and page_table is not None and arch >= 100)","tryCatchPattern":"try:\n    attn(..., blocksparse_tensors=bs, page_table=pt)\nexcept NotImplementedError:\n    attn(...)  # fallback without blocksparse","preventionTips":["Gate block-sparse features by hardware and KV cache mode","Feature-detect supported combinations at startup rather than mid-request"],"tags":["flash-attention","block-sparse","paged-kv","sm100","unsupported-feature"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}