Skip to content

DeviceCopy should not require Copy #124

Description

@juntyr

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions