Rust-GPU / Rust-GPU/rust-cuda

`DeviceCopy` should not require `Copy`

Open
#124 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.4k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

I am currently exploring moving from rustacuda to cust. cust now requires DeviceCopy: Copy, which is an insurmountable blocker for me:

  1. Copy is not strong enough by itself. For instance, *const T and &T are Copy but must not be DeviceCopy in general (unless they point to unified memory).

  2. Copy is too strict. Passing data to the GPU can be modelled as a borrow instead of a copy. The bitwise copy is just an implementation detail. A well-designed API on the host can then ensure that the borrow (or even move or copy semantics) on the host and on the GPU are maintained. However, this requires some unsafe escape hatch for copying !Copy types to the GPU.

Since cust does not implement any advanced rules for which types can and should be copied, it should - in my opinion - also not impose an overly strict requirement on DeviceCopy. Otherwise, it severely limits the safe APIs one can develop on top of cust.

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

The issue names DeviceCopy and its Copy requirement but provides no files, tests, or entry points. Start by locating the DeviceCopy definition and its Copy bound, then establish an agreed design for pointer, reference, and !Copy cases; done requires that design and corresponding validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
hpc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.