Setting Tunables

Each task instance will have its own "versions" of the task variant's tunable parameters, and the programmer must specify a compile-time constant for every tunable in every instance when mapping the program to a machine.

The tunables in the matrix multiplication running example are used to set the submatrix sizes that are passed to subtask calls. They will be set as follows:

  • MatMulInstLarge: Mblk = Pblk = Nblk = 8192
  • MatMulInstMedium: Mblk = Pblk = Nblk = 64

These numbers were chosen to arrive at arrays in each level that are as large as possible, by the following method.

  • For a given memory level, consider the amount of space that there is to work with; on this machine, this is 256KB for level 0 and 2GB for level 1.
  • Divide this amount by 3, since 3 submatrices will be stored simultaneously.
  • Divide this amount again by 4, since the tunables set the number of array elements, each of which is a 4-byte floating point value.
  • Divide this amount again by 2, since the loops will be double-buffered (a.k.a. software-pipelined); see the section on mapping control for details.
  • For simplicity, just make the submatrices square, and so Mblk, Pblk, and Nblk are all equal to the square root of the remaining amount.

The selection of tunable values is illustrated in the updated task instance call graph below:

Note that the most common use of tunable values in Sequoia is to set array block sizes, and in particular, the "max" field of array blocks may only refer to tunable and array size parameters.

The amount of freedom that a programmer has to choose tunables depends upon the particular Sequoia application and the particular machine being mapped to. For example, a program may be written assuming that a tunable value will evenly divide some other application parameter, and on a machine such as Cell, hardware alignment constraints require that the start addresses of array blocks be aligned on 16-byte boundaries; each of these can constrain the space of "valid" values that the tunables can be set to.

In general, the heuristic that a programmer should use when setting tunable values is to try to make the arrays that reside in fixed size, local memories as large as possible without exceeding their capacity. Also, it's common for a programmer to try out a handful of choices for their program's tunable values before choosing the ones that yield the highest program performance.