Skip to content

[https://nvbugs/6463987][fix] Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity - #20103

Closed
chenfeiz0326 wants to merge 1 commit into
NVIDIA:mainfrom
chenfeiz0326:chenfeiz/6463987-glm5-gb300-numa-worker-affinity
Closed

chenfeiz0326 wants to merge 1 commit into
NVIDIA:mainfrom
chenfeiz0326:chenfeiz/6463987-glm5-gb300-numa-worker-affinity

Conversation

@chenfeiz0326

@chenfeiz0326 chenfeiz0326 commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fixes nvbugs/6463987: ctx_only-gb300_glm-5-fp4_1k1k_con1_ctx1_dep2_gen1_tep4_eplb0_mtp3_ccb-NIXL regressed ~38 % in output_token_throughput after the image update in #15087, which moved NCCL from 2.29.7 to 2.30.4. The regression is intermittent: affected runs drop to ~2.6 tok/s.

Performance: ctx_only-gb300_glm-5-fp4_1k1k_con1_ctx1_dep2_gen1_tep4_eplb0_mtp3_ccb-NIXL

output_token_throughput (tok/s), every run, in submission order. All runs on oci-aga GB300; each completed 10/10 requests with 0 failed. Bold = slow-mode run (prefill step > 320 ms).

Scenario Code / image / NCCL Runs Every run (tok/s) Median / min / max Slow runs
Bad commit 46bf21b1, pytorch-26.05, NCCL 2.30.4 10 2.68, 4.33, 4.46, 4.27, 4.52, 2.64, 4.32, 4.26, 2.67, 4.31 4.29 / 2.64 / 4.52 3/10
Bad commit + fix same, + TLLM_NUMA_AWARE_WORKER_AFFINITY=1 10 4.37, 4.49, 4.22, 4.33, 4.33, 4.39, 4.25, 4.25, 4.52, 4.21 4.33 / 4.21 / 4.52 0/10
Main ToT + fix 43931299604, pytorch-26.09, NCCL 2.31.2, + TLLM_NUMA_AWARE_WORKER_AFFINITY=1 17 4.21, 4.34, 4.04, 4.18, 4.26, 4.05, 3.93, 3.97, 4.37, 4.22, 4.18, 4.21, 4.31, 3.04, 4.20, 4.06, 4.04 4.18 / 3.04 / 4.37 0/17

Per-run details.

  • Median step is the run's median prefill step: one 1024-token request per step, first request dropped.
  • Longest step is that run's slowest prefill step.
  • Socket is the CPU socket the rank's busiest thread ran on during the benchmark: 0 = CPUs 0-71, the socket attached to GPUs 0/1; 1 = CPUs 72-143.
  • Bold marks slow-mode runs and split placement.

Bad commit — 10 runs

Run tok/s Median step (ms) Longest step (ms) CPU mask r0 / r1 Socket r0 / r1
1 2.68 373.4 382 0-71 / 0-143 0 / 1 (split)
2 4.33 228.3 230 0-71 / 0-143 0 / 0
3 4.46 220.8 223 0-71 / 0-143 0 / 0
4 4.27 232.3 236 0-71 / 0-143 0 / 0
5 4.52 218.4 220 0-71 / 0-143 0 / 0
6 2.64 379.0 390 0-71 / 0-143 0 / 1 (split)
7 4.32 229.0 232 0-71 / 0-143 0 / 0
8 4.26 232.0 238 0-71 / 0-143 0 / 0
9 2.67 377.3 392 0-71 / 0-143 0 / 1 (split)
10 4.31 230.0 234 0-71 / 0-143 0 / 0

Bad commit + fix — 10 runs

Run tok/s Median step (ms) Longest step (ms) CPU mask r0 / r1 Socket r0 / r1
1 4.37 225.8 230 0-71 / 0-71 0 / 0
2 4.49 219.5 227 0-71 / 0-71 0 / 0
3 4.22 233.8 238 0-71 / 0-71 0 / 0
4 4.33 228.9 232 0-71 / 0-71 0 / 0
5 4.33 227.6 231 0-71 / 0-71 0 / 0
6 4.39 225.9 227 0-71 / 0-71 0 / 0
7 4.25 233.0 236 0-71 / 0-71 0 / 0
8 4.25 232.8 234 0-71 / 0-71 0 / 0
9 4.52 219.2 221 0-71 / 0-71 0 / 0
10 4.21 235.7 241 0-71 / 0-71 0 / 0

Main ToT + fix — 17 runs

Run tok/s Median step (ms) Longest step (ms) CPU mask r0 / r1 Socket r0 / r1
1 4.21 235.6 244 0-71 / 0-71 0 / 0
2 4.34 228.0 238 0-71 / 0-71 0 / 0
3 4.04 244.9 252 0-71 / 0-71 0 / 0
4 4.18 237.4 241 0-71 / 0-71 0 / 0
5 4.26 233.4 238 0-71 / 0-71 0 / 0
6 4.05 245.3 250 0-71 / 0-71 0 / 0
7 3.93 253.4 256 0-71 / 0-71 0 / 0
8 3.97 250.2 255 0-71 / 0-71 0 / 0
9 4.37 227.1 237 0-71 / 0-71 0 / 0
10 4.22 235.4 241 0-71 / 0-71 0 / 0
11 4.18 237.3 243 0-71 / 0-71 0 / 0
12 4.21 236.2 240 0-71 / 0-71 0 / 0
13 4.31 229.9 240 0-71 / 0-71 0 / 0
14 3.04 240.1 985 0-71 / 0-71 0 / 0
15 4.20 238.1 242 0-71 / 0-71 0 / 0
16 4.06 244.5 259 0-71 / 0-71 0 / 0
17 4.04 246.5 249 0-71 / 0-71 0 / 0
  • Bad commit and bad commit + fix use the same wheel, image and harness; the only difference is the knob. Their runs were submitted in pairs.
  • In all 3 slow bad-commit runs, the two ranks' busiest threads ran on different CPU sockets. With the fix, both ranks are on CPUs 0-71 in every run (10/10 bad commit, 17/17 main).
  • The fix costs nothing on the fast runs: bad commit fast runs have a 229.0 ms median prefill step, bad commit + fix 228.2 ms.
  • Main ToT + fix run 14 (3.04 tok/s) is not the slow mode. Its median prefill step was a normal 240 ms and both ranks stayed on CPUs 0-71, but two isolated steps took 387 and 985 ms. The other 16 runs are 3.93–4.37.
  • For reference, the bug's good commit 1662a877 (NCCL 2.29.7), same cluster: 4.08, 4.12, 4.17, 4.17, 4.28 (0/5 slow).
  • Slow-run count, bad commit vs bad commit + fix: 3/10 vs 0/10 (Fisher one-sided p = 0.11). Adding the 5 earlier bad-commit runs on the same cluster (4/5 slow): 7/15 vs 0/10, p = 0.013.

Why NCCL 2.29.7 was fast, 2.30.4 is slow, and why TLLM_NUMA_AWARE_WORKER_AFFINITY=1 fixes it

The setup.

  • This ctx worker has 2 ranks on a 4-GPU GB300 node. TRT-LLM puts rank N on GPU N (device_id = global_rank % torch.cuda.device_count()), so the ranks use GPUs 0 and 1, which are attached to CPU socket 0 (CPUs 0-71).
  • Slurm starts both ranks restricted to CPUs 0-71.
  • With TLLM_NUMA_AWARE_WORKER_AFFINITY unset, configure_cpu_affinity() (tensorrt_llm/llmapi/utils.py) sees a restricted mask and removes it: it logs Removing CPU affinity constraints and widens the rank to all CPUs (0-143). On main both ranks end up on 0-143. On the bad commit only rank 1 does; rank 0 creates its NCCL communicator on a different thread and keeps 0-71.

What NCCL changed. During communicator setup, initTransportsRank() temporarily pins the calling thread to the CPUs near its GPU. The last line decides what that thread is left with:

NCCL Last line of initTransportsRank() Thread is left on
2.29.2 – 2.29.7 ncclOsSetAffinity(comm->cpuAffinity) GPU-local CPUs, 0-71
≥ 2.30.3 (incl. 2.30.4, 2.30.7, 2.31.2) ncclOsSetAffinity(affinitySave) its own previous mask, 0-143 here
  • NCCL 2.29.x had a bug: it forgot to restore the caller's mask. NCCL 2.30.3 fixed it; the release notes say "Fixes regression from 2.29.2 where CPU affinity mask is not restored in initTransportsRank".
  • That bug happened to help this case: it re-pinned the TRT-LLM rank to 0-71, undoing TRT-LLM's widening.
  • A standalone program that calls only NCCL shows the difference. It widens its thread to 0-143, then calls ncclCommInitRank. The thread ends on 0-71 with 2.29.7, and on 0-143 with 2.30.4 and 2.30.7.

Why that makes it slow.

  • With NCCL ≥ 2.30.3 the widened rank stays on 0-143, so the scheduler can run it on either socket.
  • When the two ranks' busy threads end up on different sockets, every prefill step takes ~1.6× longer (~375 ms vs ~230 ms).
  • Both ranks on the same socket is fast, even if that is the far socket.
  • Across 140 runs with CPU placement recorded, all 20 slow runs had the ranks on different sockets, and all 120 fast runs had them on one socket. Forcing the ranks apart on NCCL 2.29.7 made 5/5 runs slow.
  • This is why the case is bimodal rather than uniformly slower.

Why TLLM_NUMA_AWARE_WORKER_AFFINITY=1 fixes it.

  • With =1, configure_cpu_affinity() doesn't remove the mask. It asks NVML which CPUs are attached to the rank's GPU and pins the rank there: 0-71 for GPUs 0 and 1. On main it binds every existing thread; on the bad commit it binds the process's main thread, and threads created afterwards inherit the mask. Both were enough here.
  • Both ranks therefore always run on the same socket, the one attached to their GPUs, whatever mask Slurm hands in and whatever NCCL does afterwards.
  • The table above shows the result: 0 slow runs, both ranks on 0-71 in every run, on NCCL 2.30.4 and 2.31.2 alike.

Why only these six YAMLs.

  • The problem needs a ctx worker that uses only part of a node. Then Slurm hands it a restricted mask, and TRT-LLM widens that mask when the knob is unset.
  • A ctx worker that uses the whole node (dep4 / pp4 / pp8) gets all 144 CPUs from Slurm. With the knob unset, TRT-LLM then already pins each rank to its GPU's socket.
  • In a GB200/GB300 ctx_only sweep of the DeepSeek-R1, DeepSeek-V4, Nemotron-Ultra-V3 and GLM-5 YAMLs, every full-node case had identical per-rank masks with and without the knob.

Change

  • Adds ctx_worker_env_var: TLLM_NUMA_AWARE_WORKER_AFFINITY=1 to the six GB300 GLM-5 ctx1_dep2 perf-sanity YAMLs: one line per file, no code change, gen workers untouched.
  • Baseline matching keys (s_test_case_name, s_gpu_type, s_runtime, s_branch) are unchanged, so each case keeps its history.

Files:

  • gb300_glm-5-fp4_1k1k_con1_ctx1_dep2_gen1_tep4_eplb0_mtp3_ccb-NIXL
  • gb300_glm-5-fp4_1k1k_con4096_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL
  • gb300_glm-5-fp4_1k1k_con512_ctx1_dep2_gen1_dep32_eplb0_mtp3_ccb-NIXL
  • gb300_glm-5-fp4_8k1k_con1024_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL
  • gb300_glm-5-fp4_8k1k_con1_ctx1_dep2_gen1_tep8_eplb0_mtp3_ccb-NIXL
  • gb300_glm-5-fp4_8k1k_con512_ctx1_dep2_gen1_dep32_eplb0_mtp3_ccb-NIXL

Test Coverage

🤖 Generated with Claude Code

Dev Engineer Review

The six GB300 GLM-5 FP4 perf-sanity configurations set TLLM_NUMA_AWARE_WORKER_AFFINITY=1 for context workers. This targets NUMA-aware worker affinity without changing generator-worker settings or the broader default. The reported verification shows fewer slow-mode runs and a modest increase in median output-token throughput; these results are author-reported.

QA Engineer Review

The change modifies six perf-sanity YAML configuration files and adds no test functions, IDs, selectors, or waivers. The reported comparison used the same wheel for both arms and changed only the case YAML. Coverage verdict: needs follow-up; the supplied evidence covers 10 repetitions per arm and does not establish broader behavior.

Per-File QA Perspective

  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_1k1k_con1_ctx1_dep2_gen1_tep4_eplb0_mtp3_ccb-NIXL.yaml: Sets NUMA-aware affinity for context workers. Verify context-worker CPU masks and prefill behavior; generator settings remain unchanged.
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_1k1k_con4096_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL.yaml: Sets NUMA-aware affinity for context workers. Verify the setting takes effect in this high-concurrency case.
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_1k1k_con512_ctx1_dep2_gen1_dep32_eplb0_mtp3_ccb-NIXL.yaml: Sets NUMA-aware affinity for context workers. Verify the setting takes effect with this generator configuration.
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_8k1k_con1024_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL.yaml: Sets NUMA-aware affinity for context workers. Verify context-worker placement and prefill behavior.
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_8k1k_con1_ctx1_dep2_gen1_tep8_eplb0_mtp3_ccb-NIXL.yaml: Sets NUMA-aware affinity for context workers. Verify the setting takes effect with this context length and generator configuration.
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_8k1k_con512_ctx1_dep2_gen1_dep32_eplb0_mtp3_ccb-NIXL.yaml: Sets NUMA-aware affinity for context workers. Verify context-worker placement and prefill behavior.

…U's NUMA node in perf-sanity

The GB300 GLM-5 ctx worker (TP2/EP2, attention DP, CUTEDSL MoE) is bimodal on
NCCL >= 2.30: some runs take ~1.6x longer per prefill step. The slow mode
appears exactly when the two ranks' executor threads land on different Grace
sockets (19/19 slow reps split; 101/101 fast reps on one socket, measured over
120 reps).

Cause: Slurm binds each task to socket 0, and configure_cpu_affinity() widens
that to all CPUs when TLLM_NUMA_AWARE_WORKER_AFFINITY is unset. NCCL 2.29.x
then re-pinned the thread that creates the communicator back to the GPU-local
CPUs at the end of initTransportsRank; 2.30.3 fixed that ("CPU affinity mask is
not restored in initTransportsRank"), so rank 1's executor now floats across
both sockets.

Set TLLM_NUMA_AWARE_WORKER_AFFINITY=1 on the ctx worker so TRT-LLM binds each
rank to its GPU's NUMA node itself, independent of the NCCL version. Applied
to the six GB300 GLM-5 1k1k/8k1k cases that share this ctx worker shape.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: chenfeiz0326 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/TensorRT-LLM/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 1b61dbbf-e0bd-45fe-ad12-4781cc54bb25
📥 Commits

Reviewing files that changed from the base of the PR and between 4393129 and e913e44.

📒 Files selected for processing (6)
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_1k1k_con1_ctx1_dep2_gen1_tep4_eplb0_mtp3_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_1k1k_con4096_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_1k1k_con512_ctx1_dep2_gen1_dep32_eplb0_mtp3_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_8k1k_con1024_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_8k1k_con1_ctx1_dep2_gen1_tep8_eplb0_mtp3_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_8k1k_con512_ctx1_dep2_gen1_dep32_eplb0_mtp3_ccb-NIXL.yaml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

Six GB300 disaggregated performance configurations add TLLM_NUMA_AWARE_WORKER_AFFINITY=1 to the context worker environment variables.

Changes

Context worker affinity

Layer / File(s) Summary
Set context-worker affinity
tests/scripts/perf-sanity/disaggregated/gb300_glm-5-fp4_*.yaml
Six configurations add TLLM_NUMA_AWARE_WORKER_AFFINITY=1 to the context worker environment variables.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix

Suggested reviewers: bowenfu

Merge Risk: ⚪ Minimal · up to e913e

The setting is applied to context workers without changing generation-worker settings. No concrete risk remains; the change is ready to merge after normal checks.

Pre-merge checks · Passed 5
Passed Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title follows the required ticket/type format and clearly describes the NUMA-affinity fix for GB300 GLM-5 context workers.
Description check Passed The description explains the regression, root cause, scope, implementation, affected files, and test coverage. The repository checklist is not explicitly completed, but the core required information i…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

chenfeiz0326 added a commit that referenced this pull request Oct 13, 2026
…GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity (#20136)

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
@chenfeiz0326
chenfeiz0326 enabled auto-merge (squash) October 13, 2026 04:58
auto-merge was automatically disabled October 13, 2026 05:44

Pull request was closed

SimengLiu-nv pushed a commit to SimengLiu-nv/TensorRT-LLM that referenced this pull request Oct 26, 2026
….3: Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity

Forward-port of release/1.3 PR NVIDIA#20136
(release/1.3 commit 47c0479) to main.

The release PR cherry-picked main PR NVIDIA#20103, which was closed
without merging, so this change was not on main.

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
Signed-off-by: Simeng Liu <[email protected]>
SimengLiu-nv pushed a commit to SimengLiu-nv/TensorRT-LLM that referenced this pull request Nov 2, 2026
….3: Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity

Forward-port of release/1.3 PR NVIDIA#20136
(release/1.3 commit 47c0479) to main.

The release PR cherry-picked main PR NVIDIA#20103, which was closed
without merging, so this change was not on main.

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
Signed-off-by: Simeng Liu <[email protected]>
SimengLiu-nv pushed a commit to SimengLiu-nv/TensorRT-LLM that referenced this pull request Nov 2, 2026
….3: Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity

Forward-port of release/1.3 PR NVIDIA#20136
(release/1.3 commit 47c0479) to main.

The release PR cherry-picked main PR NVIDIA#20103, which was closed
without merging, so this change was not on main.

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
Signed-off-by: Simeng Liu <[email protected]>
SimengLiu-nv pushed a commit to SimengLiu-nv/TensorRT-LLM that referenced this pull request Nov 3, 2026
….3: Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity

Forward-port of release/1.3 PR NVIDIA#20136
(release/1.3 commit 47c0479) to main.

The release PR cherry-picked main PR NVIDIA#20103, which was closed
without merging, so this change was not on main.

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
Signed-off-by: Simeng Liu <[email protected]>
SimengLiu-nv pushed a commit to SimengLiu-nv/TensorRT-LLM that referenced this pull request Nov 3, 2026
….3: Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity

Forward-port of release/1.3 PR NVIDIA#20136
(release/1.3 commit 47c0479) to main.

The release PR cherry-picked main PR NVIDIA#20103, which was closed
without merging, so this change was not on main.

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
Signed-off-by: Simeng Liu <[email protected]>
SimengLiu-nv pushed a commit to SimengLiu-nv/TensorRT-LLM that referenced this pull request Nov 3, 2026
….3: Pin GB300 GLM-5 ctx workers to their GPU's NUMA node in perf-sanity

Forward-port of release/1.3 PR NVIDIA#20136
(release/1.3 commit 47c0479) to main.

The release PR cherry-picked main PR NVIDIA#20103, which was closed
without merging, so this change was not on main.

Signed-off-by: chenfeiz0326 <[email protected]>
Co-authored-by: chenfeiz0326 <[email protected]>
Co-authored-by: Claude <[email protected]>
Signed-off-by: Simeng Liu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant