Repository navigation
fix(solver): grouped cursor size and required construction cache misses (#283) - #289
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
Allocation smoke (identical order hashes): scalar_swap 33636 / 8409 allocated / peak bytes (v0.31.4: 35300 / 8825); list_change 33581352 / 4201066 (33583016 / 4201482).
make lintandmake testpass. The full gate runs on merged main.