JuliaSIMD / JuliaSIMD/LoopVectorization.jl
Increased execution time bug (Ryzen CPU only?)
- Dominant language
- Julia
- Stars
- 789
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have found a slowdown upon using the `@turbo` macro
```
using LoopVectorization,BenchmarkTools
function testSum(indices,Vectors)
A,B,C,D = Vectors
sum = 0.
for ksum in eachindex(indices)
k = indices[ksum]
sum += A[k] * B[k] +C[k] * D[k]
end
return sum
end
function testSum_avx(indices,Vectors)
A,B,C,D = Vectors
sum = 0.
@turbo for ksum in eachindex(indices)
k = indices[ksum]
sum += A[k] * B[k] +C[k] * D[k]
end
return sum
end
N = 63
Vectors = Tuple(rand(N) for _ in 1:4);
indices = rand(1:N,500);
@btime testSum($indices,$Vectors)
@btime testSum_avx($indices,$Vectors)
```
The output is:
```
510.417 ns (0 allocations: 0 bytes)
871.698 ns (0 allocations: 0 bytes)
```
I found this behaviour on two Ryzen CPU's (Ryzen 2700 and Ryzen 5 3500U).
On an intel CPU (Xeon(R) Gold 6130), the avx version does run faster.
For reference, I have posted a question on this behaviour on https://discourse.julialang.org/t/loopvectorization-almost-doubles-execution-time/64333.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.