Initializes an AscendC operator project with a compilable skeleton. Detects or copies the ascend-kernel template, creates the operator directory under csrc/ops/, and outputs a checklist for further development.
Ships in tilelang2ascend-ops-developer-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; scripts run unread.
Skill类型:流程导向型(多阶段工作流,阶段检查点)
快速创建 Ascend-Kernel 算子工程,所有算子统一生成在 csrc/ops 目录下,并保证后续可直接进入设计/编码/编译测试阶段。
csrc/ops 目录下EXEC_KERNEL_CMD 左值要求、环境依赖digraph project_init {
rankdir=TB;
node [shape=box];
start [label="用户请求创建算子" shape=ellipse];
detect_ascend_kernel [label="检测ascend-kernel项目是否存在" shape=diamond];
detect_ops [label="检测csrc/ops/目录是否存在" shape=diamond];
copy_template [label="复制ascend-kernel项目模板到当前目录"];
create_ops_dir [label="创建csrc/ops目录"];
collect [label="收集算子信息"];
check_path [label="检查目标算子路径是否存在" shape=diamond];
show_exists [label="提示路径已存在,询问是否更换"];
show_result [label="展示目录结构和下一步指引"];
start -> detect_ascend_kernel;
detect_ascend_kernel -> detect_ops [label="存在"];
detect_ascend_kernel -> copy_template [label="不存在"];
copy_template -> collect;
detect_ops -> collect [label="存在ops/"];
detect_ops -> create_ops_dir [label="不存在ops/"];
create_ops_dir -> collect;
collect -> check_path;
check_path -> show_exists [label="存在"];
show_exists -> collect [label="更换名称"];
check_path -> show_result [label="不存在"];
}
op_host/ 和 op_kernel/ops.h、register.cpp、csrc/CMakeLists.txt(三处)EXEC_KERNEL_CMD 中直接传右值临时变量检测策略:
执行命令:
bash <skill_dir>/scripts/detect_ascend_kernel_project.sh
| 检测结果 | 处理方式 |
|---|---|
PROJECT_FOUND:<path> | 使用现有项目,继续步骤2 |
PROJECT_FOUND_NO_OPS:<path> | 在项目中创建csrc/ops/目录,继续步骤2 |
PROJECT_NOT_FOUND | 复制ascend-kernel模板到当前目录,继续步骤2 |
MULTIPLE_PROJECTS:<path1> <path2> ... | 列出所有项目,让用户选择 |
执行命令:
cp -r "<skill_dir>/templates/ascend-kernel" ./ascend-kernel
chmod +x ./ascend-kernel/build.sh
重要:复制后必须 chmod +x build.sh,否则编译时会报 Permission denied。
验证:确认ascend-kernel目录包含:
必须确认的信息:
| 信息 | 格式要求 | 说明 |
|---|---|---|
| 算子名称 | snake_case | 如 rms_norm, flash_attn |
确认信息:
=== Ascend-Kernel算子信息 ===
算子名称: <op_name>
生成路径: <ascend_kernel_path>/csrc/ops/<op_name>
确认创建?[Y/n]
mkdir -p csrc/ops)csrc/ops/<op_name> 不存在创建目录:
mkdir -p csrc/ops/<op_name>/op_host csrc/ops/<op_name>/op_kernel
在 csrc/ops/<op_name>/ 下创建以下文件:
csrc/ops/<op_name>/
├── CMakeLists.txt
├── design.md # 设计文档占位(由 design skill 填充)
├── op_host/
│ └── <op_name>.cpp # Host 占位(由 code-gen skill 替换)
└── op_kernel/
└── <op_name>.cpp # Kernel 占位(由 code-gen skill 替换)
CMakeLists.txtascendc_add_operator(OP_NAME <op_name>)
op_host/<op_name>.cpptorch_kernel_helper.haclrtlaunch_<op_name>.hnamespace ascend_kernel { at::Tensor <op_name>(...) { ... } } 占位op_kernel/<op_name>.cppkernel_operator.hextern "C" __global__ __aicore__ void <op_name>(...) 占位初始化完成后,明确提示用户/后续 skill 更新以下三处:
csrc/ops.h:添加函数声明csrc/register.cpp:添加 m.def 与 m.implcsrc/CMakeLists.txt:
OP_SRCS 添加 host 文件ascendc_library(...) 添加 kernel 文件aclnn/<op>.cpp说明:这是实战最高频遗漏点,必须在初始化阶段提前提示。
提示用户:
Ascend-Kernel项目初始化成功!
项目结构:
<ascend_kernel_path>/
├── build.sh # 构建脚本
├── CMakeLists.txt # CMake配置
├── csrc/
│ ├── ops/ # 算子目录
│ ├── aclnn/ # ACLNN算子封装
│ ├── utils/ # 工具类
│ ├── ops.h # 算子声明
│ └── register.cpp # 算子注册
├── python/ # Python包
└── tests/ # 测试用例
下一步操作:
调用 ascendc-operator-design skill 完成设计文档
EXEC_KERNEL_CMD 参数必须是左值;如 double 先转 float 局部变量再传完成本 skill 后,至少应满足:
ascend-kernel 项目csrc/ops/<op_name>/ 标准骨架ops.h / register.cpp / csrc/CMakeLists.txt)scripts/detect_ascend_kernel_project.sh (opens in a new tab)templates/ascend-kernel/CMakeLists.txt (opens in a new tab)templates/ascend-kernel/build.sh (opens in a new tab)templates/ascend-kernel/csrc/CMakeLists.txt (opens in a new tab)templates/ascend-kernel/csrc/ops.h (opens in a new tab)templates/ascend-kernel/csrc/ops/helloworld/op_host/helloworld.cpp (opens in a new tab)templates/ascend-kernel/csrc/ops/helloworld/op_kernel/kernel_helloworld.cpp (opens in a new tab)templates/ascend-kernel/csrc/register.cpp (opens in a new tab)templates/ascend-kernel/csrc/utils/torch_kernel_helper.h (opens in a new tab)templates/ascend-kernel/python/ascend_kernel/ascend_kernel/__init__.py (opens in a new tab)templates/ascend-kernel/python/ascend_kernel/setup.py (opens in a new tab)templates/ascend-kernel/tests/test_avg_pool3d.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/tilelang2ascend-case-simplifier测试用例精简专家 Skill。读取 `{output_dir}` 中与算子对应的 `.json` 文件, 对其中的输入 cases(JSON Lines 格式,每行一个 `{"inputs": [...]}` 对象)进行精简, 使 case 数量尽量不超过 10 个,同时保证覆盖度。 当测试用例数量过多需要精简时,使用此 skill。
/tilelang2ascend-precision-tuning用于DumpTensor进行AscendC算子精度的调试。
Use when:
- AscendC kernel / 算子精度失败,结果不对,数值错误,部分位置错误,或 NaN/Inf
- 需要用 DumpTensor / dumptensor / dump tensor 看中间结果、GM/UB/Workspace 数据
- 需要分段定位 `Cube输入/中间/输出`、`Vector输入/中间/输出` 哪一段出问题
/tilelang2ascend-tilelang-designerTileLang kernel 设计与实现专家 Skill。为 PyTorch Model 设计并实现自定义 TileLang kernel: 完成 block-level 设计、tile-level 设计,并生成 model_new_tilelang.py 调用自定义 TileLang kernel。 当需要为复杂算子设计 TileLang kernel 时,使用此 skill。
/tilelang2ascend-trace-recorder执行 trace 记录员 Skill。在算子任务完成后,回顾整个执行过程, 生成结构化的 trace 记录供 meta-agent 优化使用。 当算子任务完成后需要记录执行过程时,使用此 skill。
/tilelang2ascend-translatorAscendC kernel 转译与实现专家 Skill。将 TileLang 设计转译为 AscendC kernel, 并生成 model_new_ascendc.py 调用 AscendC kernel。 当 TileLang 设计完成需要转译为 AscendC kernel 时,使用此 skill。
3 plugins ship this exact skill · first indexed Jun 25, 2026
/tilelang2ascend-ops-developer-skills:tilelang2ascend-operator-project-initfrom tilelang2ascend-ops-developer-skills
npx claudepluginhub jieran-zhang/cannbot-skills --plugin tilelang2ascend-ops-developer-skillsOther plugins' skills for the same job