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 | $0.00034 | $0.01303 |
| Sonnet 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 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.
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.
- 8d 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 (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 68 tokens to every session and 2,607 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
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…