Skip to main content

RudaTensor

Struct RudaTensor 

Source
pub struct RudaTensor<R>
where R: Runtime,
{ pub client: ComputeClient<R>, pub handle: Handle, pub meta: Box<Metadata>, pub device: <R as Runtime>::Device, pub dtype: DType, pub qparams: Option<QParams<QParamTensor>>, }
Expand description

The basic tensor primitive struct.

Fields§

§client: ComputeClient<R>

Compute client for the runtime.

§handle: Handle

The buffer where the data are stored.

§meta: Box<Metadata>

The metadata of the tensor.

§device: <R as Runtime>::Device

The device of the tensor.

§dtype: DType

The datatype of the tensor.

§qparams: Option<QParams<QParamTensor>>

Runtime quantization parameters, if applicable

Implementations§

Source§

impl<R> RudaTensor<R>
where R: Runtime,

Source

pub fn autotune_signature(&self) -> String

Exact tuning metadata, including view offsets and accessible storage size. Deliberately excludes allocation ids so equivalent invocations can share a cache entry.

Source

pub fn new( client: ComputeClient<R>, handle: Handle, metadata: Metadata, device: <R as Runtime>::Device, dtype: DType, ) -> RudaTensor<R>

Create a new standard tensor

Source

pub fn new_contiguous( client: ComputeClient<R>, device: <R as Runtime>::Device, shape: Shape, handle: Handle, dtype: DType, ) -> RudaTensor<R>

Create a new tensor with a contiguous memory layout.

Source

pub fn to_client( &mut self, client: ComputeClient<R>, device: <R as Runtime>::Device, ) -> RudaTensor<R>

Change the context of the current tensor and return the newly transferred tensor.

Source

pub fn binding(self) -> TensorBinding<R>

Return the reference to a tensor handle.

Source

pub fn elem_size(&self) -> usize

Returns the element size of this tensor

Source

pub fn into_tensor_arg(self) -> TensorArg<R>

Return the reference to a tensor argument.

Source

pub fn into_array_arg(self) -> ArrayArg<R>

Return the reference to an array argument.

Source

pub fn as_tensor_alias(&self, input_pos: usize) -> TensorArg<R>

Returns a reference to the aliased tensor argument.

Source

pub fn into_linear_view(self) -> ViewArg<usize, R>

Return a linear view of this tensor.

Source

pub fn as_linear_view_alias(&self, input_pos: usize) -> ViewArg<usize, R>

Return an aliased linear view of this tensor

Source

pub fn into_linear_view_like( self, reference: &RudaTensor<R>, ) -> ViewArg<usize, R>

Return a linear view broadcast to the reference tensor’s shape

Source

pub fn required_address_type(&self) -> AddressType

Returns the address type required to index this tensor

Source

pub fn try_scheme(&self) -> Option<&QuantScheme>

Return the QuantScheme if present

Source

pub fn can_mut_broadcast(&self, rhs: &RudaTensor<R>) -> bool

Source

pub fn copy(&self) -> RudaTensor<R>

Copy the current tensor.

Source

pub fn can_mut(&self) -> bool

Check if the tensor is safe to mutate.

Source

pub fn assert_is_on_same_device(&self, other: &RudaTensor<R>)
where <R as Runtime>::Device: PartialEq,

Assert that both tensors are on the same device.

Source

pub fn is_contiguous(&self) -> bool

Check if the current tensor is contiguous.

A tensor is contiguous if the elements are stored in memory if the strides in non-increasing order and the strides at position k is equal to the product of the shapes at all positions greater than k. However, all axes with a shape of 1 are ignored.

Source

pub fn is_contiguous_buffer(&self) -> bool

Check if the current tensor has a contiguous backing buffer (no overlap and no empty memory regions within the shape).

Source

pub fn is_nonoverlapping(&self) -> bool

Checks if the tensor is non-overlapping (can be safely written to).

Source§

impl<R> RudaTensor<R>
where R: Runtime,

Source

pub fn new_quantized( client: ComputeClient<R>, handle: Handle, shape: Shape, device: <R as Runtime>::Device, strides: Strides, dtype: DType, qparams: QParams<QParamTensor>, ) -> RudaTensor<R>

Create a new quantized tensor

Source

pub fn quantized_handles(&self) -> Option<(RudaTensor<R>, RudaTensor<R>)>

Returns the two tensors: (values, params) for a quantized tensor. For the values, native types that aren’t supported as a normal DType will be returned as an unsigned integer tensor representing the bits. Should be reconstructed using from_bits in kernels.

Source

pub fn scales(&self) -> Option<RudaTensor<R>>

Construct a separate tensor for the quantization scales, if present

Trait Implementations§

Source§

impl<R> AutotuneOutput for RudaTensor<R>
where R: Runtime,

Source§

fn validate_for_tuning( &self, other: &RudaTensor<R>, absolute: f64, relative: f64, max_bytes: u64, ) -> Result<bool, String>

Fallible correctness gate for stack autotuning. Ok(false) explicitly means that this output has no validator; a successful launch alone is NOT a correctness check. Existing implementers need not add a method. Strict stack policy rejects unsupported output.
Source§

impl<R> Clone for RudaTensor<R>
where R: Runtime,

Source§

fn clone(&self) -> RudaTensor<R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R> Debug for RudaTensor<R>
where R: Runtime,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<R> QTensorPrimitive for RudaTensor<R>
where R: Runtime,

Source§

fn scheme(&self) -> &QuantScheme

Returns the quantization settings for the given tensor.
Source§

fn acc_precision(&self) -> QuantAcc

The precision used for the accumulation in various kernels.
Source§

fn propagation(&self) -> QuantPropagation

How quantization is propagated during computation.
Source§

fn default_scheme() -> QuantScheme

Returns the default tensor quantization scheme.
Source§

impl<R> RequiredAddrType for RudaTensor<R>
where R: Runtime,

Source§

impl<R> TensorMetadata for RudaTensor<R>
where R: Runtime,

Source§

fn dtype(&self) -> DType

The dtype of the tensor.
Source§

fn shape(&self) -> Shape

The shape of the tensor.
Source§

fn rank(&self) -> usize

The number of dimensions of the tensor.

Auto Trait Implementations§

§

impl<R> !RefUnwindSafe for RudaTensor<R>

§

impl<R> !UnwindSafe for RudaTensor<R>

§

impl<R> Freeze for RudaTensor<R>

§

impl<R> Send for RudaTensor<R>
where ComputeClient<R>: Send, <R as Runtime>::Device: Send,

§

impl<R> Sync for RudaTensor<R>
where ComputeClient<R>: Sync, <R as Runtime>::Device: Sync,

§

impl<R> Unpin for RudaTensor<R>
where ComputeClient<R>: Unpin, <R as Runtime>::Device: Unpin,

§

impl<R> UnsafeUnpin for RudaTensor<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<C> CloneExpand for C
where C: Clone,

Source§

fn __expand_clone_method(&self, _scope: &mut Scope) -> C

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.