Skip to content

fix(solver): grouped cursor size and required construction cache misses (#283) - #289

Merged
blackopsrepl merged 3 commits into
mainfrom
fix/283-grouped-cursor-size
Dec 1, 2026
Merged

blackopsrepl merged 3 commits into
mainfrom
fix/283-grouped-cursor-size

Conversation

@blackopsrepl

Copy link
Copy Markdown
Collaborator

Fixes the two failures of the zero-regression gate of main (80697e7) against v0.31.4.

allocated_bytes / peak_live_bytes on 14 local-search cases

#286 grew the grouped-scalar leaf cursor from 1424 to 1552 bytes; it is the largest local-search leaf variant, so every local-search case allocated 128 more bytes per leaf (equal allocation counts). The cursor now keeps the solve-owned pooled assignment state in its box instead of inline.

sim_d1_misses on assignment_required (+5.12%)

Required construction places one row per move through the cursor, so per-placement allocations dominated its data-cache misses: a sorted entity list per compound move, and a heap member list per new capacity/sequence key in the assignment state. A single-entity move now lends its index from its edit, and member lists keep up to two rows inline.

Subset gate against v0.31.4 (5 layouts, shared host)

case sim_d1_misses sim_instructions allocations allocated bytes peak bytes
assignment_required -28.0% -95.1% -47.9% -52.6% -34.2%
assignment_neighborhood -14.4% -2.0% -14.8% -5.6% -1.9%

Allocation smoke (identical order hashes): scalar_swap 33636 / 8409 allocated / peak bytes (v0.31.4: 35300 / 8825); list_change 33581352 / 4201066 (33583016 / 4201482).

make lint and make test pass. The full gate runs on merged main.

…rsor

#286 added path-search scratch to the assignment state and an edit buffer
to its cursor, which grew the grouped-scalar leaf cursor from 1424 to 1552
bytes. The grouped cursor is the largest local-search leaf variant, so
every local-search case allocated 128 more bytes per leaf: the gate against
v0.31.4 failed allocated_bytes and peak_live_bytes on 14 cases (e.g.
scalar_change +4096 / +128 bytes) with equal allocation counts.

The cursor held the solve-owned pooled state inline, unboxed from the slot
on open and boxed again on close. It now keeps the slot's box until
activation moves the state into the assignment cursor, so the leaf carries
one pointer instead of a 552-byte state, and a step that never activates
hands the same box back.

Gate smoke against v0.31.4 (4 iterations, identical order hashes):
scalar_swap 33636 / 8409 bytes allocated / peak (v0.31.4: 35300 / 8825),
list_change 33581352 / 4201066 (33583016 / 4201482).
A compound scalar move kept a sorted list of the entities its edits name,
allocated on every move. Required construction now commits one single-row
move per placement, so that list was one allocation and one free per placed
row. A move whose edits all name one entity now lends that index from its
first edit and allocates no list.
The assignment state indexes rows by capacity key, by value and by (value,
sequence); each key held its rows in a heap Vec. Required construction now
records every placed row in the state, so a placement allocated a member
list for each new capacity and sequence key, and dropping the state freed
them all. Member lists keep up to two rows inline: a capacity or sequence
key holds one row in a feasible plan, so placing a row allocates no list.
@blackopsrepl
blackopsrepl merged commit 2f9aadf into main Dec 1, 2026
7 checks passed
@blackopsrepl
blackopsrepl deleted the fix/283-grouped-cursor-size branch December 1, 2026 13:27
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