Tuning tensor program generation involves searching for various possible program transformation combinations for a given program on target hardware to optimize the tensor program execution. It is already a complex process because of the massive search space and exponential combinations of transformations make auto-tuning tensor program generation more challenging, especially when we have a heterogeneous target. In this research, we attempt to address these problems by learning the joint neural network and hardware features and transferring them to the new target hardware. We extensively study the existing state-of-the-art dataset, TenSet, perform comparative analysis on the test split strategies and propose methodologies to prune the dataset. We adopt an attention-inspired approach for tuning the tensor programs enabling them to embed neural network and hardware-specific features. Our approach could prune the dataset up to 45\% of the baseline without compromising the Pairwise Comparison Accuracy (PCA). Further, the proposed methodology can achieve on-par or improved mean inference time with 25%-40% of the baseline tuning time across different networks and target hardware.
多维数组(NDArrays)是现代科学计算环境中的核心抽象。不幸的是,它们可能会使程序的推理变得更加困难,因为在程序执行中使用的不同数组形状的数量通常非常大,并且它们很少显式地出现在程序文本中。更糟糕的是,许多运算符对输入的形状做了隐含的假设:数组加法通常使用广播语义来丰富,而矩阵乘法假设收缩维度的长度相等。由于精确推理形状对于使用NDArrays编写正确的程序至关重要,而且由于形状通常很难通过快速浏览程序来推断,因此我们开发了Tensors Fitting Perfectly,这是一种静态分析工具,通过从程序的抽象解释中合成一组形状约束,在Swift for TensorFlow程序中推理NDArrays形状。它可以(1)检查可能的不一致性,(2)提供有关程序中出现的中间值的形状的直接见解,包括通过称为形状孔的机制。静态分析与可选的运行时断言协同工作,以提高程序作者的生产力。
Pure Tensor Program Rewriting via Access Patterns (Representation Pearl)
机器学习(ML)中的张量内核通常对应于纯数学表达式,使得项重写成为优化和映射到专用硬件加速器的有吸引力的策略。然而,现有的ML中间表示(IR)倾向于要么是\textit{pure but high-level},使得对硬件目标的低级重写不可表达,要么是\textit{low-level but impure},完全阻碍了术语重写的使用。本文介绍了Glenside,一个纯IR的核心抽象-\textit{access pattern} -使低层次,布局感知,以硬件为中心的程序重写。我们演示了如何在Glenside长期重写可以用来映射程序片段的硬件加速器调用,并自动发现经典的数据布局转换,如\texttt{im2col}。Glenside为进一步探索优化低级张量程序的项重写技术奠定了新的基础。
QiMeng-Xpiler: Transcompiling Tensor Programs for Deep Learning Systems with a Neural-Symbolic Approach
University of Science and Technology of China(科学技术大学);Cambricon Technologies(Cambricon科技);SKL of Processors, Institute of Computing Technology, Chinese Academy of Sciences(处理器实验室,计算技术研究所,中国科学院);Institute of Software, Chinese Academy of Sciences(软件研究所,中国科学院)