blocks:
This feature measures the number of unique 64 byte cache blocks that are touched by a region of code.
It is measured as the ratio of the number of unique cache blocks accessed to the total number of
memory accesses in a code region.
Classifying blocks:
blocks can be classified into low, medium or high as follows:
Bucket | Condition |
---|---|
Low |
The number of unique array accesses in the region of code outnumber the number of
arrays declared by about 3:1.
OR
An array access takes place in a nested loop.
|
Medium | The number of unique array accesses in the region of code outnumber the number of arrays declared by about 3:2. |
High | Each array in the region of code has only one unique access. |
Example 1:
Consider the following code:
for (i=0; i<1000; i++) result[i] = sqrt(arrayOne[i]) * sqrt(arrayTwo[i]);This code region consists of 3 arrays (result, arrayone & arrayTwo) with only one location of each being accessed in each iteration of the loop. Therefore, blocks can be estimated to be high.
Example 2:
Let's look at another example:
for (i=0; i<1000; i++) result[i] += sqrtf(arrayOne[i]) + sqrtf(arrayTwo[i]);In this example, the array result is accessed twice:
Example 3:
Consider the next example:
for( j = EXCESS_PADDING_PER_DIM_BY_2(SIZE_FILTER); j < ny + EXCESS_PADDING_PER_DIM_BY_2(SIZE_FILTER); j++ ) { for( i = EXCESS_PADDING_PER_DIM_BY_2(SIZE_FILTER); i < nx + EXCESS_PADDING_PER_DIM_BY_2(SIZE_FILTER); i++ ) { s = i + (PADDED_IMAGE_ROWS_COLS(nx)*j); sum = 0.0; for( k = 0; k < SIZE_FILTER; k++){ index = INDEX2D(i,j+k,PADDED_IMAGE_ROWS_COLS(nx),SIZE_FILTER); for( l = 0; l < SIZE_FILTER; l++ ) sum += *(filter + (k*SIZE_FILTER) + l) * *(inputImage + index + l); } *(outputImage + s) = sum; } }This code contains 3 arrays (filter, inputImage & outputImage). The innermost loop computes sum by accumulating the summation of the filter & inputImage arrays for length SIZE_FILTER. Each iteration of the innermost accesses a different location in filter and inputImage.