Skip to content

Use charimarks-ci (very wip)#100

Open
LilithHafner wants to merge 144 commits into
mainfrom
lh/benchmarks
Open

Use charimarks-ci (very wip)#100
LilithHafner wants to merge 144 commits into
mainfrom
lh/benchmarks

Conversation

@LilithHafner

Copy link
Copy Markdown
Owner

No description provided.

…ing, and eliminate unintentnional infinite recursion to fix some tests
…e rng test much more robust now that it can pass that way
…bug in stage two weight storage that also significantly hurts performance)
LilithHafner and others added 20 commits February 22, 2025 08:10
…to that path. (#104)

The point of adjusting `m[3]` and recomputing approximate weights to increase `m[4]` above 2^32 is to make sure we hit the slow path infrequently so we only need to do it if we are actually hitting the slow path. This means that pathological cases of repeatedly inserting and removing a weight to stress m[4] require calls to rand in order to trigger approximate level weight recomputation and remain pathological.

This fixes all the pathological cases we currently benchmark to within a factor of 2-3 of main! But... it does not fix some slightly harder to produce pathological cases. But those cases are slightly less pathological, and this PR includes benchmarks for them. This PR does somewhat regress those new worst cases.
Optimize weight updating in _rand_slow_path by using only the top 64 bits instead of the top 65 bits of significand sums

This reduces accuracy by one bit but continues to reliably set the new m[4] within an acceptable range. Also
- manually hoist bounds checking
- Remove obsolete 0 < m4 check
- Remove TODO about checking results (they are checked with an assert)
- Rename x2 to x (the original x was deleted a while ago)
- Move the initial assignment to x into the main loop
* Make recompute_weights faster and more complex by splitting the loop into regions based on where different words of significand sums are relevant

* Add some tests that failed during development of this PR
…uting them (#112)

* Update `set_global_shift_decrease!` to shift weights rather than recomputing them, taking advantage of the fact that the shift is always down (note: this includes a bug) and add comments about invariants and a TODO

* Add test

* inline the only remaining call-site of recompute_range

Note: this does include some regressions, though the gestalt is positive and 5B′ is an improvement.
@LilithHafner

Copy link
Copy Markdown
Owner Author

TODO for perf: drop BenchmarkTools dep; debug caching.

@LilithHafner

Copy link
Copy Markdown
Owner Author

TODO for correctness: use head's benchmarks for both commits
TODO for accuracy: benchmark both commits on the same runner to get pariwise results

Base automatically changed from lh/anew-dev-2 to main May 25, 2025 00:03
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.

2 participants