arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2107.08132cs.PL
收藏

使用Clang的抽象树进行循环转换

Loop Transformations using Clang's Abstract Syntax Tree

Michael Kruse

摘要:

OpenMP 5.1引入了第一个循环嵌套转换指令unroll和tile,并且预计在OpenMP 6.0中会包含更多。我们讨论了Clang的实现所使用的两个抽象树(AST)表示,目前正在开发中。第一种表示是为了与现有实现兼容而设计的,并将转换后的循环嵌套存储在语法AST旁边的影子AST中。第二种表示引入了一个新的Meta AST节点OMPCanonicalLoop,它保证了OpenMP循环的语义要求得到满足,以及一个CanonicalLoopInfo类型,OpenMPIRBuilder使用它来表示文字和转换的循环。第二种方法提供了更好的循环语义抽象,消除了只与代码生成相关的影子AST节点的需要,允许与其他前端(如flang)共享实现,但依赖于当前正在开发的OpenMPIRBuilder。

英文摘要:

OpenMP 5.1 introduced the first loop nest transformation directives unroll and tile, and more are expected to be included in OpenMP 6.0. We discuss the two Abstract Syntax Tree (AST) representations used by Clang's implementation that is currently under development. The first representation is designed for compatibility with the existing implementation and stores the transformed loop nest in a shadow AST next to the syntactical AST. The second representation introduces a new meta AST-node OMPCanonicalLoop that guarantees that the semantic requirements of an OpenMP loop are met, and a CanonicalLoopInfo type that the OpenMPIRBuilder uses to represent literal and transformed loops. This second approach provides a better abstraction of loop semantics, removes the need for shadow AST nodes that are only relevant for code generation, allows sharing the implementation with other front-ends such as flang, but depends on the OpenMPIRBuilder which is currently under development.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑