Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
4cc4a56
[fix] add ep ipc fix, deepep works without nvl_bytes=0
xenshinu Jun 15, 2026
14dda18
[sglang] add DeepEP no-fabric IPC policy
devin-ai-integration[bot] Jul 22, 2026
1158dff
[sglang] add no-fabric DeepEP IPC recipe
devin-ai-integration[bot] Jul 22, 2026
bdaad16
[sglang] fail clearly on old DeepEP API
devin-ai-integration[bot] Jul 22, 2026
6501d7f
[sglang] move inspect import to module top
devin-ai-integration[bot] Jul 22, 2026
ae9d308
[sglang] enforce DeepEP use_fabric requirement at Buffer construction
devin-ai-integration[bot] Jul 22, 2026
a02b083
[sglang] add experimental dense tensor-parallel recipe
devin-ai-integration[bot] Jul 23, 2026
71bb812
[fix] fix workspace mismatch when using fa2
xenshinu Jul 8, 2026
3f1c769
test: add reproducible SGLang TP validation
cursoragent Jul 23, 2026
0244e81
fix: keep TP NCCL transport symmetric
cursoragent Jul 23, 2026
8bcb00e
fix: pin TP validation to immutable revisions
cursoragent Jul 23, 2026
4c0247e
fix: align TP graph mode across phases
cursoragent Jul 23, 2026
21bf734
docs: mark SGLang tensor parallel validated
cursoragent Jul 23, 2026
7b57b02
test: strengthen tensor parallel verification
cursoragent Jul 23, 2026
c46e6bb
fix: harden graph and IPC restoration
cursoragent Jul 23, 2026
3caf4b1
fix: version preallocated IPC chunks
cursoragent Jul 23, 2026
ad33975
test: require complete TP replay evidence
cursoragent Jul 23, 2026
92b03d8
fix: pass default graph pool explicitly
cursoragent Jul 23, 2026
7d351f3
test: compare semantic TP graph archives
cursoragent Jul 23, 2026
741682a
docs: make TP validation invocation portable
cursoragent Jul 23, 2026
d57a0d1
test: unpack loaded graph results
cursoragent Jul 23, 2026
6987d09
fix: pin TP validation seed
cursoragent Jul 23, 2026
2b53dc8
docs: explain deterministic TP validation
cursoragent Jul 23, 2026
45700f5
test: compare deterministic TP graph structure
cursoragent Jul 23, 2026
2985288
docs: align TP scope with upstream roadmap
cursoragent Jul 23, 2026
d3ea09f
feat: port SGLang integration to main runner API
cursoragent Jul 23, 2026
57248a4
test: add SGLang main SAVE LOAD smoke
cursoragent Jul 23, 2026
8174244
fix: fail closed on unsupported SGLang main modes
cursoragent Jul 23, 2026
dd2a2f8
fix: propagate immutable refs into Modal smoke
cursoragent Jul 23, 2026
3714935
test: run TP validation on SGLang main
cursoragent Jul 23, 2026
2e4b9f4
fix: disable multimem gather under Foundry
cursoragent Jul 23, 2026
6c55f85
fix: mirror SGLang main graph warmups on load
cursoragent Jul 23, 2026
ed4121a
test: parameterize TP validation models
cursoragent Jul 23, 2026
4b0f38e
test: exercise SGLang torch symmetric memory TP
cursoragent Jul 23, 2026
9ed2240
fix: isolate torch symmetric memory from Foundry VMM
cursoragent Jul 23, 2026
bb93faa
test: verify outputs in every TP phase
cursoragent Jul 23, 2026
ef53024
fix: load SGLang main graphs without shared executors
cursoragent Jul 23, 2026
4e68389
test: require deterministic TP all-reduce path
cursoragent Jul 23, 2026
6ceada4
fix: disable auto-fused TP all-reduce
cursoragent Jul 23, 2026
4ae6dac
test: ignore expected optional codec tracebacks
cursoragent Jul 23, 2026
004fad6
fix: ignore optional TorchCodec import traces
cursoragent Jul 23, 2026
cd39f68
Revert "fix: load SGLang main graphs without shared executors"
cursoragent Jul 23, 2026
644fddb
fix: register graph pool during parallel load
cursoragent Jul 23, 2026
47f7427
Revert "fix: register graph pool during parallel load"
cursoragent Jul 23, 2026
c6da45c
test: preserve dependencies for independent graph loads
cursoragent Jul 23, 2026
a98cdb4
fix: load SGLang graphs independently
cursoragent Jul 23, 2026
9e983b2
test: exclude manifest from graph member checks
cursoragent Jul 23, 2026
ee6dd92
fix: share SGLang graph pool during restore
cursoragent Jul 23, 2026
9e9557a
fix: replay SGLang per-shape warmup state
cursoragent Jul 23, 2026
1187915
Revert "fix: replay SGLang per-shape warmup state"
cursoragent Jul 23, 2026
e016ba5
fix: persist symmetric TP collectives on SGLang main
cursoragent Jul 23, 2026
346b497
fix: reuse stable symmetric buffer for TP gather
cursoragent Jul 23, 2026
cf9f87a
fix: match symmetric communicators across process groups
cursoragent Jul 23, 2026
9dde47e
fix: rendezvous TP gather on device group
cursoragent Jul 23, 2026
26da771
fix: capture TP gather with stable symmetric group
cursoragent Jul 23, 2026
0bbf311
fix: restore TP graphs through shared pool loader
cursoragent Jul 23, 2026
6d2cd27
fix: use one explicit graph shape for SGLang TP
cursoragent Jul 23, 2026
7539b55
test: pin validation to current SGLang main
cursoragent Jul 23, 2026
42066d6
fix: restore hybrid Mamba pool sizing
cursoragent Jul 23, 2026
1c0a2e3
test: compare concurrent TP outputs across restore
cursoragent Jul 23, 2026
ea9d324
test: verify TP collectives in every rank archive
cursoragent Jul 23, 2026
d613f8a
fix: harden SGLang TP restore and documentation
cursoragent Jul 23, 2026
42495e2
test: assert plugin-based TP recipe activation
cursoragent Jul 23, 2026
7ef12a1
test: use deterministic batched TP requests
cursoragent Jul 23, 2026
ffc3342
test: verify DeepEP and RNG replay data
cursoragent Jul 23, 2026
73b6253
style: apply branch lint formatting
cursoragent Jul 23, 2026
ea45476
test: validate DeepEP dispatch payloads semantically
cursoragent Jul 23, 2026
8234c8e
test: compare DeepEP payloads on CPU
cursoragent Jul 23, 2026
7bdca2b
test: compare first batched TP decode token
cursoragent Jul 23, 2026
d120336
docs: describe fixed-batch TP verification
cursoragent Jul 23, 2026
5b9506d
style: format DeepEP semantic checks
cursoragent Jul 23, 2026
be99408
test: strengthen TP4 and DeepEP correctness oracles
cursoragent Jul 23, 2026
d124c61
test: compare stable eight-token TP batch prefix
cursoragent Jul 23, 2026
7248d38
test: decouple SGLang log scanning from Modal
cursoragent Jul 23, 2026
de5065b
test: load TP log scanner without package import
cursoragent Jul 23, 2026
0e3ea57
style: format log scanning helpers
cursoragent Jul 23, 2026
b743b7d
docs: design SGLang graph mode persistence
cursoragent Jul 23, 2026
6231a17
docs: plan SGLang graph mode support
cursoragent Jul 23, 2026
80ff33e
test: define SGLang graph output codec
cursoragent Jul 23, 2026
a4cfe69
feat: serialize SGLang graph output trees
cursoragent Jul 23, 2026
a8d7b1c
test: cover output codec error paths with importlib load
cursoragent Jul 23, 2026
1888482
test: define SGLang graph session catalog
cursoragent Jul 23, 2026
83c29e7
feat: catalog SGLang graph sessions
cursoragent Jul 23, 2026
9213779
test: cover catalog RuntimeError guard paths
cursoragent Jul 23, 2026
3de0a02
test: define generalized SGLang backend contracts
cursoragent Jul 23, 2026
0a9c0f1
feat: persist multiple SGLang graph sessions
cursoragent Jul 23, 2026
379c176
test: cover generalized SGLang backend behavior
cursoragent Jul 23, 2026
7af1a8f
fix: refresh SGLang graph catalogs before operations
cursoragent Jul 23, 2026
8e4f2c6
test: define SGLang full graph routing contracts
cursoragent Jul 24, 2026
cb744ea
feat: route SGLang full prefill graphs through Foundry
cursoragent Jul 24, 2026
a3f5ea8
test: cover speculative SGLang resolver imports
cursoragent Jul 24, 2026
f4fbcfa
fix: patch speculative SGLang backend resolvers
cursoragent Jul 24, 2026
f2410ac
style: organize SGLang resolver imports
cursoragent Jul 24, 2026
8639650
test: define SGLang-main DeepEP bootstrap contracts
cursoragent Jul 24, 2026
558e917
test: define SGLang-main DeepEP lifecycle ordering
cursoragent Jul 24, 2026
69a87d9
feat: bootstrap DeepEP for SGLang graph restore
cursoragent Jul 24, 2026
9d52c4f
test: add SGLang graph-mode recipe argument contracts
cursoragent Jul 24, 2026
5d1add7
feat: configure SGLang persistent graph modes
cursoragent Jul 24, 2026
afaaccd
test: require nargs+ prefill buckets and sanitize graph-mode env
cursoragent Jul 24, 2026
4ada32b
fix: emit prefill buckets as one nargs+ CLI invocation
cursoragent Jul 24, 2026
e949549
test: validate SGLang full prefill restore
cursoragent Jul 24, 2026
bdb82c2
fix: rebuild SGLang manifest across graph sessions
cursoragent Jul 24, 2026
f972d92
fix: preallocate SGLang load region once
cursoragent Jul 24, 2026
df528dd
test: stabilize SGLang smoke run evidence
cursoragent Jul 24, 2026
9a15598
test: run smoke cleanup in Foundry image
cursoragent Jul 24, 2026
698e84c
test: validate Qwen3.5 NEXTN graph restore
cursoragent Jul 24, 2026
7ecc190
fix: preserve process-local SGLang graph state
cursoragent Jul 24, 2026
e3de6b1
fix: order speculative prefill after verify capture
cursoragent Jul 24, 2026
3a8669a
fix: stabilize hybrid prefill graph metadata
cursoragent Jul 24, 2026
f63e017
fix: preserve SGLang full graph warmups
cursoragent Jul 24, 2026
1ac6e35
fix: mask padded Mamba prefill slots
cursoragent Jul 24, 2026
463c101
fix: isolate Mamba prefill metadata by shape
cursoragent Jul 24, 2026
d65fb10
test: isolate TP phase compiler caches
cursoragent Jul 24, 2026
30bd936
test: validate Qwen3.5 NEXTN graph restore
cursoragent Jul 24, 2026
8fe1452
test: package TP cleanup with Foundry image
cursoragent Jul 24, 2026
dbe14f2
docs: report Qwen3.5 NEXTN acceptance
cursoragent Jul 24, 2026
b9b233d
test: validate SGLang DeepEP graph restore
cursoragent Jul 24, 2026
e9e0867
fix: package standalone DeepEP harness
cursoragent Jul 24, 2026
4b9f9d9
fix: preserve Modal GPU access after DeepEP install
cursoragent Jul 24, 2026
dd34f67
test: retain failed SGLang phase artifacts
cursoragent Jul 24, 2026
2daf770
docs: report SGLang DeepEP acceptance blockers
cursoragent Jul 24, 2026
2fee82b
fix: support pinned DeepEP IPC transport
cursoragent Jul 24, 2026
171e659
test: initialize DeepEP NCCL before capture region
cursoragent Jul 24, 2026
5a652d5
test: support pinned DeepEP top-k dtype
cursoragent Jul 24, 2026
6615563
test: preload pinned DeepEP NVSHMEM host
cursoragent Jul 24, 2026
da47eed
fix: report DeepEP transport after buffer bootstrap
cursoragent Jul 24, 2026
405b84f
test: make DeepEP acceptance transport-aware
cursoragent Jul 24, 2026
cff07e6
test: forward supported NVSHMEM IBGDA control
cursoragent Jul 24, 2026
d2ae10c
fix: honor local-only transport in pinned DeepEP
cursoragent Jul 24, 2026
0e99263
fix: preserve pinned DeepEP source indentation
cursoragent Jul 24, 2026
ceea294
revert: preserve required DeepEP IBGDA state
cursoragent Jul 24, 2026
91fc7ea
test: classify local NVSHMEM transport probes
cursoragent Jul 24, 2026
6d70eb3
test: handle interleaved IBGDA probe logs
cursoragent Jul 24, 2026
2adeed2
test: separate DeepEP configuration evidence
cursoragent Jul 24, 2026
696db8a
docs: report Task 9 DeepEP acceptance
cursoragent Jul 24, 2026
c60dce1
chore: address Task 9 review cleanup
cursoragent Jul 24, 2026
d4589f3
test: compose SGLang graph mode acceptance
cursoragent Jul 24, 2026
6f99278
test: keep full-prefill baseline eager
cursoragent Jul 24, 2026
7469fda
fix: pad hybrid prefill replay metadata
cursoragent Jul 24, 2026
25a9c0b
test: bound combined SGLang request capacity
cursoragent Jul 24, 2026
fc3ba83
fix: defer full prefill capture until decode
cursoragent Jul 24, 2026
dc33b69
test: cap combined SGLang token capacity
cursoragent Jul 24, 2026
0ab3c99
style: format SGLang integration files
cursoragent Jul 24, 2026
ec3d5f6
style: format SGLang smoke harness
cursoragent Jul 24, 2026
cd4218a
test: retain semantic graph diagnostics
cursoragent Jul 24, 2026
67879b1
debug: trace Mamba prefill metadata buffers
cursoragent Jul 24, 2026
6c76140
fix: stabilize Mamba prefill metadata addresses
cursoragent Jul 24, 2026
cf66dbc
debug: trace hybrid prefill metadata pointers
cursoragent Jul 24, 2026
0f57fed
fix: register graph pool during parallel load
cursoragent Jul 24, 2026
fbb0785
Revert "fix: register graph pool during parallel load"
cursoragent Jul 24, 2026
b90fdf0
fix: load full prefill graphs independently
cursoragent Jul 24, 2026
97123be
fix: preallocate shape-specific Mamba metadata
cursoragent Jul 24, 2026
2b92f6c
Revert "fix: load full prefill graphs independently"
cursoragent Jul 24, 2026
c1d5116
fix: prime shape-specific FLA metadata caches
cursoragent Jul 24, 2026
2b6c27a
fix: preserve Eagle prefill allocation order
cursoragent Jul 24, 2026
0397327
fix: format Mamba metadata diagnostics
cursoragent Jul 24, 2026
e852e70
test: retain remote graph diagnostics
cursoragent Jul 24, 2026
c622791
docs: record SGLang graph mode validation
cursoragent Jul 24, 2026
eb1ec00
fix: prime GDN metadata per prefill shape
cursoragent Jul 24, 2026
6844196
docs: refresh SGLang graph validation evidence
cursoragent Jul 24, 2026
193b85b
fix: harden SGLang full prefill replay
cursoragent Jul 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,7 @@ marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml
.streamlit/secrets.toml
tests/deepep_matrix_work/
deepep_fabric_archive/
hook_archive/
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,30 @@ Foundry ships engine integrations under `foundry/python/foundry/integration/`. P
| Engine | Single GPU | DP | TP | EP |
|---|:---:|:---:|:---:|:---:|
| vLLM | ✅ | ✅ | 🚧 | ✅ |
| SGLang | ✅ | ✅ | 🚧 | ✅ |
| SGLang | ✅ | ✅ | | ✅ |
| TensorRT-LLM | 🚧 | 🚧 | 🚧 | 🚧 |

✅ validated end-to-end (SAVE → LOAD → query)  ·  🚧 not yet

SGLang-main validation is pinned to
`9b853e6832e71a3058212df02a025232a453e146`; the current evidence uses immutable
Foundry `eb1ec00b7004339c5150ce6c3ba057ceda047833`. Plain TP uses one explicit
padded symmetric-memory decode shape; the Full prefill backend may additionally
persist multiple token buckets. Qwen3.5-122B-A10B-GPTQ-Int4 TP=4 restored
decode-8 and prefill-16/64 graphs on every H100 rank in Modal run
`eb1ec00b7004339c5150ce6c-1784907539317556437`. Combined online-FP8 TP=2/EP=2,
NEXTN, DeepEP low-latency, and Full prefill-16/64 was validated with
Qwen3.5-35B-A3B in run
`eb1ec00b7004339c5150ce6c-1784906247386993159`.

NEXTN is the GPU-validated speculative algorithm. DeepEP on the pinned Hopper
stack requires FA3 and the documented NVSHMEM transport settings; a separate
legacy NVL CUDA-IPC path is available for no-fabric hosts. Multi-shape decode,
other speculative algorithms, other fabrics, breakable/`tc` prefill
persistence, PP, LoRA, PDMux, diffusion, and recapture remain outside the
validated scope. Broader TP collective support is tracked in
[issue #6](https://github.com/foundry-org/foundry/issues/6).

The adapted vLLM / SGLang / TensorRT-LLM forks will be released alongside this repo at `foundry-org/vllm`, `foundry-org/sglang`, `foundry-org/TensorRT-LLM`.

### Performance
Expand Down
71 changes: 53 additions & 18 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
# Foundry 0.0.2
# Release Notes

## Unreleased

- **SGLang-main tensor parallel and Full prefill.** One explicit padded
torch-symmetric-memory decode shape is validated end-to-end with Qwen3-8B
TP=2 and Qwen3.5-122B-A10B-GPTQ-Int4 TP=4 on H100. The TP4 regression also
persisted Full prefill buckets 16/64: fresh LOAD restored three graphs per
rank at offset `59301167104`, with exact outputs, collectives, catalogs, and
SAVE/SAVE2 fingerprints in run
`eb1ec00b7004339c5150ce6c-1784907539317556437`. Multi-shape decode and
alternate-collective support remain tracked in
[upstream issue #6](https://github.com/foundry-org/foundry/issues/6).
- **SGLang graph-mode composition.** With SGLang
`9b853e6832e71a3058212df02a025232a453e146`, Qwen3.5-35B-A3B online FP8
combined TP=2/EP=2, NEXTN (3 steps, top-k 1, 4 draft tokens), DeepEP
low-latency, and Full prefill 16/64 in one fresh LOAD. Run
`eb1ec00b7004339c5150ce6c-1784906247386993159` at immutable Foundry
`eb1ec00b7004339c5150ce6c3ba057ceda047833` restored four graphs and three
sessions per rank, reproduced rank-local offsets and archives, and retained
exact token, speculative-acceptance, DeepEP-node, bootstrap, NVSHMEM-module,
and no-recapture evidence. NEXTN is the only GPU-validated speculative
algorithm; Full is the only validated prefill-persistence backend.
- **No-fabric DeepEP IPC.** The VMM-IPC bridge transports shareable file
descriptors with `SCM_RIGHTS`, allowing vLLM and SGLang DeepEP NVL buffers to
work without fabric/IMEX. This extends
[upstream PR #3](https://github.com/foundry-org/foundry/pull/3). The verified
regression is BF16 on 2×H100; GB300/aarch64 FP8 and RDC relinking reported in
[upstream issue #1](https://github.com/foundry-org/foundry/issues/1) remain
outside that validation scope.
- **A100/FA2 load parity.** CUDA generator registration is skipped on LOAD when
every graph has zero RNG increment, preventing unused seed/offset tensors
from drifting the tracked workspace cursor. This incorporates
[upstream PR #4](https://github.com/foundry-org/foundry/pull/4) and the root
cause from [issue #2](https://github.com/foundry-org/foundry/issues/2).

---

## Foundry 0.0.2

SGLang graduates to a fully validated engine. This release brings the SGLang
integration to parity with vLLM across single GPU, data parallel, and expert
parallel — with a self-contained recipe and no vLLM build dependency for EP.

## Highlights
### Highlights

- **SGLang single GPU / DP / EP all validated end-to-end.**
SAVE → LOAD → query verified on single-GPU Qwen3-1.7B / 4B / 14B,
Expand All @@ -23,12 +61,13 @@ parallel — with a self-contained recipe and no vLLM build dependency for EP.
`data_parallel_controller.py`). All save/load logic lives in the integration
layer; the edits are inert unless `--foundry-graph-extension-config-path` is set.

## Engine integrations
### Engine integrations

- **SGLang** — integration for SGLang v0.5.13. Working configurations: single
- **SGLang** — integration for SGLang v0.5.13. Working configurations in this
historical release: single
GPU, data parallel (DP), expert parallel (EP, DeepEP low-latency + DP-attention with fa3). Self-contained recipes under `recipe/sglang/` (shared TOML pair +
per-config serve scripts, mirroring `recipe/vllm/`) for Qwen3-1.7B (single),
Qwen3-1.7B (DP), and Qwen3-30B-A3B-FP8 (EP). TP attention stays unsupported
Qwen3-1.7B (DP), and Qwen3-30B-A3B-FP8 (EP). TP attention was not yet supported
(NCCL all-reduce vs the VMM region) — EP uses DP-attention instead. EP requires
SGLang's pinned kernels — DeepEP `9af0e0d` (not vLLM's `29d31c0`),
`sgl-deep-gemm >= 0.1.2`, and `flash-attn-3` (fa3 sidesteps a FlashInfer
Expand All @@ -45,7 +84,7 @@ parallel — with a self-contained recipe and no vLLM build dependency for EP.
on LOAD, with `init_nvshmem_for_loaded_modules` run once on LOAD before any
NVSHMEM-kernel graph replays.

## Fixes
### Fixes

- **Per-rank VMM device binding (DP/TP/EP).** `set_allocation_region` binds to
the current CUDA device, so the integration now calls `set_device(gpu_id)`
Expand All @@ -63,26 +102,22 @@ parallel — with a self-contained recipe and no vLLM build dependency for EP.
capture loop never sets), and the FlashInfer per-bs pre-pass gated off for fa3
while still populating `decode_cuda_graph_metadata` post-load for replay.

## Docs
### Docs

- New `docs/sglang/` set (overview, direct-edits, hooks, memory-lifecycle,
save-load-workflow, memory-consistency) and a self-contained `recipe/sglang/`
README with install, run, performance, and troubleshooting.
- Top-level README parallelism status table updated to mark SGLang single GPU,
DP, and EP as validated.

---

## Previous Releases

## Foundry 0.0.1

First public release of Foundry — a CUDA-graph persistence library that
captures an entire model's CUDA graphs (plus their device context: modules,
workspaces, VMM layout) once and replays them at startup, eliminating compile,
warmup, and capture from cold-start time.

## Highlights
### Highlights

- **Deterministic memory layout — zero patching on graph load.**
Foundry indirects memory allocation to the same reserved memory region
Expand All @@ -99,7 +134,7 @@ warmup, and capture from cold-start time.
On load, the template is rebuilt once per group and instances are reconstructed
on demand, keeping load fast and asynchronous.

## Engine integrations
### Engine integrations

- **vLLM** — compatible with vLLM v0.21. Working configurations: single GPU,
data parallel (DP), expert parallel (EP, DeepEP low-latency). End-to-end
Expand All @@ -111,31 +146,31 @@ warmup, and capture from cold-start time.
integration layer (`foundry/integration/<engine>/`); engine forks contain
only minimal hook calls.

## Verified kernel & comm support
### Verified kernel & comm support

- **cuBLAS NVJET** kernels (Hopper+).
- **torch.compile** modules.
- **NVSHMEM / DeepEP** validated.
- **DeepGEMM FP8 MoE** validated.

## Dependency
### Dependency

- **PyTorch 2.11.0** (compatible with 2.9 – 2.11).
- **CUDA 12+**, CMake 4.0+, Boost.

## Documentation
### Documentation

- Integration design notes and per-engine recipes under `docs/` and `recipe/`.
- vLLM recipe README covers save/load workflow, archive layout, and required
env settings.

## Repository hygiene
### Repository hygiene

- Open-source pre-commit hooks (ruff, ruff-format, clang-format,
markdownlint, actionlint, DCO sign-off).
- Smoke tests covering re-export imports and archive round-trip.

## Roadmap
### Roadmap

- Adapted vLLM and SGLang forks published alongside the release.
- Tensor parallel support.
Expand Down
13 changes: 11 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@
- [x] Quantized MoE with DeepGemm
- [x] Drop-in integration layer for CUDA graph persistence in vLLM
- [x] Sync with latest SGLang release
- [ ] EP on SGLang
- [ ] TP on SGLang
- [x] EP on SGLang
- [x] Single-shape symmetric-memory TP on SGLang main
- [x] Qwen3-8B TP=2 on 2×H100
- [x] Qwen3.5-122B-A10B TP=4 on 4×H100
- [x] Full-backend prefill persistence with 16/64-token buckets
- [x] NEXTN speculative graph persistence on TP=2
- [x] DeepEP low-latency graph persistence on TP=2/EP=2
- [x] Combined TP=2/EP=2 + NEXTN + DeepEP + Full prefill
- [ ] Multi-shape and alternate-collective TP ([upstream issue](https://github.com/foundry-org/foundry/issues/6))
- [ ] Other speculative algorithms and breakable/`tc` prefill persistence
- [ ] PP, LoRA, PDMux, diffusion, and recapture workflows

## Stage 5: Disaggregated and Large-Scale Serving

Expand Down
27 changes: 21 additions & 6 deletions csrc/CUDAGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1528,15 +1528,30 @@ GraphLoadResult CUDAGraph::load(const std::string& json_path, MempoolId_t pool)
}

const json::array& generators_array = root.at("generators").as_array();
bool has_rng_generator = false;
for (const auto& gen_val : generators_array) {
const json::object& gen_obj = gen_val.as_object();
uint64_t state_id = gen_obj.at("id").to_number<uint64_t>();
uint64_t seed = gen_obj.at("seed").to_number<uint64_t>();
uint64_t wholegraph_increment = gen_obj.at("wholegraph_increment").to_number<uint64_t>();
auto increment_it = gen_obj.find("wholegraph_increment");
// Missing metadata is treated conservatively: registering may expose an
// allocation mismatch, but skipping could silently leave RNG kernel
// arguments pointing at the SAVE process's seed/offset tensors.
if (increment_it == gen_obj.end() || increment_it->value().to_number<uint64_t>() != 0) {
has_rng_generator = true;
break;
}
}

auto state = global_generator_state_registry.get_state_from_id(state_id, seed);
state->register_graph(reinterpret_cast<at::cuda::CUDAGraph*>(graph.get()));
graph->captured_generator_states_[state] = wholegraph_increment;
if (has_rng_generator) {
for (const auto& gen_val : generators_array) {
const json::object& gen_obj = gen_val.as_object();
uint64_t state_id = gen_obj.at("id").to_number<uint64_t>();
uint64_t seed = gen_obj.at("seed").to_number<uint64_t>();
uint64_t wholegraph_increment = gen_obj.at("wholegraph_increment").to_number<uint64_t>();

auto state = global_generator_state_registry.get_state_from_id(state_id, seed);
state->register_graph(reinterpret_cast<at::cuda::CUDAGraph*>(graph.get()));
graph->captured_generator_states_[state] = wholegraph_increment;
}
}

const json::object& allocator_events = root.at("allocator_events").as_object();
Expand Down
26 changes: 21 additions & 5 deletions csrc/CUDAGraphParallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ std::shared_ptr<PendingGraphLoads> start_graph_builds_impl(
go["seed"] = gens[g].seed;
go["wholegraph_increment"] = gens[g].wholegraph_increment;
gens_array.push_back(go);
pending->has_rng_generators |= gens[g].wholegraph_increment != 0;
}
pending->entries[i].generators_meta = boost::json::value(std::move(gens_array));
}
Expand Down Expand Up @@ -1690,6 +1691,15 @@ std::shared_ptr<PendingGraphLoads> start_graph_builds_impl(

auto gen_it = pre_root.find("generators");
if (gen_it != pre_root.end()) {
const boost::json::array& generators = gen_it->value().as_array();
for (const auto& gen_val : generators) {
const boost::json::object& generator = gen_val.as_object();
auto increment_it = generator.find("wholegraph_increment");
if (increment_it == generator.end() || increment_it->value().to_number<uint64_t>() != 0) {
pending->has_rng_generators = true;
break;
}
}
pending->entries[i].generators_meta = std::move(gen_it->value());
pre_root.erase(gen_it);
}
Expand Down Expand Up @@ -2030,11 +2040,12 @@ std::shared_ptr<PendingGraphLoads> start_graph_builds_impl(
// SAVE mode.
// ============================================================================

// Per-entry finish. Idempotent on build_complete_ wait (shared_future).
// Per-entry finish. shared_future::get() is repeatable and propagates any
// background build exception to every caller.
GraphLoadResult finish_one_graph_load_impl(std::shared_ptr<PendingGraphLoads> pending, size_t index,
ReconstructTensorFn reconstruct_fn) {
if (pending->build_complete_.valid()) {
pending->build_complete_.wait();
pending->build_complete_.get();
}

if (index >= pending->entries.size()) {
Expand All @@ -2045,9 +2056,14 @@ GraphLoadResult finish_one_graph_load_impl(std::shared_ptr<PendingGraphLoads> pe

auto& entry = pending->entries[index];

// Register deferred generators (before allocator replay to match
// SAVE mode timing where generators are created before graph capture).
if (pending->registry && !entry.generators_meta.is_null()) {
// register_graph lazily creates seed/offset tensors before allocator replay.
// They must stay in the deterministic region when a captured kernel consumes
// Philox state, because their pointers are embedded in that kernel's args.
// When the entire pending set has zero RNG increment, no captured node
// references those tensors; skip registration entirely. This avoids the
// caching-allocator segment growth that caused a 2 MiB A100/FA2 cursor drift
// without replacing deterministic pointers with ordinary CUDA allocations.
if (pending->has_rng_generators && pending->registry && !entry.generators_meta.is_null()) {
const boost::json::array& gen_array = entry.generators_meta.as_array();
for (const auto& gen_val : gen_array) {
const boost::json::object& gen_obj = gen_val.as_object();
Expand Down
Loading