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 triton-cuda-basicsgit 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/triton-cuda-basics)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-cuda-basics"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-cuda-basics/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/triton-cuda-basics"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-cuda-basics.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.00064 | $0.01797 |
| Opus 5 | $0.00032 | $0.00898 |
| Sonnet 5 | $0.00013 | $0.00359 |
| Haiku 4.5 | $0.00006 | $0.00180 |
Grade A, and why
triton-cuda-basics 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 7d 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 — 179 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Triton CUDA 编程基础
1. 核心概念
内核 (Kernel)
- 定义: 使用
@triton.jit装饰的 Python 函数,编译后在 GPU 上并行执行 - 特点: 每个内核实例处理数据的一个子集,通过程序 ID 区分
网格 (Grid) 与块 (Block)
- 网格: 内核启动时的并行维度配置,如
(num_blocks_x, num_blocks_y) - 块: 每个程序实例处理的数据块大小,如
BLOCK_SIZE = 1024 - 关系:
grid_size = ceil(total_elements / block_size)
内存层次
- 全局内存 (Global Memory): 主内存(HBM),所有程序可访问,延迟高,带宽大
- 共享内存 (Shared Memory): SM 内共享,延迟低,容量有限(通常 48-164 KB/SM)
- 寄存器 (Registers): 每个线程私有,最快访问
CUDA GPU 架构要点
- SM (Streaming Multiprocessor): GPU 基本计算单元
- Warp: 32 个线程为一组并行执行
- Tensor Core: 专用矩阵计算单元(Ampere/Hopper 架构)
2. 标准内核结构(五步模式)
所有 Triton 内核都遵循相同的五步结构模式:
@triton.jit
def standard_kernel(
output_ptr, input_ptr, n_elements,
BLOCK_SIZE: tl.constexpr,
):
# 1. 获取程序 ID 和计算偏移
pid = tl.program_id(0)
offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
# 2. 创建边界掩码
mask = offsets < n_elements
# 3. 加载数据
data = tl.load(input_ptr + offsets, mask=mask)
# 4. 执行计算
result = compute_function(data)
# 5. 存储结果
tl.store(output_ptr + offsets, result, mask=mask)
3. 内核启动方式
函数形式
def launch_kernel(input_tensor, output_tensor):
BLOCK_SIZE = 1024
grid = (triton.cdiv(input_tensor.numel(), BLOCK_SIZE),)
kernel[grid](
output_tensor, input_tensor, input_tensor.numel(),
BLOCK_SIZE=BLOCK_SIZE,
)
ModelNew 类格式(推荐)
class ModelNew(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, input_tensor):
output_tensor = torch.empty_like(input_tensor)
BLOCK_SIZE = 1024
grid = (triton.cdiv(input_tensor.numel(), BLOCK_SIZE),)
kernel[grid](
output_tensor, input_tensor, input_tensor.numel(),
BLOCK_SIZE=BLOCK_SIZE,
)
return output_tensor
4. 边界处理
使用 mask 处理边界
# 基本边界检查
offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
mask = offsets < n_elements
data = tl.load(ptr + offsets, mask=mask, other=0.0)
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.
- 7d ago First seen · 179 lines · 64 tokens per session scan A 8d424034bcd8
triton-cuda-basics is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 64 tokens to every session and 1,797 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-09-03.
Other skills, from other repositories
course
A Python helper that displays tutorials, group information, source-code links, and other resources for the python-office library in a terminal.
notebook.create_api_intro
Create a notebook to present the API of a package.
notebook.outline_ideas
Create a set of ideas for Jupyter notebooks to explore ideas and concepts.
python-fast-skill
A beginner-friendly guide to core Python concepts, including syntax, data types, functions, classes, errors, files, packages, and concurrency.
jupyter-to-marimo
Convert a Jupyter notebook (.ipynb) to a marimo notebook (.py).
fiftyone-sdk-guidance
Answers FiftyOne Python SDK questions with accurate, runnable code. Use when the user asks how to do something in the FiftyOne Python SDK, asks a docs question, no skill or operator covers their goal, or the agent is unsure of the correct FiftyOne method, argument, or field path while writing code — e.g. "how do I do…