Make indices zero-based first in the Horner linear index #236
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 314 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.344
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #236"
general
weight: 0.35
giordano
Cartesian
getindex/setindex!compute the linear index in Horner form asThis PR changes the association to
The number of integer operations is the same, but starting with Julia v1.12 (LLVM 18) the loop vectorizer does not vectorize short loops over an index of a
FixedSizeArraywith the current form.Measurements
Gather-form derivative kernel over a
FixedSizeArrayDimswith dimensions(Val(1), Val(4), Val(4), Val(4), n), minimum time in µs, x86-64 (Ryzen 9 5950X), one pinned core:| Julia | v1.5.2 | this PR |
|---|---|---|
| 1.10 | 30 | 30 |
| 1.11 | 29 | 30 |
| 1.12 | 59 | 25 |
| 1.14 | 58 | 20 |
The same kernel with a hand-written wrapper type using either index form reproduces both columns, so the difference is the index expression and not something else in
FixedSizeArray. A sum of strided terms (1 + (i - 1) + n1 * (j - 1) + ...) does not vectorize on 1.12/1.14 either.In Trixi.jl (trixi-framework/Trixi.jl#3357, 3D p4est advection, Julia 1.14):
rhs!307–320 µs → 290–302 µs, interface flux 84–86 µs → 62–65 µs, volume integral 180–184 µs → 167–175 µs. One kernel (prolong2interfaces!) gets slower, 23 µs → 32 µs, because LLVM unrolls its node loop differently; that is fixable in the Trixi.jl kernel and independent of the index form otherwise.Open points (hence draft)
tree_3d_dgsem/elixir_euler_ec.jl1784 → 1760,p4est_3d_dgsem/elixir_euler_ec.jl1110 → 1110,tree_2d_dgsem/elixir_euler_ec.jl542–588 → 552–562,p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl369 → 365. So for compressible Euler this PR is neutral; the gains above are for scalar advection.The existing test suite passes locally on Julia 1.14.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HgDfyeGjfcC7cikr7MfRB3