Skip to main content
QUICK REVIEW

[论文解读] Modeling of languages for tensor manipulation

Norman A. Rink|arXiv (Cornell University)|Jan 26, 2018
Parallel Computing and Optimization Techniques参考文献 21被引用 5
一句话总结

本文提出了一种用于张量操作的形式化指定模型语言,能够捕捉核心操作,如逐元素算术运算、转置和张量收缩。该语言建立了进展性与安全性属性,形式化证明了参考实现与用于性能优化的填充内存变体之间的等价性,并支持在机器学习和高性能计算系统中对张量代码进行形式化验证与优化。

ABSTRACT

Numerical applications and, more recently, machine learning applications rely on high-dimensional data that is typically organized into multi-dimensional tensors. Many existing frameworks, libraries, and domain-specific languages support the development of efficient code for manipulating tensors and tensor expressions. However, such frameworks and languages that are used in practice often lack formal specifications. The present report formally defines a model language for expressing tensor operations. The model language is simple and yet general enough so that it captures the fundamental tensor operations common to most existing languages and frameworks. It is shown that the given formal semantics are sensible, in the sense that well-typed programs in the model language execute correctly, without error. Moreover, an alternative implementation of the model language is formally defined. The alternative implementation introduces padding into the storage of tensors, which may benefit performance on modern hardware platforms. Based on their formal definitions, the original implementation of the model language and the implementation with padding are proven equivalent. Finally, some possible extensions of the presented model language for tensor manipulation are discussed.

研究动机与目标

  • 为现有领域特定语言(DSL)和张量操作库中缺乏形式化语义的问题提供解决方案。
  • 定义一种最小但表达力强的模型语言,以捕捉数值计算与机器学习中使用的根本张量操作。
  • 形式化证明:在该模型语言中,良好类型的程序是安全的(不会发生越界内存访问)且具有进展性(可完全求值)。
  • 引入并形式化验证一种使用内存填充优化的实现,以提升现代硬件上的性能。
  • 通过数学上严谨的基础,实现对张量代码的形式化推理、程序分析与优化。

提出的方法

  • 使用小步求值系统的形式化操作语义定义该模型语言,包括变量赋值、表达式求值与张量存储更新的规则。
  • 该语言支持关键张量操作:逐元素算术运算、转置与张量收缩,且对维度兼容性进行显式类型检查。
  • 通过基于存储的语义定义参考实现,利用类型检查与求值期间的边界检查确保安全性。
  • 另一种实现通过填充张量维度以对齐SIMD向量宽度,从而改善现代处理器上的内存访问模式。
  • 使用双模拟技术形式化证明参考实现与填充实现之间的等价性,表明填充不会改变程序行为。
  • 该模型语言不包含显式控制流,使得诸如死代码消除与公共子表达式消除等程序分析更加直接。

实验结果

研究问题

  • RQ1能否通过一种最小化、形式化指定的模型语言,捕捉现有DSL与库中使用的根本张量操作?
  • RQ2是否可以形式化证明:在该模型语言中,良好类型的程序不会发生越界内存访问?
  • RQ3在张量存储中使用内存填充是否能在保持语义等价性的同时提升性能潜力?
  • RQ4是否可以有效应用形式化程序分析与优化技术于该模型语言中的张量表达式?
  • RQ5如何对张量操作中的并行性进行形式化推理,并在语言实现中安全地加以利用?

主要发现

  • 该模型语言被形式化证明是安全的,即良好类型的程序在求值过程中不会发生越界内存访问。
  • 该模型语言被证明具有进展性,确保每个良好类型的程序均可被完全求值而不会陷入停滞状态。
  • 带填充的替代实现被形式化证明与参考实现等价,验证了填充不会改变程序行为。
  • 在张量存储中使用填充可改善内存访问模式,并可能在具备SIMD支持的现代硬件平台上提升性能。
  • 该模型语言中未显式包含控制流,简化了程序分析,从而支持高效的死代码消除与公共子表达式消除。
  • 形式化语义为验证优化提供了坚实基础,并支持张量操作的安全并行执行。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。