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

电磁学FDTD求解器优化:一种基于高级张量抽象的编译器引导方法

Optimizing FDTD Solvers for Electromagnetics: A Compiler-Guided Approach with High-Level Tensor Abstractions

KTH Royal Institute of Technology(瑞典皇家理工学院)

Yifei He, Måns I. Andersson, Stefano Markidis

AI总结:

针对FDTD求解器传统实现存在的可移植性差、性能瓶颈等问题,提出基于MLIR/LLVM的端到端领域特定编译器方法,通过三维张量抽象实现核函数并自动优化,在多平台上较基准Python实现速度提升达10倍。

摘要:

时域有限差分(FDTD)方法是求解麦克斯韦方程组的广泛使用的数值技术,尤其适用于计算电磁学和光子学领域。它能准确建模复杂介质和结构中的波传播,但存在显著的计算挑战。传统FDTD实现依赖手写的平台特定代码,虽优化了部分核函数却在其他核函数上表现不佳。可移植性的缺乏增加了开发开销,造成性能瓶颈,限制了在现代硬件架构上的可扩展性。为应对这些挑战,我们基于MLIR/LLVM基础设施为FDTD模拟引入了端到端的领域特定编译器。我们的方法生成高效且可移植的代码,针对不同硬件平台进行了优化。我们将三维FDTD核函数实现为具有显式计算语义的三维张量抽象上的操作。编译器自动应用循环分块、融合和向量化等高级优化。我们在Intel、AMD和ARM平台上评估了定制的代码生成流水线,与使用NumPy的基准Python实现相比,速度提升高达10倍。

英文摘要:

The Finite Difference Time Domain (FDTD) method is a widely used numerical technique for solving Maxwell's equations, particularly in computational electromagnetics and photonics. It enables accurate modeling of wave propagation in complex media and structures but comes with significant computational challenges. Traditional FDTD implementations rely on handwritten, platform-specific code that optimizes certain kernels while underperforming in others. The lack of portability increases development overhead and creates performance bottlenecks, limiting scalability across modern hardware architectures. To address these challenges, we introduce an end-to-end domain-specific compiler based on the MLIR/LLVM infrastructure for FDTD simulations. Our approach generates efficient and portable code optimized for diverse hardware platforms.We implement the three-dimensional FDTD kernel as operations on a 3D tensor abstraction with explicit computational semantics. High-level optimizations such as loop tiling, fusion, and vectorization are automatically applied by the compiler. We evaluate our customized code generation pipeline on Intel, AMD, and ARM platforms, achieving up to $10\times$ speedup over baseline Python implementation using NumPy.

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

↑