mirror of
https://github.com/gorules/zen.git
synced 2026-11-30 00:07:34 +00:00
perf: let the measured typed/lane cost decide for failure-heavy typed groups
This commit is contained in:
@@ -921,14 +921,10 @@ impl<'a> Run<'_, 'a> {
|
||||
}
|
||||
let path = op.cost.path();
|
||||
let start = Instant::now();
|
||||
let failed = self.store.failed;
|
||||
let typed = match path.0 {
|
||||
Path::Typed => self.lowered(seg, op, positions).map(|lowered| self.merged(seg, op, units, positions, lowered)).is_some(),
|
||||
Path::Lane => false,
|
||||
};
|
||||
if typed {
|
||||
op.cost.failing(self.store.failed.saturating_sub(failed), local);
|
||||
}
|
||||
if !typed {
|
||||
self.laned(seg, units, positions);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::compiled::lowered::Exports;
|
||||
use crate::compiled::shred::Seen;
|
||||
use crate::compiled::table::Table;
|
||||
use crate::compiled::{Body, CompiledGraph, Kind};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering};
|
||||
use std::sync::atomic::{AtomicU32, AtomicU64, Ordering};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::time::Duration;
|
||||
use zen_expression::lane::{Binding as Site, Fusion};
|
||||
@@ -67,7 +67,6 @@ pub(crate) struct Cost {
|
||||
calls: AtomicU32,
|
||||
typed: AtomicU64,
|
||||
lane: AtomicU64,
|
||||
heavy: AtomicBool,
|
||||
}
|
||||
|
||||
struct Probe<'p> {
|
||||
@@ -136,18 +135,11 @@ impl Cost {
|
||||
calls: AtomicU32::new(0),
|
||||
typed: AtomicU64::new(u64::MAX),
|
||||
lane: AtomicU64::new(u64::MAX),
|
||||
heavy: AtomicBool::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn path(&self) -> (Path, bool) {
|
||||
let call = self.calls.fetch_add(1, Ordering::Relaxed);
|
||||
if self.heavy.load(Ordering::Relaxed) {
|
||||
return match call % Self::PERIOD {
|
||||
0 => (Path::Typed, true),
|
||||
_ => (Path::Lane, false),
|
||||
};
|
||||
}
|
||||
if call < Self::WARM {
|
||||
return (Path::Typed, false);
|
||||
}
|
||||
@@ -165,10 +157,6 @@ impl Cost {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn failing(&self, failed: usize, rows: usize) {
|
||||
self.heavy.store(failed * 4 > rows, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn record(&self, (path, fresh): (Path, bool), elapsed: Duration, rows: usize) {
|
||||
let per = u64::try_from(elapsed.as_nanos().saturating_mul(1024) / rows.max(1) as u128).unwrap_or(u64::MAX - 1);
|
||||
let cell = match path {
|
||||
|
||||
Reference in New Issue
Block a user