Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

feat(cuda-core): add zero-copy PinnedHostMapping and DeviceAllocation bridge

Open
#1,431 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
15/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
backend

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

cutile-rs post-migration-pr

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

  1. cuda-core:
    • Added PinnedHostMapping RAII struct that binds host memory via host_register and guarantees unregistration on drop.
    • Implemented Deref<Target = [u8]>, DerefMut, AsRef<[u8]>, and AsMut<[u8]>.
    • Provided constructors PinnedHostMapping::new and PinnedHostMapping::register with explicit flags (CU_MEMHOSTREGISTER_*).
    • Added low-level FFI helpers: host_register, host_unregister, and host_get_device_pointer.
  2. cuda-async:
    • Implemented DeviceAllocation for PinnedHostMapping, enabling direct integration with async copy and stream execution pipelines.
  3. Soundness & Safety:
    • Zero-length registration rejects early (CUDA_ERROR_INVALID_VALUE).
    • CU_MEMHOSTREGISTER_DEVICEMAP is ensured so that device pointer queries succeed reliably.
    • Context is bound to the thread during register and unregister.

Validation

  • cargo fmt -- --check passes cleanly.
  • Unit test tests::register_rejects_zero_length validates 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

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.

More from NVIDIA/cuda-rust

All issues in NVIDIA/cuda-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.