Performance summary

From mindspore-ai/akg · View interactive version

Performance summary is an AI agent skill from the GitHub repository mindspore-ai/akg. 用于汇总和对比多个算子的性能测试结果。当用户请求汇总多个算子的性能结果、对比算子 benchmark、生成性能报告、分析多个 kernel 的加速比时使用此 Skill。

How to use this skill

Skill file

性能汇总

汇总和对比多个算子的性能指标。

工作流程

  1. 收集性能数据
  1. 生成对比表格

```

| 算子 | 延迟 (ms) | 吞吐量 | 内存 (MB) | 加速比 |

|--------|-----------|--------|-----------|--------|

| relu | 0.15 | 1000 | 128 | 2.3x |

```

  1. 分析结果
  1. 生成报告

使用模板:## 测试环境 → ## 性能对比 → ## 分析 → ## 优化建议

数据位置

性能结果存储在验证目录中:

关键指标

| 指标 | 说明 |

|------|------|

| latency_ms | 单次执行延迟(毫秒) |

| throughput | 每秒操作数 |

| speedup | 相对基准(torch)的加速比 |

| memory_usage_mb | 峰值内存占用(MB) |

示例

用户: "帮我汇总 relu 和 sigmoid 算子的性能"

Agent 执行:

  1. 调用 read_file("verify_relu/result.json")
  2. 调用 read_file("verify_sigmoid/result.json")
  3. 提取指标,构建对比表格
  4. 生成汇总和优化建议

脚本调用

可使用 scripts/collect_metrics.py 批量收集并打印性能汇总:

from collect_metrics import collect_metrics, print_results

# 打印格式化的性能汇总结果
print_results()

Skill 验证

使用 --verify 参数验证当前 skill 是否可用:

python scripts/collect_metrics.py --verify

验证内容包括:

输出示例:

============================================================
性能汇总结果
============================================================
| Operator | Latency (ms) | Throughput | Memory (MB) | Speedup | Correct |
|----------|--------------|------------|-------------|---------|---------|
| matmul   | 1.234        | 5000       | 256.0       | 1.80x   | ✅      |
| relu     | 0.150        | 10000      | 128.0       | 2.30x   | ✅      |
| sigmoid  | 0.180        | 8000       | 128.0       | 2.10x   | ✅      |
============================================================
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.