Guides Ascend C operator Tiling design: operator classification, multi-core splitting, UB chunking, buffer planning, and branch coverage.
Ships in ops-direct-invoke-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.
| 类别 | 特征 | 典型算子 | 设计指南 |
|---|---|---|---|
| Reduction 归约类 | 沿轴归约(含索引跟踪变体) | ReduceSum, Softmax, LayerNorm, ArgMax | ✅ 场景路由(⚠️ 必须先读) / 算法 |
| Sort 排序类 | 排序、TopK、外部归并 | Sort, ArgSort, TopK | ✅ 场景路由(⚠️ 必须先读) / 多核两级归并方案 |
| Elementwise 逐元素类 | 输入输出Shape相同,逐元素独立计算 | Sin, Cos, Abs, Exp | ✅ 场景路由(⚠️ 必须先读) |
| Broadcast 广播类 | 输入Shape不同,需广播对齐 | Add, Mul, Sub | ✅ 场景路由(⚠️ 必须先读) |
| Conversion 数据转换类 | 改变布局/形状,合并/拆分张量 | Transpose, Slice/StridedSlice, Pad, ChunkCat, Split | ✅ 场景路由(⚠️ 必须先读;已展开 small-channel Transpose / Slice / Pad / ChunkCat,其余子场景待补) |
| Random 随机类 | 生成随机数,需种子管理 | RandomUniform, Dropout | 📋 规划中 |
| MatMul 矩阵乘类 | 矩阵乘法,高计算密度,用Cube单元 | MatMul, BatchMatMul, MatMulBias, GroupedMatmul | ✅ 场景路由(⚠️ 必须先读平台路由) |
| Convolution 卷积类 | 空间卷积,滑动窗口计算 | Conv2D, DepthwiseConv | 📋 规划中 |
| FlashAttention 类 | 注意力计算 | FlashAttention, GQA, MHA, MLA(可叠加量化/稀疏 trait) | ✅ 场景路由(⚠️ 必须先读) |
| Scatter 累加散射类 | 按 index 散射写入/累加,updates 按行组织 | MaskedScatter, ScatterNdAdd, ScatterElementsV2, ScatterAdd, InplaceIndexAdd, scatter_reduce | ✅ 场景路由(⚠️ 必须先读) |
| Index 索引类(A2/A3) | 以索引为核心访问数据,存在跨元素寻址 | Gather, GatherElements, IndexSelect, IndexAdd, RepeatInterleave, Take, Scatter, ScatterElements | ✅ 场景路由(⚠️ 必须先读,按 P1~P7 分流到各 Pattern 文档) |
| NN 神经网络类(其它) | 神经网络专用,多种操作组合 | GroupNorm 等非 attention | 📋 规划中 |
Pad / 填充 / 镜像类算子:设计前必须先读 conversion/pad.md(该文的结构判据优先于 tile 参数)。
芯片代际说明:
references/index/下的文档面向 A2/A3 代际(910B / 910C,arch22,dav_c220/DAV_2201,单核 UB 192KB); 其中index/scatter.md为 A2/A3 的 UB 内标量散写方案,与面向 A5 代际(950,arch35,DAV_3510)的references/scatter/patterns.md分属两代,按目标芯片选用。 两代在 UB 容量与可用指令上存在实质差异(A2/A3 无硬件 Scatter 指令、只能走标量方案),Tiling 结论不可跨代照搬。
以下设计要素是所有算子类别都必须考虑和完成的:
核心问题:任务如何分配给多个 AI Core?
设计要点:
输出:
核心问题:单次能处理多少数据?
设计要点:
输出:
核心问题:需要哪些 buffer?各多大?
设计要点:
GetCoreMemSize(UB) 上限的前提下,增大 tile size 使 UB 利用率尽可能接近 100%输出:
GetCoreMemSize(UB))核心问题:需要处理哪些不同场景?
常见分支维度:
输出:
evals/evals.json (opens in a new tab)references/broadcast/broadcast-perf-optimization.md (opens in a new tab)references/broadcast/dynamic-ub-broadcast.md (opens in a new tab)references/broadcast/nddma-broadcast.md (opens in a new tab)references/broadcast/onedim.md (opens in a new tab)references/broadcast/patterns.md (opens in a new tab)references/broadcast/ub-broadcast.md (opens in a new tab)references/conversion/chunkcat.md (opens in a new tab)references/conversion/pad.md (opens in a new tab)references/conversion/patterns.md (opens in a new tab)references/conversion/strided-slice.md (opens in a new tab)references/conversion/transpose-small-channel.md (opens in a new tab)references/elewise/patterns.md (opens in a new tab)references/elewise/tiling.md (opens in a new tab)references/flashattention/design/_governance.md (opens in a new tab)references/flashattention/design/execution.md (opens in a new tab)references/flashattention/design/resources.md (opens in a new tab)references/flashattention/design/shape.md (opens in a new tab)references/flashattention/foundation/composition.md (opens in a new tab)references/flashattention/foundation/extension_points.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/ops-direct-invoke-skills:ascendc-tiling-designfrom ops-direct-invoke-skills
npx claudepluginhub hicann/cannbot-skills --plugin ops-direct-invoke-skills25 skills in this plugin
/ascendc-api-best-practicesAscend C API 使用最佳实践。提供算术、归约、数据搬运、Buffer管理、精度转换、通信接口等 API 的正确用法和限制说明。触发:用户询问具体 API 用法(如"DataCopy 怎么用"、"ReadNbi 怎么用")、遇到 API 参数错误或限制报错(如 repeatTimes、对齐问题)、需要查看 API 最佳实践或避坑指南、算子性能疑似受标量访问/单元素读写影响时。/ascendc-blaze-best-practice在 Ascend 950 / DAV_3510 平台上,基于 Blaze/tensor_api 开发 Basic、Batch、Grouped、Quantized、MX 等 MatMul 类算子或相关的融合算子时使用。不适用于纯 Vector 算子或 A2/A3 平台。/ascendc-blaze-migration评估并将 ops-nn、ops-transformer 等仓中 Ascend 950 / DAV_3510 的 AscendC Kernel 分支等价迁移到 ops-tensor Blaze/Tensor API。适用于 CMCT、CGMCT、单体或自定义分层 Kernel,以及 Cube、Vector、MIX、高阶 Matmul、手工 Buffer、数据搬运、自定义调度、VF 和同步路径;在隔离迁移工程中串行完成迁移合同冻结、Blaze 开发、验证资产生成、原始基线、Blaze 验收和双仓本地提交交付。Other plugins' skills for the same job