and multiple implementation With data and operations to perform the function is usually limited by bandwidth to memory, and thus there is not much opportunity for optimization All routines in the ATLAS level 2 BLAS are built from two Level 2 BLAS kernels: GEMV—matrix by vector multiply update: GER—general rank 1 update from an outer product: Optimization of the level 3 BLAS uses code generation and the other two techniques Since we have ops with only data, there are many opportunities for optimization Level 3 BLAS Most of the Level 3 BLAS is derived from GEMM, so that is the primary focus of the optimization. operations vs. data The intuition that the operations will dominate over the data accesses only works for roughly square matrices. The real measure should be some kind of surface area to volume. The difference becomes important for very non-square matrices. Can it afford to copy? Copying the inputs allows the data to be arranged in a way that provides optimal access for the kernel functions, but this comes at the cost of allocating temporary space, and an extra read and write of the inputs. So the first question GEMM faces is, can it afford to copy the inputs? If so, Put into block major format with good alignment Take advantage of user contributed kernels and cleanup Handle the transpose cases with the copy: make everything into TN (transpose - no-transpose) Deal with α in the copy If not, Use the nocopy version Make no assumptions on the stride of matrix A and B in memory Handle all transpose cases explicitly No guarantee about alignment of data Support α specific code Run the risk of TLB issues, bad strides, etc. The actual decision is made through a simple heuristic which checks for "skinny cases". Cache edge For 2nd Level Cache blocking a single cache edge parameter is used. The high level choose an order to traverse the blocks: ijk, jik, ikj, jki, kij, kji. These need not be the same order as the product is done within a block. Typically chosen orders are ijk or jik. For jik the ideal situation would be to copy A and the NB wide panel of B. For ijk swap the role of A and B. Choosing the bigger of M or N for the outer loop reduces the footprint of the copy. But for large K ATLAS does not