Skip to content

Commit 91706ad

Browse files
tkfKristofferC
authored andcommitted
Remove buffer pool for tiled GEMM (#42309)
(cherry picked from commit 6893f21)
1 parent fc86c16 commit 91706ad

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
@@ -536,9 +536,6 @@ function __init__()
536536
BLAS.lbt_forward(liblapack_path)
537537
end
538538
BLAS.check()
539-
Threads.resize_nthreads!(Abuf)
540-
Threads.resize_nthreads!(Bbuf)
541-
Threads.resize_nthreads!(Cbuf)
542539
catch ex
543540
Base.showerror_nostdio(ex, "WARNING: Error during initialization of module LinearAlgebra")
544541
end

stdlib/LinearAlgebra/src/matmul.jl

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

781781
const tilebufsize = 10800 # Approximately 32k/3
782-
# per-thread arrays of buffers resized by __init__ if needed
783-
const Abuf = [Vector{UInt8}(undef, tilebufsize)]
784-
const Bbuf = [Vector{UInt8}(undef, tilebufsize)]
785-
const Cbuf = [Vector{UInt8}(undef, tilebufsize)]
786782

787783
function generic_matmatmul!(C::AbstractMatrix, tA, tB, A::AbstractMatrix, B::AbstractMatrix,
788784
_add::MulAddMul=MulAddMul())
@@ -828,9 +824,8 @@ function _generic_matmatmul!(C::AbstractVecOrMat{R}, tA, tB, A::AbstractVecOrMat
828824
@inbounds begin
829825
if tile_size > 0
830826
sz = (tile_size, tile_size)
831-
# FIXME: This code is completely invalid!!!
832-
Atile = unsafe_wrap(Array, convert(Ptr{T}, pointer(Abuf[Threads.threadid()])), sz)
833-
Btile = unsafe_wrap(Array, convert(Ptr{S}, pointer(Bbuf[Threads.threadid()])), sz)
827+
Atile = Array{T}(undef, sz)
828+
Btile = Array{S}(undef, sz)
834829

835830
z1 = zero(A[1, 1]*B[1, 1] + A[1, 1]*B[1, 1])
836831
z = convert(promote_type(typeof(z1), R), z1)
@@ -850,8 +845,7 @@ function _generic_matmatmul!(C::AbstractVecOrMat{R}, tA, tB, A::AbstractVecOrMat
850845
end
851846
end
852847
else
853-
# FIXME: This code is completely invalid!!!
854-
Ctile = unsafe_wrap(Array, convert(Ptr{R}, pointer(Cbuf[Threads.threadid()])), sz)
848+
Ctile = Array{R}(undef, sz)
855849
for jb = 1:tile_size:nB
856850
jlim = min(jb+tile_size-1,nB)
857851
jlen = jlim-jb+1

0 commit comments

Comments
 (0)