Skip to main content
QUICK REVIEW

[论文解读] Canonicalization of Batched Einstein Summations for Tuning Retrieval

Kaushik Kulkarni, Andreas Klöckner|arXiv (Cornell University)|Jan 18, 2026
Parallel Computing and Optimization TechniquesComputer Science被引用 0
一句话总结

该论文引入基于图的批量 Einstein 求和表达式的规范化,以在名为 Feinsum 的基于制表的系统中实现可重用、近最优的代码转换,在相关基准上对 JAX 的几何几何平均加速为 4.7x。

ABSTRACT

We present an algorithm for normalizing \emph{Batched Einstein Summation} expressions by mapping mathematically equivalent formulations to a unique normal form. Batches of einsums with the same Einstein notation that exhibit substantial data reuse appear frequently in finite element methods (FEM), numerical linear algebra, and computational chemistry. To effectively exploit this temporal locality for high performance, we consider groups of einsums in batched form. Representations of equivalent batched einsums may differ due to index renaming, permutations within the batch, and, due to the commutativity and associativity of multiplication operation. The lack of a canonical representation hinders the reuse of optimization and tuning knowledge in software systems. To this end, we develop a novel encoding of batched einsums as colored graphs and apply graph canonicalization to derive a normal form. In addition to the canonicalization algorithm, we propose a representation of einsums using functional array operands and provide a strategy to transfer transformations operating on the normal form to \emph{functional batched einsums} that exhibit the same normal form; crucial for fusing surrounding computations for memory bound einsums. We evaluate our approach against JAX, and observe a geomean speedup of $4.7 imes$ for einsums from the TCCG benchmark suite and an FEM solver.

研究动机与目标

  • 在科学计算工作负载中,激励并形式化对批量 einsum 的可重用高性能实现的需求。
  • 定义批量 einsum 及其同构性,以捕捉重复计算中的数据重用。
  • 开发一种规范化过程,将批量 einsum 映射到用于制表优化的唯一规范形式。
  • 通过可重用数据库实现将理想化批量 einsum 的优化转移到实用的函数式批量 einsum。
  • 提供开源实现(Feinsum),将函数式批量 einsum 与理想化形式匹配并映射到代码变换。

提出的方法

  • 将批量阿尔伯特爱因斯坦求和定义为具有共享记号和每批操作数的无序集合。
  • 通过同构定义对等效的批量 einsum 进行建模,覆盖单个 einsum 与批量变体。
  • 开发三步规范化:映射到有色有向图(诱导图),对图进行规范化,然后映射回批量 einsum。
  • 利用图的规范化来生成一个规范形式,使同构的批量 einsum 具有相同表示。
  • 引入带有 lambda 表达式的函数式批量 einsum 以便于变换知识的转移。
  • 实现一个数据库,存储针对规范化批量 einsum 的变换,并支持检索与应用于实际程序。

实验结果

研究问题

  • RQ1如何对批量 einsum 进行规范化表示,以消除语法异质性并实现对优化的重用?
  • RQ2基于图的规范化(有色图)是否能为批量 einsum 及其同构性产生唯一的规范形式?
  • RQ3如何将为理想化批量 einsum 开发的优化转移到实际应用中使用的函数式批量 einsum?
  • RQ4在内存绑定工作负载上,基于制表的规范形式是否比传统的物化策略提高性能?
  • RQ5Feinsum 的方法在实际基准测试和求解器上的实际性能影响如何?

主要发现

  • 通过三步图基管线实现的规范形式使等价类收敛到单一表示, hence 为 canonical form。
  • 函数式批量 einsum 通过带有 lambda 操作数的情形实现了变换知识的重用与转移到实际程序。
  • 一个开源的 Feinsum 系统实现了规范化、匹配理想化形式,以及将其映射到高性能代码变换的数据库。
  • Feinsum 在来自 TCCG 基准套件的批量 einsum 和一个 FEM 求解器相对于 JAX 的几何平均加速为 4.7x。
  • 该方法通过在无需中间结果物化的情况下实现变换来应对内存绑定场景,从而提升内存带宽利用率。
  • 该工作为通过制表和优化知识重用实现接近理论峰值的批量 einsum 内核提供了实际路径。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。