Skip to content

[https://nvbugs/6756848][fix] Exchange the handle as its raw CUDA_IPC_HANDLE_SIZE (64-byte) struct bytes… - #19086

Open
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6756848
Open

[https://nvbugs/6756848][fix] Exchange the handle as its raw CUDA_IPC_HANDLE_SIZE (64-byte) struct bytes…#19086
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6756848

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: open_ipc_memory read/wrote cudaIpcMemHandle_t.reserved, removed in cuda-python 13.4, which the unbounded cuda-python>=13 pin allows.
  • Fix: Exchange the handle as its raw CUDA_IPC_HANDLE_SIZE (64-byte) struct bytes via getPtr(), which both 13.2.0 and 13.4.1 expose, so one path covers the supported range.
  • Original test: pytest tests/integration/defs/accuracy/test_llm_api_pytorch.py::TestLlama4SpeculativeDecoding::test_llama4_eagle3[dynamic] -v
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Reproduction comparison

  • Failed commit: no_failed_commit
  • ToT: repro_on_tot at d26f734
    Signature: RuntimeError: Executor worker returned error
  • Signature relation: not_comparable

Dev Engineer Review

  • tensorrt_llm/_ipc_utils.py now serializes CUDA IPC handles as raw 64-byte buffers through getPtr().
  • The change removes direct access to cudaIpcMemHandle_t.reserved, restoring compatibility with cuda-python 13.2.0–13.4.1.
  • The implementation avoids version-specific branching and preserves byte-identical handle round-tripping.
  • Per-file QA perspective: Verify multi-GPU allocation and IPC handle exchange across supported cuda-python versions. Confirm that ctypes.memmove copies exactly CUDA_IPC_HANDLE_SIZE bytes.

QA Engineer Review

No test changes.

…ct bytes

cuda-python 13.4 removed the `reserved` field from `cudaIpcMemHandle_t`,
leaving `getPtr()` as the only accessor. `open_ipc_memory` read and wrote
that field directly, so every multi-GPU run aborted while allocating the
AllReduce workspace with:

  AttributeError: 'cuda.bindings.runtime.cudaIpcMemHandle_t' object has no
  attribute 'reserved'

requirements.txt pins only `cuda-python>=13`, so 13.4 is an allowed
resolution and the crash reproduces on a stock install.

Exchange the handle as its raw CUDA_IPC_HANDLE_SIZE struct bytes via
`getPtr()`. Both 13.2.0 and 13.4.1 expose `getPtr()` and a 64-byte
CUDA_IPC_HANDLE_SIZE with a byte-identical round-trip, so a single path
covers the supported range without a version branch.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

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: 782f066f-e702-475b-a011-b90404bc771e

📥 Commits

Reviewing files that changed from the base of the PR and between a85c26c and 868f983.

📒 Files selected for processing (1)
  • tensorrt_llm/_ipc_utils.py

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.


Walkthrough

The CUDA IPC memory path now serializes handles as raw bytes. It uses ctypes, CUDA_IPC_HANDLE_SIZE, getPtr(), and ctypes.memmove to reconstruct handles.

Changes

CUDA IPC handle exchange

Layer / File(s) Summary
Raw handle serialization and reconstruction
tensorrt_llm/_ipc_utils.py
open_ipc_memory replaces reserved-field access with raw CUDA IPC handle buffers and ctypes.memmove reconstruction.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 868f9

The IPC handle compatibility update is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 identifies the NVBugs fix and clearly states the main change: exchanging CUDA IPC handles as raw 64-byte struct bytes.
Description check ✅ Passed The description explains the root cause, fix, affected cuda-python versions, test coverage, bug link, and reproduction results. It uses different headings from the template and does not include the PR…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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.

2 participants