Repository navigation
[SGLang] Batch ReplaySSM radix materialization across compatible layers - #3942
ZLkanyo009 wants to merge 5 commits into
Conversation
Keep the shared replay arithmetic and single-layer API while grouping compatible eager layers through an explicit batch entry. Preserve live pool readiness, pointer generation lifetime, capture fallback and main flush bookkeeping. CPU host and routing contracts pass, including 16 Native GDN/KDA geometry comparisons. Current-head GPU, CI and model performance remain pending; historical f3d0 microbenchmarks do not validate this head.
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
Path scope:
|
Add reproducible Native recurrence, batched numerical, live replacement, graph fallback and queued-pointer retirement coverage, plus actual current-main prepare/forward/materialize/commit/conv cases at three flush boundaries. Prepared and linted only; real GPU execution remains pending with the sole owner. Product source is unchanged from 8f4ed60.
Invalidate the precompile result before the lifetime-sensitive submission, so a missing queued write cannot pass using the previous output. No product changes; GPU execution remains pending.
Prebuild and synchronize the same consumer-stream pointer table, then queue fixed matrix work and the cached materialize call. Record and require pending execution before dropping raw-pointer backings; preserve the destination sentinel. No product change or retry.
|
Current-head GPU validation is complete at The Native single-layer comparison used exact base
Both use HV24/V128/T4/CAP16. These are descriptive medians with mixed per-round directions; they do not establish absence of a regression. Event spans include CPU submission bubbles. A CPU weight download was active on NUMA1; no other task-owned GPU experiment ran during this measurement. Independent review verified the 3,956-file source inventory, dependency/runtime identity before and after, all 11 exported files, JUnit lifetime property and full resource release at 10:56:00 UTC. This validates the current test/fixture paths; production HiCache integration, current-head batch performance and same-host model TPOT/MTP/final-task accuracy remain open. The PR stays Draft. |
SGLang's ReplaySSM radix commit currently launches materialization once per GDN layer. This Draft combines compatible eager layers into one grid while retaining the shared replay arithmetic and the order of materialization, cursor commit, and convolution-state scatter.
The plugin owns the live pool lookups, HiCache readiness waits, and an immutable pointer-table generation. It refreshes the table when addresses, layouts, layer order, or consumer stream change, and retains and records the backing tensors on that stream. Graph capture and heterogeneous layouts continue through the existing per-layer path; this PR does not optimize batched graph replay.
The shared operator exposes an explicit
replayssm_materialize_batchentry point. The existing single-layer API keeps its signature, grid and arithmetic. Its host launch configuration is refactored into a common helper, so Native host dispatch is affected; the bounded current-head comparison is reported below. The kernel's required table argument isNonefor the existing entry point. No model-specific name, architecture gate, environment switch, copied replay formula, or optional private host argument is added.This change starts from public
mainatc88fef394fbf8c5eb490473079dd3f8b21854b09and retains #3618's fourthflush_arrivalsbuffer,flush_wait, and six-valueprepare_layerresult. The table contains only the checkpoint and three record buffers. It does not include the separate forward-padding changes in #3718.Validation available for this Draft:
_commit_acceptedfunction match the base AST. Black, Ruff and whitespace checks pass.The committed GPU entry is
tests/test_replayssm_materialize_batch_gpu.py(python -m pytest -q tests/test_replayssm_materialize_batch_gpu.py). Atd7d20c6c1ca9e2c83fbfcb597654e232fd8ba80d, all 12 cases passed on one gfx942 MI308X, without skip/failure/error. Coverage includes single-layer Native, batch/fallback/capture, live replacement, pointer retirement with an actually pending consumer, and the four-buffer forward/commit path. This uses real kernels and SGL scatter with fixtures, not a full model or production HiCache.The exact-base/current-head Native helper comparison used four alternating AB/BA rounds × 20 calls per arm for each layout (HV24/V128/T4/CAP16); whole checkpoints stayed byte-identical after timing:
These descriptive medians have mixed per-round directions and do not establish absence of regression. Event spans include CPU submission bubbles. A public-weight CPU download was active on NUMA1; no other task-owned GPU experiment overlapped. Source/dependency/runtime identity, JUnit lifetime proof, all exports and release were independently checked. Detailed validation.
This remains Draft pending production HiCache integration, current-head batch-performance measurement and matched two-rank model A/B results including actual route use, TPOT, MTP acceptance and final-task accuracy. Current-head CI/accuracy results remain separate. The f3d0 evidence does not replace those checks.