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.
npx skills add mindspore-ai/akg --skill tilelang-cuda-examples-torchgit clone --depth 1 https://github.com/mindspore-ai/akgWrote 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/mindspore-ai/akg/tilelang-cuda-examples-torch)<a href="https://agentmods.dev/skills/mindspore-ai/akg/tilelang-cuda-examples-torch"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/tilelang-cuda-examples-torch/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/mindspore-ai/akg/tilelang-cuda-examples-torch"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/tilelang-cuda-examples-torch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00020 | $0.03293 |
| Opus 5.5 | $0.00008 | $0.01317 |
| Sonnet 5.5 | $0.00004 | $0.00659 |
| Haiku 4.5 | $0.00002 | $0.00329 |
Grade A, and why
tilelang-cuda-examples-torch 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 371 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PyTorch + TileLang CUDA 示例代码
本 Skill 包含完整的可运行示例代码,展示如何在 PyTorch 中使用 TileLang CUDA 编写高性能 kernel。
示例列表
1. 矩阵乘法(GEMM)
算子类型: MatMul 关键点:
- 共享内存缓存输入块
T.gemm利用 Tensor Core- 软件流水线
T.Pipelined - 混合精度(float32 累加器)
import torch
import tilelang
import tilelang.language as T
@tilelang.jit(out_idx=[-1])
def matmul(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")):
with T.Kernel(T.ceildiv(N, block_N), T.ceildiv(M, block_M), threads=128) as (bx, by):
A_shared = T.alloc_shared((block_M, block_K), "float16")
B_shared = T.alloc_shared((block_K, block_N), "float16")
C_local = T.alloc_fragment((block_M, block_N), "float")
T.clear(C_local)
for ko in T.Pipelined(T.ceildiv(K, block_K), num_stages=3):
T.copy(A[by * block_M, ko * block_K], A_shared)
T.copy(B[ko * block_K, bx * block_N], B_shared)
T.gemm(A_shared, B_shared, C_local)
T.copy(C_local, C[by * block_M, bx * block_N])
return main
# 调用方式
def matmul_call(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
M, K = A.shape
K2, N = B.shape
block_M, block_N, block_K = 128, 128, 32
kernel = matmul(M, N, K, block_M, block_N, block_K)
C = kernel(A, B) # out_idx=[-1],只传输入
return C
2. 矩阵乘法(float32,手动管理输出)
算子类型: MatMul 关键点:
- 不使用
out_idx,手动管理输出 - float32 数据类型
- 需要手动创建输出张量并一起传入
import torch
import tilelang
import tilelang.language as T
@tilelang.jit
def square_matrix_multiply(M, N, K, block_M, block_N, block_K):
@T.prim_func
def main(
A: T.Tensor((M, K), "float32"),
B: T.Tensor((K, N), "float32"),
C: T.Tensor((M, N), "float32")):
with T.Kernel(T.ceildiv(N, block_N), T.ceildiv(M, block_M), threads=128) as (bx, by):
A_shared = T.alloc_shared((block_M, block_K), "float32")
B_shared = T.alloc_shared((block_K, block_N), "float32")
C_local = T.alloc_fragment((block_M, block_N), "float")
T.clear(C_local)
for ko in T.Pipelined(T.ceildiv(K, block_K), num_stages=3):
T.copy(A[by * block_M, ko * block_K], A_shared)
T.copy(B[ko * block_K, bx * block_N], B_shared)
T.gemm(A_shared, B_shared, C_local)
T.copy(C_local, C[by * block_M, bx * block_N])
return main
def square_matrix_multiply_call(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
N = A.size(0)
block_M, block_N, block_K = 128, 128, 32
# 不使用 out_idx 时,需要手动创建输出张量
C = torch.empty_like(A)
kernel = square_matrix_multiply(N, N, N, block_M, block_N, block_K)
kernel(A, B, C) # 传入所有参数包括输出
return C
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.
- 1mo ago First seen · 371 lines · 20 tokens per session scan A 389f04e38947
tilelang-cuda-examples-torch is a skill published in the GitHub repository mindspore-ai/akg (264 stars, last pushed 5d ago), licensed Apache-2.0. It adds 20 tokens to every session and 3,293 once invoked, about $0.0001 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-08-30.
Other skills, from other repositories
pypto-case-elemwise-gelu
A PyPTO example for applying the GELU activation function element by element to a one-dimensional array. It demonstrates flattening, a hand-written formula without tanh, and operator use.
cuda-c-examples-torch
A set of complete examples showing how PyTorch code can work together with CUDA C code for GPU computing.
accelerate
Run PyTorch training across GPUs with minimal changes.
pytorch-patterns
PyTorch deep learning patterns and best practices for building robust, efficient, and reproducible training pipelines, model architectures, and data loading.
optimize-for-gpu
GPU-accelerates scientific Python on NVIDIA hardware and verifies that the result is correct and faster. Use for CUDA/GPU optimization; CPU-bound NumPy, SciPy, pandas, scikit-learn, NetworkX, scikit-image, vector-search, image-processing, graph, simulation, or file-I/O workloads; CuPy, cuDF, cuML, cuGraph, cuVS…
developing-genkit-python
Develop AI-powered applications using Genkit in Python. Use when the user asks about Genkit, AI agents, flows, or tools in Python, or when encountering Genkit errors, import issues, or API problems.