A compiler's intermediate representation (IR) defines a program's execution plan by encoding its instructions and their relative order. Compiler optimizations aim to replace a given execution plan with a semantically-equivalent one that increases the program's performance for the target architecture. Alternative representations of an IR, like the Program Dependence Graph (PDG), aid this process by capturing the minimum set of constraints that semantically-equivalent execution plans must satisfy. Parallel programming like OpenMP extends a sequential execution plan by adding the possibility of running instructions in parallel, creating a parallel execution plan. Recently introduced parallel IRs, like TAPIR, explicitly encode a parallel execution plan. These new IRs finally make it possible for compilers to change the parallel execution plan expressed by programmers to better fit the target parallel architecture. Unfortunately, parallel IRs do not help compilers in identifying the set of parallel execution plans that preserve the original semantics. In other words, we are still lacking an alternative representation of parallel IRs to capture the minimum set of constraints that parallel execution plans must satisfy to be semantically-equivalent. Unfortunately, the PDG is not an ideal candidate for this task as it was designed for sequential code. We propose the Parallel Semantics Program Dependence Graph (PS-PDG) to precisely capture the salient program constraints that all semantically-equivalent parallel execution plans must satisfy. This paper defines the PS-PDG, justifies the necessity of each extension to the PDG, and demonstrates the increased optimization power of the PS-PDG over an existing PDG-based automatic-parallelizing compiler. Compilers can now rely on the PS-PDG to select different parallel execution plans while maintaining the same original semantics.
翻译:编译器的中间表示(IR)通过编码指令及其相对顺序来定义程序的执行计划。编译器优化的目标是将给定的执行计划替换为语义等价的替代计划,从而提升程序在目标架构上的性能。IR的替代表示(如程序依赖图PDG)通过捕获语义等价执行计划必须满足的最小约束集合来辅助这一过程。OpenMP等并行编程通过在顺序执行计划中添加并行运行指令的可能性,生成并行执行计划。近年来提出的并行IR(如TAPIR)明确编码了并行执行计划。这些新IR使编译器终于能够修改程序员表达的并行执行计划,以更好地适应目标并行架构。然而,并行IR并未帮助编译器识别保留原始语义的并行执行计划集合。换言之,我们仍缺乏一种并行IR的替代表示来捕获并行执行计划必须满足的最小约束集合以实现语义等价。遗憾的是,PDG作为针对顺序代码设计的表示并非此任务的理想候选。我们提出并行语义程序依赖图(PS-PDG),以精确捕获所有语义等价的并行执行计划必须满足的关键程序约束。本文定义了PS-PDG,论证了PDG各项扩展的必要性,并展示了PS-PDG相比现有基于PDG的自动并行化编译器更强的优化能力。借助PS-PDG,编译器现在可以在保持原始语义不变的前提下选择不同的并行执行计划。