Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chengxo opened this issue Jan 20, 2024 · 1 comment

Comments

@chengxo
Copy link

chengxo commented Jan 20, 2024

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!

@chengxo
Copy link
Author

chengxo commented Jan 21, 2024

After looking more into the issue list, I think it is related to #331, #411, although removing a[i,1] = 0.0 fixing the issue still looks weird to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant