Rank-Polymorphism for Shape-Guided Blocking
Artjoms Šinkarovs, Thomas Koopman, Sven‐Bodo Scholz · 2023
Many numerical algorithms on matrices or tensors can be formulated in a blocking style which improves performance due to better cache locality. In imperative languages, blocking is achieved by introducing additional layers of loops in a nested fashion alongside with suitable adjustments in index computations. While this process is tedious and error-prone, it is also difficult to implement a generically blocked version that would support arbitrary levels of blocking.