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.
curl -O https://raw.githubusercontent.com/tile-ai/tilelang-ascend/ascendc_pto/.agents/skills/tilelang-performance-best-practices/SKILL.mdgit clone --depth 1 https://github.com/tile-ai/tilelang-ascendWrote 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.
[](https://agentmods.dev/skills/tile-ai/tilelang-ascend/tilelang-performance-best-practices)<a href="https://agentmods.dev/skills/tile-ai/tilelang-ascend/tilelang-performance-best-practices"><img src="https://agentmods.dev/badge/skills/tile-ai/tilelang-ascend/tilelang-performance-best-practices/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.
<a href="https://agentmods.dev/skills/tile-ai/tilelang-ascend/tilelang-performance-best-practices"><img src="https://agentmods.dev/badge/skills/tile-ai/tilelang-ascend/tilelang-performance-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00066 | $0.02131 |
| Opus 5.5 | $0.00026 | $0.00852 |
| Sonnet 5.5 | $0.00013 | $0.00426 |
| Haiku 4.5 | $0.00007 | $0.00213 |
Grade A, and why
tilelang-performance-best-practices 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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TileLang 性能最佳实践
按以下优先级使用事实来源:
- 当前目标算子、当前仓库的
examples/、测试和公开接口约束。 - 实际导入的 TileLang 框架源码、
examples/与testing/;用实际 Python 导入结果核对运行版本与参考源码是否一致。 references/中按成熟度分类的实现参考、策略元数据和设计文档。
工作流
-
在当前目标工程和实际 TileLang 源码的
examples/查找同类算子,优先复用当前分支已经验证的调度与 API。 -
定位实际 TileLang 源码并核对实际导入版本;在
examples/、testing/、API 定义和当前后端 lowering 中核对不确定接口,禁止按目录名猜测安装版本。 -
容量、核数或架构影响实现时,阅读 硬件资源与编译器有效容量发现,按名称加载 npu-arch,传入已确认的 SoC/NpuArch 与目标设备证据,记录已确认的硬件资源来源,并从实际 TileLang lowering 核对平台用户可用量、编译器预算与预留。
-
阅读 优化点索引、模板成熟度 和对应算子族文档;只有
VERIFIED或PRODUCTION_REFERENCE可作为直接复用候选。 -
先实现精度正确的最小路径,再根据基准数据优化。不得通过放宽容差、降低 reference 精度或跳过 shape 获得“通过”。
-
由实施阶段先运行当前后端定向精度测试(独立 pytest 入口示例):
pytest <test_file> -x -
定向精度测试全部通过后运行相关完整测试套;合入前按项目要求运行扩展测试。性能比较保持输入、dtype、warmup、repeat、设备和并发度一致。
-
报告容差、通过数、首个失败、覆盖 shape、kernel latency 和基线;没有实测数据时只称“设计建议”。
-
区分数值失败、编译失败和仓库主动抛出的
NotImplementedError。未实现路径必须如实记录并补齐实现,不能放宽容差、跳过测试或把此前通过的子集称为全量通过。
验证入口
- 当前仓库的算子测试、
testing/python/与各算子族链接的现有示例用于验证;沿用目标的真实编译和测试入口,不假设固定 CLI。
代码准入规则
- Kernel 实现只使用 Python TileLang DSL;tiling、dispatch 与数学 reference 使用普通 Python。先从目标仓库同类算子实现 派生,再按 模板成熟度 选择 bundled reference。
- 编译后端沿用目标工程已经确认的配置;不为复用模板擅自切换 target,不把其他后端的环境变量或参数写入当前调用链。
- Ascend
T.Kernel的网格、threads、cid/vid和 workspace 规则按当前仓库 公共语言参考 核对,不套用其他后端的线程域规则。 - 执行域优先沿用同类已验证实现:规则逐元素通常使用
T.Parallel或T.tile.*,Norm/Reduction 复用当前T.reduce_*路径;离散索引、复杂分支或原子操作按当前 API 与同类源码核对。执行域变更必须通过精度与性能实测。 - GEMM 优先沿用已验证的
T.gemm_v0/T.mma结构与布局;其他布局不是 API 禁止项,但必须通过目标版本 lowering 与设备验证。首个有效 K 子 tile 清零 fp32 L0C,后续子 tile 累加。 - fp16/bf16 的归约、归一化、softmax 统计量和矩阵乘以 fp32 累加为起点。内部混合精度、HF32 和近似指令可实验,但必须保持原测试、容差和公开约定,并以正确性与同口径性能决定是否保留。
- Vector、Cube 与混合核分别使用硬件查询确认的可用 AIV、AIC 及配对资源;构建模板时显式传入核数,小任务核数不超过独立 task 数。
- Elementwise、gather/scatter 或布局转换优化必须按 Tiling、任务与 Vector 数据流搜索 建立任务树和有来源的 tile 边界。物理路线按完整数据路径分类:planar/scratch 中间 payload 属于 materialized transform,不能代替直接连续 load 后的寄存器重排。将 tile/task、数据流、精度和流水作为正交轴,并由同一实际激活候选裁决有交互的组合。
- UB 预算必须区分已确认的硬件规格、平台用户可用容量、当前 lowering 的编译器预算与预留和显式 buffer footprint;尤其在改变执行侧、cast、scratch 或临时 buffer 后重新计算。预算同时包含 buffer version、对齐 padding、常驻数据和有明确依据的安全余量。GM 尾块只 copy
valid,UB 仍按完整 SIMD/DMA footprint 分配。 - 流水任务必须按 多版本流水设计 建立跨迭代依赖;所有仍存活的 buffer 都要版本化,自动分析不适用时改用显式 stage storage。是否生效以生成代码及同口径 latency/overlap 为准。
- 多轴 tile 域按 Persistent 多轴任务映射 核对,避免热循环中不必要的扁平索引解码。
- 归约计算较轻且非归约连续轴较宽时,按 Reduction 宽输出轴 Tiling 评估合并连续输出 tile。
- 以公开接口合约确定 shape 矩阵;接口不支持任意尾块时只覆盖允许余数类,不把新 fallback 当成既有要求。同时检查 forward/backward、动态 shape、极小/极大 shape、NaN/Inf 语义和空任务边界。
What ships with it
60 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/broadcast/advanced_tiling.md 1.9 KB
- references/broadcast/broadcast_design.md 5.5 KB
- references/broadcast/datacopypad_design.md 1.8 KB
- references/broadcast/onedim_design.md 2.0 KB
- references/broadcast/rectangular_copy_design.md 2.1 KB
- references/broadcast/ub_broadcast_design.md 1.8 KB
- references/common/datacopy_optimization_design.md 5.6 KB
- references/common/hardware_resource_discovery.md 6.4 KB
- references/common/host_device_dataflow.md 4.1 KB
- references/common/persistent_task_mapping.md 1.6 KB
- references/common/pipeline_and_cv_overlap.md 4.9 KB
- references/common/tail_block_design.md 4.4 KB
- references/common/task_mapping.md 2.5 KB
- references/common/ub_resident_design.md 3.9 KB
- references/conv/conv_common_perf_experience.md 1.0 KB
- references/conv/guide.md 1.3 KB
- references/conversion/dtype_adaptation.md 4.3 KB
- references/conversion/guide.md 5.2 KB
- references/conversion/multi_stage_contiguous.md 4.4 KB
- references/conversion/transpose_big_dim.md 1.7 KB
- references/conversion/transpose_cut_one_axis.md 1.6 KB
- references/conversion/transpose_cut_two_axis.md 1.6 KB
- references/conversion/transpose_fusion_design.md 1.7 KB
- references/conversion/transpose_gather.md 2.1 KB
- references/conversion/transpose_n_last.md 1.7 KB
- references/conversion/transpose_small_shape.md 1.7 KB
- references/conversion/transpose_tensor_move.md 1.8 KB
- references/conversion/transpose_tiling_data.md 1.7 KB
- references/conversion/transpose_vconv_021.md 1.7 KB
- references/conversion/transpose_vconv_5hd.md 1.2 KB
- references/elementwise/double_buffer_design.md 13 KB
- references/elementwise/guide.md 1.1 KB
- references/elementwise/indexed_short_record.md 4.3 KB
- references/elementwise/tiling_task_vector_search.md 19 KB
- references/elementwise/vector_efficiency_design.md 4.4 KB
- references/flash_attention/cv_pipeline_design.md 4.0 KB
- references/flash_attention/cv_workspace_forwarding_design.md 1.9 KB
- references/flash_attention/getvalue_cacheline_batching_design.md 1.6 KB
- references/flash_attention/guide.md 6.3 KB
- references/flash_attention/scalar_general_techniques_design.md 1.7 KB
- references/flash_attention/scalar_precompute_design.md 1.5 KB
- references/flash_attention/scalarldst_subbound_design.md 1.5 KB
- references/index.md 5.0 KB
- references/matmul/fullload_design.md 3.3 KB
- references/matmul/guide.md 5.2 KB
- references/matmul/historical_cases.md 2.9 KB
- references/matmul/mte2_preload_design.md 3.6 KB
- references/matmul/pingpong_design.md 5.1 KB
- references/matmul/scale_coalescing_design.md 3.1 KB
- references/matmul/streamk_design.md 2.0 KB
- references/matmul/swat_design.md 1.6 KB
- references/matmul/task_mapping_design.md 2.5 KB
- references/matmul/tiling_design.md 3.4 KB
- references/mc2/guide.md 1.5 KB
- references/mc2/local_matmul_design.md 680 B
- references/mc2/pipeline_balancing_design.md 724 B
- references/performance-antipatterns.md 8.8 KB
- references/reduce/batched_short_reduction.md 3.3 KB
- references/reduce/fixed_small_state.md 1.4 KB
- references/reduce/guide.md 7.4 KB
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.
- today First seen · 66 lines · 66 tokens per session scan A b210ac1a53e1
tilelang-performance-best-practices is a skill published in the GitHub repository tile-ai/tilelang-ascend (427 stars, last pushed yesterday), licensed MIT. It adds 66 tokens to every session and 2,131 once invoked, about $0.0003 per session on Opus 5.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-11-06.
tilelang-performance-best-practices compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| tilelang-performance-best-practicestile-ai/tilelang-ascend | Skill | 427 | yesterday | MIT | A | 66 | Claude Code, Codex |
| hypothesessynthetic-sciences/openscience | Skill | 4.3k | 2d ago | Apache-2.0 | A | 99 | Claude Code |
| review-rpedrohcgs/claude-code-my-workflow | Skill | 1.7k | 2d ago | MIT | A | 102 | Claude Code |
| review-paper-codeclaesbackman/AI-research-feedback | Skill | 528 | 9d ago | MIT | A | 0 | Claude Code |
| paperlab_neqsim_api_claim_verificationequinor/neqsim | Skill | 163 | today | Apache-2.0 | A | 55 | Claude Code, Codex |
| workflows:reviewbrycewang-stanford/Auto-Empirical-Research-Skills | Skill | 4.9k | 4d ago | none | A | 21 | Claude Code |
| referee2brycewang-stanford/Auto-Empirical-Research-Skills | Skill | 4.9k | 4d ago | none | A | 61 | Claude Code |