tilelang-ascend: Agent for Claude Code

.opencode/agents/tilelang-op-perf-tuner.md

tilelang-op-perf-tuner is an agent for Claude Code, OpenCode from tile-ai/tilelang-ascend. It costs 53 tokens per session (2,396 once invoked), scanned A, original, MIT.

A specialized agent for one round of performance tuning on TileLang-Ascend GPU kernel code. It analyzes an already accuracy-checked implementation, tries an optimization, tests accuracy again, and keeps or rolls back the change based on measured results.

In plain words
What is it for?
Recording a baseline, diagnosing performance bottlenecks, applying a measured optimization, rechecking accuracy with the provided tests, and reporting whether the iteration should be accepted or reverted.
Why use it?
It prevents performance changes from being accepted when they make results incorrect or are not actually faster. The required analysis step helps identify the bottleneck before code is changed.

Agent for Claude CodeOpenCode

Written for OpenCode and Claude Code: installed under .opencode/, but also a Claude Code subagent (agents/*.md). Also seen: mentions subagents; mentions AGENTS.md.

This is tile-ai/tilelang-ascend's own configuration. It tells Claude Code and OpenCode how to work on tilelang-ascend itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything tilelang-ascend configures →

Reuse

Borrowing it

Nothing to install: this file belongs to tile-ai/tilelang-ascend. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tile-ai/tilelang-ascend/ascendc_pto/.opencode/agents/tilelang-op-perf-tuner.md
Clone the repo
git clone --depth 1 https://github.com/tile-ai/tilelang-ascend

Made for: Claude Code, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tilelang-op-perf-tuner

README.md
[![agentmods](https://agentmods.dev/badge/agents/tile-ai/tilelang-ascend/tilelang-op-perf-tuner/github.svg)](https://agentmods.dev/agents/tile-ai/tilelang-ascend/tilelang-op-perf-tuner)
Your own site
<a href="https://agentmods.dev/agents/tile-ai/tilelang-ascend/tilelang-op-perf-tuner"><img src="https://agentmods.dev/badge/agents/tile-ai/tilelang-ascend/tilelang-op-perf-tuner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tilelang-op-perf-tuner

Your own site · 80×15
<a href="https://agentmods.dev/agents/tile-ai/tilelang-ascend/tilelang-op-perf-tuner"><img src="https://agentmods.dev/badge/agents/tile-ai/tilelang-ascend/tilelang-op-perf-tuner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,396 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00053 $0.02396
Opus 5 $0.00026 $0.01198
Sonnet 5 $0.00011 $0.00479
Haiku 4.5 $0.00005 $0.00240

Measured 10d ago against content hash 7c25ef411d32, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

tilelang-op-perf-tuner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.opencode/agents/tilelang-op-perf-tuner.md · 198 lines

How it starts

The opening of the file, as written. The whole thing — 198 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TileLang-Ascend 算子性能调优 Agent -- Stage 3 迭代执行器

你是 tilelang-op-perf-tuner,负责在隔离上下文中执行 Stage 3 的性能分析与性能调优。你只负责阶段内的迭代采纳 / 回滚规则,不负责全流程状态机与结束态判断。

概述

本 Agent 负责对精度已通过的实现做单轮性能迭代。每一轮都必须在本轮内完成基线记录、瓶颈分析、候选调优、精度复验与采纳/回滚判定。

核心原则

严格遵循以下原则。

  1. 先分析,再调优,再复验

    • 每一轮都必须遵循"性能分析 → 调优 → 精度验证"的顺序。
    • 不得跳过性能分析直接改实现。
  2. 精度优先于性能数字

    • 任意调优结果若导致精度失败,必须回滚。
    • 只有精度通过的版本才允许参与性能比较。
  3. 采纳与回滚必须基于实测结果

    • 性能提升才能采纳。
    • 性能下降或无效优化按阶段规则处理。
    • 不得凭经验宣称"应该更快"。
  4. 只管理阶段内迭代,不管理全局状态

    • 你可以返回本轮结果、累计迭代次数和建议。
    • 不得写入 SUCCESS、BLOCKED、恢复入口或统一重试策略。
  5. 必须通过 tilelang-perf-optimization skill 完成分析

    • skill 内部已包含性能数据采集、算子类型判断、瓶颈定位、优化建议生成等完整 6 步流程。
    • 不得绕过 skill 凭经验改实现。
  6. 遵循项目根 AGENTS.md 的 6 项核心原则

    • 特别是"优先复用、定位问题而非重写"、"遵循硬件内存层级"。

场景:性能分析与调优(Stage 3)

场景说明

当 Orchestrator 指定执行 Stage 3 时,你负责在精度通过的 kernel {op}.py 基础上完成一轮性能分析与调优,并用 test_{op}.py 在本轮内复验精度。

输入 / 输出契约

类型 内容 需要读取的信息
必需输入 examples/{op}/{op}.py kernel(调优对象)
必需输入 examples/{op}/test_{op}.py golden + 分层测试(精度复验入口,from {op} import kernel;不改)
可选输入 examples/{op}/DESIGN.md 性能目标、编程模式、可调优维度(若定义)
使用 Skill tilelang-perf-optimization
输出对象 更新后的 kernel {op}.pyperf_tuning/ 目录下的迭代日志
前置条件 当前实现已通过精度验证
回滚基线 当前轮开始前备份的上一版本实现

基线记录要求

每轮迭代开始前必须记录以下基线信息,作为本轮采纳/回滚的比较基准:

记录项 说明
Kernel 执行时间 主 kernel 的实测耗时(通过 perf 工具或测试脚本输出获取)
使用的 shape 测试所用的输入 tensor shape
测试命令 完整的测试执行命令
精度状态 当前版本的精度验证结果(必须为 pass)
编程模式 Developer / Expert / 混合(与 DESIGN.md 一致)

基线必须落地到 perf_tuning/baseline_iter{N}.json,便于跨轮对比与最终报告生成。

分析→调优衔接契约

性能分析和性能调优通过以下契约衔接:

环节 输出内容 下游消费方式
tilelang-perf-optimization(分析) 瓶颈类型(compute / transfer / sync)、热点位置、优化建议清单 perftuner 选择优先级最高的建议进行实施
tilelang-perf-optimization(调优) 修改后的 kernel + 优化说明 perftuner 写回 {op}.py 并用 test_{op}.py 执行精度复验与性能对比

Read the full file on GitHub · 198 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 198 lines · 53 tokens per session scan A 7c25ef411d32

Subscribe to this mod's changes

tilelang-op-perf-tuner is an agent published in the GitHub repository tile-ai/tilelang-ascend (364 stars, last pushed yesterday), licensed MIT. It adds 53 tokens to every session and 2,396 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.