一句话:提出首个面向嵌套递归的调度变换 recursion twisting,自动提升多级存储层次局部性并显著加速。
现有循环调度变换(如循环分块、循环融合)通过重排循环嵌套的动态实例来改善访存局部性,但面向递归程序的类似变换只能处理简单情形,例如融合多个递归,或仅处理简单循环中嵌套单个递归,无法应对嵌套递归。本文针对嵌套递归——即递归方法调用其他递归方法,作为嵌套循环的递归类比——提出第一组调度变换,核心变换称为 recursion twisting,可自动在存储层次各层级改善局部性。作者在多个呈现嵌套递归的基准程序上进行评估,结果表明该变换能带来显著的性能提升。
There has been a significant amount of effort invested in designing scheduling transformations such as loop tiling and loop fusion that rearrange the execution of dynamic instances of loop nests to place operations that access the same data close together temporally. In recent years, there has been interest in designing similar transformations that operate on recursive programs, but until now these transformations have only considered simple scenarios: multiple recursions to be fused, or a recursion nested inside a simple loop. This paper develops the first set of scheduling transformations for nested recursions: recursive methods that call other recursive methods. These are the recursive analog to nested loops. We present a transformation called recursion twisting that automatically improves locality at all levels of the memory hierarchy, and show that this transformation can yield substantial performance improvements across several benchmarks that exhibit nested recursion.