You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(cuda.core): give the IPC pool owner's release a named deleter - #3548
Readability follow-up to #3511. Part 2 of 4 (stack: #3547 → #3548 → #3549 → #3552). No behavior change.
The deleter of an imported IPC pool was a 35-line lambda inside the shared_ptr constructor. It is now named steps, read top to bottom:
delete_ipc_pool_box(): the deleter. Releases only if the box owns_pool().
release_owned_ipc_pool(): revoke access, destroy imports, wake waiting importers, then report.
destroy_imports() / report_failed_destroys(): the loop and the failure report.
imports > 0 is now owns_pool(). Same driver calls in the same order. ipc_pool_registry moved up so the deleter can see it.
Testing
Top of the stack: the full cuda_core test suite passes on an RTX 5880 Ada (cu13), except test_object_code_load_rdc*, which cannot build its fixture on my machine (system nvcc rejects the environment's gcc).
clang-tidy clean, pre-commit clean.
No new tests: the existing tests cover this path.
PLC Local Security Evidence (Advisory)
Local advisory checks only, run over the whole stack. Not release-gate results.
Check
Status
Tool
Details
Secrets
SKIP
Pulse Secret Scanner
registry login failed locally; the repo trufflehog pre-commit hook passed
The deleter of an imported pool was a 35-line lambda inside the
shared_ptr constructor. Split it into named steps: destroy_imports(),
report_failed_destroys(), release_owned_ipc_pool() and the deleter
delete_ipc_pool_box(). "imports > 0" becomes owns_pool().
Same driver calls in the same order. No behavior change.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>
Reviewing files that changed from the base of the PR and between cd6579f and 9ed2aed.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Improved cleanup of shared CUDA memory pools when they are imported by multiple processes. Cleanup now releases registered pool state even if destroying an import fails, and reports the first failure afterward.
Corrected ownership tracking for imported pools.
IPC pool cleanup now runs only for owning boxes. The release path attempts destruction for every driver import, tracks failures, updates the live-owned count, releases the registry entry, and reports the first destroy failure afterward. The import path uses a named box deleter and records whether it became owner.
Changes: IPC pool ownership and cleanup
Layer / File(s)
Summary
Ownership detection and deleter wiring cuda_core/cuda/core/_cpp/rt/memory.cpp
IPC pool boxes expose an ownership check. The import path uses a named deleter and records whether the imported handle became the owner.
Owner cleanup and failure handling cuda_core/cuda/core/_cpp/rt/memory.cpp
The cleanup path attempts to destroy every driver import, decrements the live-owned count, releases the registry entry, and reports the first destroy failure.
Possibly related PRs
NVIDIA/cuda-python#3511: Introduced shared ownership for repeat IPC pool imports and the release behavior that this change refactors.
Suggested reviewers:juenglin, andy-jost, rwgk
Change: Refactor
Merge Risk: Minimal · previous review a1bba
This is a readability refactor of the imported IPC pool's release path, and no behavior change was found. No concrete merge-blocking risk remains. The existing IPC tests cover the release path.
Security architecture risk: Minimal · up to a1bba
The refactor preserves who can import a GPU memory pool, which owner cleans it up, and when waiting importers can proceed. No new or worsened risk was identified in the changed path.
Finishing Touches
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 5224ba6 and a1bba26.
Files selected for processing: 1
cuda_core/cuda/core/_cpp/rt/memory.cpp
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
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
cuda.coreEverything related to the cuda.core moduleenhancementAny code-related improvements
2 participants
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.
Description
Readability follow-up to #3511. Part 2 of 4 (stack: #3547 → #3548 → #3549 → #3552). No behavior change.
The deleter of an imported IPC pool was a 35-line lambda inside the
shared_ptrconstructor. It is now named steps, read top to bottom:delete_ipc_pool_box(): the deleter. Releases only if the boxowns_pool().release_owned_ipc_pool(): revoke access, destroy imports, wake waiting importers, then report.destroy_imports()/report_failed_destroys(): the loop and the failure report.imports > 0is nowowns_pool(). Same driver calls in the same order.ipc_pool_registrymoved up so the deleter can see it.Testing
cuda_coretest suite passes on an RTX 5880 Ada (cu13), excepttest_object_code_load_rdc*, which cannot build its fixture on my machine (system nvcc rejects the environment's gcc).PLC Local Security Evidence (Advisory)
Local advisory checks only, run over the whole stack. Not release-gate results.
Checklist
🤖 Generated with Claude Code