|
From: Nicholas N. <nj...@cs...> - 2006-11-21 04:38:12
|
On Mon, 6 Nov 2006, Ulrich Drepper wrote: > In case a data set spreads two cache lines and the second cache line is at > index zero (i.e., the first at the highest index), the tag used for the > second cache line is wrong. It is one higher than the tag for the first, > otherwise no wrap-around would happen. Patch is attached. > block2: \ > set = &(L.tags[set2 << L.assoc_bits]); \ > + if (set2 == 0) \ > + ++tag; I think a clearer thing to do in the two-set case is to compute two tag values, one for 'a' and one for 'a+size-1', just as is done for the sets. The first tag would be used when checking the first set, the second tag for the second set. I think the end effect is the same. > I've also added some optimizations. Since you already decided to keep L.sets > - 1 in a separate variable around you might as well use it in all places. > Once you do this there is no reason to keep L.sets around. So I went on > removing it. > > Which brings on the next step: now the cache_t2 structure consists of 8 words > and the char array. If you rearrange the struct to move the tags pointer > before the desc_line element all commonly used elements are in the first 32 > or 64 bytes (for 32 or 64 byte platforms respectively). If now cache_t2 is > aligned for this value there is only one cache line needed for L2, I1, D1. Have you measured the effect of these changes? Nick |