We present the first formalization and metatheory of language soundness for a user-schedulable language, the widely used array processing language Halide. User-schedulable languages strike a balance between abstraction and control in high-performance computing by separating the specification of what a program should compute from a schedule for how to compute it. In the process, they make a novel language soundness claim: the result of a program should always be the same, regardless of how it is scheduled. This soundness guarantee is tricky to provide in the presence of schedules that introduce redundant recomputation and computation on uninitialized data, rather than simply reordering statements. In addition, Halide ensures memory safety through a compile-time bounds inference engine that determines safe sizes for every buffer and loop in the generated code, presenting a novel challenge: formalizing and analyzing a language specification that depends on the results of unreliable program synthesis algorithms. Our formalization has revealed flaws and led to improvements in the practical Halide system, and we believe it provides a foundation for the design of new languages and tools that apply programmer-controlled scheduling to other domains.
翻译:我们为用户可排期的语言,即广泛使用的阵列处理语言 Halide 提供了第一个正式化和元理论的语言健全性。用户可排期语言在高性能计算中的抽象与控制之间取得平衡,方法是将一个程序应当如何计算该程序与如何计算该程序的时间表区分开来。在这个过程中,它们提出了一个新颖的语言健全性主张:一个程序的结果应当始终相同,而不管它是如何排期的。这种稳妥性保证很难在出现对非初始化数据进行冗余重估和计算的时间表时提供,而不只是重新排序语句。此外,Halide通过一个编译-时间界限推理引擎确保记忆安全,该参数决定了生成代码中每个缓冲和循环的安全大小,提出了新的挑战:正式化和分析一种语言规格,取决于不可靠的程序合成算法的结果。我们的正式化暴露了缺陷,并导致实用的Halide 系统改进,并且我们认为它为设计新语言和工具提供了基础,将程序员控制的时间安排应用到其他地区。