From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,df1933a2e94773c X-Google-Attributes: gid1164f8,public X-Google-Thread: f57db,df1933a2e94773c X-Google-Attributes: gidf57db,public X-Google-Thread: 102b75,df1933a2e94773c X-Google-Attributes: gid102b75,public X-Google-Thread: 114b0c,df1933a2e94773c X-Google-Attributes: gid114b0c,public From: Bernd Paysan Subject: Re: Fast matrix multiply and benchmark Date: 1998/12/21 Message-ID: <75leig$vav$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 424456337 References: <75ca18$ss8$1@news01cc.so-net.ne.jp> <367D9D1E.32A9@fy.no.chalmers.spam.se> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 194.139.17.7 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Dec 21 12:22:41 1998 GMT Newsgroups: comp.arch,comp.benchmarks,comp.sys.hp,comp.sys.dec X-Http-User-Agent: Mozilla/4.5 [en] (X11; I; SunOS 5.6 sun4c) In article <367D9D1E.32A9@fy.no.chalmers.spam.se>, Lennart Bengtsson 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