JuliaSIMD / JuliaSIMD/LoopVectorization.jl
AssertionError: !(iszero(length(loopstartᵢ)))
- Vorherrschende Sprache
- Julia
- Sterne
- 789
- Forks
- 73
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Not sure if I'm doing something illegal here, but I get an assertion error from the following set of llops
```julia
using LoopVectorization
function avxbug(U = randn(2,2), E1 = randn(2))
t = 1
a = 1.0
_s = 0.0
k,n = size(U)
@avx for j = 1:k
for i = 1:n
u = tanh(a * U[i,j])
v = a * (1 - t * t)
U[i,j] = u
_s += v
end
E1[j] = _s / n
end
end
avxbug()
julia> avxbug()
ERROR: AssertionError: !(iszero(length(loopstartᵢ)))
Stacktrace:
[1] add_loop_start_stop_manager!(::LoopVectorization.LoopSet) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/loopstartstopmanager.jl:163
[2] lower_unrollspec(::LoopVectorization.LoopSet) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/lowering.jl:662
[3] lower(::LoopVectorization.LoopSet, ::Array{Symbol,1}, ::Symbol, ::Symbol, ::Symbol, ::Int64, ::Int64, ::Bool) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/lowering.jl:673
[4] lower_and_split_loops(::LoopVectorization.LoopSet, ::Int64) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/split_loops.jl:121
[5] lower_and_split_loops(::LoopVectorization.LoopSet, ::Int64) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/split_loops.jl:106
[6] avx_body(::LoopVectorization.LoopSet, ::Tuple{Int8,Int8,Int8,Int64}) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/reconstruct_loopset.jl:455
[7] #s134#86 at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/reconstruct_loopset.jl:499 [inlined]
[8] #s134#86(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Type{T} where T, ::Type{T} where T, ::Type{T} where T, ::Type{T} where T, ::Any, ::Any, ::Any) at ./none:0
[9] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:527
[10] avxbug(::Array{Float64,2}, ::Array{Float64,1}) at /home/fredrikb/arl/bird_clustering/ica.jl:41
[11] avxbug() at /home/fredrikb/arl/bird_clustering/ica.jl:37
[12] top-level scope at none:1
```
If I replace `_s += v` with `_s += 1.0` I instead get
```julia
julia> avxbug()
ERROR: InexactError: trunc(Int64, Inf)
Stacktrace:
[1] trunc at ./float.jl:703 [inlined]
[2] round at ./float.jl:367 [inlined]
[3] determine_unroll_factor(::LoopVectorization.LoopSet, ::Array{Symbol,1}, ::Symbol) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/determinestrategy.jl:315
[4] choose_order_cost at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/determinestrategy.jl:1047 [inlined]
[5] lower_and_split_loops(::LoopVectorization.LoopSet, ::Int64) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/split_loops.jl:100
[6] lower_and_split_loops(::LoopVectorization.LoopSet, ::Int64) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/split_loops.jl:106
[7] avx_body(::LoopVectorization.LoopSet, ::Tuple{Int8,Int8,Int8,Int64}) at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/reconstruct_loopset.jl:455
[8] #s134#86 at /home/fredrikb/.julia/packages/LoopVectorization/ii0y6/src/reconstruct_loopset.jl:499 [inlined]
[9] #s134#86(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Type{T} where T, ::Type{T} where T, ::Type{T} where T, ::Type{T} where T, ::Any, ::Any, ::Any) at ./none:0
[10] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:527
[11] avxbug(::Array{Float64,2}, ::Array{Float64,1}) at /home/fredrikb/arl/bird_clustering/ica.jl:40
[12] avxbug() at /home/fredrikb/arl/bird_clustering/ica.jl:36
[13] top-level scope at none:1
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Reproduce avxbug() with both loop bodies shown in the issue. Start by reading add_loop_start_stop_manager! in loopstartstopmanager.jl and determine_unroll_factor in determinestrategy.jl, following the provided stack traces. Done means both reproductions no longer raise the reported AssertionError or InexactError.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- julia
- Bereich
- performance
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100