embedded3: study knobs — aperture_substeps (space-time sub-sampling), momentum_volume_cell_mean, RTX_E3_MERGE_FRACTION; all default off (refuted as the fresh-row residual's source)
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Build (macos-latest) (push) Waiting to run
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Distributed Training Tests (push) Blocked by required conditions
CI / CI Success (push) Blocked by required conditions
CI / Build (ubuntu-latest) (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 4s
CI / Build CPU-Only (Explicit) (push) Failing after 3s
Documentation / Build API Documentation (push) Failing after 4s
CI / Format Check (push) Failing after 14s
CI / Clippy Check (push) Failing after 48s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m52s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
Omar Sobh
2026-09-17 21:38:46 -05:00
co-authored by Claude Fable 5.1
parent 33de5d0080
commit c713bbbbb2
5 changed files with 87 additions and 9 deletions
@@ -228,8 +228,13 @@ impl Mask {
old.and_then(|o| o.cut.as_ref())
.map_or(v, |oc| v.max(oc.vol[idx]))
};
// `RTX_E3_MERGE_FRACTION` overrides the threshold (a study knob).
let threshold = std::env::var("RTX_E3_MERGE_FRACTION")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(MERGE_FRACTION);
let small: Vec<bool> = (0..n)
.map(|idx| self.cell_active(idx) && frac(idx) < MERGE_FRACTION)
.map(|idx| self.cell_active(idx) && frac(idx) < threshold)
.collect();
let mut master = vec![usize::MAX; n];
for idx in (0..n).filter(|&i| small[i]) {
@@ -256,17 +261,37 @@ impl Mask {
}
/// Set the step-averaged apertures and the space-time classification
/// from the previous mask's geometry.
/// from the previous mask's geometry: the trapezoid `½(αⁿ + αⁿ⁺¹)`,
/// or with `inner` intermediate geometries the composite trapezoid
/// over the step (the exact time integral of the space-time cut cell,
/// arXiv 2512.23358, approached as the sub-sampling refines).
pub fn set_step_apertures(&mut self, old: &Mask) {
self.set_step_apertures_with(old, &[]);
}
/// As [`Self::set_step_apertures`] with the apertures of the
/// intermediate geometries `inner` (in time order) inside the step.
pub fn set_step_apertures_with(&mut self, old: &Mask, inner: &[&CutGeometry]) {
let (Some(cut), Some(old_cut)) = (self.cut.as_ref(), old.cut.as_ref()) else {
return;
};
let avg = |a: &[f64], b: &[f64]| -> Vec<f64> {
a.iter().zip(b).map(|(x, y)| 0.5 * (x + y)).collect()
let n = inner.len() + 1;
let w_end = 0.5 / n as f64;
let w_in = 1.0 / n as f64;
let avg = |pick: &dyn Fn(&CutGeometry) -> &[f64]| -> Vec<f64> {
let a = pick(cut);
let b = pick(old_cut);
let mut out: Vec<f64> = a.iter().zip(b).map(|(x, y)| w_end * (x + y)).collect();
for g in inner {
for (o, v) in out.iter_mut().zip(pick(g)) {
*o += w_in * v;
}
}
out
};
let au = avg(&cut.a_u, &old_cut.a_u);
let av = avg(&cut.a_v, &old_cut.a_v);
let aw = avg(&cut.a_w, &old_cut.a_w);
let au = avg(&|g: &CutGeometry| &g.a_u);
let av = avg(&|g: &CutGeometry| &g.a_v);
let aw = avg(&|g: &CutGeometry| &g.a_w);
let open = |a: &[f64]| -> Vec<bool> { a.iter().map(|&x| x > 0.0).collect() };
let active = self
.cell_fluid