coreylowman / cudarc

Safe rust wrapper around CUDA toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `CudaSlice<T>` & remove `CudaRc`

coreylowman opened this issue · comments

Equivalent to Vec<T> on cpu. All APIs should accept this instead.

Notably this crate should not worry about compile time safety, and instead be as flexible as possible.

Equivalent to Vec<T> on cpu. All APIs should accept this instead.

So tensors and filter have a CudaSlice + Descriptor?

Notably this crate should not worry about compile time safety, and instead be as flexible as possible.

all unsafe?

Yep! The new cpu storage in dfdx looks like this:

struct StridedArray<S: Shape, E: Dtype> {
    data: Vec<E>,
    shape: S,
    strides: S::Concrete,
}

The cuda one will probably look pretty identical:

struct CudaStridedArray<S: Shape, E: Dtype> {
    data: CudaSlice<E>,
    shape: S,
    strides: S::Concrete,
}

all unsafe?

not unsafe, but moving to runtime tracked values instead of compile time. The current method of the type carrying the number of elements is more restrictive for dfdx now than it needs to be. all the compile time checks will be in dfdx, but not in this crate

ok

This was merged into main