Skip to content

[Perf] Cache uniform ragged-verify layout for DSpark verify-all compact - #31434

Merged
hnyls2002 merged 4 commits into
mainfrom
lsyin/dspark-verifyall-layout-cache
Jul 16, 2026
Merged

hnyls2002 merged 4 commits into
mainfrom
lsyin/dspark-verifyall-layout-cache

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

Without an SPS table, DSpark compact mode degenerates to verify-all, but the planner still reruns the per-step budget/topk schedule and rebuilds a constant uniform layout every step, with host<->device round-trips that act as per-step stream syncs. Serve a cached uniform layout keyed by (bs, tier) instead.

Validation: bs=1 dense-draft deployment in verify-all compact, decode forward occupancy 0.72 -> 0.90 (kernel-union).


CI States

Latest PR Test (Base): ❌ Run #29483474432
Latest PR Test (Extra): ❌ Run #29483474300

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces performance optimizations in dspark_planner.py by caching uniform layouts under specific verification modes and utilizing pinned memory for asynchronous host-to-device transfers of verification lengths. The feedback suggests improving the caching logic to correctly handle cases where the layout is None to avoid repeated cache misses, and refining the device check to prevent unnecessary memory pinning when the target device is a CPU.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_basic_sanity_dspark.py test_ragged_verify.py test_dspark_scheduler.py test_dspark_sps_table.py

@github-actions

github-actions Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_basic_sanity_dspark.py test_ragged_verify.py test_dspark_scheduler.py test_dspark_sps_table.py:

🚀 1-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/core/test_basic_sanity_dspark.py

🚀 ubuntu-latest (3 tests): ✅ View workflow run

cd test/ && python3 registered/spec/dspark/test_ragged_verify.py
cd test/ && python3 registered/spec/dspark/test_dspark_scheduler.py
cd test/ && python3 registered/spec/dspark/test_dspark_sps_table.py

@hnyls2002
hnyls2002 merged commit 9a4d640 into main Jul 16, 2026
106 of 122 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/dspark-verifyall-layout-cache branch July 16, 2026 22:00

Copy link
Copy Markdown
Contributor

Cross-reference from #31023: verify-all layout caching vs. the residual compact Graph fault

This PR is directly relevant to one half of the current DSpark stability investigation because it formalizes the distinction between:

compact + no SPS table
  -> verify-all uniform ragged layout
  -> cached by (bs, tier)

compact + SPS table
  -> confidence-scheduled variable verify lengths

The original #31023 reproducer stressed the first path beyond the bs=1 blog trace:

compact/no-SPS
batch size 64
CUDA Graph ON
repeated and fresh-service replay

A later stronger reproducer used the second path:

compact+SPS
TP8, c256
60k/1k
2560 requests
sustained replay across multiple Graph tiers

On the tested earlier development snapshot, the residual failure was an asynchronous illegal-memory access in target verification. A strong Graph-OFF control survived. Completed diagnostics did not find an actionable error in the covered host-visible metadata, explicit covered index bounds, translated out_loc, SITE4 per-key resource ownership/captured-live dimensions, or result-copy handoff. No exact faulting kernel or production fix has been identified.

Important version boundary

Those positive results were collected from a v0.5.14-series base environment importing A1 source 22cfd54c, not from a clean v0.5.16 release. A clean v0.5.16 matrix is being prepared before claiming the current release is affected.

Questions specific to this cache

For the verify-all path, the source audit indicates each (bs, tier) entry owns its own cached layout/Graph-associated metadata rather than all tiers sharing one writable output buffer. It would be useful to confirm whether existing tests cover:

  • repeated switching among (bs, tier) cache entries under overlap;
  • fresh-service and long-running replay at bs=64 or above;
  • cache-entry lifetime when request/KV state changes while the layout remains uniform;
  • Graph ON/OFF and overlap ON/OFF controls.

Also, please confirm that this optimization is intentionally limited to _is_verify_all and is not expected to change the compact+SPS variable-length path. That distinction will be used when interpreting the clean v0.5.16 regression results.

Related: #31023, diagnostic Draft PR #31455, cross-TP planning fix #31195.

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.

2 participants