Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeviceCopy should not require Copy #124

Open
juntyr opened this issue Sep 26, 2024 · 0 comments
Open

DeviceCopy should not require Copy #124

juntyr opened this issue Sep 26, 2024 · 0 comments

Comments

@juntyr
Copy link

juntyr commented Sep 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant