Skip to content

feat(cuda-core): add borrowed DeviceBuffer subviews - #1447

Open
uurl wants to merge 1 commit into
NVIDIA:mainfrom
uurl:feat/device-buffer-subviews
Open

uurl wants to merge 1 commit into
NVIDIA:mainfrom
uurl:feat/device-buffer-subviews

Conversation

@uurl

@uurl uurl commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Transplants NVlabs/cutile-rs#308 into NVIDIA/cuda-rust.

Adds safe, non-owning borrowed subviews of DeviceBuffer<T>, enabling access to contiguous regions of device memory without transferring allocation ownership.

Implements the host-side borrowed subviews requested in #968.
Typed launcher integration remains follow-up work.

Changes

  • Add DeviceSlice<'a, T> and DeviceSliceMut<'a, T>.
  • Add checked slicing and mutable slicing of device buffers.
  • Support splitting views into disjoint subviews.
  • Support converting mutable subviews into shared subviews.
  • Add bounds and overflow validation.
  • Add unit, integration, and compile-fail tests.
  • Preserve the original implementation and authorship.

Original PR: NVlabs/cutile-rs#308
Migration tracking issue: #1437

Testing

All checks passed:

  • cargo test -p cuda-core --lib — 50 passed.

  • cargo test -p cuda-core --test simt_device_buffer — 16 passed.

  • cargo test -p cuda-core --doc — 4 passed, 3 ignored.

  • cargo clippy -p cuda-core --all-targets -- -D warnings — passed.

  • cargo fmt --all -- --check — passed.

  • git diff --check upstream/main...HEAD — passed.

  • just -f cuda-oxide/Justfile check — passed.

  • cargo oxide run vecadd — all 1024 elements correct.

  • bash scripts/smoketest.sh -o '^vecadd$' — 1/1 passed.

  • just -f cuda-oxide/Justfile check passes

  • cargo oxide run <example> passes, or smoketest

Checklist

  • All commits signed off (git commit -s)
  • SPDX headers on new source files (no new files)

Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

runtime Shared runtime crates: cuda-bindings, cuda-core, cuda-core-derive, cuda-async; Tile and SIMT co-own

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants