Skip to main content

SpMmOpPlan

Struct SpMmOpPlan 

Source
pub struct SpMmOpPlan<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> SpMmOpPlan<'a>

Source

pub fn create( ctx: &'a Context, op_a: Operation, op_b: Operation, matrix_a: &'a SparseMatrixDescriptor<'a>, matrix_b: &'a DenseMatrixDescriptor<'a>, matrix_c: &'a mut DenseMatrixDescriptor<'a>, compute_type: DataType, algorithm: SpMmOpAlgorithm, add_operation_ltoir: Option<&[u8]>, mul_operation_ltoir: Option<&[u8]>, epilogue_ltoir: Option<&[u8]>, ) -> Result<(Self, usize)>

Source

pub fn context(&self) -> &Context

Source

pub fn execute(&self, external_buffer: Option<DevicePtr>) -> Result<()>

NVRTC and nvJitLink are not currently available on Arm64 Android platforms.

This operation does not support Android and Tegra platforms except Judy (sm87).

Experimental: multiplies matrix_a and matrix_b with custom operators.

where

  • op(A) is a sparse matrix of size $m \times k$.
  • op(B) is a dense matrix of size $k \times n$.
  • C is a dense matrix of size $m \times n$.
  • $\oplus$, $\otimes$, and $\text{epilogue}$ are custom add, mul, and epilogue operators respectively.

op(A) is selected by op_a and may be A, A^T, or A^H. op(B) is selected by op_b and may be B, B^T, or B^H.

Only op_a == Operation::NonTranspose is currently supported.

SpMmOpPlan::create returns the workspace size together with the compiled kernel state needed by SpMmOpPlan::execute.

The custom add, multiply, and epilogue operators must accept and return the selected compute type. The compute type may be float, double, cuComplex, cuDoubleComplex, or int.

SpMmOpPlan::execute supports the following sparse matrix formats:

SpMmOpPlan::execute supports the following index type for representing matrix_a:

SpMmOpPlan::execute supports the following data types:

Uniform-precision computation:

Mixed-precision computation:

SpMmOpPlan::execute supports the following algorithms:

AlgorithmNotes
SpMmOpAlgorithm::DefaultDefault algorithm for any sparse matrix format.

Performance notes:

  • Row-major layout provides higher performance than column-major.

SpMmOpPlan::execute has the following properties:

  • Requires extra storage.
  • Supports asynchronous execution.
  • Provides deterministic (bitwise) results for each run.
  • Allows the indices of matrix_a to be unsorted.

SpMmOpPlan::execute supports the following optimizations:

  • CUDA graph capture.
  • Hardware Memory Compression.
§Errors

Returns an error if the CUDA context cannot be bound or if cuSPARSE rejects the prepared SpMM operation.

Source

pub fn as_raw(&self) -> cusparseSpMMOpPlan_t

Source

pub unsafe fn from_raw( ctx: &'a Context, handle: cusparseSpMMOpPlan_t, ) -> Result<Self>

Wraps an existing cuSPARSE SpMM operation plan and takes ownership of it.

§Safety

handle must be a valid cusparseSpMMOpPlan_t associated with ctx and with matrix descriptors that remain valid for lifetime 'a. Ownership of handle is transferred to the returned plan, and the handle must not be destroyed elsewhere after calling this function.

Source

pub fn into_raw(self) -> cusparseSpMMOpPlan_t

Consumes the plan and returns the raw cuSPARSE handle without destroying it.

The caller becomes responsible for eventually destroying the returned handle with cusparseSpMMOp_destroyPlan.

Trait Implementations§

Source§

impl<'a> Debug for SpMmOpPlan<'a>

Source§

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

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

impl Drop for SpMmOpPlan<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for SpMmOpPlan<'_>

Source§

impl Sync for SpMmOpPlan<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for SpMmOpPlan<'a>

§

impl<'a> RefUnwindSafe for SpMmOpPlan<'a>

§

impl<'a> Unpin for SpMmOpPlan<'a>

§

impl<'a> UnsafeUnpin for SpMmOpPlan<'a>

§

impl<'a> UnwindSafe for SpMmOpPlan<'a>

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<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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.