Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions test/blasmultests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading