QUESTIONS TO PREPARE FOR THE FINAL EXAM IN CS 498
LIBRARY GENERATORS
1) Suppose you take a library that has been hand-optimized for a Pentium 4 SSE and
execute it in an Athlon XP SSE.
a) Is the code portable?
b) Is performance portable, i.e., what can be expected of the performance of this
code when running on the Pentium 4 versus the performance when running in
the Athlon? Justify your answer.
2) Explain what is the technique used by library generators to generate libraries that
adapt to different target machines.
3) How can the technique in 2) be used to generate libraries whose performance depends
on input characteristics (like the case of sorting)?
4) Many library generators generate C code and then invoke the native compiler to
generate the object code.
a) Why do library generators follow this strategy?
b) Suppose the native compiler does not perform some low level optimizations
that are important for the library being generated. What can be done?
THE ATLAS SYSTEM
1) The code generated by the ATLAS system has this form:
for (j=1; j<=M; j +=NB)
for (i=1; i<=N; i +=NB)
for (k=1; k<=K; k +=NB)
// mini-MMM code
for (jj=1; jj<=j+NB; jj+=NU)
for (ii=1; ii<=i+NB; ii+=MU)
for (kk=1; kk<=k+NB; kk++)
// micro-MMM code
C[ii][jj]+= A[ii][kk] * B[kk][jj]
C[ii+1][jj]+= A[ii+1][kk] * B[kk][jj]
C[ii+2][jj]+= A[ii+2][kk] * B[kk][jj]
C[ii][jj+1]+= A[ii][kk] * B[kk][jj+1]
C[ii+1][jj+1]+= A[ii+1][kk] * B[kk][jj+1]
C[ii+2][jj+1]+= A[ii+2][kk] * B[kk][jj+1]
In the example above, MU=3 and NU=2