Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove incorrect qrdmulh SSE code. #1258

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Syonyk
Copy link
Contributor

@Syonyk Syonyk commented Jan 3, 2025

The only reason the SSE code for qrdmulh passed is because the edge cases were not included in the tests unless SSE was disabled. The INT16_MIN * INT16_MIN case ought result in INT16_MAX - and it does, in the fallback code. It does not, in the SSE code, which is what will typically be used on x86 hardware. Saturating code not handling edge cases is simply wrong.

Unfortunately, my SSE skills are not sufficient to sort out how to fix this problem. I'd also be fine commenting out the code with a note about the problem, but I prefer correct results in all cases to "commonly correct results except in the case where the result matters."

Tests are modified to remove the conditional test. The final test cases passes cleanly on ARMv9 hardware, but not on x86 with SSE. It passes in the fallback code path.

@mr-c
Copy link
Collaborator

mr-c commented Jan 3, 2025

Checking the git blame, I'm pinging @nemequ about ccacf94 and @zengdage
about 2a548e5 in the context of this PR

The only reason the SSE code for qrdmulh passed is because the edge
cases were not included in the tests unless SSE was disabled.  The
INT16_MIN * INT16_MIN case ought result in INT16_MAX - and it does,
in the fallback code.  It does not, in the SSE code, which is
what will typically be used on x86 hardware.  Saturating code not
handling edge cases is simply wrong.
@Syonyk
Copy link
Contributor Author

Syonyk commented Jan 3, 2025

Sounds good - if they're able to fix it properly, to cover all the test cases, I have no objections. Just so long as all cases are correct.

@mr-c mr-c marked this pull request as draft January 4, 2025 01:40
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