math: Keep `^(::Float64, ::Integer)` cheap to inline #64532
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 333 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #64532"
general
weight: 0.35
oscardssmith
Since #53967 (1.12),
^(::Float64, ::Integer)is@inlinebut carries the large-exponent fallback (threepow_body(::Float64, ::Float64)calls) in its body. Every caller pays for that in its inlining cost. A ForwardDiff-style dual number with^(a::Dual, n::Integer) = Dual(a.v^n, (n a.v^(n - 1)) . a.p)inlined on 1.11 (cost 83) but no longer does. The loop using it then calls^out of line, returns the dual through memory, and loses the vectorized partials. On the CI runtime benchmarks,apps/dual_gradientis 1.65× slower than on 1.10.This PR makes
^do a single out-of-line call again:pow_intchecks the range, then either runspow_bodyinline or tail-calls the large-exponent path. The second commit startspow_bodywithxnlo = 0.0again: since #62527 a zeroerrreturnsx*y, so the-0.0from #55875 no longer affects any result. Results are bitwise identical to master on a 493k-case grid: signed zeros, Inf, NaN, subnormals,nin -70:70, theuse_power_by_squaringedges,typemin/typemax, andInt32/UInt8/BigIntexponents.Cycles per call on an M4 Pro (
thread_selfcounts, min of 400, stable over 3 processes):| | master | PR |
|---|---|---|
| Dual Rosenbrock gradient chunk (256 elements) | 16.8k | 10.5k |
|
x^n, runtimen = 2| 11.1 | 8.8 ||
x^n, runtimen = -7| 16 | 12.5 ||
x^n, runtimen = 100_000| 32.3 | 35.6 |The last row is the extra call on the rare large-exponent path.
<details><summary>Benchmark</summary>
</details>
🤖 Generated with Claude Code