JuliaSIMD / JuliaSIMD/LoopVectorization.jl

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

Abierto
#417 5 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
789
Forks
73
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start by reproducing the Julia v1.7.2 example using @turbo and the firstindex/lastindex loop shown in the issue. Trace the @turbo handling of array axes and Static.StaticInt values; done when the example no longer raises the Integer type assertion error and the regression is covered by a test.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
julia
Área
performance, tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.