JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Reduction not found

オープン
#528 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
789
フォーク
73
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi, here is a MWE of an unexpected error:

```
using LoopVectorization

function test(a, b)
#s = 0.0
@turbo for i in axes(a,1)
ai = 0.0
for j in axes(b,2)
bij = b[i, j]
ai += bij^2
end
ai = exp(ai)
a[i] = ai
end
return nothing
end

a = rand(256)
b = rand(256, 256)
test(a, b)
```

LoadError: LoadError: "Reduction not found."
Stacktrace:
[1] reduction_zero
@ $HOME\.julia\packages\LoopVectorization\7gWfp\src\modeling\costs.jl:649 [inlined]
[2] add_reduction_update_parent!(vparents::Vector{LoopVectorization.Operation}, deps::Vector{Symbol}, reduceddeps::Vector{Symbol}, ls::LoopVectorization.LoopSet, parent::LoopVectorization.Operation, instr::LoopVectorization.Instruction, reduction_ind::Int64, elementbytes::Int64)
@ LoopVectorization $HOME\.julia\packages\LoopVectorization\7gWfp\src\parse\add_compute.jl:255



If I use `a[i] = exp(ai)` instead of the last two lines, it works. It also works if the last two lines are `ai = exp(ai/2); a[i] = ai`. I feel the issue is related to your explanation in #498, but honestly I don't fully understand that. My general feeling there is that the error it gives is unnecessary and can be ignored if it can run... Is that correct?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Run the supplied Julia MWE with LoopVectorization and start by reading reduction_zero in src/modeling/costs.jl around line 649, then add_reduction_update_parent! in src/parse/add_compute.jl around line 255. Compare the failing assignment with the working variants and determine whether the reduction error is expected; done means the behavior is explained and the MWE no longer produces an unjustified error.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
julia
領域
performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。