Repository navigation
[None][perf] serve: keep the iteration-stats reads off the serving event loop - #21907
Merged
Tabrizian merged 2 commits intoNov 9, 2026
Conversation
… from blocking the serving event loop (NVIDIA#20698) Signed-off-by: Bowen Fu <[email protected]> Signed-off-by: JunyiXu-nv <[email protected]> Co-authored-by: Bowen Fu <[email protected]>
…loop Ports the tensorrt_llm/serve/openai_server.py change of NVIDIA#20815 (5d86481). Only that hunk: the rest of NVIDIA#20815 is Qwen3.5 GB300 kernel work, and a whole-commit cherry-pick conflicts in the nanobind bindings and drags in 223 files. A straight apply of the hunk does not fit either -- this branch has not taken NVIDIA#20815's wakeup-timer rework, so the collector is ported onto the form the branch has. The collector awaited get_stats_async(timeout=0.5) on the serving event loop; on the IPC proxy that is a synchronous RPC which waits up to its timeout, so every streaming response stalled up to ~0.5 s per stats cycle and its tokens reached the client in one burst. It now reads through the metrics executor, the same one /metrics uses, which is idle while this loop owns the queue. This branch is exposed to it on every point that follows our rule requiring enable_iter_perf_stats: true. Applies on top of the cherry-pick of NVIDIA#20698, which introduces _metrics_stats_executor. Signed-off-by: Iman Tabrizian <[email protected]>
Member
Author
|
/bot run --disable-fail-fast |
Tabrizian
requested review from
JunyiXu-nv,
QiJune,
arysef,
asfiyab-nvidia,
brnguyen2,
dpitman-nvda,
nv-guomingz and
yiqingy0
November 9, 2026 03:52
JunyiXu-nv
approved these changes
Nov 9, 2026
JunyiXu-nv
left a comment
Collaborator
There was a problem hiding this comment.
Serve part LGTM. The legacy /metrics read is identical to main's, and the collector now reads through the metrics thread the same way main does (minus main's timer wakeup, which this branch doesn't have). The collector task is cancelled before the executor shuts down, and get_stats returns the same dicts the async iterator yielded.
Member
Author
|
/bot run --disable-fail-fast |
Collaborator
|
PR_Github #83341 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #83341 [ run ] completed with state |
Tabrizian
added a commit
to Tabrizian/TensorRT-LLM
that referenced
this pull request
Nov 10, 2026
…become dispatch levers Ports the MuseSpark GB300 decode kernel stack onto feat/musespark-open-agentx and replaces the environment switches it carried with dispatch levers. EVERY LEVER IS DEFAULT OFF. This is the port; it changes no behaviour until a lever is knobbed on. Proved rather than asserted: a verifier rebuilds FAST_PATHS, DEPENDS_ON and both compositions by AST and resolves them with an EMPTY environment -- the resolved path sets are identical to the base at all ten deployments (44 paths at TEP8, 54/53 at TEP4), and each lever is then shown to turn on by its own knob. WHAT IS IN. 18 of the 25 patches in the source set: staged-router-gemm, moe-expert-balance (2), decode-g1 (parts 1-5), decode-kernel-stack (3), kernel-stack-2 (parts 1-5), tep8-decode-stack-v2, and context-fmha-v2. decode-g1/6 is omitted as 100% redundant -- 51daa26 (NVIDIA#21364) is already in the base and git apply --reverse of its hunk succeeds. The rest are not kernel changes (http-keep-alive, context-kv-retire-v2, torch-memory-reserve), already upstream (serving-stats-off-loop, merged as NVIDIA#21907), not free (context-scheduler-aging buys x +7.9..9.0% with y -1.0..-1.2%), or inapplicable (router-held-placement: the GB300 e2e point is all-agg, so there is no router to configure). Substantial redundancy was found and dropped rather than re-landed: NVIDIA#21377 and NVIDIA#21580 had already built the widened TP8 finalize transport and left it pinned at TP8_MAX_TOKENS = 16, so that layer collapses to a reader that unpins it. NOT LANDED, reported rather than approximated. kernel-stack-2/4's three gathers.py hunks need a TP8 kernel table (TP8_WIDE_KERNELS / WIDE_KERNELS_BY_SM_TP) that appears in the patches only as context -- it is in no patch and no public commit. decode-kernel-stack/3's eight EARLY_LOADS hunks have no host class, because NVIDIA#21754 moved SwaBlockMultiAttention out of the sm103 tree. THREE DEFECTS THIS PORT INTRODUCED, each found by running the code after static checks passed: 1. weights._ring_buddy_row_cap called max_rows_for with two arguments against a one-argument signature, on the unconditional replicated_experts install path. Every TP8 deployment would have raised TypeError at load_weights. 2. moe_prologue declared _wide_direct: bool as a class attribute, shadowing projection_gathers' transport object (default None) through the MRO. Every 8-row decode step raised AttributeError("'bool' object has no attribute 'is_armed'") at warmup, inside attention_output_into_hop, which is served by default at TP8. 3. pool_into_route called _wide_router_shard with four arguments against five. Latent, behind a default-off lever. THIRD-PARTY LICENSING. multi_instance_context_kernel.py derives from the CUTLASS CuTe DSL Blackwell FMHA example (v4.8.0) and declares that derivation with the full BSD-3-Clause notice in-file, matching 51 existing files in this repository and the sm107 sibling added in 736cfdc. CUTLASS is already attributed in ATTRIBUTIONS-Python.md and both per-arch CPP files, so no attribution file changes. MEASURED. With every lever off the branch is indistinguishable from its base on GB300 TEP8 decode (11.67 vs 11.93 ms at bs3, 12.26 vs 12.28 at bs4), which is a correctness result -- the port does not disturb the default path -- and says nothing about what the levers are worth. Non-bitwise levers still need their acceptance, drift and step-time gates before any of them ships on by default. Signed-off-by: Iman Tabrizian <[email protected]>
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.
Brings the two upstream serving-stats fixes onto
feat/musespark-open-agentx, which predates both.Why this branch needs them. With iteration perf stats enabled, the collector awaited
get_stats_async(timeout=0.5)on the serving event loop. On the IPC proxy that is a synchronous RPCwhich waits up to its timeout, so every streaming response stalled up to ~0.5 s per stats cycle and its
tokens reached the client in one burst. Benchmarks on this branch are required to run with
enable_iter_perf_stats: true, so every such point pays it.Commits
[https://nvbugs/6758245][fix] Cherry-pick #20429: Keep /metrics from blocking the serving event loop (#20698)— applies cleanly; introduces_metrics_stats_executor.[None][perf] serve: keep the iteration-stats collector off the event loop— thetensorrt_llm/serve/openai_server.pychange of [None][perf] Qwen3.5 GB300: upstream the AgentX side-branch optimizations #20815, ported.On the second commit. #20815 is not cherry-pickable here: the rest of it is Qwen3.5 GB300 kernel
work, it touches 223 files, and a whole-commit pick conflicts in the nanobind bindings. Its
openai_server.pyhunk does not apply either, because this branch never took #20815's wakeup-timerrework — so the change is ported onto the collector form this branch has, reading through the same
metrics executor
/metricsuses, which is idle while the collector owns the queue.Stats content, ordering and the
/metricstee are unchanged; this moves where the read happens.Draft: not yet CI-run on this branch.