JuliaSIMD / JuliaSIMD/LoopVectorization.jl

[bug] incorrect result

Open
#138 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
789
Forks
73
PR merge metrics
No merged PRs in 30d

Description

```julia
function _snparray_ax_additive!(out, s::Matrix{UInt8}, v)
fill!(out, zero(UInt8))
k = size(s, 1)
@avx for j ∈ eachindex(v)
for l in 1:k
block = s[(j-1)*size(s, 1) + (l-1) + 1]

# i = 4 * (l-1) + 1
Aij = block & 3
i = 4 * (l-1) + 1
out[i] += ((Aij >= 2) + (Aij >= 3)) * v[j]

# i = 4 * (l-1) + 2
Aij = (block >> 2) & 3
i = 4 * (l-1) + 2
out[i] += ((Aij >= 2) + (Aij >= 3)) * v[j]

# i = 4 * (l-1) + 3
Aij = (block >> 4) & 3
i = 4 * (l-1) + 3
out[i] += ((Aij >= 2) + (Aij >= 3)) * v[j]

# i = 4 * (l-1) + 4
Aij = (block >> 6) & 3
i = 4 * (l-1) + 4
out[i] += ((Aij >= 2) + (Aij >= 3)) * v[j]

end
end
out
end
```
The result is different from the code without `@avx`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.