Add O(N log N) sweep and hybrid sweep allocators#34
Open
fpedd wants to merge 1 commit into
Open
Conversation
Chronological sweep placement for very large problems: allocation/free events are processed in time order over an address-ordered, coalescing free list (C++ sweep_place), with first-fit, best-fit, and two-ended (median split) fit policies. Hybrid variants place the largest max_obstacles allocations with the exact quadratic first-fit and sweep the rest around them as forbidden offset bands (hybrid_sweep_place); with the budget fixed at its default of 1024 the family stays O(N log N). SweepByAllAllocator runs all 7 variants in parallel and keeps the best result, mirroring GreedyByAll. On a 33-problem suite (minimalloc datasets, synthetic sources, ONNX models) the portfolio matches the quadratic GreedyByAll baseline at geomean 0.9967 (2 wins, 29 ties, 2 losses, worst +1.7%) while placing 1M allocations in 0.83 s for a single sweep versus hours extrapolated for one quadratic greedy variant. Hybrid runs with max_obstacles >= N are bit-identical to the corresponding exact greedy variants, used as a test invariant. Total sizes beyond the free list's 2^61 top-gap bound raise OverflowError instead of overflowing offset arithmetic, and a negative max_obstacles raises ValueError. Research notes, prototypes, and the quality benchmark used to select the shipped variants live in research/, excluded from ruff/ty as a scratch area.
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.
Chronological sweep placement for very large problems: allocation/free
events are processed in time order over an address-ordered, coalescing
free list (C++ sweep_place), with first-fit, best-fit, and two-ended
(median split) fit policies. Hybrid variants place the largest
max_obstacles allocations with the exact quadratic first-fit and sweep
the rest around them as forbidden offset bands (hybrid_sweep_place);
with the budget fixed at its default of 1024 the family stays
O(N log N). SweepByAllAllocator runs all 7 variants in parallel and
keeps the best result, mirroring GreedyByAll.
On a 33-problem suite (minimalloc datasets, synthetic sources, ONNX
models) the portfolio matches the quadratic GreedyByAll baseline at
geomean 0.9967 (2 wins, 29 ties, 2 losses, worst +1.7%) while placing
1M allocations in 0.83 s for a single sweep versus hours extrapolated
for one quadratic greedy variant. Hybrid runs with max_obstacles >= N
are bit-identical to the corresponding exact greedy variants, used as
a test invariant.
Total sizes beyond the free list's 2^61 top-gap bound raise
OverflowError instead of overflowing offset arithmetic, and a negative
max_obstacles raises ValueError. Research notes, prototypes, and the
quality benchmark used to select the shipped variants live in
research/, excluded from ruff/ty as a scratch area.