About triton-operator-design
A skill for producing Triton operator requirements and design documents, covering requirements, API prototypes, constraints, and implementation plans. It calls for specific tiling calculations and explicit treatment of hardware limits, data flow, and precision.
Key features
- 01Analyze requirements and define functions and formulas
- 02Design API interface prototypes
- 03Specify input, output, and hardware constraints
- 04Plan tiling and kernel implementation
- 05Document data flow, alignment, and precision
Use cases
- 01Draft a design document for a Triton operator
- 02Plan tiling for an Ascend NPU operator
- 03Assess UB capacity and memory alignment constraints
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ ascend/ agent-skills --skill triton-operator-designAfter installing, type/triton-operator-designin Claude Code to confirm it loaded.
Bundled filesreferences/triton-operator-template.md
Details
From the project READMETriton 算子需求文档生成
工作流
- 需求分析 → 产出:功能定义、数学公式、竞品对比
- 原型设计 → 产出:API 接口定义
- 规格约束 → 产出:输入输出约束、硬件限制
- 特性实现 → 产出:Tiling 策略、Kernel 实现方案
参考资源加载
| 阶段 | 必须加载 | 不要加载 |
|---|---|---|
| 需求分析 | ascend-terminology.md | template, tiling-strategies |
| 原型设计 | triton-api-reference.md | tiling-strategies |
| 特性实现 | tiling-strategies.md, triton-operator-template.md | ascend-terminology |
MANDATORY:阶段 4 前,完整阅读 tiling-strategies.md 和 triton-operator-template.md,不设行数限制。按模板格式输出文档。
关键术语
- GM:全局内存(DDR),UB:Vector Core 高速缓存(192KB),L1:Cube Core 缓存(~1MB)
- AI Core:A2/A3 有 24 个,含 1 Cube + 2 Vector
- 归约操作必须升精度到 FP32
绝对不要做的事
- ❌ 使用模糊术语("适当切分"、"合理分配")— 必须给出具体计算方法
- ❌ 忽略 UB 大小(192KB)和对齐要求(32B)
- ❌ 不区分 Vector Core(向量计算)和 Cube Core(矩阵计算)
- ❌ 不标注数据流图中的数据类型和 GM↔UB 传输
- ❌ 归约操作不说明升精度策略
常见陷阱
| 陷阱 | 症状 | 解决 |
|---|---|---|
| UB 超限 | 方案不可实现 | 计算缓冲区总大小 < 192KB |
| 内存未对齐 | 硬件报错 | UB 缓冲区 32B 对齐,单值缓冲区分配 32B |
| 精度损失 | FP16 结果不准 | 归约前升 FP32,完成后降精度 |
| Tiling 不合理 | 性能差/大 shape 不支持 | 按维度切分,避免跨 Core 数据依赖 |
Comments
Markdown supported