LWN.net Logo

Memory part 5: What programmers can do

Memory part 5: What programmers can do

Posted Nov 2, 2007 15:34 UTC (Fri) by iulianm (guest, #48843)
Parent article: Memory part 5: What programmers can do

Referring to the optimized matrix multiplication code, the text reads:

> k2 and j2 loops are in a different order. This is done since, in the actual 
> computation, only one expression depends on k2 but two depend on j2

I believe that a better reason for changing the order of the two loops is that this way the
mul2 matrix is traversed by rows instead of by columns, which is the whole point of the
example since it prevents cache dirtying when accessing the elements of this matrix.


(Log in to post comments)

Memory part 5: What programmers can do

Posted Nov 2, 2007 17:20 UTC (Fri) by iulianm (guest, #48843) [Link]

...ignore the cache dirtying part... I meant loading more cache lines to access mul2 in the
innermost loop, when only one is needed

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds