Repository navigation
Fix wrong v2 hashes on big-endian PPC64 with VSX - #345
Merged
Merged
Conversation
Co-authored-by: cyrozap <cyrozap@gmail.com>
SChernykh
approved these changes
Oct 13, 2026
SChernykh
pushed a commit
to SChernykh/RandomX
that referenced
this pull request
Oct 14, 2026
* Fix v2 F/E mixing on big-endian PPC64 with VSX Co-authored-by: cyrozap <cyrozap@gmail.com> * Remove unused vector helpers that are wrong on big-endian --------- Co-authored-by: cyrozap <cyrozap@gmail.com>
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.
On big-endian PPC64 builds with VSX (
-mcpu=power7or newer) the interpreter computes wrong RandomX v2 hashes. v1 is not affected.The v2 F/E mixing converts registers between
rx_vec_f128andrx_vec_i128withrx_cast_vec_f2i/rx_cast_vec_i2f, which the PPC64 branch implements as plain reinterpretations. On big-endian,rx_vec_f128is built from 64-bit lanes andrx_vec_i128from 32-bit lanes, so the reinterpretation swaps the two 32-bit halves of each 64-bit lane and the AES rounds operate on a permuted state.This PR swaps the halves back on big-endian, adds a round-trip test for the casts, and removes two unused helpers (
rx_vec_i128_vec_f128,rx_set1_long_vec_i128) that have the same big-endian bug.@cyrozap is credited as co-author because I found afterwards the cast fix is identical to his commit ee98798 in #320, where it is bundled with the PPC64 JIT.