Skip to content

[#14500][fix] avoid TypedStorage wrapper in CUTLASS MoE expert key on UMA GPUs - #14586

Open
ssam18 wants to merge 3 commits into
NVIDIA:mainfrom
ssam18:fix/14500-uma-storage-data-ptr
Open

ssam18 wants to merge 3 commits into
NVIDIA:mainfrom
ssam18:fix/14500-uma-storage-data-ptr

Conversation

@ssam18

@ssam18 ssam18 commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

load_expert_w3_w1_weight and load_expert_w3_w1_weight_scale_nvfp4 in the CUTLASS NVFP4 fused-MoE path key a per-expert accumulator dict by (dst.storage().data_ptr(), expert_idx). The .storage() call constructs a (deprecated) TypedStorage Python wrapper around the underlying ATen storage.

On integrated GPU with UMA-backed CUDA storage (NVIDIA GB10 / sm_121, Grace-Blackwell), that wrapper construction calls into NVRM to query device properties for the storage. The call enters a memory-handshake ioctl loop that does not terminate. Cold-start hangs at Loading weights concurrently: 0/1288 with one worker thread at 100 % CPU spinning on ioctl(_, _IOC(R|W, 0x46, 0x2a, 0x20), …) = 0. The TypedStorage is deprecated warning is logged immediately above the hang site, confirming the trip is in the wrapper construction.

Change

Two-line swap at the two affected sites in tensorrt_llm/_torch/modules/fused_moe/quantization.py:

-        dst_base = dst_w3_w1_weight_scale.storage().data_ptr()
+        dst_base = dst_w3_w1_weight_scale.data_ptr()
...
-        dst_base = dst_w3_w1_weight.storage().data_ptr()
+        dst_base = dst_w3_w1_weight.data_ptr()

tensor.data_ptr() returns the same disambiguating value — different storage allocations (regular vs shared experts pointing at different dst buffers) have different data pointers — without going through the Storage wrapper. The consumer in process_weights_after_loading() iterates the dict via .values() and never looks up by key, so the key only needs to correctly partition calls into setdefault; both choices satisfy that.

Added an explanatory comment above the first site (with the second referring back to it) so a future reviewer understands why this isn't just stylistic preference.

End-to-end validation

The issue reporter (@zentradev-rabih) validated this patch on GB10 / sm_121a hardware in issue #14500:

  • Cold start: rc15 + this patch came up in ~5 min, parity with rc12 (which was the only working release before this)
  • 20-minute soak: 10 concurrent streamers (above the 8-slot batch ceiling), 15 % cancellation rate, mixed prompt sizes
  • Result: 0 engine deaths, 0 cancel hangs, engine still serving post-soak. 70 157 tokens streamed across 119 dispatched requests/82 completed/18 cancelled cleanly. The 9 read_timeout errors are harness-side queue-wait timeouts (expected at 10 concurrent vs 8-slot batch), not engine failures.

I don't have GB10 hardware myself; the validation above is the reporter's. The change is a two-line swap that is reversible if any unforeseen issue surfaces in CI.

Notes for reviewers

  • Scope: Only the CUTLASS NVFP4 MoE path is touched. Discrete-GPU NVFP4 loading and all other backends are unaffected — tensor.data_ptr() works identically on discrete-GPU CUDA tensors and was always a cheaper call than tensor.storage().data_ptr().

  • Why this happens specifically on integrated GPU: the Skipping device transfer from cpu to cuda on integrated GPU to conserve shared memory log immediately above the hang site indicates dst_w3_w1_weight stays host/UMA-backed. The TypedStorage wrapper construction on UMA-backed CUDA storage is what trips NVRM; on discrete GPU the same wrapper construction completes quickly because the device-property query is cached differently.

  • Bisect: the per-expert dict-accumulation pattern was introduced between rc12 and HEAD (likely f15af81 EPLB host memory reduction or 1f5339f shared-expert index fix). The fix doesn't depend on which commit introduced the pattern — both call sites swap independently.

  • Companion issue: the reporter found a second, separate failure mode when re-enabling MTP on rc15 + this patch (CUTLASS sm_120 grouped-GEMM init → SMEM shortfall → Triton fallback emits .rs PTX rejected by PTXAS on sm_121a). Tracked at 1.3.0rc15 on sm_121a / GB10: MTP path fails — CUTLASS sm_120 grouped-GEMM init → SMEM shortfall → Triton fallback emits .rs PTX rejected by PTXAS #14575, out of scope for this PR. Fixes 1.3.0rc15: trtllm-serve hangs in fused_moe/quantization.py during cold-start on GB10 / sm_121 — 1.3.0rc12 works with identical config #14500.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed an issue with the caching mechanism for quantized Mixture of Experts models in TensorRT LLM. The fix properly distinguishes between regular and shared expert configurations during model loading, improving correctness and reliability of quantized model inference.

Review Change Stack

…key on UMA GPUs

`load_expert_w3_w1_weight` and `load_expert_w3_w1_weight_scale_nvfp4` in
the CUTLASS NVFP4 fused-MoE path key a per-expert accumulator dict by `(dst.storage().data_ptr(), expert_idx)`. The `.storage()` call constructs a (deprecated) `TypedStorage` Python wrapper around the underlying ATen storage. On integrated GPU with UMA-backed CUDA storage (e.g. NVIDIA GB10/sm_121), that wrapper construction calls into NVRM to query device properties for the storage; the call enters a memory handshake ioctl loop that does not terminate. Cold-start hangs at "Loading weights concurrently: 0/1288" with one worker thread at 100% CPU spinning on `ioctl(_, _IOC(R|W, 0x46, 0x2a, 0x20), …) = 0`. The TypedStorage deprecation warning is logged immediately above the hang site, confirming the trip is in wrapper construction.

Switch the key value to `tensor.data_ptr()`. This returns the same disambiguating value -- different storage allocations (regular vs shared experts pointing at different dst buffers) have different data pointers -- without going through the Storage wrapper. The consumer in `process_weights_after_loading()` iterates the dict via `.values()` and never looks up by key, so the key only needs to correctly partition calls into `setdefault`, both choices satisfy that.

End-to-end validated on GB10 / sm_121a by the issue reporter
(zentradev-rabih in NVIDIA#14500): rc15 + this patch cold-starts in ~5 min (parity with rc12), serves a 20-minute soak at 10-concurrent/8-slot-batch with 15 % cancellation, zero engine deaths, zero cancel hangs.

Signed-off-by: Samaresh Kumar Singh <[email protected]>
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 07634de1-152f-40eb-8bbd-7bebb1ee046e

📥 Commits

Reviewing files that changed from the base of the PR and between 1f8312d and 17c2763.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/modules/fused_moe/quantization.py

📝 Walkthrough

Walkthrough

This PR fixes a TypedStorage deprecation issue in NVFP4 fused-MoE weight loading that was causing hangs on integrated GPUs (sm_121). The cache key derivation is updated from tensor.storage().data_ptr() to tensor.data_ptr() in two weight-loading methods to avoid deprecated storage API usage.

Changes

NVFP4 Cache Key Derivation Fix

Layer / File(s) Summary
NVFP4 weight scale and weight cache key updates
tensorrt_llm/_torch/modules/fused_moe/quantization.py
Cache keys for per-expert weight scales and weights in load_expert_w3_w1_weight_scale_nvfp4 and load_expert_w3_w1_weight are changed from dst_w3_w1_*.storage().data_ptr() to dst_w3_w1_*.data_ptr() to remove deprecated TypedStorage usage while maintaining the (dst_base, expert_idx) structure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: avoiding TypedStorage wrapper in CUTLASS MoE expert key on UMA GPUs, which directly corresponds to the two-line swap in quantization.py.
Description check ✅ Passed The PR description comprehensively covers the issue, the technical root cause, the fix, validation results, and scope limitations, addressing all key aspects of why and how the change solves the problem.
Linked Issues check ✅ Passed The PR fully addresses the requirements from issue #14500 by fixing the TypedStorage wrapper hang on GB10/sm_121 integrated GPUs, as validated by the reporter on that hardware with cold-start recovery and successful 20-minute soak testing.
Out of Scope Changes check ✅ Passed All changes are strictly scoped to the CUTLASS NVFP4 MoE weight-loading path with no unrelated modifications; discrete-GPU NVFP4 and other backends are explicitly unaffected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@mikeiovine

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51677 [ run ] triggered by Bot. Commit: 17c2763 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51677 [ run ] completed with state SUCCESS. Commit: 17c2763
/LLM/main/L0_MergeRequest_PR pipeline #41057 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@mikeiovine

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #52123 [ run ] triggered by Bot. Commit: 17c2763 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #52123 [ run ] completed with state SUCCESS. Commit: 17c2763
/LLM/main/L0_MergeRequest_PR pipeline #41448 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

@ssam18 this pull request has had no activity for more than 120 days and currently has merge conflicts. Is it still active? Please resolve the conflicts or post an update. Otherwise, it will be closed after another 60 days of inactivity.

This branch has not been deployed

No deployments
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.3.0rc15: trtllm-serve hangs in fused_moe/quantization.py during cold-start on GB10 / sm_121 — 1.3.0rc12 works with identical config

3 participants