Repository navigation
Prefix caching | Coordinator scheduling. - #3665
Merged
lmcafee-nvidia merged 9 commits intoMar 3, 2026
Merged
Conversation
lmcafee-nvidia
marked this pull request as draft
March 3, 2026 02:53
The DP inference coordinator now computes block hashes from prompt tokens and routes each request to the rank with the longest consecutive prefix match, with recency tie-breaking. Falls back to round-robin when prefix caching is disabled or no rank has matching hashes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…routing. Adds a `PrefixCachingCoordinatorPolicy` enum with `LONGEST_PREFIX` (default) and `ROUND_ROBIN` options, wired through CLI, InferenceConfig, context, engine, and coordinator. When `ROUND_ROBIN` is selected, the coordinator skips prefix matching and cycles through ranks, enabling baseline benchmarking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lmcafee-nvidia
force-pushed
the
prefix-caching-coordinator
branch
from
March 3, 2026 04:00
1223fad to
0312044
Compare
Thread a --coordinator-schedule-output-path CLI arg through the coordinator entry script, dynamic engine, and coordinator process. The coordinator records each routing decision (request_id, rank_index, num_hashes) and writes a JSON file at shutdown, enabling verification that LONGEST_PREFIX consolidates duplicate prompts on the same rank while ROUND_ROBIN spreads them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lmcafee-nvidia
marked this pull request as ready for review
March 3, 2026 15:40
lmcafee-nvidia
force-pushed
the
prefix-caching-coordinator
branch
3 times, most recently
from
March 3, 2026 17:39
faa5027 to
84679e0
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lmcafee-nvidia
force-pushed
the
prefix-caching-coordinator
branch
from
March 3, 2026 17:54
84679e0 to
ab3c6ca
Compare
shanmugamr1992
approved these changes
Mar 3, 2026
Consolidate rank_cached_hashes and rank_hash_timestamps into a single
hash_to_rank_info dict (hash → {rank → timestamp}), and use a reverse
scan over parent-chained hashes for O(hashes) routing instead of
O(ranks × hashes).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…o start(). Ensures both get_best_data_parallel_rank and _update_rank_hashes see the same truncated request_hashes, so the coordinator only stores the first block hash rather than all hashes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
/ok to test eefe32f |
kvareddy
approved these changes
Mar 3, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/22645872157 |
ilml
added a commit
to ilml/Megatron-LM
that referenced
this pull request
Mar 20, 2026
…VIDIA#3665) New files: - tests/unit_tests/inference/test_dynamic_prefix_caching_coordinator.py
yangbofun
pushed a commit
to xlm-research/Megatron-LM
that referenced
this pull request
May 22, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
terminator123
pushed a commit
to 021ai/Megatron-LM
that referenced
this pull request
Aug 3, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2 of 6 tasks
This branch was previously 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.
Summary
block_size_tokensandenable_prefix_cachingparameters toDataParallelInferenceCoordinator, with per-rank shadow state (rank_cached_hashes,rank_hash_timestamps) for tracking which hashes each rank owns.INCREMENT_STALENESSheader to coordinator for bookkeeping.test_dynamic_prefix_caching_coordinator.py) covering hash computation, affinity routing, recency tie-breaking, round-robin fallback, and multi-rank scenarios.Test plan
test_dynamic_prefix_caching_coordinator.pyunit teststest_dynamic_prefix_caching.pyto verify no regressions in base prefix caching🤖 Generated with Claude Code