Use siphash on architectures that support misaligned accesses #825
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.
Python uses siphash (siphash13 in 3.11+, siphash24 on older versions) as the default internal hashing algorithm, but only on architectures that support misaligned accesses, i.e., reads/writes of integers from a memory address that is not a round multiple of the integer size. On other architectures it uses fnv, which is not supported by Numba and raises a warning. The distinction between architectures is done by a configure-time code execution check, which is not supported on our cross builds, including on our x86_64_vN microarchitecture builds (see #599), so Python defaults to assuming it is not supported.
Hard-code a list of platforms that are known to support misaligned accesses just fine. Credit to
https://blog.vitlabuda.cz/2025/01/22/unaligned-memory-access-on-various-cpu-architectures.html for pointing out that the Linux kernel has this pretty well documented in Kconfig.
Note that loongarch and riscv have optional support for misaligned access, and it's quite possible that the hardware that people actually use have support for them (or that we are targeting a limited hardware profile anyway for some reason that implies support for misaligned access). I've left them out for now but we can add them later.
Fixes #683.