TensorRight:自动验证张量图重写
TensorRight: Automated Verification of Tensor Graph Rewrites
AI总结:
TensorRight 是首个能自动验证任意秩和大小张量图重写的系统,通过聚合轴定义和有界验证算法证明重写规则的正确性。
摘要:
张量编译器在生成深度学习模型高效代码方面至关重要,其中张量图重写是关键优化之一。这些重写优化张量计算图,期望在任意秩和大小的张量上保持语义。尽管有此期望,目前尚不存在一个完全自动化的验证系统来证明这些重写在任意秩和大小的张量上的正确性。先前的工作虽然在验证具有具体秩的张量重写方面取得成功,但并未在无界设置中提供保证。为填补这一空白,我们引入TensorRight,这是首个能够验证任意秩和大小输入张量图重写的自动验证系统。我们引入了一个核心语言TensorRight DSL,用一种称为聚合轴的新轴定义来表示重写规则,这使我们能够对无界数量的轴进行推理。我们通过证明在张量秩上存在一个界,从而实现无界验证:在该界下,对所有实例的有界验证暗示了在无界设置中重写规则的正确性。我们推导出一个算法,利用TensorRight DSL的指称语义计算此秩。TensorRight使用该算法生成有限数量的有界验证证明义务,然后通过符号执行将其分发给SMT求解器,以自动验证重写规则的正确性。我们通过实现XLA的代数简化器中的重写规则来评估TensorRight的验证能力。结果表明,TensorRight可以证明175条规则中的115条在全范围内正确,而最接近的自动有界验证系统只能表达其中的18条。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。