mcpField
T
triton-operator-doc-gen

triton-operator-doc-gen

github.com/ascendDocuments52109 installsUpdated 25w ago
Repository

About triton-operator-doc-gen

A skill for developers writing Triton operator interface documentation. It uses templates and implementation checks to cover formulas, platform support, dtype constraints, and runnable examples.

Key features

  1. 01Structure docs from a template
  2. 02Write descriptions and LaTeX formulas
  3. 03Document platform and dtype constraints
  4. 04Generate complete usage examples

Use cases

  1. 01Document a Triton operator interface
  2. 02Check formulas against kernel code
  3. 03Fill in platform and dtype support

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ascend/agent-skills --skill triton-operator-doc-gen

After installing, type/triton-operator-doc-genin Claude Code to confirm it loaded.

Bundled filesexamples/layer-norm.mdreferences/triton_operator_template.md

Details

From the project README

Triton 算子接口文档生成

工作流

  1. 收集算子信息:名称、功能、公式、接口、参数、约束
  2. MANDATORY:完整阅读 triton_operator_template.md 获取输出格式
  3. 参考示例:完整阅读 layer-norm.md 理解完整文档结构
  4. 需要确认 API 签名时,完整阅读 triton-api-reference.md
  5. 按模板生成文档,确保包含:
    • 产品支持情况表(Ascend 全系列产品)
    • 功能说明 + LaTeX 公式
    • 函数原型
    • 参数说明表
    • 约束条件(各平台数据类型支持)
    • 调用示例

常见陷阱

陷阱症状解决
产品支持表不全文档缺平台行覆盖所有 Ascend 产品线(A3/A2/950/Kirin)
约束表缺少 dtype 组合用户按文档用不支持的类型从 code 的 BLOCK_SIZE/dtype 限制反推,列出所有合法组合
公式与实现不一致文档说的和代码算的不一样从 kernel 代码逐行验证公式
调用示例不可运行用户复制粘贴报错示例必须完整可执行,包含 import 和数据构造

反模式清单(NEVER)

  • ❌ 生成空模板占位符(如 {公式}、{参数描述} 未填写)——所有占位符必须替换为实际内容
  • ❌ 调用示例缺少 import 语句或数据构造
  • ❌ 约束表缺少 dtype × 平台组合
  • ❌ 函数原型与实际 kernel 签名不一致
  • ❌ 公式使用纯文本而非 LaTeX 语法
  • ❌ 产品支持表包含不支持的型号标记为 √

Comments

Markdown supported