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-reducegit 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-reduce)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-cuda-reduce"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-cuda-reduce/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-reduce"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-cuda-reduce.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.00068 | $0.02607 |
| Opus 5.5 | $0.00027 | $0.01043 |
| Sonnet 5.5 | $0.00014 | $0.00521 |
| Haiku 4.5 | $0.00007 | $0.00261 |
Grade A, and why
triton-cuda-reduce 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 3mo 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 — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Reduce 算子优化
适用于需要聚合多个值的归约操作
适用算子
基础归约: sum, mean, max, min, prod 归一化: softmax, logsoftmax, layernorm, batchnorm 统计: variance, std
通用归约策略
1. 块内归约 + 原子操作
@triton.jit
def reduction_kernel(input_ptr, output_ptr, n_elements, BLOCK_SIZE: tl.constexpr):
pid = tl.program_id(0)
offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
mask = offsets < n_elements
# 加载数据
data = tl.load(input_ptr + offsets, mask=mask, other=0.0)
# 块内归约
block_sum = tl.sum(data, axis=0)
# 原子操作写回全局内存
tl.atomic_add(output_ptr, block_sum)
2. 数值稳定性处理
关键: 对于涉及 exp 的操作(softmax、logsoftmax),必须减去最大值防止溢出。
# 错误:直接 exp 可能溢出
exp_val = tl.exp(x)
# 正确:减去最大值
max_val = tl.max(x, axis=0)
exp_val = tl.exp(x - max_val)
特定算子优化
Softmax
标准 Softmax: output = exp(x - max(x)) / sum(exp(x - max(x)))
@triton.jit
def softmax_kernel(input_ptr, output_ptr, input_row_stride, output_row_stride,
n_rows, n_cols, BLOCK_SIZE: tl.constexpr):
# 获取当前程序处理的行
row_start = tl.program_id(0)
row_step = tl.num_programs(0)
for row_idx in tl.range(row_start, n_rows, row_step):
# 计算当前行的起始指针
row_start_ptr = input_ptr + row_idx * input_row_stride
# 创建列偏移
col_offsets = tl.arange(0, BLOCK_SIZE)
input_ptrs = row_start_ptr + col_offsets
# 加载数据,使用掩码处理边界
mask = col_offsets < n_cols
row = tl.load(input_ptrs, mask=mask, other=-float('inf'))
# 数值稳定性:减去最大值
row_minus_max = row - tl.max(row, axis=0)
# 计算指数(CUDA 后端直接使用 tl.exp)
numerator = tl.exp(row_minus_max)
# 计算分母(归一化因子)
denominator = tl.sum(numerator, axis=0)
# 计算 softmax
softmax_output = numerator / denominator
# 存储结果
output_row_start_ptr = output_ptr + row_idx * output_row_stride
output_ptrs = output_row_start_ptr + col_offsets
tl.store(output_ptrs, softmax_output, mask=mask)
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.
- 3mo ago First seen · 296 lines · 68 tokens per session scan A 5229aceee178
triton-cuda-reduce is a skill published in the GitHub repository mindspore-ai/akg (269 stars, last pushed today), licensed Apache-2.0. It adds 68 tokens to every session and 2,607 once invoked, about $0.0003 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-09-03.
triton-cuda-reduce compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| triton-cuda-reducemindspore-ai/akg | Skill | 269 | today | Apache-2.0 | A | 68 | Claude Code, Codex |
| hatch3r-ai-featurehatch3r/hatch3r | Skill | 26 | 2mo ago | MIT | A | 39 | Claude Code |
| AI Integration Specialisteddiebelaval/squire | Skill | 21 | 3mo ago | MIT | A | 15 | Claude Code, Codex |
| triton-cuda-attentionwenyi-li/awesome-agent-kernel-skills | Skill | 11 | 6mo ago | none | A | 59 | Claude Code, Codex |
| triton-cuda-reducewenyi-li/awesome-agent-kernel-skills | Skill | 11 | 6mo ago | none | A | 68 | Claude Code, Codex |
| AI Integration Specialistjmsktm/claude-settings | Skill | 11 | 10mo ago | none | A | 15 | Claude Code, Codex |
| agent-platform-model-registrygoogle/skills | Skill | 25k | today | Apache-2.0 | A | 60 | Claude Code, Codex |