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-ascend-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-ascend-reduce)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-reduce"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-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-ascend-reduce"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-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.00213 | $0.03185 |
| Opus 5 | $0.00106 | $0.01592 |
| Sonnet 5 | $0.00043 | $0.00637 |
| Haiku 4.5 | $0.00021 | $0.00318 |
Grade A, and why
triton-ascend-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 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 — 216 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, rmsnorm, groupnorm, batchnorm 统计: variance, std
关键性能优化:计算重组(延迟归约)
Ascend 上
tl.sum/tl.max/tl.min等归约指令开销较大,循环内每次迭代都调用归约会成为性能瓶颈。核心思路:循环内只做逐元素累加(+=),循环结束后再执行一次归约。
反模式 vs 正确范式
# ❌ 反模式:循环内每次都调 tl.sum,产生 N/BLOCK_SIZE 次归约
total = 0.0
for offset in range(0, N, BLOCK_SIZE):
block = tl.load(ptr + offset + tl.arange(0, BLOCK_SIZE), ...)
total += tl.sum(block) # 每次迭代都归约 → 开销大
# ✅ 正确:循环内只做逐元素累加,最后一次性归约
acc = tl.zeros((BLOCK_SIZE,), dtype=tl.float32)
for offset in range(0, N, BLOCK_SIZE):
block = tl.load(ptr + offset + tl.arange(0, BLOCK_SIZE), ...)
acc += block # 逐元素 add,无归约开销
total = tl.sum(acc) # 仅此一次归约
2D 场景(沿某一轴归约)
# ❌ 反模式:循环内每次沿 axis=0 归约
acc_1d = tl.zeros((BLOCK_N,), dtype=tl.float32)
for m_start in range(0, M, BLOCK_M):
tile = tl.load(...) # [BLOCK_M, BLOCK_N]
acc_1d += tl.sum(tile, axis=0) # 每次迭代都归约
# ✅ 正确:保持 2D 累加器,最后一次性归约
acc_2d = tl.zeros((BLOCK_M, BLOCK_N), dtype=tl.float32)
for m_start in range(0, M, BLOCK_M):
tile = tl.load(...) # [BLOCK_M, BLOCK_N]
acc_2d += tile # 保持 2D,无归约
result = tl.sum(acc_2d, axis=0) # 最后一次归约 → [BLOCK_N]
适用条件
- 可结合律操作:sum(
+=)、prod(*=)等满足结合律的操作均可使用此范式 - 非 sum 归约(max/min)也适用:循环内用
tl.maximum/tl.minimum逐元素取极值,最后一次tl.max/tl.min - UB 容量权衡:2D 累加器占用更多 UB(统一缓冲区),需确保
BLOCK_M × BLOCK_N × dtype_size不超出 UB 容量。当 UB 不够时可适当减小 BLOCK_SIZE - 掩码处理:累加器初始化为归约的幺元(sum → 0、prod → 1、max → -inf、min → inf),用
other=幺元处理边界
完整示例:Sum reduction over a dimension
@triton.jit
def sum_reduce_kernel(
x_ptr, y_ptr,
B: tl.constexpr, M: tl.constexpr, N: tl.constexpr,
BLOCK_SIZE_M: tl.constexpr, BLOCK_SIZE_N: tl.constexpr,
NUM_CORES: tl.constexpr = 20,
):
"""Input X[B, M, N] → Output Y[B, N],沿 M 轴求和"""
pid = tl.program_id(0)
num_blocks_n = tl.cdiv(N, BLOCK_SIZE_N)
total_blocks = B * num_blocks_n
for block_idx in range(pid, total_blocks, NUM_CORES):
b_idx = block_idx // num_blocks_n
n_start = (block_idx % num_blocks_n) * BLOCK_SIZE_N
n_offsets = n_start + tl.arange(0, BLOCK_SIZE_N)
n_mask = n_offsets < N
# 2D 累加器,延迟归约
acc = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=tl.float32)
for m_start in range(0, M, BLOCK_SIZE_M):
m_offsets = m_start + tl.arange(0, BLOCK_SIZE_M)
m_mask = m_offsets < M
x_offset = b_idx * M * N + m_offsets[:, None] * N + n_offsets[None, :]
x_block = tl.load(x_ptr + x_offset, mask=m_mask[:, None] & n_mask[None, :], other=0.0)
acc += x_block # 逐元素累加,不归约
result = tl.sum(acc, axis=0) # 循环结束后一次性归约
tl.store(y_ptr + b_idx * N + n_offsets, result, mask=n_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.
- 7d ago First seen · 216 lines · 213 tokens per session scan A 04e7d27ff023
triton-ascend-reduce is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 213 tokens to every session and 3,185 once invoked, about $0.0011 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
fs-notebook-tabs
A computer-science capstone: an on-device ML keyboard that predicts next words privately — problem, method, evaluation, and defense answers. Built as a decision-grade coursework defense deck for professor, defense committee.
implementing-llms-litgpt
Implements and trains LLMs using Lightning AI's LitGPT with 20+ pretrained architectures (Llama, Gemma, Phi, Qwen, Mistral). Use when need clean model implementations, educational understanding of architectures, or production fine-tuning with LoRA/QLoRA. Single-file implementations, no abstraction layers.
rwkv-architecture
RNN+Transformer hybrid with O(n) inference. Linear time, infinite context, no KV cache. Train like GPT (parallel), infer like RNN (sequential). Linux Foundation AI project. Production at Windows, Office, NeMo. RWKV-7 (March 2025). Models up to 14B parameters.
nanogpt
Educational GPT implementation in 300 lines. Reproduces GPT-2 (124M) on OpenWebText. Clean, hackable code for learning transformers. By Andrej Karpathy. Perfect for understanding GPT architecture from scratch. Train on Shakespeare (CPU) or OpenWebText (multi-GPU).
lesson-quiz
Test a learner on a single Claude Code tutorial lesson (01-10) with 10 questions, scoring answers and flagging weak spots. Use before, during, or after a lesson. Don't use for whole-tutorial assessment or explaining a topic instead of testing it.
kaggle-learner
This skill should be used when the user asks to "learn from Kaggle", "study Kaggle solutions", "analyze Kaggle competitions", or mentions Kaggle competition URLs. Provides access to extracted knowledge from winning Kaggle solutions across NLP, CV, time series, tabular, and multimodal domains.