JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Error caused by `Static.StaticInt` not being an `Integer`

Offen
#417 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
789
Forks
73
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I get the following error (on Julia v1.7.2):
```julia
julia> using Pkg; Pkg.activate(temp=true); Pkg.add("LoopVectorization")
...
[bdcacae8] + LoopVectorization v0.12.119
...
[aedffcd0] + Static v0.7.4
...

julia> function foo_plain!(dst, src)
for i in (firstindex(dst, 2) + 1):(lastindex(dst, 2) - 1)
dst[1, i] = src[1, i]
end
dst
end
foo_plain! (generic function with 1 method)

julia> src = ones(6, 6); dst = zero(src)
6×6 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0

julia> foo_plain!(dst, src)
6×6 Matrix{Float64}:
0.0 1.0 1.0 1.0 1.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0

julia> using LoopVectorization

julia> function foo_turbo!(dst, src)
@turbo for i in (firstindex(dst, 2) + 1):(lastindex(dst, 2) - 1)
dst[1, i] = src[1, i]
end
dst
end
foo_turbo! (generic function with 1 method)

julia> foo_turbo!(dst, src)
ERROR: TypeError: in typeassert, expected Integer, got a value of type Static.StaticInt{2}
Stacktrace:
[1] axes
@ ./abstractarray.jl:74 [inlined]
[2] firstindex
@ ./abstractarray.jl:396 [inlined]
[3] foo_turbo!(dst::Matrix{Float64}, src::Matrix{Float64})
@ Main ./REPL[9]:2
[4] top-level scope
@ REPL[10]:1
```
How would you recommend to solve this?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.