JuliaSIMD / JuliaSIMD/LoopVectorization.jl
LoadError: BoundsError: attempt to access 2-element Vector{LoopVectorization.ArrayReferenceMeta} at index [0]
- Vorherrschende Sprache
- Julia
- Sterne
- 789
- Forks
- 73
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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!
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Reproduziere das MWE mit Julia v1.6.2 und LoopVectorization v0.12.166 und vergleiche die fehlschlagende Form mit der Version ohne `a[i, 1] = 0.0`. Beginne in `src/reconstruct_loopset.jl` bei `mref_elbytes` und `add_op!`; abgeschlossen ist die Aufgabe, wenn die gezeigte `@turbo`-Schleife keinen BoundsError mehr auslöst oder es eine dokumentierte unterstützte Alternative gibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- julia
- Bereich
- performance
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100