Improve applyCompMatr accumulation accuracy#784
Open
agentlaunchops-ai wants to merge 2 commits into
Open
Conversation
Author
|
I pushed a follow-up regression test in Local checks:
On the removed |
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 #598.
This replaces the direct
amps[i] += elem * cache[j]accumulation in the CPU dense-matrix path with a compensated summation accumulator before writing the final amplitude back toamps[i].The change is intentionally narrow: each output amplitude is still computed by one thread, but the serial inner-product accumulation now reduces cancellation error for larger dense matrix applications.
Tests run locally:
/opt/homebrew/bin/cmake -S . -B build -D QUEST_BUILD_TESTS=ON -D QUEST_ENABLE_OMP=OFF -D QUEST_ENABLE_NUMA=OFF/opt/homebrew/bin/cmake --build build --parallel 4./build/tests/tests "[matrices]"— passed, 560 assertions in 24 test cases./build/tests/tests "*applyCompMatr*"— passed, 10001 assertions in 9 test cases