Generates Catlass operator code from design documents: op_host, op_kernel, and test_aclnn files, following Catlass components and TilingKey patterns for Ascend NPUs.
Ships in external-gitcode-ascend-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
设计文档解析 → Catlass 实现参考选型 → op_host 生成 → op_kernel 生成 → test_aclnn 生成 → 质量验证
设计文档是代码生成的唯一依据,须 100% 遵守。
| 章节 | 必须遵守内容 | 验证方式 |
|---|---|---|
| 算子名 | 含 catlass 子串,snake_case 目录名与 CamelCase 类名一致 | 目录、OpDef、test_aclnn 命名一致 |
| I/O 与 dtype | 输入输出 shape、dtype、format | OpDef 与 test_aclnn tensor 一致 |
| 核心组件 | ArchTag、BlockMmad、BlockEpilogue、BlockScheduler、Kernel 类型 | op_kernel 与 custom-epilogue.md 一致 |
| 参考 example | 指定的 catlass example 路径与选型理由 | 实现与选型一致(非整份粘贴) |
| TilingKey | 各分支对应 dtype/转置等 | Host SetTilingKey 与 TILING_KEY_IS 一一对应 |
| Workspace | 固定写法 | 见 kernel-rules.md |
| 检查项 | 说明 |
|---|---|
| 设计文档 | 含算子名、I/O、dtype、转置、参考 example、Kernel/Block/Epilogue |
| 工程 | OPS_PROJECT_ROOT 已定,含 build.sh、ops/ |
| Catlass | <OPS_PROJECT_ROOT>/catlass/ 含 include/、examples/;缺则在工程根克隆 |
条件不明时追问用户。
在 catlass/examples/ 中按设计文档选定实现参考(读结构、抄组件组合思路,不是把 example 当 ops/ 迁移源):
TILING_KEY_IS 分支与 Host 侧对齐在 OPS_PROJECT_ROOT:bash build.sh --genop=ops/<op_name>
删无用模板;按 compile-options.md 配置 ascendc_config.json
算子名、I/O、dtype、转置、参考路径、Kernel/Block/Epilogue、Workspace、TilingKey 分支
同上文「Catlass 实现参考选型」
生成 3 类 4 个文件:
*_tiling.h / *_tiling.cpp:按 tiling-rules.md*_def.cpp:按 def-rules.md*_infershape.cpp:按 infershape-rules.md按 kernel-rules.md:GET_TILING_DATA、TILING_KEY_IS、Device 调用、#define K_MAX_SHAPE_DIM 0、勿 #include tiling.h
按 example-rules.md 覆盖 examples/test_aclnn_<op_name>.cpp
NEVER:跳过 --genop;tiling/infershape 并进 def;漏 IMPL_OP_* 注册;def 里 SetTiling/SetInferShape;目录名无 catlass;Kernel 内用 if 代替 TilingKey;op_kernel 用 DeviceGemm;op_kernel #include tiling.h;对 Gemm 仅用 shape 推断转置;忘记在 ascendc_config.json 中配置 Catlass 编译选项
ALWAYS:先 opgen 再覆盖;三文件分文件注册;严格按设计文档组件选型;在 ascendc_config.json 中配置 Catlass 编译选项;改算子后 --pkg 安装再跑示例
| 文件 | 内容 |
|---|---|
| compile-options.md | 编译选项配置 |
| code-structure.md | 目录树、文件职责索引 |
| example-rules.md | test_aclnn 写法 |
| tiling-rules.md | tiling.h / tiling.cpp |
| def-rules.md | def.cpp |
| infershape-rules.md | infershape.cpp |
| kernel-rules.md | Catlass 依赖与 Device 调用 |
| custom-epilogue.md | 自定义 Tile Epilogue |
| 文档/目录 | 用途 |
|---|---|
| catlass/examples/advanced/basic_matmul_aclnn | 工程化 op_host / op_kernel / 测试组织对照 |
| catlass/examples/03_matmul_add | MatmulEpilogue + BlockEpilogue 组合参考 |
| ascendc-operator-compile-debug | 编译、安装、跑示例 |
| catlass-operator-design | 设计文档 |
examples/catlass_basic_matmul.cpp (opens in a new tab)references/code-structure.md (opens in a new tab)references/compile-options.md (opens in a new tab)references/example/example-rules.md (opens in a new tab)references/example/golden.md (opens in a new tab)references/op_host/def-rules.md (opens in a new tab)references/op_host/infershape-rules.md (opens in a new tab)references/op_host/tiling-rules.md (opens in a new tab)references/op_kernel/custom-epilogue.md (opens in a new tab)references/op_kernel/kernel-rules.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
/external-gitcode-ascend-skills:external-gitcode-ascend-catlass-operator-code-genfrom external-gitcode-ascend-skills
npx claudepluginhub ascend-ai-coding/awesome-ascend-skills --plugin external-gitcode-ascend-skills91 skills in this plugin
/external-gitcode-ascend-analyse-coverage分析测试覆盖率盲区,生成覆盖率分析报告/external-gitcode-ascend-arxiv-recommendation-npu自动化推荐系统论文发现流水线。抓取 arxiv 推荐论文,检测源码,生成待迁移任务清单,由 npu-model-migration skill 完成 NPU 适配。/external-gitcode-ascend-ascendc-operator-code-gen根据设计文档生成 AscendC 算子完整代码实现并完成框架适配。TRIGGER when: 设计文档已完成,需要生成 op_host/op_kernel 代码、注册到 PyTorch 框架、编译测试。关键词:代码生成、op_host、op_kernel、tiling、kernel、框架适配、算子注册。Other plugins' skills for the same job