Repository navigation
feat: add opt-in bounded-hash routing for TP1 and TP2 replicas - #616
Open
chengcuiping wants to merge 5 commits into
Open
chengcuiping wants to merge 5 commits into
chengcuiping wants to merge 5 commits into
Conversation
chengcuiping
marked this pull request as ready for review
November 12, 2026 04:29
chengcuiping
force-pushed
the
feat/bounded-hash-v3-upstream-20261112T030118Z
branch
from
November 30, 2026 09:58
581eeaa to
d0a095f
Compare
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
--bounded-hash-backend-key-env INFINILM_REPLICA_KEYand--bounded-hash-cache-policy prefix_lru. Build a cost file on a separate replica from the same deployment, then start the gateway withenabled: trueandrouting_policy: bounded_hash_v3. A TP1 or TP2 replica runs both prefill and decode. Build, calibration, gateway and request commandsround_robinto compare placement policies with the same model, prefix LRU, KV budget and in-flight limit. V3 checks every replica's authenticated token contract. RR checks the replica it reserved. Each admitted request sends one generation POST and holds its full KV reservation until completion or cleanup.Motivation
Long shared prompts can benefit from cache locality while demand can exceed a hot replica's slots. V3 weighs a reusable prefix against serving cost and the wait for capacity. The same-cache RR control isolates the effect of placement. Both policies reserve the entire prompt and output envelope. The original PR ported the frozen V3 experiment and verified the 98 source-file digests. Its source attribution, vendored hash ring and Apache-2.0 notice are retained. Original V3 source
Type of Change
feat— new feature / new modelfix— bug fixperf— performance improvement (no behavioral change)refactor— code restructuring without behavior changetest— adding or fixing tests onlydocs— documentation onlybuild/ci— build system or CI configurationchore— tooling, formatting, or other non-code changesTest Results of Involved Models on Supported Platforms (Please attach screenshots)
Final rebased PR head
d0a095f345fe0747ffa12fed80615a2a1809aa67on upstream3a630d18. We rebuilt the final checkout and ran the following checks on eight NVIDIA A100-SXM4-80GB GPUs. Build, cost calibration, B/D startup and request commands · Regression and workload commandstest/runtime/test_chunked_prefill_sched.pyandtest/service/test_agent_protocol.py. A separate CPython 3.10.12 run passed 29 routing, cancellation, cache and TP-layout tests. Nine device-selection tests passed. Native topology passed 540 mappings and 18,576 ranges. The repository format check passed.The hardware checks used Qwen3-32B BF16. The two stock entry points were
examples/test_infer.pyandscripts/test_perf.py. We skipped the offline engine microbenchmark inexamples/bench.pybecause it bypasses HTTP routing. Task accuracy, including C-Eval and MMLU intest/bench/test_benchmark.py, was outside this validation.The screenshot records the earlier rebased checkout
98a3a6c5. The table above records the repeat on the final head.Previously published A100 checkout
b3269ad4b88a1a148d05fbe552cefad585bfeb1aseparately passed 19 service tests, real TP2 cold/warm and dual-rank checks, independent calibration, and four-TP2 B/D contract and release checks. Release validation · Source correspondence · Release build and run instructionsBenchmark / Performance Impact
Original platform experiments. Both platforms used 8 GPUs, Qwen3-32B BF16, four TP2 replicas and closed-loop concurrency 16. Requests had 8,192 input tokens, a page-aligned 7,936-token shared prefix and 32 actual output tokens. Each cell ran 64 cache-learning requests then 128 measured requests. Throughput divides actual output tokens by total elapsed time for the phase. Deployment, unrelated warmup and independent calibration are outside the timed windows.
B was run independently in each W64 batch. vLLM-MetaX had shorter combined TTFT and E2E P99 in B/C. The historical public W64 +48.52% is an 8B/TP1 measurement. The reduced B/D run above checks behavior on this head. The historical throughput percentages apply to their original builds. W64 32B per-round receipts and source digests · Public W64 8B/TP1 validation
Earlier MUSA experiment. A separate, single-round run used eight MTT S5000 GPUs and eight TP1 Qwen3-32B replicas. All 1,728 requests across three methods and three output lengths completed. Original TP1 scope and results
Notes for Reviewers
CI / ChatOps
At the November 30 push of
d0a095f3, GitHub created two upstream pull-request workflow runs. Both reportedaction_requiredwith zero jobs. An upstream maintainer can review and approve the runs. CI run · Ruff runHost behavior and format have automatic PR triggers. The separate upstream device workflow uses manual dispatch. The A100 results above were obtained on the final checkout. The protected main branch also requires an approving review from its designated team. PR checks
Checklist
Title, Branch, and Commits
feat(nvidia): …,fix(cuda/gemm): …).<type>/xxx-yyyy-zzzzwhere<type>matches the PR title's Conventional Commits type and words are joined with hyphens (seeCONTRIBUTING.md§Branches).CONTRIBUTING.md§Pull Requests).main— the branch is rebased cleanly on top of the currentmain.fixup!/squash!/wipcommits remain.Scope and Design
CONTRIBUTING.md§Code/General).printf/std::cout/print(...)left behind, orTODOwithout an owner and issue link.General Code Hygiene (applies to all languages)
CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).the `seqlens_k` tensor) (CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General; §Python).C++ Specific (if C++ files changed)
CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).new/delete; RAII / smart pointers / existing allocators are used.scripts/format.py.csrc/models/llama_legacy/.Python Specific (if Python files changed)
CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).scripts/format.py.python/infinilm/auto_config.py.Testing
examples/test_infer.py), or specify the reason for skipping.examples/bench.py), or specify the reason for skipping.test/bench/test_benchmark.py), or specify the reason for skipping.python/infinilm/server/inference_server.py+scripts/test_perf.py), or specify the reason for skipping.Build, CI, and Tooling
/retestwas requested.Documentation
README.md,CONTRIBUTING.md, or inline docs updated when behavior, build flags, or developer workflow changed.!orBREAKING CHANGE:footer.Security and Safety
The original experiment modules retain their attributed comments. Individual prose, docstring and backtick style items above await review. The platform table identifies the unavailable devices. No additional hardware reviewer was requested. The manual device workflow remains a maintainer action. The testing entries for offline performance and task accuracy refer to the explicit skip reasons above.