JuliaSIMD / JuliaSIMD/LoopVectorization.jl
Increased execution time bug (Ryzen CPU only?)
- 主要言語
- Julia
- スター
- 789
- フォーク
- 73
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、報告されている Ryzen および Intel の CPU で、提供されている testSum と testSum_avx のベンチマークを @btime で実行します。ベースラインのループと @turbo ループを比較し、背景を把握するためにリンクされている Discourse の議論を確認します。Ryzen 固有の速度低下が説明され、問題が修正されるか、その制限事項とともに文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- julia
- 領域
- performance
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100