{"record":{"id":"cfdc2da4b8786643","repo":"xai-org/x-algorithm","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":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/cutedsl/ranker_fa4/flash_fwd_sm100.py","lineNumber":783,"sourceCode":"\n        self.shared_storage = SharedStorage\n\n        softmax_scale_log2, softmax_scale = utils.compute_softmax_scale_log2(\n            softmax_scale, self.score_mod\n        )\n        window_size_left = Int32(window_size_left) if window_size_left is not None else None\n        window_size_right = Int32(window_size_right) if window_size_right is not None else None\n        fastdiv_mods = utils.compute_fastdiv_mods(\n            mQ, mK, self.qhead_per_kvhead, self.pack_gqa, aux_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(\"Block sparsity + paged KV not supported on SM100\")\n        if cutlass.const_expr(self.use_block_sparsity and self.is_varlen_q):\n            assert const_expr(blocksparse_tensors.cu_total_m_blocks is not None), (\n                \"blocksparse_tensors.cu_total_m_blocks must be provided for varlen blocksparsity\"\n            )\n\n        self.kernel(\n            mQ,\n            mK,\n            mV,\n            mO,\n            mLSE,\n            mCuSeqlensQ,\n            mCuSeqlensK,\n            mSeqUsedQ,\n            mSeqUsedK,\n            mPageTable,\n            tma_atom_Q,\n            tma_atom_K,","sourceCodeStart":765,"sourceCodeEnd":801,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/cutedsl/ranker_fa4/flash_fwd_sm100.py#L765-L801","documentation":"The SM100 flash-attention forward kernel does not implement the combination of block sparsity (blocksparse_tensors provided) and paged KV (mPageTable provided). The check use_block_sparsity and mPageTable is not None aborts with NotImplementedError at launch time.","triggerScenarios":"Passing both a non-None blocksparse_tensors argument and a non-None mPageTable (page table for paged KV cache) to __call__.","commonSituations":"Serving stacks that use vLLM-style paged KV caches combined with block-sparse attention masks; upgrading a workflow that previously used only one of the two features on a different architecture.","solutions":["Disable block sparsity for this call (pass blocksparse_tensors=None)","Or disable paged KV (pass mPageTable=None and use dense KV tensors)","Materialize the paged KV into a contiguous/dense tensor first, then use block sparsity","Request/port an implementation combining both features for SM100 upstream"],"exampleFix":"// before\nout = flash_attn(q, k, v, mPageTable=page_table, blocksparse_tensors=bs)\n// after\nk_dense, v_dense = unpaged_from_table(k, v, page_table)\nout = flash_attn(q, k_dense, v_dense, blocksparse_tensors=bs)","handlingStrategy":"validation","validationCode":"if blocksparse_tensors is not None and page_table is not None:\n    raise ValueError('block sparsity + paged KV unsupported; densify KV or drop sparsity')","typeGuard":null,"tryCatchPattern":"try:\n    out = flash_attn(q, k, v, mPageTable=pt, blocksparse_tensors=bs)\nexcept NotImplementedError:\n    k, v = gather_paged(k, v, pt)\n    out = flash_attn(q, k, v, blocksparse_tensors=bs)","preventionTips":["Feature-gate block sparsity off when running with paged KV caches","Keep a code path that materializes paged KV into dense tensors for unsupported combos"],"tags":["flash-attention","block-sparsity","paged-kv","not-implemented","sm100"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}