Skip to content

Avoid freeing failed VMM grow reservations#2237

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/vmm-grow-reserve-fallback
Open

Avoid freeing failed VMM grow reservations#2237
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/vmm-grow-reserve-fallback

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • Split the VMM grow adjacent-reservation fallback into failed-reservation and noncontiguous-reservation cases.
  • Only call cuMemAddressFree when cuMemAddressReserve succeeded and returned a noncontiguous address.
  • Add regression coverage for both fallback paths.

Why

The previous grow path called cuMemAddressFree(new_ptr, ...) even when the adjacent cuMemAddressReserve call failed with a recoverable error. In that case the returned pointer is not an owned reservation, so cleanup can turn a recoverable fallback into another driver error.

Checks

  • python3 -m py_compile cuda_core/cuda/core/_memory/_virtual_memory_resource.py cuda_core/tests/test_memory.py
  • git diff --check -- cuda_core/cuda/core/_memory/_virtual_memory_resource.py cuda_core/tests/test_memory.py

Not run locally:

  • uv run --no-project --with pytest --with cuda-bindings --with cuda-pathfinder --with numpy python -m pytest cuda_core/tests/test_memory.py -k 'vmm_allocator_grow_allocation_does_not_free_failed_adjacent_reservation or vmm_allocator_grow_allocation_frees_noncontiguous_adjacent_reservation'

The isolated test environment on this macOS arm64 host cannot resolve cuda-bindings, because published wheels are available for Linux and Windows but not this platform.

@copy-pr-bot

copy-pr-bot Bot commented Jun 17, 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 Jun 17, 2026
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