Closed
Description
julia> using LoopVectorization
julia> function foofoo(xs::Vector{Int64})
s = 0f0
@inbounds @avx for i in 1:length(xs)
s += Float32(xs[i])
end
return s
end
foofoo (generic function with 1 method)
julia> foofoo(collect(1:10))
ERROR: MethodError: no method matching Float32(::VectorizationBase.Vec{8, Int64})
Closest candidates are:
(::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:200
(::Type{T})(::T) where T<:Number at boot.jl:760
(::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
...
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/LoopVectorization/O8WW6/src/reconstruct_loopset.jl:630 [inlined]
[2] _avx_!
@ ~/.julia/packages/LoopVectorization/O8WW6/src/reconstruct_loopset.jl:630 [inlined]
[3] foofoo(xs::Vector{Int64})
@ Main ./REPL[2]:3
[4] top-level scope
@ REPL[3]:1
Using convert(Float32, xs[i])
compiles fine and generates SIMD. Base @simd
handles the Float32
constructor fine, so I suppose this just a missing method / oversight? Thanks!
Metadata
Assignees
Labels
No labels