Skip to content

Commit 6893f21

Browse files
authored
Remove buffer pool for tiled GEMM (#42309)
1 parent 1843201 commit 6893f21

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

stdlib/LinearAlgebra/src/LinearAlgebra.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,6 @@ function __init__()
586586
BLAS.lbt_forward(liblapack_path)
587587
end
588588
BLAS.check()
589-
Threads.resize_nthreads!(Abuf)
590-
Threads.resize_nthreads!(Bbuf)
591-
Threads.resize_nthreads!(Cbuf)
592589
catch ex
593590
Base.showerror_nostdio(ex, "WARNING: Error during initialization of module LinearAlgebra")
594591
end

stdlib/LinearAlgebra/src/matmul.jl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,6 @@ function generic_matmatmul(tA, tB, A::AbstractVecOrMat{T}, B::AbstractMatrix{S})
726726
end
727727

728728
const tilebufsize = 10800 # Approximately 32k/3
729-
# per-thread arrays of buffers resized by __init__ if needed
730-
const Abuf = [Vector{UInt8}(undef, tilebufsize)]
731-
const Bbuf = [Vector{UInt8}(undef, tilebufsize)]
732-
const Cbuf = [Vector{UInt8}(undef, tilebufsize)]
733729

734730
function generic_matmatmul!(C::AbstractMatrix, tA, tB, A::AbstractMatrix, B::AbstractMatrix,
735731
_add::MulAddMul=MulAddMul())
@@ -775,9 +771,8 @@ function _generic_matmatmul!(C::AbstractVecOrMat{R}, tA, tB, A::AbstractVecOrMat
775771
@inbounds begin
776772
if tile_size > 0
777773
sz = (tile_size, tile_size)
778-
# FIXME: This code is completely invalid!!!
779-
Atile = unsafe_wrap(Array, convert(Ptr{T}, pointer(Abuf[Threads.threadid()])), sz)
780-
Btile = unsafe_wrap(Array, convert(Ptr{S}, pointer(Bbuf[Threads.threadid()])), sz)
774+
Atile = Array{T}(undef, sz)
775+
Btile = Array{S}(undef, sz)
781776

782777
z1 = zero(A[1, 1]*B[1, 1] + A[1, 1]*B[1, 1])
783778
z = convert(promote_type(typeof(z1), R), z1)
@@ -797,8 +792,7 @@ function _generic_matmatmul!(C::AbstractVecOrMat{R}, tA, tB, A::AbstractVecOrMat
797792
end
798793
end
799794
else
800-
# FIXME: This code is completely invalid!!!
801-
Ctile = unsafe_wrap(Array, convert(Ptr{R}, pointer(Cbuf[Threads.threadid()])), sz)
795+
Ctile = Array{R}(undef, sz)
802796
for jb = 1:tile_size:nB
803797
jlim = min(jb+tile_size-1,nB)
804798
jlen = jlim-jb+1

0 commit comments

Comments
 (0)