cuda.core: VirtualMemoryResource.deallocate() unmaps without ordering on the stream
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- backend-api-design, performance
Research direction
Start at VirtualMemoryResource.deallocate() and compare its handling of stream validation and cuMemUnmap with _SynchronousMemoryResource and LegacyPinnedMemoryResource. Confirm Buffer.close()'s stream-ordering documentation, then verify that deallocation synchronizes the stream before unmapping and that the slow-path grow behavior remains correct.
Written by the indexing model from the issue text.
Description
Summary
VirtualMemoryResource.deallocate() validates its stream argument and then calls cuMemUnmap at once. The VMM unmap does not synchronize, so work still in flight on the buffer accesses an unmapped range.
Buffer.close() documents stream-ordered deallocation, and the two synchronous resources (_SynchronousMemoryResource, LegacyPinnedMemoryResource) call stream.sync() before they free. VirtualMemoryResource is the only synchronous resource that skips this.
Suggested fix
Sync the stream before cuMemUnmap, as the siblings do. After #2880 the slow-path grow closes the old buffer through deallocate(), so a grow will sync once; that is the correct cost for a synchronous resource.
Refs: found while analyzing #2882.
- Dominant language
- Cython
- Stars
- 3.4k
- Forks
- 329
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 113
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/cuda-python
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NVIDIA/cuda-python#2717 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
NVIDIA/cuda-python#2712 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NVIDIA/cuda-python#2646 · 1 reaction ·
-
cuda.core triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
NVIDIA/cuda-python#2435 · 1 comment ·
-
CI/CD
NVIDIA/cuda-python#2926 · 1 assignee ·
All issues in NVIDIA/cuda-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-api#45 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·