NVIDIA / NVIDIA/cuda-python

cuda.core: grown VMM buffers record the requested size, not the aligned size

Open
#2,907 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug cuda.core
Dominant language
Cython
Stars
3.4k
Forks
329
Avg merge
1d 23h
Merged PRs (30d)
116

Description

modify_allocation records new_size on the returned Buffer (slow path: Buffer.from_handle(ptr=new_ptr, size=new_size); fast path: buf._size = new_size), while allocate() records the granularity-aligned size. For a grow to a size that is not a multiple of the granularity (2 MiB on current GPUs), close() calls cuMemUnmap with an end inside the last mapping, which the driver rejects, so the reservation, the mappings, and the physical memory leak and the Buffer deleter reports a CUDAWarning. The equal-size branch hits the same alignment rule in cuMemSetAccess and raises. Reachable today through the slow path. No test grows to an unaligned size. Fix belongs to the ownership redesign (epic #2906).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in modify_allocation and compare the slow path's Buffer.from_handle size with the fast path's buf._size and allocate()'s aligned size. Exercise an unaligned grow and the equal-size branch, then verify close() reaches cuMemUnmap and cuMemSetAccess without CUDA warnings or leaks. Account for the ownership redesign in epic #2906 and add regression coverage for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.