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>
impl<'h> Plan<'h>
Sourcepub fn new(
op: &OperationDescriptor<'h>,
pref: &PlanPreference<'h>,
workspace_size_limit: u64,
) -> Result<Self>
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.
Sourcepub fn as_raw(&self) -> cutensorPlan_t
pub fn as_raw(&self) -> cutensorPlan_t
Raw cutensorPlan_t. Use with care.
Sourcepub 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<()>
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.
Sourcepub 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<()>
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<()>
Sourcepub 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<()>
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<()>
Sourcepub 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<()>
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<()>
Sourcepub unsafe fn permute(
&self,
alpha: *const c_void,
a: *const c_void,
b: *mut c_void,
stream: *mut c_void,
) -> Result<()>
pub unsafe fn permute( &self, alpha: *const c_void, a: *const c_void, b: *mut c_void, stream: *mut c_void, ) -> Result<()>
Sourcepub 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<()>
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.
Sourcepub 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<()>
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§
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> 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