Skip to content

AssertionError: !(iszero(length(loopstartᵢ))) #134

@baggepinnen

Description

@baggepinnen

Not sure if I'm doing something illegal here, but I get an assertion error from the following set of llops

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> 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions