Skip to main content

Plan

Struct Plan 

Source
pub struct Plan<'h> { /* private fields */ }
Expand description

A compiled operation plan. Dispatch to the matching execute method based on the op kind that built it.

Implementations§

Source§

impl<'h> Plan<'h>

Source

pub fn new( op: &OperationDescriptor<'h>, pref: &PlanPreference<'h>, workspace_size_limit: u64, ) -> Result<Self>

Compile an operation descriptor into a plan. workspace_size_limit bytes — pass the estimate.

Source

pub fn as_raw(&self) -> cutensorPlan_t

Raw cutensorPlan_t. Use with care.

Source

pub unsafe fn contract( &self, alpha: *const c_void, a: *const c_void, b: *const c_void, beta: *const c_void, c: *const c_void, d: *mut c_void, workspace: *mut c_void, workspace_bytes: u64, stream: *mut c_void, ) -> Result<()>

Execute a contraction plan. Aborts if self wasn’t built from a Contraction descriptor.

§Safety

All device pointers must be live, tensor-descriptor-conforming, and aligned. workspace must be at least the estimated size.

Source

pub unsafe fn reduce( &self, alpha: *const c_void, a: *const c_void, beta: *const c_void, c: *const c_void, d: *mut c_void, workspace: *mut c_void, workspace_bytes: u64, stream: *mut c_void, ) -> Result<()>

Execute a reduction plan.

§Safety

Same as Self::contract.

Source

pub unsafe fn elementwise_binary( &self, alpha: *const c_void, a: *const c_void, gamma: *const c_void, c: *const c_void, d: *mut c_void, stream: *mut c_void, ) -> Result<()>

Execute an elementwise-binary plan.

§Safety

Same as Self::contract.

Source

pub unsafe fn elementwise_trinary( &self, alpha: *const c_void, a: *const c_void, beta: *const c_void, b: *const c_void, gamma: *const c_void, c: *const c_void, d: *mut c_void, stream: *mut c_void, ) -> Result<()>

Execute an elementwise-trinary plan.

§Safety

Same as Self::contract.

Source

pub unsafe fn permute( &self, alpha: *const c_void, a: *const c_void, b: *mut c_void, stream: *mut c_void, ) -> Result<()>

Execute a permutation plan.

§Safety

Same as Self::contract.

Source

pub unsafe fn contract_block_sparse( &self, alpha: *const c_void, a: *const c_void, b: *const c_void, beta: *const c_void, c: *const c_void, d: *mut c_void, workspace: *mut c_void, workspace_bytes: u64, stream: *mut c_void, ) -> Result<()>

Execute a block-sparse contraction plan.

§Safety

Same as Self::contract; a must be a block-sparse device buffer matching the BlockSparseTensorDescriptor passed to BlockSparseContraction::new.

Source

pub unsafe fn contract_trinary( &self, alpha: *const c_void, a: *const c_void, b: *const c_void, c: *const c_void, beta: *const c_void, d: *const c_void, e: *mut c_void, workspace: *mut c_void, workspace_bytes: u64, stream: *mut c_void, ) -> Result<()>

Execute a trinary-contraction plan: E = α·op_a(A)·op_b(B)·op_c(C) + β·op_d(D).

§Safety

Same as Self::contract.

Trait Implementations§

Source§

impl<'h> Debug for Plan<'h>

Source§

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

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

impl Drop for Plan<'_>

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

Auto Trait Implementations§

§

impl<'h> !Send for Plan<'h>

§

impl<'h> !Sync for Plan<'h>

§

impl<'h> Freeze for Plan<'h>

§

impl<'h> RefUnwindSafe for Plan<'h>

§

impl<'h> Unpin for Plan<'h>

§

impl<'h> UnsafeUnpin for Plan<'h>

§

impl<'h> UnwindSafe for Plan<'h>

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<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, 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.