JuliaSIMD / JuliaSIMD/LoopVectorization.jl
no method matching similar in broadcasting expression
- Lingua principale
- Julia
- Stelle
- 789
- Fork
- 73
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
On LV v0.8.1
```julia
julia> using StaticArrays, LoopVectorization
julia> function softmin_avx(a::T, b, c, γ) where T
γ = -γ
v = SVector(a, b, c, zero(T))
v = @avx v ./ γ
maxv = maximum(v)
ve = @avx exp.(v .- maxv) #.* SVector(one(T), one(T), one(T), zero(T))
γ*(log(sum(ve)) + maxv)
end
softmin_avx (generic function with 1 method)
julia> softmin_avx(1.0, 1.0, 1.0, 1.0)
ERROR: MethodError: no method matching similar(::Base.Broadcast.Broadcasted{StaticArrays.StaticArrayStyle{1},Nothing,typeof(/),Tuple{SArray{Tuple{4},Float64,1,4},Float64}}, ::Type{Float64})
Closest candidates are:
similar(::JuliaInterpreter.Compiled, ::Any) at /home/fredrikb/.julia/packages/JuliaInterpreter/sZur5/src/types.jl:7
similar(::Array{T,1}, ::Type) where T at array.jl:358
similar(::Array{T,2}, ::Type) where T at array.jl:359
...
Stacktrace:
[1] vmaterialize at /home/fredrikb/.julia/packages/LoopVectorization/lmGAZ/src/broadcast.jl:316 [inlined]
[2] softmin_avx(::Float64, ::Float64, ::Float64, ::Float64) at ./none:4
[3] top-level scope at none:0
```
Trying the same thing with `vmap` produces another error
```julia
jjulia> function softmin_avx(a::T, b, c, γ) where T
γ = -γ
v = SVector(a, b, c, zero(T))
v = vmap(v->v / γ, v)
maxv = maximum(v)
ve = vmap(v->exp(v - maxv), v) #.* SVector(one(T), one(T), one(T), zero(T))
γ*(log(sum(ve)) + maxv)
end
softmin_avx (generic function with 1 method)
julia> softmin_avx(1.0, 1.0, 1.0, 1.0)
ERROR: Abstract type Any does not have a definite size.
Stacktrace:
[1] sizeof(::Type{T} where T) at ./essentials.jl:451
[2] #s19#58(::Any, ::Any, ::Any) at /home/fredrikb/.julia/packages/VectorizationBase/e8k1q/src/vector_width.jl:26
[3] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:526
[4] #s18#60(::Any, ::Any, ::Any) at /home/fredrikb/.julia/packages/VectorizationBase/e8k1q/src/vector_width.jl:33
[5] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:526
[6] vmap_quote(::Int64, ::Type{Any}) at /home/fredrikb/.julia/packages/LoopVectorization/lmGAZ/src/map.jl:3
[7] #s16#5(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at /home/fredrikb/.julia/packages/LoopVectorization/lmGAZ/src/map.jl:32
[8] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:526
[9] vmap_call at /home/fredrikb/.julia/packages/LoopVectorization/lmGAZ/src/map.jl:165 [inlined]
[10] vmap at /home/fredrikb/.julia/packages/LoopVectorization/lmGAZ/src/map.jl:175 [inlined]
[11] softmin_avx(::Float64, ::Float64, ::Float64, ::Float64) at ./none:4
[12] top-level scope at none:0
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.