Tensor compilers, essential for generating efficient code for deep learning models across various applications, employ tensor graph rewrites as one of the key optimizations. These rewrites optimize tensor computational graphs with the expectation of preserving semantics for tensors of arbitrary rank and size. Despite this expectation, to the best of our knowledge, there does not exist a fully automated verification system to prove the soundness of these rewrites for tensors of arbitrary rank and size. Previous works, while successful in verifying rewrites with tensors of concrete rank, do not provide guarantees in the unbounded setting. To fill this gap, we introduce TensorRight, the first automatic verification system that can verify tensor graph rewrites for input tensors of arbitrary rank and size. We introduce a core language, TensorRight DSL, to represent rewrite rules using a novel axis definition, called aggregated-axis, which allows us to reason about an unbounded number of axes. We achieve unbounded verification by proving that there exists a bound on tensor ranks, under which bounded verification of all instances implies the correctness of the rewrite rule in the unbounded setting. We derive an algorithm to compute this rank using the denotational semantics of TensorRight DSL. TensorRight employs this algorithm to generate a finite number of bounded-verification proof obligations, which are then dispatched to an SMT solver using symbolic execution to automatically verify the correctness of the rewrite rules. We evaluate TensorRight's verification capabilities by implementing rewrite rules present in XLA's algebraic simplifier. The results demonstrate that TensorRight can prove the correctness of 115 out of 175 rules in their full generality, while the closest automatic, bounded-verification system can express only 18 of these rules.


翻译:张量编译器对于为深度学习模型在各种应用中生成高效代码至关重要,其采用张量图重写作为关键优化手段之一。这些重写旨在优化张量计算图,并期望在任意秩和尺寸的张量上保持语义不变。尽管存在这一期望,据我们所知,目前尚不存在完全自动化的验证系统来证明这些重写在任意秩和尺寸张量上的正确性。先前的研究虽成功验证了具体秩张量的重写,但无法在无界设定下提供保证。为填补这一空白,我们提出了TensorRight,首个能够验证任意秩和尺寸输入张量图重写的自动化验证系统。我们引入了一种核心语言——TensorRight DSL,通过一种称为聚合轴的新型轴定义来表示重写规则,这使我们能够推理无界数量的轴。我们通过证明存在一个张量秩的边界来实现无界验证,在该边界下对所有实例的有界验证意味着重写规则在无界设定下的正确性。我们利用TensorRight DSL的指称语义推导出一种计算该秩的算法。TensorRight运用该算法生成有限数量的有界验证证明义务,随后通过符号执行将这些义务分派给SMT求解器,以自动验证重写规则的正确性。我们通过实现XLA代数简化器中存在的重写规则来评估TensorRight的验证能力。结果表明,TensorRight能够证明175条规则中115条规则的完全通用正确性,而最接近的自动化有界验证系统仅能表达其中18条规则。

0
下载
关闭预览

相关内容

机器或装置在无人干预的情况下按规定的程序或指令自动进行操作或控制的过程, 是一门涉及学科较多、应用广泛的综合性科学技术。
FlowQA: Grasping Flow in History for Conversational Machine Comprehension
专知会员服务
34+阅读 · 2019年10月18日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
163+阅读 · 2019年10月12日
Unsupervised Learning via Meta-Learning
CreateAMind
43+阅读 · 2019年1月3日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
STRCF for Visual Object Tracking
统计学习与视觉计算组
15+阅读 · 2018年5月29日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
国家自然科学基金
13+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
VIP会员
相关资讯
Unsupervised Learning via Meta-Learning
CreateAMind
43+阅读 · 2019年1月3日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
STRCF for Visual Object Tracking
统计学习与视觉计算组
15+阅读 · 2018年5月29日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
相关基金
国家自然科学基金
13+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员