pub struct OperationCost {
pub compute_flops: f64,
pub memory_bytes: f64,
pub communication_bytes: f64,
pub io_bytes: f64,
pub latency_ms: f64,
pub custom: HashMap<String, f64>,
}Expand description
Cost annotation for a single operation.
Fields§
§compute_flops: f64Estimated computational cost (FLOPs)
memory_bytes: f64Estimated memory footprint (bytes)
communication_bytes: f64Estimated communication cost (bytes transferred)
io_bytes: f64Estimated I/O cost (bytes read/written)
latency_ms: f64Estimated latency (milliseconds)
custom: HashMap<String, f64>Custom cost metrics
Implementations§
Source§impl OperationCost
impl OperationCost
Sourcepub fn compute_only(flops: f64) -> Self
pub fn compute_only(flops: f64) -> Self
Create an operation cost with only computational cost.
Sourcepub fn compute_and_memory(flops: f64, memory_bytes: f64) -> Self
pub fn compute_and_memory(flops: f64, memory_bytes: f64) -> Self
Create an operation cost with computational and memory cost.
Sourcepub fn with_custom(self, key: impl Into<String>, value: f64) -> Self
pub fn with_custom(self, key: impl Into<String>, value: f64) -> Self
Add a custom cost metric.
Sourcepub fn add(&self, other: &OperationCost) -> OperationCost
pub fn add(&self, other: &OperationCost) -> OperationCost
Combine two costs (for sequential operations).
Sourcepub fn max(&self, other: &OperationCost) -> OperationCost
pub fn max(&self, other: &OperationCost) -> OperationCost
Get the maximum cost (for parallel operations).
Trait Implementations§
Source§impl Clone for OperationCost
impl Clone for OperationCost
Source§fn clone(&self) -> OperationCost
fn clone(&self) -> OperationCost
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OperationCost
impl Debug for OperationCost
Source§impl Default for OperationCost
impl Default for OperationCost
Source§impl<'de> Deserialize<'de> for OperationCost
impl<'de> Deserialize<'de> for OperationCost
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for OperationCost
impl PartialEq for OperationCost
Source§impl Serialize for OperationCost
impl Serialize for OperationCost
impl StructuralPartialEq for OperationCost
Auto Trait Implementations§
impl Freeze for OperationCost
impl RefUnwindSafe for OperationCost
impl Send for OperationCost
impl Sync for OperationCost
impl Unpin for OperationCost
impl UnwindSafe for OperationCost
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