![Intel IXP45X Скачать руководство пользователя страница 209](http://html1.mh-extra.com/html/intel/ixp45x/ixp45x_developers-manual_2073092209.webp)
Intel
®
IXP45X and Intel
®
IXP46X Product Line of Network Processors
August 2006
Developer’s Manual
Order Number: 306262-004US
209
Intel XScale
®
Processor—Intel
®
IXP45X and Intel
®
IXP46X Product Line of Network Processors
As an example of rearranging often written to sections in a structure, consider the code
sample:
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:
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:
struct {
int a;
int b;
} c_arrays;
int ix;
for (i=0; i<NMAX]; i++)
{
ix = c[i].b;
if (c[i].a != 0)
ix = c[i].a;
do_other_calculations;
}
struct employee
{
struct employee *prev;
struct employee *next;
float Year2DatePay;
float Year2DateTax;
int ssno;
int empid;
float Year2Date401KDed;
float Year2DateOtherDed;
};
struct employee {
struct employee *prev;
struct employee *next;
int ssno;
int empid;
float Year2DatePay;
float Year2DateTax;
float Year2Date401KDed;
float Year2DateOtherDed;
};
for(i=0; i<10000; i++)
for(j=0; j<10000; j++)
for(k=0; k<10000; k++)
C[j][k] += A[i][k] * B[j][i];