pub enum TensorArg<'a, R: Runtime> {
Handle {
handle: TensorHandleRef<'a, R>,
vectorization_factor: u8,
},
Alias {
input_pos: usize,
},
}
Expand description
Argument to be used for tensors passed as arguments to kernels.
Variants§
Handle
The tensor is passed with a tensor handle.
Fields
§
handle: TensorHandleRef<'a, R>
The tensor handle.
Alias
The tensor is aliasing another input tensor.
Implementations§
Source§impl<'a, R: Runtime> TensorArg<'a, R>
impl<'a, R: Runtime> TensorArg<'a, R>
Sourcepub unsafe fn from_raw_parts<E: CubePrimitive>(
handle: &'a Handle,
strides: &'a [usize],
shape: &'a [usize],
factor: u8,
) -> Self
pub unsafe fn from_raw_parts<E: CubePrimitive>( handle: &'a Handle, strides: &'a [usize], shape: &'a [usize], factor: u8, ) -> Self
Create a new tensor argument specified with its vectorization factor.
§Safety
If you provide wrong strides or shapes, it might create undefined behavior caused by out-of-bound reads and writes.
Sourcepub unsafe fn from_raw_parts_and_size(
handle: &'a Handle,
strides: &'a [usize],
shape: &'a [usize],
factor: u8,
elem_size: usize,
) -> Self
pub unsafe fn from_raw_parts_and_size( handle: &'a Handle, strides: &'a [usize], shape: &'a [usize], factor: u8, elem_size: usize, ) -> Self
Create a new tensor argument specified with its vectorization factor with a manual element size in bytes.
§Safety
If you provide wrong strides or shapes, it might create undefined behavior caused by out-of-bound reads and writes.
Trait Implementations§
Source§impl<R: Runtime> ArgSettings<R> for TensorArg<'_, R>
impl<R: Runtime> ArgSettings<R> for TensorArg<'_, R>
Source§fn register(&self, launcher: &mut KernelLauncher<R>)
fn register(&self, launcher: &mut KernelLauncher<R>)
Register the information of an argument to the KernelLauncher.
Auto Trait Implementations§
impl<'a, R> Freeze for TensorArg<'a, R>
impl<'a, R> RefUnwindSafe for TensorArg<'a, R>where
R: RefUnwindSafe,
impl<'a, R> Send for TensorArg<'a, R>
impl<'a, R> Sync for TensorArg<'a, R>
impl<'a, R> Unpin for TensorArg<'a, R>where
R: Unpin,
impl<'a, R> UnwindSafe for TensorArg<'a, R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more