feat(cuda-core): add zero-copy PinnedHostMapping and DeviceAllocation bridge
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 15/100
Research direction
Read AGENTS.md's “Transplanting a cutile-rs pull request” section first; it describes replaying pull request #279 from NVlabs/cutile-rs while preserving authorship and sign-off. The work spans cuda-core and cuda-async; inspect the original pull request and its validation, including tests::register_rejects_zero_length. Done means recreating the change against this repository and validating it here.
Written by the indexing model from the issue text.
Description
Tracks pull request NVlabs/cutile-rs#279 (https://github.com/NVlabs/cutile-rs/pull/279) by @emersonbusson, opened 2026-09-13: feat(cuda-core): add zero-copy PinnedHostMapping and DeviceAllocation bridge. The branch was rebased onto cutile-rs main on 2026-10-07 and merges cleanly.
@emersonbusson: that repository has moved here and is being archived, so the pull request is closed there, not rejected. If you want to continue the work, please recreate it against NVIDIA/cuda-rust. AGENTS.md in NVIDIA/cuda-rust has a "Transplanting a cutile-rs pull request" section that lets an agent do the replay (it fetches pull/279/head from NVlabs/cutile-rs, keeps your authorship and sign-off, and maps the moved paths).
Original description:
Summary
This PR introduces zero-copy host memory registration via cuMemHostRegister and cuMemHostUnregister, exposing a safe RAII abstraction PinnedHostMapping in cuda-core and bridging it to cuda-async via DeviceAllocation.
Motivation
When working with high-throughput streaming workloads, system page tiering, or pre-allocated userspace/OS buffers (e.g. hugepages, NUMA-pinned memory, kernel drivers), copying memory into PinnedHostBuffer adds unnecessary CPU overhead and allocation latency. cuMemHostRegister allows page-locking existing memory and obtaining a device-accessible pointer directly without copying.
Changes
cuda-core:- Added
PinnedHostMappingRAII struct that binds host memory viahost_registerand guarantees unregistration on drop. - Implemented
Deref<Target = [u8]>,DerefMut,AsRef<[u8]>, andAsMut<[u8]>. - Provided constructors
PinnedHostMapping::newandPinnedHostMapping::registerwith explicit flags (CU_MEMHOSTREGISTER_*). - Added low-level FFI helpers:
host_register,host_unregister, andhost_get_device_pointer.
- Added
cuda-async:- Implemented
DeviceAllocationforPinnedHostMapping, enabling direct integration with async copy and stream execution pipelines.
- Implemented
- Soundness & Safety:
- Zero-length registration rejects early (
CUDA_ERROR_INVALID_VALUE). CU_MEMHOSTREGISTER_DEVICEMAPis ensured so that device pointer queries succeed reliably.- Context is bound to the thread during register and unregister.
- Zero-length registration rejects early (
Validation
cargo fmt -- --checkpasses cleanly.- Unit test
tests::register_rejects_zero_lengthvalidates early refusal contracts. - Strictly additive API; zero breaking changes.
- Dominant language
- Rust
- Stars
- 3.8k
- Forks
- 325
- Avg merge
- 5d 19h
- Merged PRs (30d)
- 73
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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-rust
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NVIDIA/cuda-rust#1568 · 1 comment ·
Maintainers usually reply within 1 day
-
[BUG]: The doc of trait `LoadTileLike` is incorrectMay be free again @akhil9tiet claimed this 8 days ago, and no pull request is open. Openbug
Difficulty 1/5 Under an hour Newbie friendliness 72/100
NVIDIA/cuda-rust#1523 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NVIDIA/cuda-rust#1303 · 1 comment ·
Maintainers usually reply within 1 day
All issues in NVIDIA/cuda-rust
Similar issues
-
checkpoint/verify/rebuild_indexes on a thread holding a WriteTransaction deadlock instead of INT-001Openbug known-issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
project-minigraf/minigraf#734 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug CLI documentation
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
openai/codex#56630 · 3 comments · 3 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
DayuanJiang/PecoFence#139 ·
Maintainers usually reply within 1 day