pub struct Conv2dCost {
pub batch: usize,
pub channels_in: usize,
pub spatial_in: [usize; 2],
pub channels_out: usize,
pub kernel: [usize; 2],
pub spatial_out: [usize; 2],
pub bias_elems: usize,
pub elems: MatmulGlobalElems,
}Expand description
Minimal representation of a 2D convolution’s cost: the shapes it moves and the element types it moves them in.
Fields§
§batch: usizeBatch, input channels, and the input’s spatial extent.
channels_in: usize§spatial_in: [usize; 2]§channels_out: usizeOutput channels and the filter’s spatial extent.
kernel: [usize; 2]§spatial_out: [usize; 2]The output’s spatial extent, which stride, padding and dilation decide.
bias_elems: usizeElements of the bias, zero when the convolution has none.
elems: MatmulGlobalElemsGlobal element types of the operands.
Implementations§
Source§impl Conv2dCost
impl Conv2dCost
Sourcepub fn work(&self) -> Work
pub fn work(&self) -> Work
Calculates the compute operations and compulsory memory traffic for the convolution.
Sourcepub fn compute_ops(&self) -> usize
pub fn compute_ops(&self) -> usize
Operations the contraction performs, 2 * k - 1 per output element.
Sourcepub fn traffic(&self) -> (usize, usize)
pub fn traffic(&self) -> (usize, usize)
Compulsory global traffic in bytes, split by direction, which
work sums.
The maps and the filter are each moved once. An unfolded operand would re-read every overlapping window, which is the implementation’s choice rather than the convolution’s cost.
Sourcepub fn compute_key(&self, client: &Client) -> ThroughputKey
pub fn compute_key(&self, client: &Client) -> ThroughputKey
The probe the contraction’s arithmetic runs on, which is the matmul’s: an accelerated convolution issues the same MMA a gemm does.
Trait Implementations§
Source§impl Clone for Conv2dCost
impl Clone for Conv2dCost
Auto Trait Implementations§
impl Freeze for Conv2dCost
impl RefUnwindSafe for Conv2dCost
impl Send for Conv2dCost
impl Sync for Conv2dCost
impl Unpin for Conv2dCost
impl UnsafeUnpin for Conv2dCost
impl UnwindSafe for Conv2dCost
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more