{"record":{"id":"56c133e096c06549","repo":"sgl-project/sglang","slug":"the-requested-flashattention-forward-configuration","errorCode":null,"errorMessage":"The requested FlashAttention forward configuration exceeds SM120 kernel constraints or shared-memory capacity","messagePattern":"The requested FlashAttention forward configuration exceeds SM120 kernel constraints or shared-memory capacity","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/attention/fa4_sm120/runtime.py","lineNumber":961,"sourceCode":"        is_split_kv: bool,\n        has_bias: bool,\n        bias_block_size: int,\n        rel_extent_padded: int,\n        plan: Sm120ForwardPlan,\n    ) -> FlashAttentionForwardSm120:\n        if not FlashAttentionForwardSm120.can_implement(\n            dtype,\n            head_dim,\n            head_dim_v,\n            config.tile_m,\n            config.tile_n,\n            num_stages=config.num_stages,\n            num_threads=config.num_threads,\n            is_causal=is_causal,\n            Q_in_regs=False,\n            paged_kv=paged_kv,\n        ):\n            raise ValueError(\n                \"The requested FlashAttention forward configuration exceeds \"\n                \"SM120 kernel constraints or shared-memory capacity\"\n            )\n        if has_bias:\n            bias_smem_bytes = (\n                bias_block_size * config.tile_n * (dtype.width // 8) * config.num_stages\n            )\n            total_smem_bytes = (\n                FlashAttentionForwardSm120._smem_usage_in_bytes(\n                    head_dim,\n                    head_dim_v,\n                    config.tile_m,\n                    config.tile_n,\n                    config.num_stages,\n                    False,\n                )\n                + bias_smem_bytes\n            )","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/attention/fa4_sm120/runtime.py#L943-L979","documentation":"make_kernel validates the requested FlashAttention SM120 configuration (tile sizes, num_stages, num_threads, causal, paged KV) against kernel constraints and shared-memory capacity via a predicate call. If the combination is infeasible it raises this generic ValueError.","triggerScenarios":"Building the kernel with an explicit config whose tile/stage/thread combination fails the internal feasibility check — e.g. large tiles with many stages, or a config copied from a different GPU/architecture.","commonSituations":"Loading persisted autotune configs tuned on a different SM120 SKU with more shared memory; manual tile overrides; num_stages too high for the chosen tile.","solutions":["Pass config=None (or the equivalent) to let the runtime auto-select a feasible config","Re-run autotuning on the target GPU so cached configs match its constraints","Reduce num_stages or tile size in the requested config"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"try:\n    Kernel = make_kernel(config=cfg, ...)\nexcept ValueError:\n    Kernel = make_kernel(config=None, ...)  # auto-select","typeGuard":null,"tryCatchPattern":"try:\n    Kernel = make_kernel(config=cfg, ...)\nexcept ValueError as e:\n    logger.warning(\"config infeasible on this GPU, falling back to autotune: %s\", e)\n    Kernel = make_kernel(config=None, ...)","preventionTips":["Re-autotune on each GPU SKU; never share config caches across architectures","Prefer config=None unless you have measured a specific config on this device"],"tags":["flash-attention","sm120","shared-memory","config-validation"],"backgroundTag":"kernel-resource-limit-exceeded","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}