Keep bounded settled checkpoints beyond page eight

This commit is contained in:
gloamxun committed 2026-12-01 20:01:17 +08:00
1 parent a5dba52acb
commit 1cf985469c
3 files changed
+83 -4

No files matched your search

+19 -4
View File
@@ -89,6 +89,15 @@ enum ExecutionCandidate {
}
const SOURCE_INTERVALS: usize = 4;
const DENSE_SETTLED_PAGES: usize = 4;
const SPARSE_SETTLED_SLOTS: usize = 4;
fn settled_page_stride(page: usize) -> usize {
page.saturating_sub(DENSE_SETTLED_PAGES)
.div_ceil(SPARSE_SETTLED_SLOTS)
.max(1)
.next_power_of_two()
}
// Each interval can keep an early command boundary and a more advanced
// boundary after actual shipout. Larger jobs sample pages at wider intervals.
@@ -192,11 +201,13 @@ impl CaptureSchedule {
}
}
}
if self.fixed_frontier.is_none() && source.output_returned
&& pages > self.settled_page && pages <= 8
{
if self.fixed_frontier.is_none() && source.output_returned && pages > self.settled_page {
self.settled_page = pages;
return Some(Capture::Settled { page: pages, regular });
// A wider grid is a subset of the earlier grid, so a new run
// still visits any checkpoint retained by a completed run.
if pages.saturating_sub(DENSE_SETTLED_PAGES) % settled_page_stride(pages) == 0 {
return Some(Capture::Settled { page: pages, regular });
}
}
regular.map(Capture::Entry).or(line_end)
}
@@ -331,6 +342,10 @@ impl<'a> CapturedEntries<'a> {
let slots = match slots {
Capture::Settled { page, regular } => {
if let Some((_, calls)) = host.prefix() {
let stride = settled_page_stride(page);
self.settled.retain(|&old, _| {
old.saturating_sub(DENSE_SETTLED_PAGES) % stride == 0
});
self.settled.insert(page, SettledCheckpoint {
entry: entry.clone(),
host: host.files().replay_boundary(),