JuliaLinearAlgebra / Octavian.jl

Multi-threaded BLAS-like library that provides pure Julia matrix multiplication
https://julialinearalgebra.github.io/Octavian.jl/stable/
Other
230 stars 18 forks source link

`matmul!` crashes inside `@batch` loops #108

Closed jlchan closed 3 years ago

jlchan commented 3 years ago

MWE:

using Polyester, Octavian
du = zeros(10,100)
A = ones(10,10)
rhs_local = [similar(view(du,:,1)) for _ in 1:Threads.nthreads()]
@batch for e = 1:size(du, 2)
  matmul!(view(du,:,e), A, rhs_local[Threads.threadid()])
end

The stacktrace starts with

Task (failed) @0x000000011d6dd660
BoundsError: attempt to access 7-element Vector{Task} at index [12]
Stacktrace:
  [1] getindex
    @ ./array.jl:801 [inlined]
  [2] getindex
    @ ./abstractarray.jl:1173 [inlined]
  [3] checktask(tid::UInt32)
    @ ThreadingUtilities ~/.julia/packages/ThreadingUtilities/IkkvN/src/threadtasks.jl:55
  [4] wait
    @ ~/.julia/packages/ThreadingUtilities/IkkvN/src/threadtasks.jl:74 [inlined]
  [5] macro expansion
    @ ~/.julia/packages/LoopVectorization/5UaTq/src/codegen/lower_threads.jl:439 [inlined]
  [6] macro expansion
    @ ~/.julia/packages/LoopVectorization/5UaTq/src/reconstruct_loopset.jl:704 [inlined]
  [7] _turbo_!(::Val...............
chriselrod commented 3 years ago

What version? Should be fixed on Octavian v0.3.

jlchan commented 3 years ago

Thanks for the heads up! Just tried again, seems to work now. I'm using v0.3.1 FWIW.

Closing issue since I can't seem to reproduce it.