Skip to content

Commit 9f35c5b

Browse files
Restore specialized Array SIMD method for calculate_residuals!
The hand-written @simd ivdep loop for Array + Serial() bypasses FastBroadcast overhead for the common case of plain Arrays with serial execution. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 23b1a2f commit 9f35c5b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/DiffEqBase/src/calculate_residuals.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ with multiple threads.
114114
return nothing
115115
end
116116

117+
@inline function calculate_residuals!(
118+
out::Array, ũ::Array, u₀::Array, u₁::Array, α::Number,
119+
ρ::Number, internalnorm::F, t, ::Serial
120+
) where {F}
121+
@inbounds @simd ivdep for i in eachindex(out, ũ, u₀, u₁)
122+
out[i] = calculate_residuals(ũ[i], u₀[i], u₁[i], α, ρ, internalnorm, t)
123+
end
124+
return nothing
125+
end
126+
117127
"""
118128
calculate_residuals!(out, u₀, u₁, α, ρ, thread=Serial())
119129

0 commit comments

Comments
 (0)