Skip to main content
QUICK REVIEW

[论文解读] TTC: A high-performance Compiler for Tensor Transpositions

Paul Springer, Jeff R. Hammond|RWTH Publications (RWTH Aachen)|Mar 7, 2016
Parallel Computing and Optimization Techniques参考文献 18被引用 6
一句话总结

TTC 是一种领域特定编译器,通过使用分块、循环重排序、软件预取和显式向量化等优化技术,为多维张量转置生成高性能 C++ 代码。它在 Intel Haswell 和 AMD Steamroller 架构上实现了接近峰值内存带宽的性能,优于现代编译器,并利用剪枝启发式方法在性能损失极小的情况下减少搜索空间——仅使用 100 个候选方案即达到穷举搜索 99% 的性能。

ABSTRACT

We present TTC, an open-source parallel compiler for multidimensional tensor transpositions. In order to generate high-performance C++ code, TTC explores a number of optimizations, including software prefetching, blocking, loop-reordering, and explicit vectorization. To evaluate the performance of multidimensional transpositions across a range of possible use-cases, we also release a benchmark covering arbitrary transpositions of up to six dimensions. Performance results show that the routines generated by TTC achieve close to peak memory bandwidth on both the Intel Haswell and the AMD Steamroller architectures, and yield significant performance gains over modern compilers. By implementing a set of pruning heuristics, TTC allows users to limit the number of potential solutions; this option is especially useful when dealing with high-dimensional tensors, as the search space might become prohibitively large. Experiments indicate that when only 100 potential solutions are considered, the resulting performance is about 99% of that achieved with exhaustive search.

研究动机与目标

  • 为高性能计算工作负载中多维张量转置缺乏高性能可移植软件的问题提供解决方案。
  • 生成优化后的 C++ 代码,使其在现代架构上实现接近峰值内存带宽。
  • 通过有效的剪枝启发式方法,减少代码变换的组合爆炸问题。
  • 在科学计算和机器学习中实现高效、可重用且可移植的张量操作。
  • 为未来集成到更广泛的张量收缩编译器流水线中提供支持。

提出的方法

  • TTC 采用领域特定方法,通过显式循环变换生成 C++ 代码,实现张量转置的编译。
  • 通过循环重排序优化跨多个维度的数据局部性和内存访问模式。
  • 使用分块技术通过将张量划分为可管理的子块来优化缓存利用率。
  • 通过性能模型动态调优软件预取,以隐藏内存延迟。
  • 使用 AVX 指令应用显式向量化,以最大化 SIMD 吞吐量。
  • 采用剪枝策略,基于启发式方法优先选择高质量候选方案,从而在不显著损失性能的前提下减少搜索空间。

实验结果

研究问题

  • RQ1领域特定编译器能否在现代 CPU 上生成实现接近峰值内存带宽的张量转置代码?
  • RQ2剪枝启发式方法在不牺牲性能的前提下,对高维张量转置的搜索空间减少效果如何?
  • RQ3分块、循环重排序、预取和向量化对性能的独立影响分别是什么?
  • RQ4TTC 的性能与现代优化编译器在不同张量维度和数据布局下的表现相比如何?
  • RQ5固定预取距离在多大程度上可作为减少搜索空间的实际折中方案?

主要发现

  • TTC 生成的代码在 Intel Haswell 和 AMD Steamroller 架构上均实现了接近峰值内存带宽的性能。
  • 仅使用 100 个候选方案,TTC 在基准测试中实现了穷举搜索 99.10% 的性能。
  • 固定预取距离为 5 到 8 时,平均效率超过 99%,最小效率达 98%,使其成为一种稳健的实际选择。
  • 即使仅使用一个候选方案,TTC 也能达到穷举搜索 94.58% 的性能,表明其启发式方法质量极高。
  • 分块、循环重排序、预取和向量化技术的组合共同贡献了相对于现代编译器的大部分性能提升。
  • 该编译器的设计支持未来扩展至新型指令集,如 AVX512、ARM、Power 以及 GPU。

更好的研究,从现在开始

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

无需绑定信用卡

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