JuliaMath / NaNMath.jl

Julia math built-ins which return NaN and accumulator functions which ignore NaN
Other
52 stars 26 forks source link

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

Open oscardssmith opened 11 months ago

oscardssmith commented 11 months ago

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

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 80.00% and project coverage change: +0.02% :tada:

Comparison is base (d5ea765) 97.05% compared to head (d51c509) 97.08%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #67 +/- ## ========================================== + Coverage 97.05% 97.08% +0.02% ========================================== Files 1 1 Lines 102 103 +1 ========================================== + Hits 99 100 +1 Misses 3 3 ``` | [Files Changed](https://app.codecov.io/gh/JuliaMath/NaNMath.jl/pull/67?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaMath) | Coverage Δ | | |---|---|---| | [src/NaNMath.jl](https://app.codecov.io/gh/JuliaMath/NaNMath.jl/pull/67?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaMath#diff-c3JjL05hTk1hdGguamw=) | `97.08% <80.00%> (+0.02%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ViralBShah commented 11 months ago

I'm not the right person to review this.

mlubin commented 11 months ago

This needs a review from someone who understands @assume_effects

oscardssmith commented 11 months ago

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 commented 11 months ago

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

oscardssmith commented 11 months ago

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)