JuliaSIMD / JuliaSIMD/LoopVectorization.jl

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

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

Description

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?

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.