[None][perf] optimize native V2 KV event production - #16876
Draft
alec-flowers wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Alec Flowers <aflowers@nvidia.com>
Signed-off-by: Alec Flowers <aflowers@nvidia.com>
This was referenced Jul 29, 2026
1 task
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
Depends on #16869.
This stacked draft optimizes the native TensorRT-LLM V2 KV-event production path introduced by #16869. Until the base PR merges, GitHub will show both commits; this branch will be rebased onto
mainafterward.Block.key, converting its low 64 bits to vLLM's signed integer wire representationRoot cause
The generic V2 manager constructs events for cache creation, storage-tier updates, sliding-window lifecycles, partial blocks, and other mutations that the vLLM wire adapter later discards. In the distributed AgentX run, 3.249 million native events produced only 54,491 wire events, so 98.3% of the generic events were filtered after construction.
For the blocks that survived filtering, the native path also translated the existing V2 radix key back into the legacy V1 token hash on the scheduler thread. vLLM instead reuses the SHA-256 hash already owned by its prefix cache.
The new manager filters at the cache mutation hook and directly accumulates the events the router consumes. It reuses
Block.keyfor both stores and removals, avoiding token re-hashing.Validation
The final implementation was validated against the exact TensorRT-LLM
1.3.0rc21benchmark image.248471424881352496292Job
2496292completed the full 600-second warmup and 3,600-second AgentX profile on 8 nodes / 32 GPUs with 61,774 successful requests and zero errors. It improved throughput 13.5349% over legacy event publishing, with no event-gap or event-drop markers and zero KV-event allgathers.Local exact-image long points:
mainforward-port passes Python compilation andgit diff --check; focused CI remains pending on this draftRegression protected by the focused test: publishing could revert to legacy token re-hashing or emit incorrect lifecycle/removal identities, causing scheduler throughput loss or stale KV-router state; the test checks the observable real-ZMQ wire boundary.