Fortran is the lingua franca of HPC code development and as such it is crucial that we as a community have open source Fortran compilers capable of generating high performance executables. Flang is LLVM's Fortran compiler and leverages MLIR which is a reusable compiler infrastructure which, as part of LLVM, has become popular in recent years. However, whilst Flang leverages MLIR it does not fully integrate with it and instead provides bespoke translation and optimisation passes to target LLVM-IR. In this paper we first explore the performance of Flang against other compilers popular in HPC for a range of benchmarks before describing a mapping between Fortran and standard MLIR, exploring the performance of this. The result of this work is an up to three times speed up compared with Flang's existing approach across the benchmarks and experiments run, demonstrating that the Flang community should seriously consider leveraging standard MLIR.
翻译:Fortran是高性能计算代码开发的通用语言,因此我们作为社区必须拥有能够生成高性能可执行文件的开源Fortran编译器。Flang是LLVM的Fortran编译器,它利用MLIR——一种可重用的编译器基础设施,作为LLVM的一部分,近年来已变得日益流行。然而,尽管Flang利用了MLIR,但并未与其完全集成,而是提供了定制的转换和优化流程以生成LLVM-IR。本文首先通过一系列基准测试,探讨Flang与其他高性能计算常用编译器的性能对比,随后描述Fortran与标准MLIR之间的映射关系,并分析其性能表现。这项工作的成果显示,在运行的基准测试和实验中,相较于Flang现有方法,新方法实现了最高三倍的加速,这证明Flang社区应认真考虑采用标准MLIR。