Triton Operator Performance Eval logo

Triton Operator Performance Eval

Organization
Ascend
triton-operator-performance-eval

评估 Ascend NPU 上 Triton 算子性能。使用 msprof/msprof op 采集性能数据,诊断 Memory-Bound/Compute-Bound 瓶颈,测量硬件利用率,生成性能报告。

Overview

PublisherAscend
Repositoryagent-skills
Skill nametriton-operator-performance-eval
Stars
54
Forks
4
Bundled files
3
LicenseMulanPSL-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Ascend on GitHub. Read the source before you install it.

Installation

Install the Triton Operator Performance Eval AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Ascend/agent-skills/tree/master/skills/triton-operator-performance-eval
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Ascend/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/triton-operator-performance-eval .claude/skills/triton-operator-performance-eval
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Triton Operator Performance Eval in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Triton Operator Performance Eval on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Triton Operator Performance Eval is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Triton 算子性能评估(Ascend NPU)

核心原则

只相信 msprof 数据,不凭直觉。

性能比(Ratio)定义:Ratio = torch_npu 耗时 / Triton 耗时。Ratio > 1.0 表示 Triton 更快,Ratio < 1.0 表示更慢。不是耗时的直接比值,而是耗时的倒数。目标通常为 Ratio ≥ 1.0x。

唯一可信采集方式:msprof(函数级)和 msprof op(算子级)。其他方式(time.time()、torch.npu.Event、do_bench等)因包含 Host 开销且精度不足,绝对不可用于性能评估。

命令用途典型场景
msprof --application="python x.py"函数级:多算子对比、全链路分析"哪个算子最慢?"
msprof op --kernel-name=K python x.py算子级:硬件利用率、Bank Conflict"这个 kernel 为什么慢?"

决策:先 msprof 定位热点,再 msprof op 深度分析。

参考资源加载

任务必须加载不要加载
函数级性能对比msprof-function-level.mdmsprof-op-level
算子级硬件分析msprof-op-level.md, performance-data-analysis.mdmsprof-function-level
理解硬件术语ascend-terminology.md—

性能总结模板

完成评估后必须输出:

模块内容
基本信息算子名称、输入规模、硬件型号、测量方法
性能指标执行耗时、内存带宽利用率、Cube/Vector 利用率、L2 Cache 命中率、Bank Conflict
瓶颈诊断瓶颈类型 + 判断依据 + CSV 数据证据
优化建议按优先级排列,附预期收益

原则:所有结论必须有 Profiling 数据支撑。利用率 < 30% 标记为 重点关注。

瓶颈分类(仅用于诊断归类)

瓶颈判断条件详细优化手法
Memory-BoundAI < 硬件平衡点→ 交给 performance-optim skill
Compute-BoundAI > 硬件平衡点→ 交给 performance-optim skill
Latency-Bound带宽和计算利用率均低→ 交给 performance-optim skill

边界:本 skill 负责诊断瓶颈类型并输出数据。优化手法由 triton-operator-performance-optim 负责。

反模式清单(NEVER)

  • ❌ 使用非 msprof 方式计时(time.time/Event/do_bench 等)
  • ❌ Triton(NPU) vs PyTorch(CPU) 对比 — 必须 同硬件 对比
  • ❌ 不预热就采集(首次含编译开销)
  • ❌ 只测一次就下结论 / 只测大 shape
  • ❌ 采集时含打印或日志(I/O 干扰)
  • ❌ 混淆 msprof 和 msprof op 的用途

常见陷阱

陷阱表现正确做法
用 msprof op 做对比只看单个 kernel对比用 msprof,深度分析用 msprof op
--kernel-name 拼错静默完成但无数据确认名称与 Triton 函数定义一致
未区分编译和稳态首次耗时异常高至少 5 次预热后采集
忽略小 shape 性能小 shape 差未发现必须覆盖小/中/大 shape
忽略 dtype 影响FP16/FP32 差异大固定 dtype 对比,分别评估
函数级含 JIT 编译op_statistic 中 Triton avg 异常高(ms 级)对比用 msprof op 的 Task Duration,或函数级仅比较稳态调用
Triton vs torch_npu Core Type 不同Triton=AI_VECTOR_CORE,torch_npu=MIX_AIC注意:MIX_AIC 不一定使用 Cube 引擎,需检查 aic_cube_ratio 是否为 NA;真正差距在 MTE2 指令粒度

函数级 msprof 的 JIT 编译陷阱(重要)

msprof 函数级采集会包含 JIT 编译时间。Triton kernel 首次调用每种 (shape, dtype, mode) 组合时触发编译,耗时可达数秒。op_statistic.csv 中的 Total Time 和 Avg Time 会将这些编译时间算入。

案例:Triton kernel 的 op_statistic 显示 Avg=17791 us,但 msprof op 的 Task Duration 仅 1362 us。差距完全来自 11 种 unique config 的 JIT 编译。

正确做法:

  1. 函数级对比仅看 稳态调用(忽略前 N 次或单独统计编译开销)
  2. 或直接用 msprof op 的 Task Duration 作为 kernel 性能基准
  3. 对比 torch_npu 时注意 Core Type:torch_npu=MIX_AIC 可用 Cube 引擎,Triton=AI_VECTOR_CORE 不行

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Triton Operator Performance Eval AI skill do?

评估 Ascend NPU 上 Triton 算子性能。使用 msprof/msprof op 采集性能数据,诊断 Memory-Bound/Compute-Bound 瓶颈,测量硬件利用率,生成性能报告。

Why use Triton Operator Performance Eval on TypingMind?

Because you install it once and use it with any model. Triton Operator Performance Eval is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Triton Operator Performance Eval in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Ascend/agent-skills/tree/master/skills/triton-operator-performance-eval. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Triton Operator Performance Eval?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Triton Operator Performance Eval?

As many as you like. As long as a model supports skills, you can use Triton Operator Performance Eval with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Triton Operator Performance Eval AI skill free?

Yes. It is published on GitHub by Ascend under the MulanPSL-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇