JuliaSIMD / JuliaSIMD/LoopVectorization.jl

LoadError: BoundsError: attempt to access 2-element Vector{LoopVectorization.ArrayReferenceMeta} at index [0]

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

Description

Hi,

I am working with Julia v1.6.2 with LoopVectorization v0.12.166. I am new to LoopVectorization, and I cannot figure out the problem after searching online for quite a while.

Here is a MWE of the error that I encounter.
```
using LoopVectorization
function test(a, b)
@turbo for i in axes(a,1)
a[i, 1] = 0.0
for j in axes(a,2)
a[i, 1] += b[i,j]
end
end
return nothing
end

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

will give me ($HOMEFOLDER is used below for privacy)
ERROR: LoadError: BoundsError: attempt to access 2-element Vector{LoopVectorization.ArrayReferenceMeta} at index [0]
Stacktrace:
[1] getindex
@ .\array.jl:801 [inlined]
[2] getindex
@ .\abstractarray.jl:1173 [inlined]
[3] mref_elbytes
@ $HOMEFOLDER\.julia\packages\LoopVectorization\7gWfp\src\reconstruct_loopset.jl:675 [inlined]
[4] add_op!(ls::LoopVectorization.LoopSet, instr::LoopVectorization.Instruction, ops::Vector{LoopVectorization.OperationStruct}, nopsv::Vector{Int64}, expandedv::Vector{Bool}, i::Int64, mrefs::Vector{LoopVectorization.ArrayReferenceMeta}, opsymbol::Symbol, elementbytes::Vector{Int64})
@ LoopVectorization $HOMEFOLDER\.julia\packages\LoopVectorization\7gWfp\src\reconstruct_loopset.jl:69

However, if I remove the line `a[i, 1] = 0.0`, it works well. The original also works if I don't use `@turbo`.

Could you help me understand this error message? And how should I implement such a task using `@turbo`? Thanks very much!

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.