feat: guard nonfinite inputs in LV @turbo compound unary eval#179
Open
MilesCranmerBot wants to merge 6 commits into
Open
feat: guard nonfinite inputs in LV @turbo compound unary eval#179MilesCranmerBot wants to merge 6 commits into
MilesCranmerBot wants to merge 6 commits into
Conversation
Contributor
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #179 +/- ##
==========================================
- Coverage 59.43% 59.00% -0.44%
==========================================
Files 30 30
Lines 2682 2700 +18
==========================================
- Hits 1594 1593 -1
- Misses 1088 1107 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9ee6040 to
9d55269
Compare
The @turbo compound unary evaluators called the outer operator even when the inner result was nonfinite. Guard operators that cannot be evaluated on nonfinite inputs; keep the unguarded path for operators that can. Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
9d55269 to
b2e05d7
Compare
Member
|
@MilesCranmerBot could we please rename this to Also please update the PR body and title |
Per review feedback, the name should be specific to LoopVectorization since it only guards @turbo loops. Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Member
|
@MilesCranmerBot the downgrade-compat CI is failing. Could you please fix that? If unrelated to this PR, then make a new PR that fixes it. |
Member
|
@MilesCranmerBot your code coverage is still dropping relative to master. Please fix. |
- Add tests covering both branches (turbo_can_eval_nonfinite true/false) for all compound binary+unary evaluation paths in the LV extension - Bump LoopVectorization compat floor from 0.12 to 0.12.170 to fix downgrade-compat CI failure (old LV versions crash on Julia 1.12)
MilesCranmer
approved these changes
Jun 28, 2026
- Remove extra blank line flagged by JuliaFormatter - Bump SymbolicUtils compat from 4 to 4.27 (old versions crash on Julia 1.12 with SCALARS undefvar error)
LV 0.12.170 still has GlobalRef bug on Julia 1.12 CI runners. Bump to latest 0.12.174. SymbolicUtils 4.35 matches arenanode-prototype which was the last branch with passing downgrade-compat on Julia 1.10.
The julia-downgrade-compat action merges main+test projects. Without matching compat entries in test/Project.toml, the test env tries to resolve different versions than the main project, causing 'can not merge projects' on Julia 1.10.
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.
What
Guard nonfinite inputs in the 4 compound unary
@turboloops in the LoopVectorization extension that were missingifelse(isfinite, ...)guards.How
turbo_can_eval_nonfinite(op)returnstruefor operators that are safe to call onInf/NaN(e.g.exp,abs,+,identity).@turbo(zero overhead).sin,log,sqrt, etc.):@turbowithifelse(isfinite(x_l), op(x_l), T(NaN)).Files
src/ValueInterface.jl:turbo_can_eval_nonfinitedispatch table (+9 lines)ext/DynamicExpressionsLoopVectorizationExt.jl: guard 4@turboloops (+41/-16)test/test_nonfinite_operator_guard.jl: tests (+39 lines)Total: +90/-16 across 4 files (including test registration).
CI notes
Two failures appear pre-existing:
Julia 1 - ubuntu:maptest intest_base.jl:107(unrelated to this diff)downgrade-compat (1):SymbolicUtilsprecompilation failure (dependency issue)