JuliaSIMD / JuliaSIMD/LoopVectorization.jl

vmap gives incorrect results for iszero

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

説明

If I run vmap with certain functions i get wrong results in some cases. I noticed this first for an integer array with iszero:
```
a = rand(Int8,200,20)
@test map(iszero,a) == vmap(iszero,a) #fails

```
Repeated evaluations of `vmap(iszero,a)` give different answers each time.
The same happens for some other functions I tested such as:

```
a = rand(200,20) #also for floats
vmap( ==(2.0), a)
vmap( >(0.5), a)
```
As a pattern these all return boolean arrays, functions that return floats seem to be unaffected.

vmapreduce is unaffected:
```
a = rand( Int8,200,20)
@test vmapreduce(iszero,+,a) == mapreduce(iszero,+,a) #passes
@test sum(map(iszero,a)) == sum(vmap(iszero,a)) #fails
```
The inplace version seems affected as well:
```
a = rand( Int8,200,20)
out = rand( Bool,200,20)
vmap!(iszero,out,a)
@test out == map(iszero,a) #fails
```
Interestingly this seems to consistently return the same (wrong) result instead of the always changing values of the out of place version. Here again this seems to only affect functions that return bools.

This is just from some playing around not something I actually need but unless I'm violating some assumptions LoopVectorization makes this seems like a bug.

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

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

調査の方向性

提供されている `vmap(iszero, a)` と `vmap!` の例で不一致を再現し、それぞれの結果を `map` と比較してください。さらに、`vmapreduce` が引き続き正しいことも確認してください。`vmap` と `vmap!` のエントリポイントから開始し、ブール値を返す関数を追跡してから、報告されたケースで `map` と等しい安定した結果を示す回帰テストを追加してください。

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

評価

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

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

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