Agent skill

Tilelang Programming Model Guide

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

TileLang Ascend Developer/Expert 模式选择与 passconfigs 配置指南。当需要确定编程模式、配置 passconfigs、或在两种模式之间转换时触发。API 详情请参考 tilelang-api-best-practices skill。

MITAuto-check passedDevelopment

Install Tilelang Programming Model Guide

skills CLI
$ npx skills add tile-ai/tilelang-ascend --skill tilelang-programming-model-guide -a claude-code

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

GitHub CLI
$ gh skill install tile-ai/tilelang-ascend tilelang-programming-model-guide --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-custom-skill/tilelang-programming-model-guide .claude/skills/tilelang-programming-model-guide && 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-programming-model-guide
GitHub stars
400
Token cost
~1.8k tokens
SKILL.md length
430 words
Files
2 (incl. references)
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

TileLang Ascend Developer/Expert 模式选择与 passconfigs 配置指南。当需要确定编程模式、配置 passconfigs、或在两种模式之间转换时触发。API 详情请参考 tilelang-api-best-practices skill。

  • Works in 4 steps: 模式对比 → pass_configs 详解(核心) → 模式转换规则(Expert → Developer) → …
  • Development work in your project
  • SKILL.md covers 1. 模式对比, 2. pass_configs 详解(核心), 3. 模式转换规则(Expert → Developer) and 4. 示例代码与代码对比
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Tilelang Programming Model Guide is an agent skill from tile-ai/tilelang-ascend. TileLang Ascend Developer/Expert 模式选择与 passconfigs 配置指南。当需要确定编程模式、配置 passconfigs、或在两种模式之间转换时触发。API 详情请参考 tilelang-api-best-practices skill。

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/mode-examples.md`).

It sits in Development. The repository describes itself as: Ascend TileLang adapter. The licence is MIT.

When your agent uses it

  • Development work in your project

Example prompts

  • “/tilelang-programming-model-guide”

Requirements

  • Python 3

Workflow steps

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

  1. 模式对比
  2. pass_configs 详解(核心)
  3. 模式转换规则(Expert → Developer)
  4. 示例代码与代码对比

What it can do on your machine

Read from SKILL.md and the folder at commit 3d17c28. 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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

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

  • Network

    No URLs in SKILL.md.

    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 Programming Model Guide loads about 1.8k tokens when it runs, and up to ~6.1k if it reads all its reference files. Until then it costs about 44 tokens; SKILL.md has 430 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.1k

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 3d17c28, republished under its MIT licence (© tile-ai). 430 words, ~1,837 tokens.

Download SKILL.mdSave it as .claude/skills/tilelang-programming-model-guide/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
tilelang-programming-model-guide
description
TileLang Ascend Developer/Expert 模式选择与 pass_configs 配置指南。当需要确定编程模式、配置 pass_configs、或在两种模式之间转换时触发。API 详情请参考 tilelang-api-best-practices skill。

TileLang Ascend 编程模式与 pass_configs 指南

API 用法详情(内存分配、计算原语、同步原语等)请参考 tilelang-api-best-practices skill,本文档不再重复。


1. 模式对比

维度Developer 模式Expert 模式
内存分配T.alloc_shared / T.alloc_fragmentT.alloc_L1 / T.alloc_ub / T.alloc_L0A/L0B/L0C
计算表达T.Parallel + 符号运算T.tile.xxx 扩展原语
作用域编译器自动分离 Cube/Vector手动 with T.Scope("C"/"V")
同步编译器自动插入手动 T.barrier_all / T.set_flag / T.wait_flag
CV 交互默认消除 workspace+vid(threads=2 + 片上直连,见 §3.1.1)显式 GM workspace + 手动 vid 二分
pass_configs全部开启全部关闭或不设
适用场景大多数算子,跨平台兼容极致性能优化,需要底层控制
示例目录examples/developer_mode/examples/flash_attention/fa_opt/flash_attn_bhsd_expert_*.py

混合模式:Developer 主体 + 少量 Expert / Ascend 专属 T.tile.xxx。使用 Developer 的 pass_configs,不写 T.Scope 和手动同步。大多数实际算子使用混合模式。


2. pass_configs 详解(核心)

2.1 四个 Ascend 专用开关
python
import tilelang

pass_configs = {
    tilelang.PassConfigKey.TL_ASCEND_AUTO_SYNC: True,        # ① 自动核内同步
    tilelang.PassConfigKey.TL_ASCEND_MEMORY_PLANNING: True,   # ② 自动内存规划
    tilelang.PassConfigKey.TL_ASCEND_AUTO_CV_COMBINE: True,   # ③ 自动CV分离
    tilelang.PassConfigKey.TL_ASCEND_AUTO_CV_SYNC: True,      # ④ 自动核间同步
}
① TL_ASCEND_AUTO_SYNC(自动核内同步)
  • 底层 key:"tl.ascend_auto_sync",默认 False
  • 功能:自动在数据搬运和计算之间插入 T.barrier_all() 等同步指令
  • 开启时:无需手写 T.barrier_all()、T.set_flag/T.wait_flag
  • 关闭时:必须手动插入所有同步点
② TL_ASCEND_MEMORY_PLANNING(自动内存规划)
  • 底层 key:"tl.ascend_memory_planning",默认 False
  • 功能:自动分析 buffer 生命周期,实现片上内存复用
  • 开启时:自动复用 buffer 空间,减少片上内存占用
  • 关闭时:需手动通过 T.annotate_address 规划内存地址
③ TL_ASCEND_AUTO_CV_COMBINE(自动 CV 分离)
  • 底层 key:"tl.ascend_auto_cv_combine",默认 False
  • 功能:自动将 kernel 中的 Cube 操作和 Vector 操作分离到不同的执行核
  • 开启时:无需手写 with T.Scope("C") / with T.Scope("V"),编译器根据 buffer 类型和所用原语自动识别
  • 关闭时:必须手动用 T.Scope 标注每段代码的执行域

注意:避免在开启 AUTO_CV_COMBINE 同时手写 T.Scope,可能会导致编译器无法正确处理代码

④ TL_ASCEND_AUTO_CV_SYNC(自动核间同步)
  • 底层 key:"tl.ascend_auto_cross_core_sync",默认 False
  • 功能:自动在 Cube Scope 和 Vector Scope 之间插入 T.set_cross_flag/T.wait_cross_flag
  • 开启时:无需手写核间同步
  • 关闭时:必须手动管理核间同步
2.2 按场景选择 pass_configs
场景AUTO_SYNCMEMORY_PLANNINGAUTO_CV_COMBINEAUTO_CV_SYNC手动 Scope
纯 Vector 算子(elementwise, softmax)✅✅❌❌❌
Developer GEMM(完全自动)✅✅✅✅❌
Developer Flash Attention(核间流水线)✅✅✅✅❌
Developer CV 融合(Vector计算+Cube GEMM)✅✅✅✅❌
混合模式 CV 融合✅✅❌❌✅

Developer Flash Attention / Developer CV 融合:默认消除 workspace+vid(threads=2 + 片上直连),写法见 §3.1.1 与 mode-examples.md §6。 | Expert 极致性能 | ❌ | ❌ | ❌ | ❌ | ✅ |

纯 Vector 算子(来自 Programming Guide §2.2):

python
pass_configs = {
    tilelang.PassConfigKey.TL_ASCEND_AUTO_SYNC: True,
    tilelang.PassConfigKey.TL_ASCEND_MEMORY_PLANNING: True,
}

Developer GEMM / Developer CV 融合(推荐配置):

python
pass_configs = {
    tilelang.PassConfigKey.TL_ASCEND_AUTO_CV_COMBINE: True,  # 自动分离 Cube/Vector
    tilelang.PassConfigKey.TL_ASCEND_AUTO_SYNC: True,        # 自动核内同步
    tilelang.PassConfigKey.TL_ASCEND_MEMORY_PLANNING: True,  # 自动内存规划
    tilelang.PassConfigKey.TL_ASCEND_AUTO_CV_SYNC: True,     # 自动核间同步
}

Expert 全手动:

python
pass_configs = {
    tilelang.PassConfigKey.TL_ASCEND_AUTO_CV_COMBINE: False,
    tilelang.PassConfigKey.TL_ASCEND_AUTO_CV_SYNC: False,
    tilelang.PassConfigKey.TL_ASCEND_MEMORY_PLANNING: False,
    tilelang.PassConfigKey.TL_ASCEND_AUTO_SYNC: False,
}

3. 模式转换规则(Expert → Developer)

3.1 转换步骤
  1. 开启 pass_configs:添加完整 4 个 True 开关
  2. 内存分配:T.alloc_L1 → T.alloc_shared,T.alloc_L0C → T.alloc_fragment,T.alloc_ub → T.alloc_shared
  3. 删除作用域:移除 with T.Scope("C") / with T.Scope("V")
  4. 删除同步:移除 T.barrier_all()、T.set_flag/T.wait_flag、T.set_cross_flag/T.wait_cross_flag
  5. 计算转换(可选):T.tile.exp(dst, src) → for i,j in T.Parallel(...): dst[i,j] = T.exp(src[i,j])
  6. 删除手动内存规划:移除 T.annotate_address
Show full SKILL.md (192 more words)Show less
3.1.1 Developer 模式 CV 交互:优先消除 workspace / vid

Developer 模式下 Cube↔Vector 交互默认不写 GM workspace、不手动二分 vid,交给编译器自动处理。前提链(按序,不可跳级):

threads=2  ──►  vid 消除  ──►  workspace 消除

四步改造:

  1. 加 threads=2:T.Kernel(block_num, is_npu=True) as (cid, vid) → T.Kernel(block_num, threads=2, is_npu=True) as (cid)(编译器自动并行 2 个 V 核,这是消 vid 的前提)。
  2. 删 workspace_idx:@tilelang.jit(out_idx=[N], workspace_idx=[...], ...) → @tilelang.jit(out_idx=[N], ...),并删除 kernel 签名里的 workspace_* 参数。
  3. 去 vid 偏移:v_block 不再 // 2,循环恢复整程 range(BI),删除全部 vid * ... 索引偏移。
  4. 片上直连:原「片上 buffer ↔ workspace[cid,...] ↔ 另一片上 buffer」两跳 GM 往返,合并为片上 T.copy 一跳;中转/同步交给四个 pass。

完整模板、映射表、代码骨架、自检清单与回退条件见 mode-examples.md §6。 复杂同步/多版本流水场景可回退保留 workspace+vid 写法(见 mode-examples.md §7)。

3.2 转换对照表
Expert 写法Developer 写法
T.alloc_L1(shape, dtype)T.alloc_shared(shape, dtype)
T.alloc_ub(shape, dtype)T.alloc_shared(shape, dtype)
T.alloc_L0A/L0B(shape, dtype)删除(gemm_v0 内部处理)
T.alloc_L0C(shape, dtype)T.alloc_fragment(shape, dtype)
with T.Scope("C"): ...直接写代码(编译器自动分离)
T.barrier_all()删除(编译器自动插入)
T.set_flag/T.wait_flag(...)删除
T.set_cross_flag/T.wait_cross_flag(...)删除
T.tile.exp(dst, src)for i,j in T.Parallel(...): dst[i,j] = T.exp(src[i,j]) 或保留
T.annotate_address({...})删除(开启 MEMORY_PLANNING)
@jit(..., workspace_idx=[...]) + 签名 workspace_* 参数删除(CV 交互改片上直连,见 §3.1.1)
T.Kernel(..., is_npu=True) as (cid, vid)T.Kernel(..., threads=2, is_npu=True) as (cid)(消 vid 前提)
T.copy(buf, ws[cid,...]) + T.copy(ws[cid,vid*..], buf2) 两跳T.copy(buf, buf2) 片上一跳直连

4. 示例代码与代码对比

模式目录说明
Developerexamples/developer_mode/GEMM、elementwise 等
Developer(消除 workspace/vid)examples/developer_mode/sparse_flash_attn_developer_vid_reduce.py(新)vs sparse_flash_attn_developer.py(旧)threads=2 + 片上直连,逐行对照消除范式
Expertexamples/gemm/example_gemm_intrinsic.py、examples/flash_attention/fa_opt/flash_attn_bhsd_expert_*.py极致性能优化
混合(核间流水线)examples/flash_attention/flash_attn_bhsd_cc_sync.py、examples/flash_attention/fa_opt/flash_attn_bhsd_auto_pipeline_*.pyFA 核间流水线
纯 Vectorexamples/elementwise/、examples/softmax/无 Cube 操作
CV 融合examples/dequantize_gemm/、examples/quant_batch_matmul/Vector 计算 + Cube GEMM

完整代码对比(Developer vs Expert):

  • → mode-examples.md
  • 包含 GEMM、Flash Attention、Softmax、CV 融合(消除 workspace/vid 推荐写法 §6 / workspace+vid 兜底写法 §7) 等示例

© 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

SKILL.md and 1 other file (references) in .agents/skills/tilelang-custom-skill/tilelang-programming-model-guide of tile-ai/tilelang-ascend.

  • SKILL.md
  • references/mode-examples.md

Open the folder on GitHubat commit 3d17c28

Compare with similar skills

Tilelang Programming Model Guide 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 Programming Model Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Tilelang Programming Model Guide this skilltile-ai/tilelang-ascend400—~1.8kAutomated safety check: PassMIT
Vercel Composition Patternssupabase/supabase111k59 repos~726Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Official

    React composition patterns that scale. An agent skill from supabase/supabase.

    111k GitHub starsUsed in 59 repos~726 tokens
    DevelopmentAuto-check passed
  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Greploop

    onyx-dot-app/onyx

    Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.

    32k GitHub starsUsed in 4 repos~3.3k tokens
    DevelopmentAuto-check passed

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.

    400 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.

    400 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。

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

    tile-ai/tilelang-ascend

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

    400 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) 测试覆盖率分析。理解算子实现逻辑后智能判断测试策略。触发:设计算子测试、生成测试用例、补充测试、测试覆盖率不足。

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

    tile-ai/tilelang-ascend

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

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

Categories

Questions about Tilelang Programming Model Guide

What does Tilelang Programming Model Guide do?

TileLang Ascend Developer/Expert 模式选择与 passconfigs 配置指南。当需要确定编程模式、配置 passconfigs、或在两种模式之间转换时触发。API 详情请参考 tilelang-api-best-practices skill。. Tilelang Programming Model Guide is an agent skill from tile-ai/tilelang-ascend.

When should I use Tilelang Programming Model Guide?

Tilelang Programming Model Guide fits situations like: development work in your project.

How do I install Tilelang Programming Model Guide in Claude Code?

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

How do I install Tilelang Programming Model Guide in Codex?

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

Can I use Tilelang Programming Model Guide 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-programming-model-guide -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-programming-model-guide, .gemini/skills/tilelang-programming-model-guide, .github/skills/tilelang-programming-model-guide and .opencode/skills/tilelang-programming-model-guide in your project.

What does Tilelang Programming Model Guide need to run?

SKILL.md names no scripts, command-line tools or credentials: Tilelang Programming Model Guide is instructions for the agent only. Our summary lists: Python 3.

Does Tilelang Programming Model Guide access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Tilelang Programming Model Guide 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 Programming Model Guide use?

Tilelang Programming Model Guide 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 Programming Model Guide use?

About 1.8k tokens (SKILL.md is roughly 7.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.2k tokens, read only when the agent opens those files.

What are the alternatives to Tilelang Programming Model Guide?

Skills that share tags, products or a category with Tilelang Programming Model Guide: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 296k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tilelang Programming Model Guide?

tile-ai (a GitHub organization) maintains it in tile-ai/tilelang-ascend, which has 400 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 8, 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.