Skip to content

fix(core): restore access descriptors when a VMM grow rolls back - #2440

Open
aryanputta wants to merge 2 commits into
NVIDIA:mainfrom
aryanputta:fix/vmm-rollback-restore-access
Open

fix(core): restore access descriptors when a VMM grow rolls back#2440
aryanputta wants to merge 2 commits into
NVIDIA:mainfrom
aryanputta:fix/vmm-rollback-restore-access

Conversation

@aryanputta

Copy link
Copy Markdown
Contributor

Description

Defect 1 of #2388, continuing the per-defect split from #2407 (defect 2) and #2418 (defect 4).

_grow_allocation_slow_path() unmaps the old VA range before remapping the physical memory into the new reservation. Access permissions live on the mapping, so that unmap drops the resource's access descriptors. The _remap_old rollback restored the mapping but not the descriptors, so a buffer recovered from a failed grow was mapped and yet not accessible: it faulted on its next access until cuMemSetAccess was run again.

_remap_old now reapplies the access descriptors to the old range after the remap succeeds. It stays inside the same best-effort try, so a failure while restoring access cannot mask the error that triggered the rollback.

The descriptor list is now built once above the transaction and shared by the forward path and the rollback, rather than built only at the point of use near the end. The rollback restores exactly the descriptors the grow was in the middle of applying, and there is one source of truth for them.

Test

test_vmm_allocator_grow_slow_path_rollback_restores_access fails cuMemSetAccess over the new range to drive the transaction into rollback, then asserts that the old range is remapped, that its access is reapplied, that the two happen in that order, and that the failed reservation is still freed. Reverting the three added lines fails the test on the restored-access assertion.

Checks

  • ruff check, ruff format
  • mypy-cuda-core
  • cython-lint, stubgen-pyx
  • lychee, SPDX headers, rst hooks

The slow-path rollback in modify_allocation remapped the old physical
memory to its original address but never reapplied the access
descriptors that the preceding unmap dropped, so a buffer recovered by
a failed grow faulted on its next access until cuMemSetAccess was run
again.

Hoist the descriptor list above the transaction so the rollback applies
the same descriptors the forward path does, and reapply them to the old
range after the remap succeeds.

Defect 1 of NVIDIA#2388.

Signed-off-by: Aryan <aryansputta@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Jul 28, 2026
Signed-off-by: Aryan <aryansputta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant