Repository navigation
perf(solver): keep cartesian and list kernel tables across steps (#283) - #290
Merged
Merged
Conversation
…ast step The cartesian cursor rebuilt its row and pair lists from empty on every step and grew them by reallocation. Whether a reallocation extends in place depends on what the heap holds next to it: after #289 shrank the grouped leaf cursor, the cartesian gate case's reallocations moved instead of extending, and its simulated data-L1 misses rose +112% against v0.31.4 with equal allocation counts. The composition stream state keeps each cartesian node's last row and pair counts, and the next step's cursor allocates both lists once at that size. cartesian, one layout against v0.31.4: sim D1 misses 1353503 (1619900), instructions -0.9%, allocated bytes 2491972 (5193284), peak 278866 (481042), identical order hash.
Every list neighborhood step opened its slot kernels with empty candidate stores and an empty union table and regrew them one candidate at a time; k-opt and the full list neighborhoods enumerate thousands of candidates per step, so most of their data-L1 misses were reallocation copies of those tables. After #289 changed the heap layout the k_opt gate case moved more of them and failed sim_d1_misses at +5.5% against v0.31.4. The list leaf's stream state keeps each slot kernel's candidate-ID table and the slot union's discovered table; the step's cursor takes them on open and the local-search leaf hands them back on close, as it already does for its own table. One layout against v0.31.4 (sim D1 misses, instructions): k_opt 177635 / 388051, -2.4%; list_change 2871081 / 5943680, -1.6%; union 6954045 / 14367383, -1.7%. Allocation smoke (4 iterations, identical order hashes): list_change 60 allocations / 27432 bytes / 6762 peak (188 / 33583016 / 4201482); k_opt 5492 / 222184 / 6658 (5588 / 2320488 / 269218).
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 failures of the zero-regression gate of main (2f9aadf) against v0.31.4:
#289 shrank the grouped leaf cursor, which moved the heap layout of every local-search case. Cartesian and the list kernels rebuilt per-step lists from empty and regrew them by reallocation; whether a reallocation extends in place depends on its heap neighbours, so after the layout change more of them copied. On identical code, moving the heap start by 0-3584 bytes left main in the worse mode on 7 of 8 offsets, so the fix is in the cursors, not in the gate's sampling.
Cachegrind, one layout against v0.31.4 (sim D1 misses / instructions):
Allocation smoke on 16 cases against v0.31.4: identical order hashes, and allocations, allocated bytes and peak live bytes at or below v0.31.4 on every case (e.g. list_change 60 / 27432 / 6762 against 188 / 33583016 / 4201482).
scalar_change on a quiet core (perf stat -r 20, three rounds): 74.4-75.5 M cycles against v0.31.4's 74.7-77.2 M.
make lintandmake testpass. The full gate runs on merged main.