Repository navigation
add np.float_power and np.cbrt #6075
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
17bcd58
add np.float_power and np.cbrt
guilhermeleobas 2533dd2
fix cbrt test failure due to fp-precision
guilhermeleobas 353473c
Update npyfuncs.py
guilhermeleobas c991752
Update npyfuncs.py
guilhermeleobas b161b0b
Update npyfuncs.py
guilhermeleobas 9b44726
trigger CI
guilhermeleobas 8de632a
Merge remote-tracking branch 'upstream/master' into ufuncs
guilhermeleobas 80425a7
Fix cbrt test
guilhermeleobas 4d076fa
replace cbrt implementation
guilhermeleobas 4f4767b
Set fastmath flag on np.cbrt for llvm to a call to libm _cbrt
guilhermeleobas 95f8b52
trigger CI
guilhermeleobas 7eda7ac
move isnan check to outside cbrt function
guilhermeleobas 33615bd
add comment explaining fastmath flag
guilhermeleobas 66955b1
move import statement to the top of the file
guilhermeleobas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to understand why this is needed?
This:
generates a call to the
cbrtfunction, LLVM "knows" thatpower(x, 1/3)iscbrtunder the flags set. Perhaps this can be used to ensure that acbrtcall is generated along with adding the inf/nan handling as per NumPy?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before adding this, one of the tests were failing on CI. See:
#6075 (comment)
For me, this produces a call to
@llvm.pow.f64(x, 1/3):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that then ends up as a call to
cbrtonce compiled?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, you right. Nevertheless, If I remove the code you quote, some builds on CI starts to fail. Do you want me to give a try and implement
cbrtin numba?edit: this implementation produces the following assembly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this:
I'm not seeing the call to
cbrtbeing made. I suspect it requires floating point assumptions to be relaxed in the two branches that callnp.power.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one enables fast-math, you'll see a call to cbrt.