EasyManua.ls Logo

Intel ARCHITECTURE IA-32 - Example 3-19 Strip Mined Code

Intel ARCHITECTURE IA-32
568 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Coding for SIMD Architectures 3
3-33
The main loop consists of two functions: transformation and lighting.
For each object, the main loop calls a transformation routine to update
some data, then calls the lighting routine to further work on the data. If
the size of array
v[Num] is larger than the cache, then the coordinates for
v[i] that were cached during Transform(v[i]) will be evicted from
the cache by the time we do
Lighting(v[i]). This means that v[i]
will have to be fetched from main memory a second time, reducing
performance.
for (i=0; i<Num; i++) {
Lighting(v[i]);
}
....
}
Example 3-19 Strip Mined Code
main()
{
Vertex_rec v[Num];
....
for (i=0; i < Num; i+=strip_size) {
for (j=i; j < min(Num, i+strip_size); j++) {
Transform(v[j]);
}
for (j=i; j < min(Num, i+strip_size); j++) {
Lighting(v[j]);
}
}
}
Example 3-18 Pseudo-code Before Strip Mining (continued)

Table of Contents

Related product manuals