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
Four pre-existing defects in VirtualMemoryResource, all found while verifying #2235 (verification details in #2235 (review)); none are introduced by that PR.
Rollback of a failed grow loses access grants — if modify_allocation() fails after the old range has been remapped (slow path), the _remap_old rollback restores the mapping at the original address but never re-applies the access descriptors, so the rolled-back buffer faults on its next access until cuMemSetAccess is re-run. Reproduced on main by forcing cuMemSetAccess to fail during a grow. Likely fix: _remap_old should re-apply the resource's access descriptors to the old range (best-effort, matching the remap itself).
The grow fast path is dead code — this check compares a CUdeviceptr against a plain int, and CUdeviceptr(x) == x is always False, so modify_allocation() always takes the slow path (full re-reserve + remap, base pointer changes) even when the driver granted the exact contiguous extension address. Fix: compare int(new_ptr).
Warning spam after every slow-path grow — the slow path calls buf._clear() so the old buffer's destructor won't double-free, but the destructor still calls deallocate(), emitting Warning: mr.deallocate() failed during Buffer destruction: CUDA_ERROR_INVALID_VALUE at GC after each grow. (Adjacent to the existing TODO referencing Bug in _grow_allocation_fast_path #2049.)
handle_type docstring is wrong — the docstring claims posix_fd is "required for cuMemRetainAllocationHandle"; retain works on handle_type=None allocations (verified on driver r595) and the driver documentation has no such restriction.
Component
cuda.core
What happened?
Four pre-existing defects in
VirtualMemoryResource, all found while verifying #2235 (verification details in #2235 (review)); none are introduced by that PR.Rollback of a failed grow loses access grants — if
modify_allocation()fails after the old range has been remapped (slow path), the_remap_oldrollback restores the mapping at the original address but never re-applies the access descriptors, so the rolled-back buffer faults on its next access untilcuMemSetAccessis re-run. Reproduced onmainby forcingcuMemSetAccessto fail during a grow. Likely fix:_remap_oldshould re-apply the resource's access descriptors to the old range (best-effort, matching the remap itself).The grow fast path is dead code — this check compares a
CUdeviceptragainst a plainint, andCUdeviceptr(x) == xis alwaysFalse, somodify_allocation()always takes the slow path (full re-reserve + remap, base pointer changes) even when the driver granted the exact contiguous extension address. Fix: compareint(new_ptr).Warning spam after every slow-path grow — the slow path calls
buf._clear()so the old buffer's destructor won't double-free, but the destructor still callsdeallocate(), emittingWarning: mr.deallocate() failed during Buffer destruction: CUDA_ERROR_INVALID_VALUEat GC after each grow. (Adjacent to the existing TODO referencing Bug in_grow_allocation_fast_path#2049.)handle_typedocstring is wrong — the docstring claims posix_fd is "required for cuMemRetainAllocationHandle"; retain works onhandle_type=Noneallocations (verified on driver r595) and the driver documentation has no such restriction.-- Leo's bot