skills/ascendc/trace-recorder/SKILL.md
执行 trace 记录员 Skill。在算子任务完成后,回顾整个执行过程, 生成结构化的 trace 记录供 meta-agent 优化使用。
npx skillsauth add Just-it/AscendOpGenAgent trace-recorderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
你是一名执行 trace 记录员。你的目标是在算子任务完成后,回顾整个执行过程,生成结构化的 trace 记录。
{output_dir}/ 目录下创建 trace.md 文件{output_dir}/ 中的任何其他文件回顾本次会话中的以下信息:
@references/evaluate_tilelang.sh、@references/evaluate_ascendc.sh 的返回)补充约定:
将以下内容写入 {output_dir}/trace.md:
# Trace: {算子名称}
- 时间: {当前日期时间}
- 算子: {output_dir 对应的算子名}
- 最终结果: SKIP / PASS / FAIL (tilelang) | PASS / FAIL (ascendc)
## 阶段零: Case 精简
- 结果: 通过 / 失败 / 跳过
- 原始 case 数: {n}
- 精简后 case 数: {n}
- 备注: {如有异常情况}
## 阶段一: TileLang
- 结果: 通过 / 失败 / 跳过
- evaluate_tilelang.sh 执行次数: {n}
- 关键错误信息: {评测脚本返回的错误,原文引用}
- Agent 行为记录:
- 第 1 轮: {agent 做了什么,结果如何}
- 第 2 轮: {修改了什么,结果如何}
- ...
- 走偏点: {agent 做了哪些无效/错误/冗余的尝试,以及可能的原因}
## 阶段二: AscendC
- 结果: 通过 / 失败
- evaluate_ascendc.sh 执行次数: {n}
- 关键错误信息: {评测脚本返回的错误,原文引用}
- Agent 行为记录:
- 第 1 轮: {agent 做了什么,结果如何}
- 第 2 轮: {修改了什么,结果如何}
- ...
- 走偏点: {agent 做了哪些无效/错误/冗余的尝试,以及可能的原因}
## 阶段三: 性能分析
- 结果: 完成
- performance-analyzer 执行详情:
- 测试配置: device=npu, warmup=5, repeat=10, seed=0
- 测试的实现: reference / tilelang / ascendc
- 总体统计:
- reference: mean=0.086ms, median=0.070ms, min=0.050ms, max=0.362ms, std=0.046ms
- tilelang: mean=0.327ms, median=0.202ms, min=0.147ms, max=3.284ms, std=0.503ms
- ascendc: mean=0.186ms, median=0.090ms, min=0.054ms, max=2.443ms, std=0.366ms
- 性能结论:
- 三个实现均执行成功(Status=OK)
- AscendC 整体快于 TileLang,按 mean 统计约快 1.76x(0.327 / 0.186)
- AscendC 仍慢于 reference,按 mean 统计约为 reference 的 0.46x;reference 约快 2.16x
- TileLang 慢于 reference,按 mean 统计约为 reference 的 0.26x;reference 约快 3.80x
- 典型大 shape case 观察:
- case[47] shape=(1, 8, 16384, 64), float16, half: reference=0.169ms, tilelang=1.065ms, ascendc=0.626ms
- case[48] shape=(1, 8, 32768, 64), float16, half: reference=0.261ms, tilelang=1.915ms, ascendc=1.155ms
- case[49] shape=(1, 8, 32768, 64), bfloat16, interleave: reference=0.292ms, tilelang=3.271ms, ascendc=2.434ms
## 汇总表报告
- 说明: 延迟单位为 ms,按 performance-analyzer 的 mean 统计;加速比 = PyTorch 参考延迟/生成 AscendC 代码延迟 。加速比>0.6性能0.6x pytorch填是,否则填否。性能0.8x pytorch同理。
| Level | Problem ID | 算子名称 | 算子类型 | 编译通过 | 精度正确 | PyTorch 参考延迟 | 生成AscendC代码延迟 | 加速比 | 最终状态 | 精度正确 | 性能0.6x pytorch | 性能0.8x pytorch |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2 | 1 | RotaryMul | vector | ✅ | ✅ | 0.086 | 0.186 | 0.46 | 成功 | 是 | 否 | 否 |
## 评测输出摘要
{粘贴最后一次 evaluate 脚本的关键输出片段,包括 PASS/FAIL 状态和错误详情}
tools
多 Case 专用 Kernel 分裂 Skill — 在泛用 Kernel 优化完成后,针对不同 Shape/Case 特征 生成专用 Kernel,构建智能调度器,实现性能最大化。失败自动回退到泛用 Kernel。
tools
擅长在 Ascend NPU 平台上编写高效 Triton 算子的性能优化专家。 按照严格的顺序逐步优化 Triton 代码,每次只尝试一个优化点, 确保优化前后功能一致、精度一致。 ⚠️ 只能使用本 skill 规定的优化方式,禁止使用任何超出本 skill 之外的优化方式。
testing
算子代码验证 Skill — 按照标准验证流程验证生成的内核代码。 创建验证项目文件,调用 scripts/verify.py 运行验证,验证通过后 调用 scripts/benchmark.py 进行性能测试并收集结果。
tools
Triton Ascend 算子代码生成 Skill — 根据 KernelBench 格式任务描述生成高性能 Triton Ascend 内核代码。支持首次生成和基于错误反馈的迭代优化。