tilelang-cuda-api

tilelang-cuda-api is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 43 tokens per session (3,002 once invoked), scanned A, original, Apache-2.0.

A reference manual for the TileLang CUDA programming interface, including kernel compilation, launch dimensions, thread blocks, memory allocation, and utility functions. TileLang is a Python-like language for writing GPU kernels.

In plain words
What is it for?
Use it to look up APIs such as @tilelang.jit, tilelang.compile, T.Kernel, T.ceildiv, and memory-allocation functions, with short code examples.
Why use it?
It lets you check what common TileLang functions do and how their parameters are used while writing kernel code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to look up APIs such as @tilelang.jit, tilelang.compile, T.Kernel, T.ceildiv, and memory-allocation functions, with short code examples.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/tilelang-cuda-api
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mindspore-ai/akg --skill tilelang-cuda-api
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

Made for: Claude Code, Codex.

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-cuda-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/tilelang-cuda-api.svg)](https://agentmods.dev/skills/mindspore-ai/akg/tilelang-cuda-api)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/tilelang-cuda-api"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/tilelang-cuda-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,002 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00043 $0.03002
Opus 5 $0.00022 $0.01501
Sonnet 5 $0.00009 $0.00600
Haiku 4.5 $0.00004 $0.00300

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

Security

Grade A, and why

tilelang-cuda-api 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 8d 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.

akg_agents/python/akg_agents/op/resources/skills/tilelang-cuda/guides/tilelang-cuda-api/SKILL.md · 348 lines

How it starts

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

TileLang CUDA API 参考手册

本文档提供 TileLang 核心 API 的详细参考,包括函数签名、参数说明和使用示例。

1. 内核定义与编译

@tilelang.jit(out_idx)

@tilelang.jit(out_idx=[-1])
def my_kernel(M, N, K, block_M, block_N, block_K):
    @T.prim_func
    def main(
        A: T.Tensor((M, K), "float16"),
        B: T.Tensor((K, N), "float16"),
        C: T.Tensor((M, N), "float16"),
    ):
        # 内核实现
        pass
    return main
  • 作用: 将 TileLang 函数编译为 GPU 内核
  • 参数: out_idx - 指定输出张量的索引列表(如 [-1] 表示最后一个参数为输出)
  • 调用: 设置 out_idx 后,运行内核时只需传入输入张量,输出由 TileLang 自动创建

tilelang.compile

kernel = tilelang.compile(my_func, out_idx=[-1])
  • 作用: 编译 TileLang 函数(等价于 @tilelang.jit

2. 内核上下文

T.Kernel(grid_x, grid_y, threads)

with T.Kernel(T.ceildiv(N, block_N), T.ceildiv(M, block_M), threads=128) as (bx, by):
    # bx, by 对应 blockIdx.x, blockIdx.y
    pass
  • 参数:
    • grid_x: 网格 X 维度大小
    • grid_y: 网格 Y 维度大小(可选)
    • threads: 每个线程块的线程数
  • 返回: 线程块索引 (bx, by)

T.ceildiv(a, b)

grid_size = T.ceildiv(N, block_N)
  • 参数: a, b - 被除数和除数
  • 返回: 向上取整的除法结果
  • 用途: 计算网格大小

3. 内存分配 API

T.alloc_shared(shape, dtype)

A_shared = T.alloc_shared((block_M, block_K), "float16")
  • 作用: 分配共享内存(对应 GPU 共享内存)
  • 参数:
    • shape: 张量形状
    • dtype: 数据类型
  • 用途: 缓存频繁访问的数据

T.alloc_fragment(shape, dtype)

C_local = T.alloc_fragment((block_M, block_N), "float")
  • 作用: 分配寄存器片段(对应 GPU 寄存器文件)
  • 参数:
    • shape: 张量形状
    • dtype: 数据类型
  • 用途: 累加器和临时存储

T.alloc_local(shape, dtype)

temp = T.alloc_local((1,), "float32")
  • 作用: 分配线程本地内存
  • 参数:
    • shape: 张量形状
    • dtype: 数据类型
  • 用途: 线程私有的临时变量

4. 数据操作 API

T.copy(src, dst)

# 全局内存到共享内存
T.copy(A[by * block_M, ko * block_K], A_shared)

# 寄存器到全局内存
T.copy(C_local, C[by * block_M, bx * block_N])
  • 作用: 高效内存复制,自动合并访问
  • 参数:
    • src: 源数据(可以是全局内存切片或寄存器片段)
    • dst: 目标数据

T.clear(tensor)

T.clear(C_local)
  • 作用: 将张量清零
  • 参数: tensor - 要清零的张量

Read the full file on GitHub · 348 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. 8d ago First seen · 348 lines · 43 tokens per session scan A c9d57bf0babe

Subscribe to this mod's changes

tilelang-cuda-api is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 28d ago), licensed Apache-2.0. It adds 43 tokens to every session and 3,002 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

agent-platform-rag-engine-management

Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…

google/skills · 85 tokens

agent-platform-model-registry

Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.

google/skills · 60 tokens

foundry-config-setup

Resolve missing setup caused by a hardcoded Foundry project endpoint or model in a sample. Use when a sample fails because it uses a placeholder/hardcoded projectendpoint (for example "https://your-project.services.ai.azure.com") or a hardcoded model instead of reading them from the environment.

microsoft/agent-framework · 65 tokens

google-cloud-solution-agentic-analytics-spark-knowledge-catalog

Discovers requirements and generates guidance to design and deploy a governed, secure agentic-analytics solution for data that's distributed across Google Cloud, other cloud providers, or on-premises. Data that's outside Google Cloud (such as data from Databricks, Snowflake, Salesforce, SAP, or Oracle systems) is…

google/skills · 138 tokens

training-check

Interactively monitor training metrics from the current Codex session, periodically checking WandB or fallback logs for NaN, divergence, plateaus, and broken runs.

wanshuiyin/Auto-claude-code-research-in-sleep · 35 tokens

nemo-automodel-launcher-config

Configure NeMo AutoModel job launches for interactive runs, Slurm clusters, and SkyPilot cloud execution.

NVIDIA/skills · 30 tokens