Agent skill

Tilelang Ascend Tile API

by tile-ai in tile-ai/tilelang-ascend

TileLang-Ascend 新增 Ascend 专属 T.tile.xxx 小 API 的端到端开发流程。用户要求新增、封装、暴露、实现或测试 ascendtile.py 中的 T.tile API / Ascend tile primitive 时必须使用本 skill,尤其适用于需要同时打通 Python 前端、C++ lowering/codegen、Ascend C…

MITAuto-check passedDevelopment

Install Tilelang Ascend Tile API

skills CLI
$ npx skills add tile-ai/tilelang-ascend --skill tilelang-ascend-tile-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tile-ai/tilelang-ascend tilelang-ascend-tile-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tile-ai/tilelang-ascend.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/tilelang-ascend-tile-api .claude/skills/tilelang-ascend-tile-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
tilelang-ascend-tile-api
GitHub stars
402
Token cost
~1.5k tokens
SKILL.md length
456 words
Files
1
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

TileLang-Ascend 新增 Ascend 专属 T.tile.xxx 小 API 的端到端开发流程。用户要求新增、封装、暴露、实现或测试 ascendtile.py 中的 T.tile API / Ascend tile primitive 时必须使用本 skill,尤其适用于需要同时打通 Python 前端、C++ lowering/codegen、Ascend C…

  • Works in 4 steps: Python 前端 → C++ Operator 和 Lowering → Ascend C Helper → …
  • Tasks that involve Project scaffolding
  • SKILL.md covers 第一轮调研, 范围决策, 实现路径 and 测试放置, plus 5 more sections
  • Calls conda, python and git

What it does

Tilelang Ascend Tile API is an agent skill from tile-ai/tilelang-ascend. TileLang-Ascend 新增 Ascend 专属 T.tile.xxx 小 API 的端到端开发流程。用户要求新增、封装、暴露、实现或测试 ascendtile.py 中的 T.tile API / Ascend tile primitive 时必须使用本 skill,尤其适用于需要同时打通 Python 前端、C++ lowering/codegen、Ascend C helper、文档和 CI 测试的任务。

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Project scaffolding. It works with C++ and Python. The repository describes itself as: Ascend TileLang adapter. The licence is MIT.

When your agent uses it

  • Tasks that involve Project scaffolding

Example prompts

  • “/tilelang-ascend-tile-api”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Python 前端
  2. C++ Operator 和 Lowering
  3. Ascend C Helper
  4. Codegen 和 Pipeline 集成

What it can do on your machine

Read from SKILL.md and the folder at commit 83b0ece. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • conda
    • python
    • git
    • pytest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Tilelang Ascend Tile API loads about 1.5k tokens when it runs. Until then it costs about 59 tokens; SKILL.md has 456 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~59
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from tile-ai/tilelang-ascend at commit 83b0ece, republished under its MIT licence (© tile-ai). 456 words, ~1,482 tokens.

Download SKILL.mdSave it as .claude/skills/tilelang-ascend-tile-api/SKILL.md (or your agent's skills folder).
name
tilelang-ascend-tile-api
description
TileLang-Ascend 新增 Ascend 专属 T.tile.xxx 小 API 的端到端开发流程。用户要求新增、封装、暴露、实现或测试 ascend_tile.py 中的 T.tile API / Ascend tile primitive 时必须使用本 skill,尤其适用于需要同时打通 Python 前端、C++ lowering/codegen、Ascend C helper、文档和 CI 测试的任务。

TileLang Ascend Tile API 开发流程

当任务是新增一个面向用户的 T.tile.xxx 小 API 时使用本 skill,尤其是从 tilelang/language/ascend_tile.py 暴露、并由 Ascend C 代码生成支撑的 API。

这里的目标不只是增加一个 Python 函数名,而是交付一个真正可用的 API:它能编译、能 lowering、能生成合法的 Ascend C、有清晰稳定的语义边界,并且有合适的 CI 测试覆盖。

第一轮调研

开始实现前,先读清楚当前仓库形态,再决定方案:

  1. 阅读 AGENTS.md。
  2. 阅读 .agents/skills/tilelang-custom-skill/tilelang-api-best-practices/SKILL.md。
  3. 阅读 .agents/skills/tilelang-custom-skill/tilelang-api-best-practices/references/api-compute.md。
  4. 如果涉及编程模式或 pass_configs,阅读 .agents/skills/tilelang-custom-skill/tilelang-programming-model-guide/SKILL.md。
  5. 查看 tilelang/language/ascend_tile.py 中最相近的现有 API。
  6. 查看 testing/python/language/ 中最相近的测试。
  7. 查看 src/op/ascend.{h,cc}、src/target/codegen_ascend.cc、src/tl_templates/ascend/common.h 中相近的 lowering、codegen 和 helper 实现。

不要凭记忆推断 API 签名。已有本地模式优先于看起来更聪明的新抽象。

范围决策

编辑前,先明确并说明 API 边界:

  • 用户 API 名称,例如 T.tile.foo(dst, src, ...)。
  • 它属于纯 tile 计算、数据搬运、类 reduction 行为,还是带副作用的写回。
  • 支持的 buffer scope,通常是 GM、UB(shared.ub)、L1(shared.l1)、L0(wmma.*),或其中子集。
  • 支持的 dtype 和 rank。
  • 是否接受 Buffer、BufferLoad、BufferRegion。
  • 不支持的参数组合和语义。
  • 应该支持 Developer pass_configs、Expert 模式,还是两者都支持。

当语义无法和主仓 / GPU 的全局 API 对齐时,优先新增 Ascend 专属的 T.tile.xxx API。除非用户明确要求、且语义确实一致,否则不要新增或修改全局 T.xxx API。

实现路径

1. Python 前端

在 tilelang/language/ascend_tile.py 中新增用户入口。

优先复用该文件和 tilelang/language/copy_op.py 里的本地 helper 模式:

  • 如果现有 API 会解析 let-bound value,新 API 也应保持一致。
  • 只在语义明确时接受 Buffer、BufferLoad 或 BufferRegion。
  • 当 C++ lowering 需要 region、rank 或 extent 信息时,把前端输入转换为 tl.region。
  • 对不支持的 scope 或参数组合尽早报错,并给出清晰错误信息。
  • 当操作需要 C++ lowering 时,发射命名清晰的 op,通常是 tl.ascend_<api_name>。

除非操作本质上就是普通 copy,否则不要为了省事复用 tl.ascend_copy。有副作用、会改变硬件模式、或语义不同的操作,通常应该有显式 op 名称。

2. C++ Operator 和 Lowering

如果前端发射新的 tl.ascend_* op,需要补齐对应 C++ operator 路径:

  • 在 src/op/ascend.h 中声明。
  • 在 src/op/ascend.cc 中实现参数解析和 lowering。
  • 当它需要 tile-op lowering 时,用 TIR_REGISTER_TL_OP 注册。
  • 保留 region 信息,直到 lowering 可以计算访问指针、extent、stride、mask 或合法 shape。
  • 即使 Python 已经做过校验,C++ 侧也要重新检查关键约束。

lowering 结果应变成后端可识别的 call_extern 或已有 codegen pattern。降低后的调用名要稳定且有描述性,例如 tl::ascend::<helper_name><...>。

3. Ascend C Helper

可复用的 Ascend C 片段优先放在 src/tl_templates/ascend/common.h,除非仓内已有更合适的模板位置。

尽量把硬件状态切换封装在 helper 函数内部。比如 helper 开启了某种模式,它也应该在返回前恢复或关闭该模式。

如果需要兼容不同 CANN 版本:

  • 先在本地或目标 Ascend C 头文件中搜索真实存在的版本宏。
  • 只有确认环境或项目约定中存在后,再使用 CANN_MAJOR 之类的官方宏。
  • 增加一个小的兼容 helper,而不是在 codegen 各处散落 #if 分支。
  • 只有当注释能避免后续误解时,才补充 fallback 行为说明。
4. Codegen 和 Pipeline 集成

把 lowering 后的调用接入后端:

  • 更新 src/target/codegen_ascend.cc,让它打印对应 helper 调用。
  • 只有当参数顺序和指针打印逻辑完全匹配时,才复用 CopyCodegen 等现有 helper。
  • 如果操作读写 GM,按需更新调度或 pipeline 元数据:
    • src/transform/common/operation_config.h
    • src/transform/ascend_combinecv.cc
    • src/transform/cross_core_pipeline.cc
  • pipeline 分析中,应把带副作用的 GM 写回当作写操作处理。

默认不要添加 PTO 支持。只有当任务明确要求,或已有 PTO 路径能以很小、低风险的改动接入时,才考虑补充。

Show full SKILL.md (202 more words)Show less

测试放置

不要自动创建新的独立测试文件。先选择和 API 行为最匹配、范围最窄的现有测试文件。

测试位置建议:

  • 纯 elementwise T.tile.xxx 数学 API:优先放在 testing/python/language/test_tilelang_ascend_language_elementwise.py。
  • compare/select API:优先放在已有 compare/select 主题测试文件中。
  • cast/copy 类行为:优先放在已有 cast/copy 主题测试文件中。
  • parallel lowering 行为:只有当 API 主要测试 T.Parallel 或 auto-copy 行为时,才放入 parallel 相关测试文件。
  • 新的带副作用写回、新的 memory pipeline 类别,或没有合适主题归属的 API:创建聚焦的独立测试文件。

独立测试文件是允许的,但应该少用,并且要能清楚说明原因。记住 examples/bench_test.sh 会运行 testing/python/,所以每个新文件都会进入 CI 范围。

CI 测试风格

默认编写面向 CI 的正确性测试,而不是开发阶段的 TDD 检查测试。

推荐的测试形态:

  • 有 NPU 环境时,编译并运行 kernel。
  • 当 torch.npu 不可用时,用 pytest.mark.skipif 跳过。
  • 用 PyTorch 或简单 reference 计算期望结果,并通过 torch.testing.assert_close 对比。
  • 覆盖能保护 API 契约的最小 dtype/rank 集合。
  • 当 API 支持 Developer 或混合模式时,使用对应 pass configs:
python
PASS_CONFIGS = {
    tilelang.PassConfigKey.TL_ASCEND_AUTO_SYNC: True,
    tilelang.PassConfigKey.TL_ASCEND_MEMORY_PLANNING: True,
}

除非生成源码字符串、helper 名称或负例本身就是公开契约,否则不要把这些断言长期留在 CI 中。这类检查适合开发阶段,但实现稳定后容易变成噪声。

对于带副作用写回的 API,测试应在运行 kernel 前显式初始化目标 buffer。例如 accumulation API 应该先把 GM 清零,再检查累加后的值。

文档更新

公开契约只维护一份,其余层次通过链接分工:

  • docs/language_ref/tilelibrary.md:唯一的 user-facing API contract,记录签名、语义、 支持范围和拒绝条件。
  • docs/TileLang-Ascend Programming Guide.md:只有需要概念解释或完整教程时才更新;链接 language reference,不复制参数表。
  • tilelang-api-best-practices/references/api-compute.md:只写会改变 Agent 选择或验证方式的 门禁,并链接 language reference,不维护第二份 API 手册。
  • tilelang-programming-model-guide/SKILL.md:仅当 Developer/Hybrid/Expert 的选择建议变化时更新。

若 API 暴露 tmp,先区分通用 byte arena 与会改变 operand layout 的专用 contract; row_expand_*_experiment 属于后者,不能从相邻 API 推断。内部 helper 不更新宽泛文档。 Review 纠错应原地替换、合并或删除;净增长必须对应新增的公开行为或 Agent 决策分支。

如果旧文档里有相似但语义不同的全局 API,增加简短提醒,而不是静默改写可能属于 GPU / 主仓教程的示例。

验证清单

运行本地能支持的最强验证:

bash
python -m py_compile <changed-python-files>
conda run -n tilelang_dev ruff check <changed-python-files>
conda run -n tilelang_dev ruff format --check <changed-python-files>
git diff --check

如果修改了 C++ 文件,也运行:

bash
conda run -n tilelang_dev clang-format --dry-run --Werror <changed-cpp-files>

如果当前环境可运行,执行目标 pytest:

bash
pytest -q <selected-test-file-or-test-node>

如果本地缺少 pytest、TVM、CANN 或 NPU runtime,需要明确说明哪一层没有验证,以及是否需要服务器侧运行。

可选 Agent 拆分

只有当用户明确授权并行 agent 工作时,才拆分任务。

适合独立拆分的工作:

  • tilelang/language/ascend_tile.py 中的前端 API 和 IR 形态。
  • src/op/ascend.{h,cc} 中的 C++ op 和 lowering。
  • src/tl_templates/ascend/common.h 中的 Ascend C helper。
  • src/target 和 src/transform 中的 codegen 与 pipeline 元数据。
  • 测试和文档。
  • 集成验证。

给每个 agent 分配不重叠的写入范围,并明确提醒它不要 revert 其他 agent 的修改。

最终回复

完成后总结:

  • 新增用户 API 以及精确支持边界。
  • 修改过的前端、lowering、codegen/helper 和测试文件。
  • 测试放置位置以及选择原因。
  • 哪些检查已通过,哪些无法在本地运行。
  • 已知不支持的语义。

© tile-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/tilelang-ascend-tile-api of tile-ai/tilelang-ascend.

Open the folder on GitHubat commit 83b0ece

Compare with similar skills

Tilelang Ascend Tile API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Tilelang Ascend Tile API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Tilelang Ascend Tile API this skilltile-ai/tilelang-ascend402—~1.5kAutomated safety check: PassMIT
Add Ophw-native-sys/pypto127—~2kAutomated safety check: PassCustom licence
Mirage VFS Adapter Authoringstrukto-ai/mirage3.7k—~2.5kAutomated safety check: PassApache-2.0
pybind11 Release Preparationpybind/pybind1118k—~1.7kAutomated safety check: PassCustom licence
Paddle Eager GraphPaddlePaddle/Paddle24k—~562Automated safety check: PassApache-2.0
pybind11 Release Publicationpybind/pybind1118k—~2.5kAutomated safety check: PassCustom licence

Similar skills

  • Add Op

    hw-native-sys/pypto

    Add new operator definitions to PyPTO across all layers (C++, Python IR, Python DSL, tests, codegen, docs).

    127 GitHub stars~2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Builds or extends a custom Mirage virtual filesystem adapter for an API, database, object store or app data, with a working mount configuration and filesystem tests.

    3.7k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Opens the pybind11 release-preparation pull request: picking the release base, bumping the version in common.h and integrating the changelog, following docs/release.rst.

    18k GitHub stars~1.7k tokensUpdated today
    DevelopmentAuto-check passed
  • Paddle Eager Graph

    PaddlePaddle/Paddle

    A skill your agent uses when navigating Paddle eager-mode (dynamic graph) source code, tracing forward/backward execution, debugging autograd issues, understanding PyLayer, or investigating…

    24k GitHub stars~562 tokensUpdated today
    DevelopmentAuto-check passed
  • Walks a maintainer through publishing a pybind11 release after the preparation PR merges, with preflight checks, confirmations before each push and a GitHub release.

    18k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed
  • ExecuTorch Build Guide

    pytorch/executorch

    Builds ExecuTorch from source: the Python package, C++ runtime, model runners, Android and iOS cross-compilation and backend-specific builds, with environment checks.

    5.1k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check: notes

More from tile-ai/tilelang-ascend

All 20 skills in this repo
  • Tilelang Submodule Pull

    tile-ai/tilelang-ascend

    Automatically pull tilelang repository and its third-party code.

    402 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Tilelang Debug Helper

    tile-ai/tilelang-ascend

    How to add debugging capabilities to TileLang Ascend example operators.

    402 GitHub stars~1.7k tokensUpdated today
    Auto-check: notes
  • Tilelang A5 Sim Convert

    tile-ai/tilelang-ascend

    将 tilelang example 脚本转换为可在 A5 camodel 仿真器上直接运行的版本。输入脚本路径,输出一个新的 sim.py 文件,不覆盖原始文件。触发:仿真运行、camodel、A5 仿真、sim 模式、转换脚本为仿真、不需要 NPU 跑 kernel、simulate A5。

    402 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Tilelang Env Check

    tile-ai/tilelang-ascend

    TileLang-Ascend 环境检查与配置验证技能。检查代码仓库完整性、编译安装状态、环境变量配置,并运行简单测试验证环境。发现问题会自动调用相关 skill 进行修复,并按依赖顺序重新执行后续步骤。触发关键词:"环境检查"、"检查环境"、"验证环境"、"环境配置"、"环境搭建"、"env check"、"check environment"、"verify…

    402 GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Tilelang Op Test Design

    tile-ai/tilelang-ascend

    TileLang-Ascend 算子测试设计技能。支持多种场景:(1) 从 design.md 设计测试配置 (2) 从 examples/{op}/.py 补充测试 (3) 手动提供算子信息生成测试 (4) 测试覆盖率分析。理解算子实现逻辑后智能判断测试策略。触发:设计算子测试、生成测试用例、补充测试、测试覆盖率不足。

    402 GitHub stars~5.6k tokensUpdated today
    Auto-check passed
  • Tilelang Review

    tile-ai/tilelang-ascend

    检查代码格式是否符合 CI 规则。自动检测并安装缺失工具(ruff、clang-format),先运行检查生成报告,使用醒目方式询问用户后,仅在用户同意时执行修复。工作流程:检测环境→自动安装缺失工具→运行检查→生成报告→醒目询问→用户确认→执行修复。使用此技能当:用户要求"格式检查"、"格式化代码"、"代码格式化"、"检查代码格式"、"代码…

    402 GitHub stars~2.8k tokensUpdated today
    Auto-check: notes

Works with

Categories

Questions about Tilelang Ascend Tile API

What does Tilelang Ascend Tile API do?

TileLang-Ascend 新增 Ascend 专属 T.tile.xxx 小 API 的端到端开发流程。用户要求新增、封装、暴露、实现或测试 ascendtile.py 中的 T.tile API / Ascend tile primitive 时必须使用本 skill,尤其适用于需要同时打通 Python 前端、C++ lowering/codegen、Ascend C…. Tilelang Ascend Tile API is an agent skill from tile-ai/tilelang-ascend.

When should I use Tilelang Ascend Tile API?

Tilelang Ascend Tile API fits situations like: tasks that involve Project scaffolding.

How do I install Tilelang Ascend Tile API in Claude Code?

Run `npx skills add tile-ai/tilelang-ascend --skill tilelang-ascend-tile-api -a claude-code`. Or copy the skill folder (.agents/skills/tilelang-ascend-tile-api in tile-ai/tilelang-ascend) into .claude/skills/tilelang-ascend-tile-api in your project. Claude Code loads it when a task matches its description.

How do I install Tilelang Ascend Tile API in Codex?

Run `npx skills add tile-ai/tilelang-ascend --skill tilelang-ascend-tile-api -a codex`. Or copy the skill folder (.agents/skills/tilelang-ascend-tile-api in tile-ai/tilelang-ascend) into .agents/skills/tilelang-ascend-tile-api in your project. Codex loads it when a task matches its description.

Can I use Tilelang Ascend Tile API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tile-ai/tilelang-ascend --skill tilelang-ascend-tile-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tilelang-ascend-tile-api, .gemini/skills/tilelang-ascend-tile-api, .github/skills/tilelang-ascend-tile-api and .opencode/skills/tilelang-ascend-tile-api in your project.

What does Tilelang Ascend Tile API need to run?

Going by SKILL.md and its folder, Tilelang Ascend Tile API needs the command-line tools its instructions call (conda, python, git and pytest). Our summary lists: Python 3.

Does Tilelang Ascend Tile API access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Tilelang Ascend Tile API safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Tilelang Ascend Tile API use?

Tilelang Ascend Tile API is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Tilelang Ascend Tile API use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Tilelang Ascend Tile API?

Skills that share tags, products or a category with Tilelang Ascend Tile API: Add Op (hw-native-sys/pypto, 127 stars), Mirage VFS Adapter Authoring (strukto-ai/mirage, 3.7k stars), pybind11 Release Preparation (pybind/pybind11, 18k stars) and Paddle Eager Graph (PaddlePaddle/Paddle, 24k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tilelang Ascend Tile API?

tile-ai (a GitHub organization) maintains it in tile-ai/tilelang-ascend, which has 402 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 9, 2026.

Source: tile-ai/tilelang-ascend on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.