Skip to content

fix(engine): backport SM90 GDN decode padding protection - #1806

Open
yulangz wants to merge 1 commit into
areal-project:mainfrom
yulangz:fix/sglang-sm90-gdn-decode-padding
Open

yulangz wants to merge 1 commit into
areal-project:mainfrom
yulangz:fix/sglang-sm90-gdn-decode-padding

Conversation

@yulangz

@yulangz yulangz commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Description

Backport sgl-project/sglang#44014
as an explicit AReaL source patch for SM90 FlashInfer GDN decode.

With padded decode CUDA Graphs, cache_indices contains -1. The SM90
Python gather/scatter path treats it as the last real state-pool slot.
Padded lanes can therefore overwrite live or cached recurrent state,
causing intermittent corrupted output in subsequent generation.

The backport passes the full pool and int32 indices to FlashInfer's indexed
decode API. It preserves the SM100+ branch, prefill and MTP code. It uses
AReaL's existing atomic, locked source-patch installer, validates input/output
hashes, refuses unknown sources, and is idempotent.

Apply before starting servers, in the SGLang interpreter:

python -m areal.engine.sglang_gdn_decode_padding

A disposable source copy can be checked without local GPU dependencies:

python -m areal.engine.sglang_gdn_decode_padding --target /path/to/gdn_flashinfer.py

Runtime boundary: installed application requires a separately provisioned
FlashInfer >= 0.6.18 runtime. AReaL currently pins SGLang 0.5.10.post1 with
FlashInfer 0.6.7.post3; that older FlashInfer is rejected before any write.
This PR does not change dependency pins or auto-enable the patch. Source
hashes cover SGLang 0.5.10.post1, 0.5.20 and the original upstream PR base
module, with the same SM90 fix adapted to their different call sites.

Related Issue

Upstream fix: sgl-project/sglang#44014 (still open).

Type of Change

  • Bug fix

Validation

  • 13 CPU tests passed, including the negative-index call contract, idempotent
    writes, permission preservation, unknown-source refusal and runtime guards.
  • SM90 GPU regressions passed for all three source profiles with FlashInfer
    0.6.18: 2 test methods per profile, covering BF16/FP32 states, int32/int64
    indices, eager decode and CUDA Graph replay with changing index patterns.
    Checks include untouched live slots, especially the last allocatable slot,
    and valid-row state/output agreement with an unpadded reference.
  • Changed-file pre-commit hooks and normal commit hooks passed.
  • pre-commit run --all-files was attempted. Its project-wide manifest/CLI
    hooks could not pass in the minimal Python 3.10 check environment:
    tomllib and httpx were unavailable, and uv was not on the hook PATH.
    Formatting, linting, license and other source checks passed. The GPU tests
    used a separate Python 3.12 runtime. Full training/distributed integration
    was not run for this standalone source backport.

Checklist

  • I have read the contributing guide.
  • Relevant tests pass; regression tests added.
  • Usage and runtime requirements documented in the patch module.
  • Branch is based on the checked upstream main commit.
  • Full repository pre-commit checks pass in a complete development environment.

Prepared with coding-agent assistance; public code and synthetic regression
inputs only.

Preserve negative padding indices through FlashInfer indexed decode so
padded CUDA Graph lanes cannot overwrite the last live GDN state slot.
Provide explicit, hash-guarded application for validated SGLang sources
and require a separately provisioned FlashInfer >= 0.6.18 runtime.

Refs: sgl-project/sglang#44014
Signed-off-by: yulangz <53958801+yulangz@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 07:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants