Skip to content
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

Teach julia that NaNMath functions don't have effects #67

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

oscardssmith
Copy link
Member

This allows constant folding and dead code elimination on Julia 1.8 and up.

@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.08%. Comparing base (7e44d41) to head (e51a40a).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/NaNMath.jl 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   97.05%   97.08%   +0.02%     
==========================================
  Files           1        1              
  Lines         136      137       +1     
==========================================
+ Hits          132      133       +1     
  Misses          4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oscardssmith oscardssmith requested a review from ViralBShah August 7, 2023 13:04
@ViralBShah
Copy link
Member

I'm not the right person to review this.

@oscardssmith oscardssmith changed the title Teach julia that NaNMath functions don't have effectsAssume effects Teach julia that NaNMath functions don't have effects Aug 8, 2023
@mlubin
Copy link
Collaborator

mlubin commented Aug 14, 2023

This needs a review from someone who understands @assume_effects

@oscardssmith
Copy link
Member Author

I've talked to @vtjnash about this a bit and he thinks that libm might be leaking effectful information (rounding modes and signals) but I haven't been able to find observe this.

@vtjnash
Copy link

vtjnash commented Aug 15, 2023

In particular, note that C documentation for these explicitly states these are not pure due to side effects.

@oscardssmith
Copy link
Member Author

however the two areas of impurity (rounding modes and flags) appear not to be accessible from julia (or at least I haven't been able to observe the impurity)

@ChrisRackauckas
Copy link
Member

@oscardssmith can you update this and drop the compat?

@ChrisRackauckas
Copy link
Member

Actually that was simple enough. Looks right.

@ChrisRackauckas ChrisRackauckas merged commit ca02438 into master Jan 22, 2025
17 of 18 checks passed
@ChrisRackauckas ChrisRackauckas deleted the Assume-effects branch January 22, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants