A Reduction -- an accumulation over a set of values, using an associative and commutative operator -- is a common computation in many numerical computations, including scientific computations, machine learning, computer vision, and financial analytics. Contemporary polyhedral-based compilation techniques make it possible to optimize reductions, such as prefix sums, in which each component of the reduction's output potentially shares computation with another component in the reduction. Therefore an optimizing compiler can identify the computation shared between multiple components and generate code that computes the shared computation only once. These techniques, however, do not support reductions that -- when phrased in the language of the polyhedral model -- span multiple dependent statements. In such cases, existing approaches can generate incorrect code that violates the data dependences of the original, unoptimized program. In this work, we identify and formalize the optimization of dependent reductions as an integer bilinear program. We present a heuristic optimization algorithm that uses an affine sequential schedule of the program to determine how to simplfy reductions yet still preserve the program's dependences. We demonstrate that the algorithm provides optimal complexity for a set of benchmark programs from the literature on probabilistic inference algorithms, whose performance critically relies on simplifying these reductions. The complexities for 10 of the 11 programs improve siginifcantly by factors at least of the sizes of the input data, which are in the range of $10^4$ to $10^6$ for typical real application inputs. We also confirm the significance of the improvement by showing speedups in wall-clock time that range from $1.1\text{x}$ to over $10^6\text{x}$.
翻译:A 的递减 -- -- 一个使用关联和通俗操作器的递减 { -- -- 一个在一组数值上的累积 { -- -- 是一个在许多数字计算中常见的计算方法,包括科学计算、机器学习、计算机视觉和金融分析。当代多面制汇编技术使得有可能优化削减,例如前缀总和,在这个过程中,每个递减产出的每个组成部分都有可能与裁员中的另一个组成部分分享计算。因此,一个最优化的编译器可以确定多个组成部分之间的计算,并生成只计算一次计算共算的代码。然而,这些技术并不支持 -- -- 当用多面4 4 模型的语言表述时 -- -- 跨越多个依赖性报表。在这种情况下,现有的方法可以产生不正确的代码,违反原始、非优化程序的数据依赖性。在这项工作中,我们确定并正式优化依赖性递减量的每个组成部分,作为程序的整数双线程序。 6 我们展示了超级的精度优化优化算法算算法,它使用一个缩略的顺序表来决定如何递减速度,但仍能保护程序的依赖性。 我们显示的是,在10美元递减的精确度中,在10度的精确度中,我们的算算中, 的精确的精确的缩缩缩算法是用来对10度的缩算法的缩算法中, 的缩算法中, 的缩缩算法在10的缩数的缩度的缩数。