diff --git a/src/linalg.jl b/src/linalg.jl index c5befd1..4a1bbbe 100644 --- a/src/linalg.jl +++ b/src/linalg.jl @@ -148,7 +148,7 @@ function _threaded_blas_mul!( end nthreads1 = nthreads >> 1 nthreads2 = nthreads - nthreads1 - t = Threads.@spawn _threaded_blas_mul!(Chead, Ahead, CA, Bhead, CB, α, β, nthreads1) + t = Threads.@spawn _threaded_blas_mul!($Chead, $Ahead, CA, $Bhead, CB, α, β, nthreads1) _threaded_blas_mul!(Ctail, Atail, CA, Btail, CB, α, β, nthreads2) wait(t) return C diff --git a/test/blasmultests.jl b/test/blasmultests.jl index 45a30f2..af62bf0 100644 --- a/test/blasmultests.jl +++ b/test/blasmultests.jl @@ -96,3 +96,18 @@ end C1 = StridedView(copy(C)) @test mul!(C, A, B, α, β) ≈ mul!(C1, A1, B1, α, β) end + +# small enough to never be split over threads, such that no tasks need to be spawned +blasmul_allocations(C, A, B, α, β) = @allocated mul!(C, A, B, α, β) +@testset "Matrix multiplication with StridedView does not allocate: $T" for T in (Float64, ComplexF64) + d = 8 + A = StridedView(rand(T, (d, d))) + B = StridedView(rand(T, (d, d))) + C = StridedView(rand(T, (d, d))) + α = rand(T) + β = rand(T) + for op1 in (identity, conj, transpose, adjoint), op2 in (identity, conj, transpose, adjoint) + blasmul_allocations(C, op1(A), op2(B), α, β) # compile + @test blasmul_allocations(C, op1(A), op2(B), α, β) == 0 + end +end