From: Bernd Paysan <bernd.paysan@gmx.de>
Subject: Re: Fast matrix multiply and benchmark
Date: 1998/12/21 [thread overview]
Message-ID: <75leig$vav$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 367D9D1E.32A9@fy.no.chalmers.spam.se
In article <367D9D1E.32A9@fy.no.chalmers.spam.se>,
Lennart Bengtsson <tfylb@fy.no.chalmers.spam.se> wrote:
> Hi,
>
> Dr. Naohiko Shimizu recently proposed a way to organize the computation
> of matrix products so that the number of TLB missed was minimized.
> TLB misses may occur, for instance, when accessing the elements of
> a large matrix row by row, and the number of columns are greater than
> the available number of TLB entries. This is the case when calculating
> a matrix product using dot products:
>
> c(i,j) = sum_k a(i,k)*b(k,j) (inner loop over index k)
I thought blocking of matrix products is pretty standard and straight-forward.
You can get quite close to peak performance even with low memory bandwidth. I
got to more than 30 MFlops on a 50 MHz PA-RISC (50 MFlops peak).
I organized the dot product so that I compute a 5x5 field in the inner loop.
This fits nicely into a typical 31-element register set: five temporaries for
row, one for column (or vice versa, the single temporary at best is the one
without unit stride), and 25 destination registers. You then have 25 macs for
10 cache loads.
The outer loop then blocks the matrix into sub-fields that fit into the L1
cache or the limit of TLB mapable part, whatever is smaller. The machine I
used then had no L2 cache, but the next outer block would have either half
the size of the TLB area or the L2 cache, whatever is smaller or the L2 area
if the TLB area already is covered by the L1 loop. The next outer block
should trade between RAM and swap space, if necessary.
A 128 element TLB can keep at ease one 100x100 matrix, and the two 5x100
stripes for second source and result. You have to compute one million macs
for 240k memory throughput.
--
Bernd Paysan
"Late answers are wrong answers!"
http://www.jwdt.com/~paysan/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
next prev parent reply other threads:[~1998-12-21 5:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-12-18 5:00 Fast matrix multiply and benchmark pshimizu
1998-12-18 5:00 ` Dann Corbit
1998-12-21 5:00 ` Lennart Bengtsson
1998-12-21 5:00 ` Bernd Paysan [this message]
1998-12-26 5:00 ` pshimizu
1998-12-28 5:00 ` Andy Glew
1998-12-29 5:00 ` pshimizu
1998-12-29 5:00 ` Andy Glew
1998-12-28 5:00 ` Andy Glew
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox