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

最短路径FFT:通过图搜索实现最优SIMD指令调度

Shortest-Path FFT: Optimal SIMD Instruction Scheduling via Graph Search

Illumina

Mohamed Amine Bergach

AI总结:

本文通过图搜索方法解决FFT最优SIMD指令调度问题,提出两种模型以考虑指令间依赖关系,实验显示基于上下文的Dijkstra算法在M1 NEON上实现了更高的性能。

摘要:

一个N点FFT有许多有效的实现方式,它们在基数选择、阶段顺序和寄存器阻塞策略上有所不同。这些替代方案使用不同的SIMD指令混合,具有不同的延迟,但产生相同数学结果。我们证明找到最快实现是一个有向无环图上的最短路径问题。我们正式化了两种这种图的变体。在无上下文模型中,节点代表计算阶段,边权重是独立测量的指令成本。在有上下文模型中,节点被扩展以编码前驱边类型,因此边权重捕捉操作间的相关性,如缓存预热——操作B的成本取决于其前驱操作A的类型。这解决了FFTW[1]中识别但故意绕过的限制:最优子结构假设因缓存状态的不同而失效。应用于Apple M1 NEON,无上下文Dijkstra找到一个安排在22.1 GFLOPS(74%的最优)。有上下文Dijkstra发现R4→R2→R4→R4→Fused-8在29.8 GFLOPS——比纯基数-2快5.2倍,比无上下文结果快34%。这种安排包括一个基数-2阶段夹在基数-4阶段之间,利用仅在上下文中的缓存残余。无上下文搜索无法发现此结果。

英文摘要:

An $N$-point FFT admits many valid implementations that differ in radix choice, stage ordering, and register-blocking strategy. These alternatives use different SIMD instruction mixes with different latencies, yet produce the same mathematical result. We show that finding the fastest implementation is a shortest-path problem on a directed acyclic graph. We formalize two variants of this graph. In the \emph{context-free} model, nodes represent computation stages and edge weights are independently measured instruction costs. In the \emph{context-aware} model, nodes are expanded to encode the \emph{predecessor edge type}, so that edge weights capture inter-operation correlations such as cache warming -- the cost of operation~B depends on which operation~A preceded it. This addresses a limitation identified but deliberately bypassed by FFTW \citep{FrigoJohnson1998}: that optimal-substructure assumptions break down ``because of the different states of the cache.'' Applied to Apple M1 NEON, the context-free Dijkstra finds an arrangement at 22.1~GFLOPS (74\% of optimal). The context-aware Dijkstra discovers $\text{R4} \to \text{R2} \to \text{R4} \to \text{R4} \to \text{Fused-8}$ at 29.8~GFLOPS -- a $5.2\times$ improvement over pure radix-2 and 34\% faster than the context-free result. This arrangement includes a radix-2 pass \emph{sandwiched between} radix-4 passes, exploiting cache residuals that only exist in context. No context-free search can discover this.

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

↑