Type 2M sentinel returns by all result-feeding inputs#727
Closed
haakon-e wants to merge 1 commit into
Closed
Conversation
The early return (no rain, or supersaturated) was typed from eltype(q_tot) alone while the main path's rates derive from all eight numeric arguments. Callers mixing Dual-valued species with a plain-float q_tot (any pointwise Jacobian) got a union-typed, heap-boxed return — silently: JET reports nothing and the optimized IR contains no dynamic calls, since the box comes from the abstract return convention. Adds Utilities.promote_typeof for the idiom: type sentinels and early returns by the promotion of the arguments the result derives from.
Member
Author
|
This change is part of the following stack: Change managed by git-spice. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## he/ad-compat-2m-p3 #727 +/- ##
===================================================
Coverage 92.90% 92.90%
===================================================
Files 56 56
Lines 2720 2721 +1
===================================================
+ Hits 2527 2528 +1
Misses 193 193
🚀 New features to boost your workflow:
|
Member
Author
|
Folded into #725 (tiny fix + tests; not worth a separate PR in the stack). |
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.
Functions that type early returns or sentinel values from a single argument (
FT = eltype(q_tot)-style) return union-typed, heap-boxed results when a caller mixes plain floats with ForwardDiff Duals across arguments -- as any pointwise Jacobian of the tendencies does (frozen thermodynamic context, Dual species). JET reports nothing and the optimized IR contains no dynamic calls, since the box lives in the abstract return convention (found while chasing per-substep allocations in the Rosenbrock substepping work; tracked there as a value-dependent 32 B/substep).Adds
Utilities.promote_typeofand typesrain_evaporation's early return by the promotion of all the arguments its rates derive from, with an@inferredregression test over both branches. Stacked on #725; further 2M/P3 cases from the same sweep land here as they are confirmed.