User-schedulable languages (USLs) help programmers productively optimize programs by providing safe means of transforming them. Current USLs are designed to give programmers exactly the control they want, while automating all other concerns. However, there is no universal answer for what performance-conscious programmers want to control, how they want to control it, and what they want to automate, even in relatively narrow domains. We claim that USLs should, instead, be designed to grow. We present Exo 2, a scheduling language that enables users to define new scheduling operations externally to the compiler. By composing a set of trusted, fine-grained primitives, users can safely write their own scheduling library to build up desired automation. We identify actions (ways of modifying code), inspection (ways of interrogating code), and references (ways of pointing to code) as essential for any user-extensible USL. We fuse these ideas into a new mechanism called Cursors that enables the creation of scheduling libraries in user code. We demonstrate libraries that amortize scheduling effort across more than 80 high-performance kernels, reducing total scheduling code by an order of magnitude and delivering performance competitive with state-of-the-art implementations on three different platforms.
翻译:用户可调度语言通过提供安全的程序变换手段,帮助程序员高效地优化程序。当前的用户可调度语言旨在精确给予程序员所需的控制,同时自动化处理所有其他关注点。然而,即使在相对狭窄的领域中,对于注重性能的程序员希望控制什么、如何控制以及希望自动化什么,并不存在普适的答案。我们主张,用户可调度语言应被设计为可生长的。我们提出了Exo 2,一种允许用户在编译器外部定义新调度操作的调度语言。通过组合一组可信的细粒度原语,用户可以安全地编写自己的调度库,以构建所需的自动化。我们认为,动作(修改代码的方式)、检查(查询代码的方式)和引用(指向代码的方式)对于任何用户可扩展的用户可调度语言都是必不可少的。我们将这些思想融合到一个称为Cursors的新机制中,该机制支持在用户代码中创建调度库。我们展示了在超过80个高性能内核上分摊调度工作量的库,将总调度代码量减少了一个数量级,并在三个不同平台上实现了与最先进方案相竞争的性能。