Skip to content

DDIR: corgi pin to 13f3ab8, and the chunk merge on survey_groups - #861

Merged
frankmcsherry merged 2 commits into
master-nextfrom
corgi-pin-indexed-sort
Sep 7, 2026
Merged

DDIR: corgi pin to 13f3ab8, and the chunk merge on survey_groups#861
frankmcsherry merged 2 commits into
master-nextfrom
corgi-pin-indexed-sort

Conversation

@frankmcsherry

@frankmcsherry frankmcsherry commented Sep 7, 2026

Copy link
Copy Markdown
Member

Two corgi PRs landed this weekend: the indexed sort (WIP#24), which arranges a chunk and orders the reduce's candidates without gathering at every level of the shape, and the rank-at-a-time survey (WIP#26), which reports the interleaving of two sorted columns as maximal exclusive ranges and equal classes as their ranges on both sides. This moves the pin to master 13f3ab8 and takes the second one up.

The merge. CorgiChunk::merge compared row by row with compare_at, and its own comment named survey_groups as the interface it was waiting for. It is now the exclusive runs copied by range (push_range, extend_from_slice) and each equal class merged once on its times, where consolidation happens; corgi walks the shape once per level per chunk. The group form is simpler than the pairwise one on survey-merge: no group-end scan, no done marks, no u64_lanes.

Numbers. Medium scale, one worker, corgi backend, medians of three, de0f2ac → here:

workload initial epoch before after churn epoch before after
ast_hier 948.6 ms 685.8 ms 19.5 ms 19.2 ms
ast 562.0 ms 462.4 ms 166.4 ms 164.0 ms
kcore 302.9 ms 265.4 ms 2.4 ms 2.3 ms
scc 1.98 s 1.78 s 58.0 ms 57.8 ms
stable 327.3 ms 294.9 ms 6.2 ms 5.9 ms
tour 745.4 ms 704.4 ms 13.3 ms 13.1 ms
reach 188.2 ms 177.1 ms 10.1 ms 9.8 ms
unnest 247.5 ms 237.6 ms 1.4 ms 1.4 ms
adt 44.0 ms 41.8 ms 13.6 ms 13.5 ms

Chunk sizing, second commit. The chunker accumulated TARGET rows before sorting them, so one constant set both the ingest bundle and the chunks the merge and advance emit. They are two knobs now: INGEST at 2^24, the whole of a large epoch's input in one radix sort, and TARGET at 2^20. Swept at 1M nodes, one worker, medians of two, initial epoch / churn epoch: target 2^18 as before, ast 6.98 s / 2.58 s, kcore 4.27 / 0.027, scc 22.99 / 0.711; ingest 2^22 with target 2^18, ast 6.19 / 2.59, kcore 3.42 / 0.026, scc 22.16 / 0.705; ingest 2^24 with target 2^20, ast 5.46 / 2.57, kcore 3.05 / 0.026, scc 22.66 / 0.685; target 2^24 for both roles, ast 5.07 / 2.69, kcore 2.85 / 0.026. The bundle alone is half to two thirds of the gain with churn untouched; the chunk size is the rest and the part that costs churn past 2^22. At medium scale the chunk size alone takes ast 462 to 419 ms and kcore 265 to 236, churn flat.

Of the initial-epoch gain from the first commit, the sort alone was 2 to 10%, measured at the intermediate pin 5bee8df; the merge is the rest. The numbers were taken with bench-spike's harness copied in, since master-next does not carry it. Tests pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QDsLC46QQW9aBrksaWad6T

frankmcsherry and others added 2 commits September 7, 2026 00:02
Two corgi PRs landed: the indexed sort (frankmcsherry/WIP#24), which arranges a chunk and orders
the reduce's candidates without gathering at every level of the shape, and the rank-at-a-time
survey (frankmcsherry/WIP#26), which reports the interleaving of two sorted columns as maximal
exclusive ranges and equal classes as their ranges on both sides. The pin moves to master
13f3ab8. The chunk merge, which compared row by row with compare_at and whose own comment
named survey_groups as the interface it waited for, is now the exclusive runs copied by range
and each equal class merged once on its times; corgi walks the shape once per level per chunk.

Medium scale, one worker, corgi backend, medians of three, de0f2ac -> here. Initial epoch:
ast_hier 949 -> 686 ms, ast 562 -> 462, kcore 303 -> 265, scc 1.98 -> 1.78 s, stable 327 -> 295,
tour 745 -> 704, reach 188 -> 177, unnest 248 -> 238, adt 44.0 -> 41.8. Churn epoch: stable
6.2 -> 5.9 ms, reach 10.1 -> 9.8, kcore 2.4 -> 2.3, tour 13.3 -> 13.1, scc 58.0 -> 57.8, the
rest within a tenth. Of the initial-epoch gain, the sort alone was 2-10%, measured at the
intermediate pin 5bee8df; the merge is the rest. Tests pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDsLC46QQW9aBrksaWad6T
…s are 2^20

The chunker accumulated TARGET rows before sorting them, so the one constant set both how
much arrives in one radix sort and how big the chunks the merge and advance emit are, which is
what the fueled merger yields on. They pull different ways: a big bundle is cheaper to sort
than to merge from pieces, while a big chunk makes the merger yield less often. INGEST is now
the bundle, 2^24 rows, the whole of a large epoch's input at once; TARGET the chunk, 2^20.

Swept at 1M nodes, one worker, medians of two, initial epoch / churn epoch:
  TARGET 2^18 (before):            ast 6.98 s / 2.58 s, kcore 4.27 / 0.027, scc 22.99 / 0.711
  TARGET 2^22 for both roles:      ast 5.81 / 2.42,     kcore 2.92 / 0.026, scc 22.73 / 0.692
  INGEST 2^22, TARGET 2^18:        ast 6.19 / 2.59,     kcore 3.42 / 0.026, scc 22.16 / 0.705
  INGEST 2^24, TARGET 2^20 (here): ast 5.46 / 2.57,     kcore 3.05 / 0.026, scc 22.66 / 0.685
  TARGET 2^24 for both roles:      ast 5.07 / 2.69,     kcore 2.85 / 0.026, scc 22.62 / 0.689
The ingest bundle alone is half to two thirds of the gain; the chunk size is the rest and the
part that can hurt churn. At medium scale, where an epoch's input fits one bundle either way,
2^18 to 2^20 on the chunk takes ast 462 to 419 ms and kcore 265 to 236, churn flat.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDsLC46QQW9aBrksaWad6T
@frankmcsherry
frankmcsherry merged commit 660ff8d into master-next Sep 7, 2026
6 checks passed
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