Repository navigation
Add DP coordinator pairwise test foundation - #81
Open
lmcafee-nvidia wants to merge 11 commits into
Open
lmcafee-nvidia wants to merge 11 commits into
lmcafee-nvidia wants to merge 11 commits into
Conversation
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
lmcafee-nvidia
marked this pull request as ready for review
October 13, 2026 17:33
Owner
Author
|
hi @sidsingh-nvidia, can you please review this DP coordinator test foundation? thanks! |
sidsingh-nvidia
approved these changes
Oct 14, 2026
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
Signed-off-by: Lawrence McAfee <lmcafee@nvidia.com>
kvareddy
approved these changes
Oct 21, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
October 20 main refresh: head
3d8fb014ff90f3dd72751a7a054bebcf97f03b9d, parent184ed356a80030f38f448e60ff0ebe1f622f9d5d, pinned NVIDIA main474b1e9ee72fbe19205a6dfe26d56620977a6275. Existing branches and dependencies are preserved. Shared fixtures select their intended attention backend explicitly and observe the current async forward state.This PR adds the shared unit-test foundation for data-parallel inference coordination. Real clients submit requests through the coordinator to real model replicas; the tests check that routing preserves model results while the selected inference behavior actually executes.
The foundation adds:
The 97 selections include parameter variants and correctness controls. They are not 97 distinct positive pairwise cells. Production fixes and their focused regressions have separate owners in the split.
How was the test matrix determined?
The source audit found a gap between coordinator plumbing coverage and real inference behavior. Existing coordinator tests use a
DummyEnginewith synthetic progress, or fake rank identities and seeded hashes to check routing choices. Those tests cannot establish that the chosen replica consumes real cached KV, executes a model kernel, preserves a sampling distribution, or resumes a partly generated request correctly.The matrix follows the production boundaries exposed by coordinator routing and handlers, engine configuration, request sampling fields, and model/parallel execution. It has three layers:
Deterministic rows compare direct and routed execution using the same engine weights and companion configuration. The stochastic rows compare the first-step logits and filtered distribution at the same prompt/history, then check the sampled token's reported score; they do not require identical random draws. Stateful rows additionally assert the exact transition or ownership invariant. Each claimed interaction needs runtime evidence from the affected routed work.
This is a bounded differential interaction matrix. It does not enumerate every CLI combination, every companion-disabled cell, or every fault phase. Parameter products are expanded only where listed below; backend wrappers reuse the all-owner oracle, and graph-selection rows reuse the chunk-partition workload without adding another copy of either helper. Static enumeration of the frozen source agrees with the extraction author's inventory; it is not a runtime collection result.
What combinations are tested?
All paths below are under
tests/unit_tests/inference/. Counts are unique authored selections, counted once regardless of rank count or repeated consumer runs:8 + 28 + 13 + 12 + 12 + 4 + 1 + 6 + 12 + 1 = 97.
Routing, streaming, and prefix ownership (8 selections)
test_coordinator_pairwise.pyuses real clients with overlapping local request ID zero. Ordinary output rows submit one request per DP owner; prefix rows warm an owner and repeat a 33-token prompt with 16-token KV blocks and LRU eviction.test_routed_output_matches_direct, final resultLEGACY/ interval0;ASYNC/ interval0LEGACY/ interval1;ASYNC/ interval1LEGACY/ interval3;ASYNC/ interval3test_routed_prefix_reuse_executes_on_warm_ownerLONGEST_PREFIX;FIRST_PREFIX_BLOCKSampling and request output policy (28 selections)
test_coordinator_sampling_pairwise.pycontributes 20 stochastic selections, four output opt-ins, and four BOS/stop-compaction selections. Stochastic requests generate one token at temperature0.7; each backend/filter row runs all four combinations of shared versus DP-offset seed and raw versus processed log probabilities.(top_k, top_p)torch-top-k(4, 0.0)torch-top-p(0, 0.7)flashinfer-top-k(4, 0.0)flashinfer-top-p(0, 0.7)flashinfer-joint(4, 0.7)Here shared/rank means
offset_sampling_seed_by_dp_rank=False/True, and raw/processed meansraw_logprobs/processed_logprobs.test_routed_output_opt_ins:(echo, detokenize, eos)(False, False, False)(True, True, False)(True, False, False)(False, False, True)test_routed_bos_stop_after_metadata_compaction:(keep, skip)(False, False)(False, True)(True, False)(True, True)The last four cases insert BOS, place a stochastic short request before the greedy target on its owner, and require the target's
top_k=1metadata to survive compaction after the short request retires.Model topology and feature execution (13 selections)
test_coordinator_features_pairwise.pycompares direct output with routed output on every DP owner and every model-parallel role. The three topology rows use eight ranks; ordinary feature rows use two DP replicas. Each row below is one selection.tp2-dp4pp2-dp4tp2-pp2-sp-dp2test_routed_cuda_graph_replays_for_every_targettest_routed_mtp_executes_inner_steps_on_every_targetmambagdpgdnfp8fused-ropeswa-sink(4, 0), off-by-one softmaxalternating-swa-sink(4, 0), skip frequency 2, learnable softmaxtest_routed_moe_participates_in_ep_collectivesRequest lifecycle and memory residency (12 selections)
test_coordinator_lifecycle_pairwise.pypauses an active request only after real generation has begun. Residency rows compare the resumed 16-token result with uninterrupted direct execution; the other schedules exercise cancellation, epoch propagation, pressure, and drained reset.LEGACY/PERSIST;ASYNC/PERSISTLEGACY/OFFLOAD;ASYNC/OFFLOADLEGACY/RECOMPUTE;ASYNC/RECOMPUTEqueued; abortactiveFalse;TrueMedia routing, embedding reuse, and epochs (12 selections)
test_coordinator_media_pairwise.pyuses two replicas and real LLaVA vision, projection, and language execution. Each row runs bothallow_stale_multimodal_embeddings=False(invalidate) andTrue(retain) across suspend/resume. Prefix routing isLOAD_BALANCED, prefix eviction is LRU, and the vision cache is enabled.clip, fixed imageAFFINITYclip, fixed imageLOAD_BALANCEDradio-dynamic, dynamic imageAFFINITYradio-dynamic, dynamic imageLOAD_BALANCEDradio-video, two framesAFFINITYradio-video, two framesLOAD_BALANCEDA competing text request puts the warm image on its peer. After the epoch transition, the workload repeats the same media and then submits different media, checking actual owner choice, vision/projection call counts, embedding injection at 4/6/12 image positions, cache salt changes, and zero incorrect prefix reuse for different media. It checks the configured cache policy across an epoch transition without changing model weights.
Chunk scheduling and routing priorities (4 selections)
test_coordinator_schedule_pairwise.pyuses two replicas and records work on the selected target owner.test_routed_chunk_partition_beside_decodeaffinity0, TTL300; warm owner wins despite competing load and actually reuses KVload100, TTL300; another owner wins and target has no warm KV reuseexpired0, TTL0; expired routing affinity sends the target away from the warm ownerBatch invariance at a physical padding boundary (1 selection)
test_coordinator_batch_invariant_pairwise.pyuses native Transformer Engine batch invariance, ordered collectives, FA3, BF16, and legacy scheduling. The shared factory supplies the real model.test_routed_batch_invariance_at_padding_boundaryThe selected request's input tokens, positions
0, 1, 2, 3, and finite logits must be bitwise identical across the two schedules; every routed result also matches the direct output.Dense backends and native model modes (6 selections)
test_coordinator_backends_pairwise.pyreuses the all-owner kernel test, including direct/routed result parity and finite sampled logits. Each row below is one selection.optimizedfa2fa4mlamxfp8nvfp4Native precision uses the same 128-row physical batch for direct and routed runs. These two rows check ordinary precision/routing parity, independently of the batch-invariance row's deliberate shape change.
Graph selection and idle expert progress (12 selections)
test_coordinator_execution_pairwise.pyadds six graph-sizing selections and six idle-progress selections. Graph rows reuse the 65-token chunked target with three graphs, mixed-prefill count 2, and maximum decode graph size 16; they check actual replay dimensions and retain the chunk-partition oracle.cuda_graph_all_prefillscasesEXPONENTIALFalse;True8;16LINEARFalse;True12;12HYBRIDFalse;True8;16All observed dimensions must belong to the captured set and match physical input size. A target-bearing pure-prefill replay above 16 tokens must occur exactly when all-prefill capture is enabled.
20, EP2False;True3, EP2False;TrueNone, consensus disabled, EP1False;TrueThese rows generate 32 tokens on one owner, compare token/status output with the direct reference, require finite score arrays, and check balanced NCCL dispatch/combine where EP2 applies. The disabled-consensus EP1 cases do not claim disabled-consensus EP2 support.
Rejected admission and subsequent progress (1 selection)
test_coordinator_admission_pairwise.pychecks rejection before real model execution, then sends a healthy request to the same owner.test_rejected_admission_retires_before_healthyFAILEDterminal withMaxSequenceLengthOverflowError, no forward or retained request state; the subsequent healthy request matches direct outputThis selection is a rejection/liveness control and receives no positive model-feature pair credit.
How are results checked?
The harness observes completed production forwards and coordinator handler events. Tests force assignment while engines are paused, record the actual owner and client-local IDs, then release real execution. The all-owner helper gathers records across ranks and requires every DP owner and model-parallel role to prefill and decode its assigned IDs, with disjoint ownership between replicas. Warmup, direct-reference calls, and bookkeeping-only work cannot satisfy that helper's target evidence.
The oracles match each contract:
torch.testing.assert_closedefaults, and requires incremental partials, aligned token/selected-score lengths, exactly one final stream item, and no duplicate terminal engine reply.rtol=0,atol=0), RNG consumption, the expected per-owner seed, and a real FlashInfer joint-filter call where selected. The returned selected-token log probability uses absolute tolerance8 * finfo(dtype).epsand zero relative tolerance; raw and processed scores must differ and the sampled token must remain in the nontrivial filtered support.Retirement is checked before teardown: engine requests/queues and active context rows are empty, coordinator request maps and pending counts are empty, client futures/submission timestamps/streams are empty, and the coordinator remains alive after ordinary completion. The shared fixture then performs the original pause/stop/barrier/shutdown sequence, joins the coordinator, closes clients and sockets, deletes graphs, and destroys model-parallel state. Original assertions, parameter cases, timeouts, fixtures, and teardown are retained.
Scope
This PR adds 11 unit-test/helper files, +2185/-0 lines, and has no production delta or functional-test/config/runner changes. It owns 97 selections; the 18 focused child selections remain in #82/#86/#87/#83/#85. Together they preserve the 115-selection campaign.
The current candidate is
79e2160ee2d5f8458dd6184e9de46470edc40c7babovedp-prerequisites-v2at5a1c4da4d27b297078f8fe74572731d556ea39a6. Main4729b9c6cc17af2a1b47bf7c42b05059f36ca3b9was merged into the campaign-owned prerequisite branch first, then propagated through the foundation and descendants with signed append-only merges.The campaign is self-contained: its own prerequisite branch copies the FA3 trailing-return-metadata fix and the TE norm/projection source-device fix; it does not merge peer campaign branches. Four earlier copied prerequisite concepts are now supplied by upstream NVIDIA#7256 and no longer appear as production differences from main.
The test source originated in historical fork/76, which remains frozen. Current API adaptations consume flat completed-request futures, decode prompt-token tensors through production deserialization, and check coordinator-detokenized text against the direct generated-token oracle, and inspect the current vision-cache entry.embedding payload. All original activation witnesses, parity/invariant checks, parameters, timeouts and normal teardown remain.
0865a7b01ab0e3a062f60ccc305afbf48fe45faa55fb75d133dfdde2f6b3e347c4ce09063c69c451New main features, including multi-EOS defaults, payload staging, cached MTP drafts, nondefault softcap, BI+MXFP8 MoE and dynamic CP, are not automatically covered by existing separate rows. Runtime configuration/plumbing alone receives no pairwise credit. These stable fork review records remain the primary records; later upstream landing uses new linked PRs.
Validation
October 20 refresh acceptance
Candidate
3d8fb014ff90f3dd72751a7a054bebcf97f03b9dincludes pinned main474b1e9ee72fbe19205a6dfe26d56620977a6275.DFW jobs
20558189,20563746: all 10 required groups passed on every required rank, including setup, execution and teardown.HSG jobs
8095236,8095800: all 2 required groups passed on every required rank, including setup, execution and teardown.No selected case was skipped.
Validation uses qualified compatibility environments: DFW H100 with Torch 2.10/CUDA 13.1, TE 2.20 and FlashInfer 0.6.16.post3; where listed, HSG GB200 with Torch 2.11/CUDA 13.2, TE 2.20 and FlashInfer 0.6.8. This does not claim the exact current 26.09 CI image.
Signed append-only ancestry, Python compilation, whitespace, Black, isort, Ruff, Pylint and the actual-parent kernel gate passed. Existing documented non-numeric kernel-gate exemptions remain on #65 and #102. No unit tests ran on the local workstation.
Earlier validation records
Tested candidate:
79e2160ee2d5f8458dd6184e9de46470edc40c7b(tree3899970c34ba7eafaf4cd10acb9b83c6115f3b2e).All 97 unique authored foundation selections passed: DFW jobs 19788479 and 19788480 cover ordinary, media, lifecycle and native backend rows; HSG 7686748 covers MXFP8 and NVFP4. Every two-rank row passed on both ranks and each of the three topology rows passed on all eight ranks. All authored selections have zero skips.
The complete refreshed union passes all 115 unique authored selections, with zero authored skips, and remains at the approved 2,630 net unit-test-line cap. Current-main production oracles pass five stop/admission cases in DFW 19787958 and two pressure/reset cases in 19788480; source checks confirm zero production differences from pinned main.
The DFW compatibility environment uses TE 2.20.0+131157b5, FlashInfer 0.6.16.post3 and Mamba 2.3.2.post1 on Torch 2.10/CUDA 13.1. Native Blackwell precision uses TE 2.20 on HSG with Torch 2.11/CUDA 13.2. These qualified native environments are not a byte-for-byte reproduction of the 26.08 lock environment.
Pinned isort 5.13.2, Black 26.3.0, Ruff 0.12.11, AST, diff checks, signed/DCO history, append-only ancestry, parent-relative scope and the kernel-determinism gate passed. Post-run source receipts confirm clean exact commits. No unit tests, collection or test imports ran locally.