首页> 外文期刊>ACM SIGPLAN Notices: A Monthly Publication of the Special Interest Group on Programming Languages >Optimizing Data Structures in High-Level Programs New Directions for Extensible Compilers based on Staging
【24h】

Optimizing Data Structures in High-Level Programs New Directions for Extensible Compilers based on Staging

机译:在高级程序中优化数据结构,基于分段的可扩展编译器新方向

获取原文
获取原文并翻译 | 示例
           

摘要

High level data structures are a cornerstone of modern programming and at the same time stand in the way of compiler optimizations. In order to reason about user or library-defined data structures, compilers need to be extensible. Common mechanisms to extend compilers fall into two categories. Frontend macros, staging or partial evaluation systems can be used to programmatically remove abstraction and specialize programs before they enter the compiler. Alternatively, some compilers allow extending the internal workings by adding new transformation passes at different points in the compile chain or adding new intermediate representation (IR) types. None of these mechanisms alone is sufficient to handle the challenges posed by high level data structures. This paper shows a novel way to combine them to yield benefits that are greater than the sum of the parts. Instead of using staging merely as a front end, we implement internal compiler passes using staging as well. These internal passes delegate back to program execution to construct the transformed IR. Staging is known to simplify program generation, and in the same way it can simplify program transformation. Defining a transformation as a staged IR interpreter is simpler than implementing a low-level IR to IR transformer. With custom IR nodes, many optimizations that are expressed as rewritings from IR nodes to staged program fragments can be combined into a single pass, mitigating phase ordering problems. Speculative rewriting can preserve optimistic assumptions around loops. We demonstrate several powerful program optimizations using this architecture that are particularly geared towards data structures: a novel loop fusion and deforestation algorithm, array of struct to struct of array conversion, object flattening and code generation for heterogeneous parallel devices.We validate our approach using several non trivial case studies that exhibit order of magnitude speedups in experiments.
机译:高级数据结构是现代编程的基石,同时也阻碍了编译器优化。为了推断用户或库定义的数据结构,编译器需要可扩展。扩展编译器的通用机制分为两类。前端宏,暂存或部分评估系统可用于以编程方式删除抽象,并在程序进入编译器之前对其进行专门化。或者,某些编译器允许通过在编译链中不同点添加新的转换遍历或添加新的中间表示(IR)类型来扩展内部工作。仅这些机制不足以应付高级数据结构带来的挑战。本文展示了一种新颖的方式来组合它们以产生大于各部分之和的收益。我们不仅仅将登台用作前端,还使用登台来实现内部编译器传递。这些内部通道将委派回程序执行以构造转换后的IR。分期可简化程序生成,并且以相同的方式可简化程序转换。将转换定义为分段IR解释程序比实现低级IR到IR转换器要简单。使用自定义的IR节点,可以将许多优化表示为从IR节点到暂存程序片段的重写,这些优化可以合并为一次传递,从而减轻了阶段排序问题。投机重写可以保留围绕循环的乐观假设。我们展示了使用此体系结构的一些强大的程序优化,这些优化特别适合于数据结构:新颖的循环融合和毁林算法,结构数组到数组结构的数组转换,对象扁平化和异构并行设备的代码生成。在实验中表现出数量级加速的非平凡案例研究。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号