BUG: fix FNV-1a 64-bit selection by using NPY_SIZEOF_UINTP#31035
BUG: fix FNV-1a 64-bit selection by using NPY_SIZEOF_UINTP#31035seberg merged 3 commits intonumpy:mainfrom
Conversation
numpy/_core/src/multiarray/fnv.c
Outdated
| return (size_t)npy_fnv1a_64(buf, len, FNV1A_64_INIT); | ||
| #else /* NPY_SIZEOF_SIZE_T == 4 */ | ||
| return (size_t)npy_fnv1a_32(buf, len, FNV1A_32_INIT); | ||
| #if NPY_SIZEOF_INTP == 8 |
There was a problem hiding this comment.
FWIW, I think it's fine to only change this and keep size_t throughout. (can add a comment that intp is the same size as size_t).
uintp feels a bit more natural, but it doesn't matter much. Some of the calculations below also seem unrelated, but I guess they also don't really matter (since they don't seem to generate new warnings).
(if this was C++, constexpr would be nice I guess, but dunno it's worth to change that.)
Anyway, this also looks completely fine, though.
There was a problem hiding this comment.
Thanks for the review.
I updated the condition to use NPY_SIZEOF_UINTP and reverted the unrelated changes.
|
I don't think the loongarch64 or ppc64le failures are real. That said, I think maybe the cp312-macosx_286_64 failure is real, maybe? Or maybe you just got unlucky and this started breaking on your PR for some reason. Can you try rebasing on current Sorry you're hitting issues in our CI. I think this change looks correct to me and great catch - nice to see such huge speedups! |
|
Also maybe add a release note for the performance improvement? No need to if you don't want to though. |
nah, it's happening on other PRs. This is unrelated. Sorry our CI is so flaky! |
|
Fun that we have SIZEOF_UINTP, but not for most types... but since we have it, LGTM, thanks. |
BUG: fix FNV-1a 64-bit selection by using NPY_SIZEOF_UINTP (#31035)
PR summary
close #31034
benchmark result