I am trying the first example from GitHub - JuliaSIMD/LoopVectorization.jl: Macro(s) for vectorizing loops. . That is:
using LoopVectorization, BenchmarkTools
function mydot(a, b)
s = 0.0
@inbounds @simd for i ∈ eachindex(a,b)
s += a[i]*b[i]
end
s
end
function mydotavx(a, b)
s = 0.0
@avx for i ∈ eachindex(a,b)
s += a[i]*b[i]
end
s
end
a = rand(256); b = rand(256);
@btime mydot($a, $b)
@btime mydotavx($a, $b)
a = rand(43); b = rand(43);
@btime mydot($a, $b)
@btime mydotavx($a, $b)
I get an error from “s += a[i]*b[i]” which is
ERROR: LoadError: “Don’t know how to handle expression:\ns += a[i] * b[i]”
Stacktrace:
[1] push!( ::LoopVectorization.LoopSet, ::Expr, ::Int64 ) at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/graphs.jl:539
[2] add_block!( ::LoopVectorization.LoopSet, ::Expr, ::Int64 ) at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/graphs.jl:310
[3] add_loop!( ::LoopVectorization.LoopSet, ::Expr, ::Int64 ) at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/graphs.jl:401
[4] add_loop! at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/graphs.jl:398 [inlined]
[5] copyto! at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/constructors.jl:6 [inlined]
[6] LoopVectorization.LoopSet( ::Expr ) at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/constructors.jl:45
[7] @avx( ::LineNumberNode, ::Module, ::Any ) at /Users/user/.julia/packages/LoopVectorization/WdP5f/src/constructors.jl:93
in expression starting at REPL[25]:3
Am I doing something dim or is this a bug?