CuTe 布局表示与代数
CuTe Layout Representation and Algebra
AI总结:
CuTe 提供了一种新的数学规范用于表示和操作张量,通过分层布局表示和丰富的布局运算代数,提升张量处理的效率与准确性。
摘要:
现代高性能计算和深度学习架构越来越多地集成了专门的张量指令,包括用于矩阵乘法的张量核心和针对多维数据优化的硬件复制操作。这些指令规定了固定且通常复杂的布局,必须在整个执行管道中正确传播,以确保正确性和最佳性能。我们提出了 CuTe,一种新的数学规范,用于表示和操作张量。CuTe 引入了两个关键创新:(1)一种分层布局表示,它直接扩展了传统的扁平形状和扁平步长张量表示,使能够表示现代硬件指令所需的复杂映射;(2)一种丰富的布局运算代数,包括连接、合并、组合、补集、分割、分块和反转等运算,使能够进行复杂的布局操作、推导、验证和静态分析。CuTe 布局提供了一个框架,用于管理和安排 GPU 内核中的数据布局和线程安排,而布局代数使能够对布局属性进行强大的编译时推理,并表达通用的张量变换。在本工作中,我们证明了 CuTe 的抽象在软件开发中比传统方法有显著优势,促进了对架构所规定布局的编译时验证,促进了能够推广到广泛应用的算法原语的实现,并使能够简洁地表达现代专用张量指令所需的分块和分片模式。CuTe 已成功部署在生产系统中,成为 NVIDIA 的 CUTLASS 库以及包括 CuTe DSL 在内的其他相关努力的基础。
英文摘要:
Modern architectures for high-performance computing and deep learning increasingly incorporate specialized tensor instructions, including tensor cores for matrix multiplication and hardware-optimized copy operations for multi-dimensional data. These instructions prescribe fixed, often complex data layouts that must be correctly propagated through the entire execution pipeline to ensure both correctness and optimal performance. We present CuTe, a novel mathematical specification for representing and manipulating tensors. CuTe introduces two key innovations: (1) a hierarchical layout representation that directly extends traditional flat-shape and flat-stride tensor representations, enabling the representation of complex mappings required by modern hardware instructions, and (2) a rich algebra of layout operations -- including concatenation, coalescence, composition, complementation, division, tiling, and inversion -- that enables sophisticated layout manipulation, derivation, verification, and static analysis. CuTe layouts provide a framework for managing both data layouts and thread arrangements in GPU kernels, while the layout algebra enables powerful compile-time reasoning about layout properties and the expression of generic tensor transformations. In this work, we demonstrate that CuTe's abstractions significantly aid software development compared to traditional approaches, promote compile-time verification of architecturally prescribed layouts, facilitate the implementation of algorithmic primitives that generalize to a wide range of applications, and enable the concise expression of tiling and partitioning patterns required by modern specialized tensor instructions. CuTe has been successfully deployed in production systems, forming the foundation of NVIDIA's CUTLASS library and a number of related efforts including CuTe DSL.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。