Skip to content

feat(runtime): add heterogeneous one-producer multi-consumer DFlash fanout#707

Open
heiheiha798 wants to merge 48 commits into
sgl-project:mainfrom
heiheiha798:feat/one-producer-multi-consumer-launcher
Open

feat(runtime): add heterogeneous one-producer multi-consumer DFlash fanout#707
heiheiha798 wants to merge 48 commits into
sgl-project:mainfrom
heiheiha798:feat/one-producer-multi-consumer-launcher

Conversation

@heiheiha798

@heiheiha798 heiheiha798 commented Jul 18, 2026

Copy link
Copy Markdown

Summary

  • Add bounded asynchronous 1P1C and 1P3C fanout so heterogeneous DFlash consumers advance independently while sharing producer captures.
  • Route fanout through canonical SpecForge surfaces: typed config -> windowed_fanout launch planning -> producer and independent consumers -> standard training assembly.
  • Keep capture ownership durable across per-consumer windows, retries, restart, acknowledgement, reclamation, and shutdown.
  • Add an authenticated SGLang 0.5.14 capture patch that writes requested tensors directly into the server-owned Mooncake namespace.

Runtime model

Each consumer owns an independent cursor and bounded sliding window. A target capture is reused while any consumer remains interested, reclaimed after all interests and read leases are released, and recaptured with a fresh physical generation if a lagging consumer later needs it again. Ordinary lost-response retries remain idempotent within the same generation.

The registry bounds live references and bytes, persists consumer progress and lifecycle state in SQLite, and recovers interrupted captures without granting stale read leases. Canonical JSON prompts without explicit IDs receive deterministic content-derived IDs; invalid or duplicate explicit IDs fail early.

Scope

After review, this branch was reduced from 64 changed files to 45 relative to main. It intentionally excludes the benchmark production supervisor, NVML and input-timing instrumentation, DFlash custom kernels, fused CE and optimizer changes, FlexAttention tuning, and obsolete patch migrations. The remaining changes are limited to the fanout runtime, canonical config and launch integration, SGLang capture transport, focused tests, and one heterogeneous example.

The large windowed-capture module is split into contracts, queueing, registry, and runtime responsibilities. The SGLang integration now uses one tested base-to-current patch instead of incremental migration patches.

Validation

  • Focused PR regression: 284 tests completed, with 3 skipped and 1 existing expected failure.
  • Offline non-network sweep: 936 tests completed, with 7 skipped and 1 existing expected failure.
  • Live SGLang + Mooncake server-capture CUDA gate: 2/2 passed.
  • SGLang capture and installer suite: 16/16 passed in an environment with SGLang installed.
  • Full pre-commit run --all-files: passed.
  • Real four-GPU heterogeneous run: one Qwen3-8B producer plus DFlash consumers using block/anchor settings 4/64, 8/128, and 16/256; 48 prompts and 24 optimizer steps per consumer.
  • All consumers completed at cursor 48 and wrote step-24 checkpoints. The registry recorded 66 captures, including 18 post-reclamation recaptures, peaked at 39 live refs / 4,641,911,088 bytes, and returned all 48 entries to absent at shutdown.
  • No traceback, OOM, segfault, lifecycle error, leaked GPU process, or occupied test port remained after the successful run.

The local four-GPU machine required NCCL_IB_DISABLE=1 and NCCL_NET=Socket to avoid its NCCL network-plugin crash. This machine-specific setting is not included in the branch.

The live run validates runtime completion, lifecycle correctness, and numerical finiteness; it is not a convergence claim.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@heiheiha798
heiheiha798 marked this pull request as ready for review July 18, 2026 01:31
Copilot AI review requested due to automatic review settings July 18, 2026 01:31
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@jiapingW

Copy link
Copy Markdown
Collaborator

Hi, it's a great work. But the updated content is huge, we will review it for some time.

@heiheiha798

Copy link
Copy Markdown
Author

Thank you for taking a look, and apologies for the unsolicited ping. There is no urgency at all. We really appreciate your time and feedback.

@heiheiha798

Copy link
Copy Markdown
Author

Scope update: I reduced this PR from 64 changed files to 42 to keep the review focused on producer-consumer fanout. The removed files covered the production benchmark supervisor, NVML/timing instrumentation, DFlash/FlexAttention kernel and optimizer work, and obsolete patch migrations. The remaining path now goes through the canonical typed config, launch planner, and training assembly.

The narrowed branch was revalidated with 242 focused runtime tests, the 16-test SGLang capture/installer suite, full pre-commit, and a real four-GPU heterogeneous 1P3C run in which all three consumers completed 48/48 samples and 24 optimizer steps. The PR description has been updated to match the current scope and evidence.

@heiheiha798

Copy link
Copy Markdown
Author

CI follow-up is now pushed at cd9ce32. This resolves the local PR Test failures in the recipe topology/count fixtures, the authenticated multi-server capture fixture, and the Mooncake transport architecture.

The Mooncake fix restores the single raw-tensor wire path (is_exist/remove/put_from/get_into) and rejects incompatible backends during construction, while preserving the PR lifecycle journal, generations, recapture, leases, and deferred cleanup.

Local validation on this head:

  • Full pre-commit suite: passed
  • SGLang v0.5.14 patch apply and verification: passed
  • Focused PR suite: 284 tests, OK (3 skipped, 1 expected failure)
  • Offline non-network sweep: 936 tests, OK (7 skipped, 1 expected failure)
  • Live SGLang + Mooncake CUDA gate: 2/2 passed on GPUs 0-3

Network/model-download modules were intentionally excluded locally. Three unchanged distributed baseline tests (embedding, lm_head, and no_sync) were also excluded because they hang in this local Torch 2.11/CUDA 13 environment; their source and dependency paths have no diff from upstream/main. The upstream workflow remains authoritative for those cases.

@heiheiha798

Copy link
Copy Markdown
Author

Hi @jiapingW, sorry to bother you again. The PR is now finalized at cd9ce325, and I have completed the local CI checks:

  • pre-commit passed on all files
  • the unit suite completed successfully: 958 tests, with 7 skips and 1 expected failure
  • the live SGLang + Mooncake server-capture gate passed: 2/2 tests
  • the SGLang v0.5.14 patch apply/verification passed

The two offline multi-GPU SGLang capture cases were intentionally omitted on this RTX host because usable GPU P2P is unavailable. All other tests, including the live network and data-regeneration paths, were exercised locally.

Could you please approve the GitHub Actions workflow when convenient? This is only a request for workflow approval; there is no urgency on the code review. Thank you.

@heiheiha798

heiheiha798 commented Jul 20, 2026

Copy link
Copy Markdown
Author

CI update: the latest unit-test failure is caused by stale GPU state on the self-hosted sglang-h20-ci runner, rather than a new memory regression in this PR.

At the point of failure, GPU 0 had 95.33 GiB total memory, while PID 66780 was already holding 92.58 GiB and only 26.25 MiB remained free. The SGLang process used by test_regenerate_sharegpt then failed while requesting just 32 MiB to load unsloth/Llama-3.2-1B-Instruct. The exact same PID and 92.58 GiB allocation appear in preceding jobs on the same runner, starting hours before this job, so the allocation clearly predates the current run. The separate live SGLang + Mooncake server-capture gate completed successfully.

After the SGLang child exited on OOM, the existing wait_for_server(..., timeout=None) path kept waiting, and the workflow eventually reported the 45-minute step timeout. The runner therefore needs its stale GPU processes cleaned up (or a restart) before rerunning; a plain rerun is likely to reproduce the same result 😇

This is also not isolated to PR #707. The identical runner/PID/allocation fingerprint caused failures in at least five distinct PRs:

An earlier #668 run that was later cancelled had already hit the same OOM at 07:43Z: https://github.com/sgl-project/SpecForge/actions/runs/29722060776. In total, there are five confirmed failed PR runs plus one cancelled run affected by the same stale process. Cleaning or restarting sglang-h20-ci is therefore a prerequisite for meaningful reruns of all affected workflows.

Local CI was already completed and reported for this exact head (cd9ce325) in #707 (comment), and the PR head has not changed since. I do not think repeating the same local run would add useful evidence. A clean hosted rerun is the meaningful next check. The two offline dense/MoE cases also emitted ERROR before the later timeout, so their final status should be evaluated from that clean rerun rather than from this contaminated one.

@heiheiha798

Copy link
Copy Markdown
Author

Local PR Test rerun is complete on current head ec07263.

  • SGLang spec-capture patch check: passed.
  • Live server-capture numerics gate: 2/2 passed in 45.158s.
  • Main unittest suite: 959/959 passed in 1333.430s, with 0 failures, 0 errors, 7 skips, and 1 expected failure.
  • The local main-suite runner excluded only the two offline multi-GPU SGLang capture cases previously called out for this RTX host:
    • test_offline_capture.test_sglang_backend.TestOfflineSGLangCapture.test_sglang_backend_with_dense
    • test_offline_capture.test_sglang_backend.TestOfflineSGLangCapture.test_sglang_backend_with_moe
      Both require a P2P/NCCL topology unavailable on this machine; all other discovered tests ran.
  • Local NCCL used the Socket backend with P2P and IB disabled to avoid this hosts NCCL network-plugin/P2P limitation.

The branch remains mergeable. GitHub Actions still needs workflow approval; these are the corresponding local validation results.

@heiheiha798

Copy link
Copy Markdown
Author

Hi @jiapingW, sorry to bother you again, and thank you for your previous help.

The conflicts with the latest main have now been resolved, and the current head ec07263 is mergeable. The new Lint and PR Test runs are both in action_required state and need maintainer approval before they can start.

I reran the workflow locally on this exact head: the main suite passed 959/959 with no failures or errors, and the live SGLang + Mooncake capture gate passed 2/2. The two previously documented offline multi-GPU capture cases remain excluded only because this RTX host has no usable GPU P2P.

For context, the previous CI failure was traced to a stale 92.58 GiB GPU allocation on the self-hosted sglang-h20-ci runner, with the same runner/PID fingerprint also affecting several unrelated PRs. If that OOM recurs after approval, the runner may need its stale GPU process cleaned up or restarted rather than another code change here.

When convenient, could you please approve the workflows? There is no urgency, and we appreciate your time and help. Thank you.

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