Skip to content

int_proxy reduce: witness interesting times with novel records, not bare times - #1114

Draft
frankmcsherry wants to merge 1 commit into
master-nextfrom
proxy-reduce-novel-witnesses
Draft

frankmcsherry wants to merge 1 commit into
master-nextfrom
proxy-reduce-novel-witnesses

Conversation

@frankmcsherry

Copy link
Copy Markdown
Member

The proxy reduce is quadratic on a one-round workload where records come and go, because it marks interesting times with bare times, which never cancel.
This PR marks them with the round's novel records instead, which cancel once the running meet moves an insertion and its retraction to one time.
It is the proxy counterpart of #1113, built on master-next independently of it.

Problem

The workload is a diagonal, all in one round.
At step i, record 2i is present at (i, 0) and record 2i+1 at (i, n+1-i), and both are retracted at step i+1.
The live collection stays the same size throughout.

The seed list holds the novel time support as bare times, and reached keeps every seed it consumes, plus every visited synthetic time.
Advanced by the meet, the insertion time of record 2i+1 becomes (s, n+1-i), which is distinct for each i.
So reached keeps one entry per earlier record, every later time joins against all of them, and every join counts as reached.

Change

  • ReduceWindow::seeds: Vec<(K, T)> becomes novel: ProxyBridge<T, RIn, K, VIn>: the novel records alone, consolidated among themselves and not netted against the prior history. input is unchanged, still merged and netted as in Extract novel times explicitly #830.
  • The sweep holds the novel records in a ValueHistory. It is a frontier source, is stepped in absorb, joins settle's meet, and has its buffer advanced and consolidated in every settle.
  • Due times stay bare seeds in reached. Visited synthetic times are no longer kept there.
  • A time is reached if a due seed or a synthetic join lands on it, or if a reached due time, a surviving novel record, or a correction emitted this round lies at or below it.
  • close joins every time with reached, the novel buffer and produced. Reached times also join with the input and output buffers, as before.
  • The backends present the new channel:
    • The vec backend gives the novel records their own ids per key.
    • BackendFrontier reads them as of since.
    • DDIR's corgi backend presents the novel chunks a second time.
  • The new test reduce_scaling_cancelled_history in tests/int_proxy.rs runs the diagonal at n = 100,000 in one round.

Measurements

Logic calls on the diagonal in one round, release build, vec backend:

n master-next this PR single steps
500 126,754 (0.34 s) 1,504 (3.6 ms) 1,504
1,000 503,504 (2.5 s) 3,004 (3.1 ms) 3,004
2,000 2,007,004 (19.4 s) 6,004 (5.6 ms) 6,004

That is exactly (n+1)(n+4)/2 + n + 2 calls before, and 3n + 4 after.
In a debug build, the new test takes 2.1 s at n = 100,000; master-next takes 39 s at n = 1,000 and 307 s at n = 2,000.

The proxy benches in int_proxy_bench, single runs, µs per round, master-next then this PR:

bench master-next this PR
churn 16,787 16,389
propagate 2,572 2,548
wide 18,732 18,641
multimoment, run 1 13,810 15,205
multimoment, run 2 14,136 15,733
multimoment, run 3 (busy machine) 22,031 22,309

Multimoment looks about 10% slower.
Likely causes are the second presentation of the novel records and consolidating their buffer at every step; it is not profiled.

Checks

Uncommitted scratch harnesses, run in debug against an oracle:

  • The existing fuzz_proxy_max and a new fuzz_proxy_churn each pass 50,000 seeds. Churn makes 720,951 logic calls against 724,504 on master-next.
  • Each fuzz catches deliberate breaks of the new pieces:
break seeds fuzz_proxy_max failures fuzz_proxy_churn failures
the novel buffer no longer marks times 5,000 4,822 4,888
the novel buffer joins only at reached times 5,000 50 27
produced joins only at reached times 50,000 0 0
produced no longer marks times 50,000 0 0
both of the last two 50,000 0 0

The tests also pass:

  • DD and dogs3 pass 114 (3 ignored), including reduce_seed_survives_cancellation.
  • Doc tests pass 54 (10 ignored).
  • interactive passes 350 (9 ignored).

Open questions

  1. Are the two produced pieces needed: marking later times, and joining with unreached times? Removing them causes no failures, and n = 1,000 still costs 3,004 calls. Without them, the handling of produced matches master-next. reduce: stop keeping visited synthetic times as witnesses #1113 adds the same two pieces to the cursor. They are kept here until there is an argument either way.
  2. The multimoment slowdown above.
  3. produced is still compacted only when corrections are added, as in reduce: stop keeping visited synthetic times as witnesses #1113's first question.
  4. Comments: the docs that described seeds as bare times are rewritten. Two comments are removed: the one on the seed merge loop, with the loop, and "produced counts as prior". That second one becomes true again if question 1 drops the two pieces.

As in #1113, the step from this sweep to formal/ is informal.
The Sweep doc now reads round_coverage at the finer grain that meet_view_agrees in Model.lean permits.

🤖 Generated with Claude Code

…are times

The proxy reduce marked interesting times with the raw novel time support, held as bare times in the seed list and in `reached`, and kept visited synthetic times there too.
A bare time never cancels, so a record inserted and retracted within one round kept every later time it joined interesting.
On a one-round diagonal workload (each record lives for one step of the first coordinate) that is about n²/2 evaluations, where single steps take about 3n.

The window now carries the novel records alone, `ReduceWindow::novel`, consolidated among themselves but not netted against the prior history.
The sweep holds them in a `ValueHistory` advanced by the running meet, so an insertion and its retraction cancel once the meet moves them to one time, and then witness nothing.
Due times stay bare seeds.
Visited synthetic times are no longer kept in `reached`; corrections emitted this round witness later times and join with every time instead.

This is the proxy counterpart of the cursor change in #1113, and reads `round_coverage` at the finer grain that `meet_view_agrees` in `formal/Differential/Model.lean` permits.
The vec backend, `BackendFrontier`, and DDIR's corgi backend present the new channel.
`reduce_scaling_cancelled_history` runs the diagonal at n = 100,000 in one round.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant