BUG: Fix for npyv__trunc_s32_f32 (VXE)#23077
Merged
seiko2plus merged 2 commits intonumpy:mainfrom Jan 25, 2023
Merged
Conversation
np.sin(), np.cos() are giving erroneous result for float32 (VXE) This PR is fixing `npyv_s32 npyv__trunc_s32_f32(npyv_f32 a)` to resolve the issue.
Andreas-Krebbel
suggested changes
Jan 24, 2023
Andreas-Krebbel
left a comment
There was a problem hiding this comment.
Please replace __builtin_s390_vflls with npyv_doublee again. __builtin_s390_vflls will fail to build with clang. The npyv_doublee definition already has the logic to distingiush between gcc and clang.
| #elif defined(NPY_HAVE_VXE) | ||
| return vec_packs(vec_signed(npyv_doublee(a)), vec_signed(npyv_doublee(vec_mergel(a, a)))); | ||
| return vec_packs(vec_signed(__builtin_s390_vflls(vec_mergeh(a,a))), | ||
| vec_signed(__builtin_s390_vflls(vec_mergel(a, a)))); |
There was a problem hiding this comment.
I just realized that npyv_doublee is simply a
#define npyv_doublee __builtin_s390_vflls
in utils.h So it would have been fine to continue using npyv_doublee instead of __builtin_s390_vflls
Contributor
Author
There was a problem hiding this comment.
Thanks @Andreas-Krebbel ! I have updated in latest commit.
Contributor
Author
|
Hi @seiko2plus, Please let us know your comments. Thank you ! |
Member
|
@pradghos, LGTM, Thanks for the fix |
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.
np.sin(), np.cos() are giving erroneous result for float32 (VXE).
This PR is fixing
npyv__trunc_s32_f32(npyv_f32 a)to resolve the issue.np.sin() reproduce (without fix)
After the fix:
Test failure without fix -
cc @Andreas-Krebbel @potula-chandra @andrewsi-z