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-memorygit 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-memory)<a href="https://agentmods.dev/skills/mindspore-ai/akg/tilelang-cuda-memory"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/tilelang-cuda-memory/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-memory"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/tilelang-cuda-memory.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.00062 | $0.02253 |
| Opus 5 | $0.00031 | $0.01126 |
| Sonnet 5 | $0.00012 | $0.00451 |
| Haiku 4.5 | $0.00006 | $0.00225 |
Grade A, and why
tilelang-cuda-memory 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 9d 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 — 256 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TileLang CUDA 内存访问优化
内存访问是 GPU 性能的关键瓶颈。本文档提供 TileLang CUDA 的内存访问优化策略。
1. GPU 内存层次
内存带宽和延迟
| 内存类型 | 带宽 (A100) | 延迟 | 容量 | TileLang API |
|---|---|---|---|---|
| 寄存器 | ~19 TB/s | 1 cycle | 256 KB/SM | T.alloc_fragment / T.alloc_local |
| 共享内存 | ~19 TB/s | ~20 cycles | 164 KB/SM | T.alloc_shared |
| L2 缓存 | ~5 TB/s | ~100 cycles | 40 MB | T.use_swizzle 优化 |
| 全局内存 (HBM) | ~2 TB/s | ~400 cycles | 40/80 GB | T.Tensor |
优化原则
- 减少全局内存访问: 利用共享内存和寄存器缓存数据
- 合并访问 (Coalesced Access): 使用
T.copy进行高效数据传输 - 提高 L2 缓存命中率: 使用
T.use_swizzle优化数据局部性
2. 内存分配最佳实践
共享内存(频繁访问的数据)
# 共享内存用于缓存从全局内存加载的数据块
A_shared = T.alloc_shared((block_M, block_K), "float16")
B_shared = T.alloc_shared((block_K, block_N), "float16")
# 高效数据加载
T.copy(A[by * block_M, ko * block_K], A_shared)
适用场景:
- 矩阵乘法中的输入块
- 多次访问的中间数据
- 需要线程间共享的数据
寄存器片段(累加器和临时存储)
# 寄存器用于累加和局部计算
C_local = T.alloc_fragment((block_M, block_N), "float")
T.clear(C_local)
# 累加操作
T.gemm(A_shared, B_shared, C_local)
适用场景:
- 矩阵乘法累加器
- 归约的临时结果
- 局部计算结果
本地内存(线程私有存储)
# 本地内存用于线程私有变量
C_reg = T.alloc_local((1,), "float")
T.clear(C_reg)
适用场景:
- 单个线程的累加值
- 线程局部的临时变量
3. 数据传输优化
使用 T.copy 进行合并访问
# ✅ 推荐:使用 T.copy 自动合并访问
T.copy(A[by * block_M, ko * block_K], A_shared)
T.copy(B[ko * block_K, bx * block_N], B_shared)
# ✅ 结果写回
T.copy(C_local, C[by * block_M, bx * block_N])
使用 T.Parallel 进行并行数据复制
# 并行数据复制
for k, j in T.Parallel(block_K, block_N):
B_shared[k, j] = B[ko * block_K + k, bx * block_N + j]
使用向量化加载
# 向量化加载以提高带宽利用率
for k in T.vectorized(TILE_K):
A_local[k] = A[bk * BLOCK_K + tk * TILE_K + k]
B_local[k] = B[bn * BLOCK_N + tn, bk * BLOCK_K + tk * TILE_K + k]
4. 软件流水线
基本用法
# 使用 T.Pipelined 实现软件流水线
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)
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.
- 9d ago First seen · 256 lines · 62 tokens per session scan A 443a4de38c57
tilelang-cuda-memory is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 29d ago), licensed Apache-2.0. It adds 62 tokens to every session and 2,253 once invoked, about $0.0003 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.
Other skills, from other repositories
hatch3r-ai-feature
Eval-driven development workflow for shipping AI features — write eval before prompt, measure, iterate, ship with caching + cost telemetry + model fallback + hallucination SLI.
AI Integration Specialist
Integrate AI tools and APIs into business workflows and applications.
triton-cuda-attention
An implementation guide for attention operations in Triton on CUDA, with a complete Flash Attention example and changes for causal, grouped-query, multi-query, and rotary-position variants.
triton-cuda-reduce
A guide to writing CUDA GPU code that combines many values into results such as sums, averages, maximums, and minimums. It also covers softmax, layer normalization, and log-softmax.
AI Integration Specialist
Integrate AI tools and APIs into business workflows and applications.
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…