Skip to content

扉页、摘要与目录 ​

译文总目录 · 第 1 章:引言

中文译文:Colfax Research,2025 年 9 月版。校注。

PDF 第 1 页 ​

CuTe 布局的范畴基础 ​

Colfax Research ​

2025 年 9 月 ​

展开原页对照(保留全部图示、代码、标签和数学排版)

PDF 第 1 页原页

展开本页英文正文
Categorical Foundations for CuTe Layouts

Colfax Research

September 2025

PDF 第 2 页 ​

摘要

NVIDIA 的 CUTLASS 库提供了一套稳健且富有表达力的方法,用于描述和操作 GPU 上的多维张量数据。这些方法在概念上以 CuTe 布局这一抽象概念及其丰富的布局代数为基础,其中包括复合、逻辑乘积和逻辑除法等运算。本文聚焦于一类自然出现的可处理布局,提出了一个用于理解这一布局代数的范畴论框架。为此,我们定义了两个范畴 Tuple 和 Nest,其中的态射能够产生布局。我们在这些范畴的态射上定义了一组运算,并证明它们与相应的布局运算兼容。此外,我们完整刻画了通过我们的构造所产生的布局。最后,我们给出了这些范畴论构造的 Python 实现,并提供了测试,以展示其行为与 CUTLASS 一致。实现位于我们的 Git 仓库:https://github.com/ColfaxResearch/layout-categories。

展开原页对照(保留全部图示、代码、标签和数学排版)

PDF 第 2 页原页

展开本页英文正文
Abstract

NVIDIA’s CUTLASS library provides a robust and expressive set of methods for describing and manipulating multi-dimensional tensor data on the GPU. These methods are conceptually grounded in the abstract notion of a CuTe layout and a rich algebra of such layouts, including operations such as composition, logical product, and logical division. In this paper, we present a categorical framework for understanding this layout algebra by focusing on a naturally occurring class of tractable layouts. To this end, we define two categories Tuple and Nest whose morphisms give rise to layouts. We define a suite of operations on morphisms in these categories and prove their compatibility with the corresponding layout operations. Moreover, we give a complete characterization of the layouts which arise from our construction. Finally, we provide a Python implementation of our categorical constructions, along with tests that demonstrate alignment with CUTLASS behavior. This implementation can be found at our git repository https://github.com/ColfaxResearch/layout-categories.

PDF 第 3 页 · 原书第 1 页 ​

节标题原书页码
1引言3
1.1主要结果概述6
1.2文章结构8
1.3实现10
1.4记号16
2布局及其代数17
2.1平坦布局17
2.1.1元组17
2.1.2基本定义18
2.1.3基本运算26
2.1.4平坦合并35
2.1.5紧致平坦布局40
2.1.6补布局43
2.1.7进一步的运算53
2.1.8可处理平坦布局55
2.2嵌套元组57
2.2.1轮廓57
2.2.2基本定义59
2.2.3代入62
2.2.4细化63
2.3布局66
2.3.1基本定义66
2.3.2基本运算69
2.3.3合并71
2.3.4相对合并73
2.3.5紧致布局76
2.3.6补布局77
2.3.7复合79
2.3.8逻辑除法80
2.3.9逻辑乘积83
2.3.10可处理布局84
3布局的范畴86
3.1Tuple 范畴86
3.1.1基本定义86
展开原页对照(保留全部图示、代码、标签和数学排版)

PDF 第 3 页原页

展开本页英文正文
Contents

1 Introduction 3 1.1 Summary of main results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.2 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2 Layouts and their algebra 17 2.1 Flat Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.1.1 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.1.2 Basic definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.1.3 Basic operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.1.4 Flat coalesce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.1.5 Compact flat layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.1.6 Complements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.1.7 Further operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 2.1.8 Tractable flat layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 2.2 Nested Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 2.2.1 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 2.2.2 Basic definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 2.2.3 Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.2.4 Refinement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 2.3 Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 2.3.1 Basic definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 2.3.2 Basic operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 2.3.3 Coalesce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 2.3.4 Relative coalesce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 2.3.5 Compact layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 2.3.6 Complements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 2.3.7 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 2.3.8 Logical division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 2.3.9 Logical product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 2.3.10 Tractable layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

3 Categories of layouts 86 3.1 The category Tuple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 3.1.1 Basic definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

PDF 第 4 页 · 原书第 2 页 ​

节标题原书页码
3.1.2从元组态射到平坦布局90
3.1.3例子98
3.1.4元组态射的具象化102
3.1.5元组态射上的运算105
3.2Nest 范畴123
3.2.1基本定义123
3.2.2从嵌套元组态射到布局124
3.2.3例子127
3.2.4嵌套元组态射的具象化129
3.2.5细化130
3.2.6嵌套元组态射上的运算138
4计算146
4.1复合146
4.1.1共同细化147
4.1.2从共同细化到可复合态射151
4.1.3复合算法152
4.1.4例子153
A范畴入门157
A.1什么是范畴?157
A.2什么是函子?160

原文公式、图示或代码(PDF 第 4 页)

展开原页对照(保留全部图示、代码、标签和数学排版)

PDF 第 4 页原页

展开本页英文正文
3.1.2 From tuple morphisms to flat layouts . . . . . . . . . . . . . . . . . . . . . . . 90 3.1.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 3.1.4 Realization of tuple morphisms . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.1.5 Operations on tuple morphisms . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 3.2 The category Nest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 3.2.1 Basic definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 3.2.2 From nested tuple morphisms to layouts . . . . . . . . . . . . . . . . . . . . . . 124 3.2.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 3.2.4 Realization of nested tuple morphisms . . . . . . . . . . . . . . . . . . . . . . . 129 3.2.5 Refinements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 3.2.6 Operations on nested tuple morphisms . . . . . . . . . . . . . . . . . . . . . . . 138

4 Computations 146 4.1 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 4.1.1 Mutual refinements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 4.1.2 From mutual refinements to composable morphisms . . . . . . . . . . . . . . . 151 4.1.3 The composition algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 4.1.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

A An introduction to categories 157 A.1 What is a category? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 A.2 What is a functor? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

译文总目录 · 第 1 章:引言

记录原理、连接知识、积累实践。