Intel IXP45X Developer's Manual page 209

Network processors
Table of Contents

Advertisement

®
Intel XScale
Processor—Intel
struct {
int a;
int b;
} c_arrays;
int ix;
for (i=0; i<NMAX]; i++)
{
ix = c[i].b;
if (c[i].a != 0)
do_other_calculations;
}
As an example of rearranging often written to sections in a structure, consider the code
sample:
struct employee
struct employee *prev;
struct employee *next;
float Year2DatePay;
float Year2DateTax;
int ssno;
int empid;
float Year2Date401KDed;
float Year2DateOtherDed;
};
In the data structure shown above, the fields Year2DatePay, Year2DateTax,
Year2Date401KDed, and Year2DateOtherDed are likely to change with each pay check.
The remaining fields however change very rarely. If the fields are laid out as shown
above, assuming that the structure is aligned on a 32-byte boundary, modifications to
the Year2Date fields is likely to use two write buffers when the data is written out to
memory. However, we can restrict the number of write buffers that are commonly used
to 1 by rearranging the fields in the above data structure as shown below:
struct employee {
struct employee *prev;
struct employee *next;
int ssno;
int empid;
float Year2DatePay;
float Year2DateTax;
float Year2Date401KDed;
float Year2DateOtherDed;
};
3.10.4.4.6
Cache Blocking
Cache blocking techniques, such as strip-mining, are used to improve temporal locality
of the data. Given a large data set that can be reused across multiple passes of a loop,
data blocking divides the data into smaller chunks which can be loaded into the cache
during the first loop and then be available for processing on subsequence loops thus
minimizing cache misses and reducing bus traffic.
As an example of cache blocking consider the following code:
for(i=0; i<10000; i++)
for(j=0; j<10000; j++)
August 2006
Order Number: 306262-004US
®
®
IXP45X and Intel
IXP46X Product Line of Network Processors
ix = c[i].a;
{
for(k=0; k<10000; k++)
C[j][k] += A[i][k] * B[j][i];
®
®
Intel
IXP45X and Intel
IXP46X Product Line of Network Processors
Developer's Manual
209

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?

Questions and answers

This manual is also suitable for:

Ixp46x

Table of Contents