Intel IXP45X Developer's Manual page 211

Network processors
Table of Contents

Advertisement

®
Intel XScale
Processor—Intel
Recursive data structure traversal is another construct where prefetching can be
applied. This is similar to linked list traversal. Consider the following pre-order traversal
of a binary tree:
preorder(treeNode *t) {
if(t) {
}
}
The pointer variable t becomes the pseudo induction variable in a recursive loop. The
data structures pointed to by the values t->left and t->right can be pre-fetched for the
next iteration of the loop.
preorder(treeNode *t) {
if(t) {
}
}
Note the order reversal of the prefetches in relationship to the usage. If there is a
cache conflict and data is evicted from the cache then only the data from the first
prefetch is lost.
3.10.4.4.9
Loop Interchange
As mentioned earlier, the sequence in which data is accessed affects cache thrashing.
Usually, it is best to access data in a contiguous spatially address range. However,
arrays of data may have been laid out such that indexed elements are not physically
next to each other. Consider the following C code which places array elements in row
major order.
for(j=0; j<NMAX; j++)
for(i=0; i<NMAX; i++)
{
}
In the above example, A[i][j] and A[i+1][j] are not sequentially next to each other.
This situation causes an increase in bus traffic when prefetching loop data. In some
cases where the loop mathematics are unaffected, the problem can be resolved by
induction variable interchange. The above examples becomes:
for(i=0; i<NMAX; i++)
for(j=0; j<NMAX; j++)
{
}
3.10.4.4.10 Loop Fusion
Loop fusion is a process of combining multiple loops, which reuse the same data, in to
one loop. The advantage of this is that the reused data is immediately accessible from
the data cache. Consider the following example:
August 2006
Order Number: 306262-004US
®
®
IXP45X and Intel
IXP46X Product Line of Network Processors
process(t->data);
preorder(t->left);
preorder(t->right);
prefetch(t->right);
prefetch(t->left);
process(t->data);
preorder(t->left);
preorder(t->right);
prefetch(A[i+1][j]);
sum += A[i][j];
prefetch(A[i][j+1]);
sum += A[i][j];
®
®
Intel
IXP45X and Intel
IXP46X Product Line of Network Processors
Developer's Manual
211

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the IXP45X and is the answer not in the manual?

This manual is also suitable for:

Ixp46x

Table of Contents