It has been demonstrated that specialised architectures, such as FPGAs and AMD's AI Engines (AIEs), have the potential to deliver energy and performance advantages for scientific computing. Given the integration of AIEs into AMD's CPUs, this is an interesting potential avenue especially when executing on the edge or making better use of local compute constrained resources. However, a major challenge is in enabling existing codes to run on this architecture without extensive modification. Put simply, it requires significant expertise and time to port codes to the AIE's execution model. In this paper we explore a compilation pipeline for efficiently mapping loops in general purpose, scientific codes to AIEs. Lifting the semantics of an application into tensors, we demonstrate that this is able to capture the intention of general purpose loops annotated with OpenMP and such high-level tensor information provides a richness that is effective when mapping to the AIEs. Requiring only an OpenMP decorated loop, our approach significantly reduces code complexity when targeting the architecture. For six kernel benchmarks, representing AI and scientific computing, using our approach the NPU performs comparatively to the multicore CPU for float32, in all cases at reduced energy to solution. For two scientific computing kernels running across both the CPU and NPU together delivers up to a 40% improvement in performance and 15% reduction in energy usage compared to the CPU alone.
翻译:研究表明,FPGA和AMD的AI引擎(AIE)等专用架构在科学计算中具有提升能效和性能的潜力。鉴于AI引擎已集成到AMD CPU中,这一方向在边缘计算或优化本地受限计算资源方面尤为值得关注。然而,主要挑战在于如何使现有代码无需大量修改即可在该架构上运行。简而言之,将代码移植到AIE执行模型需要大量专业知识和时间。本文探索了一种将通用科学代码中的循环高效映射到AIE的编译流水线。通过将应用语义提升为张量,我们证明该方法能够捕获标注了OpenMP的通用循环的意图,并且这种高层张量信息在映射到AIE时能提供有效的丰富性。我们的方法仅需OpenMP修饰的循环,即可显著降低针对该架构的代码复杂度。在代表AI和科学计算的六个内核基准测试中,使用该方法,NPU在float32计算性能上与多核CPU相当,且在所有案例中均降低了能耗比。对于两个科学计算内核,相较于单CPU运行,CPU与NPU协同运行可实现最高40%的性能提升和15%的能耗降低。