LoopVectorization.jl icon indicating copy to clipboard operation
LoopVectorization.jl copied to clipboard

vmapreduce: no method matching reduce_to_onevec

Open nsajko opened this issue 3 years ago • 1 comments

vmapreduce_bugreport.jl:

using LoopVectorization

f(a) =
  (a, a)

g(a, b) =
  let (q, w) = a, (e, r) = b
    (min(q, e), max(w, r))
  end

myminmax_mapreduce(x) =
  mapreduce(f, g, x)

myminmax_vmapreduce(x) =
  vmapreduce(f, g, x)

const inp = rand(1:9, 100)

myminmax_mapreduce(inp)

myminmax_vmapreduce(inp)

nothing
$ julia -O3 --min-optlevel=3 -g 2 --threads 4
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.0 (2022-08-17)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> include("vmapreduce_bugreport.jl")
ERROR: LoadError: MethodError: no method matching reduce_to_onevec(::typeof(g), ::Tuple{VectorizationBase.VecUnroll{3, 4, Int64, VectorizationBase.Vec{4, Int64}}, VectorizationBase.VecUnroll{3, 4, Int64, VectorizationBase.Vec{4, Int64}}})
Closest candidates are:
  reduce_to_onevec(::F, ::VectorizationBase.VecUnroll) where F at ~/.julia/packages/VectorizationBase/oCgEJ/src/VectorizationBase.jl:504
Stacktrace:
 [1] _vmapreduce
   @ ~/.julia/packages/LoopVectorization/aw6pf/src/simdfunctionals/mapreduce.jl:83 [inlined]
 [2] vmapreduce
   @ ~/.julia/packages/LoopVectorization/aw6pf/src/simdfunctionals/mapreduce.jl:62 [inlined]
 [3] myminmax_vmapreduce(x::Vector{Int64})
   @ Main ~/vmapreduce_bugreport.jl:14
 [4] top-level scope
   @ ~/vmapreduce_bugreport.jl:21
 [5] include(fname::String)
   @ Base.MainInclude ./client.jl:476
 [6] top-level scope
   @ REPL[1]:1
in expression starting at /home/nsajko/vmapreduce_bugreport.jl:21

nsajko avatar Aug 23 '22 07:08 nsajko

The code here shouldn't be that hard to read. You're welcome to try and tackle it.

chriselrod avatar Aug 23 '22 18:08 chriselrod