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-elementwise-reduce-fusedgit 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-elementwise-reduce-fused)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-elementwise-reduce-fused"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-elementwise-reduce-fused/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-elementwise-reduce-fused"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-elementwise-reduce-fused.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.00189 | $0.00805 |
| Opus 5 | $0.00095 | $0.00402 |
| Sonnet 5 | $0.00038 | $0.00161 |
| Haiku 4.5 | $0.00019 | $0.00081 |
Grade A, and why
triton-ascend-elementwise-reduce-fused 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.
What it actually says
Elementwise + Reduce 融合算子指南
适用于先逐元素计算、再全局归约的复合算子(损失函数等)
计算模式
这类算子的通用流程:
- Elementwise 阶段:对输入张量逐元素执行变换(如差值、平方、clamp、log 等)
- Reduce 阶段:对变换结果做全局归约(sum / mean),得到标量或低维输出
融合 Kernel 写法
将 elementwise 计算和局部归约放在同一个 kernel 中,避免中间结果写回 GM:
@triton.jit
def fused_loss_kernel(
pred_ptr, target_ptr, output_ptr,
n_elements,
BLOCK_SIZE: tl.constexpr, CORE_NUM: tl.constexpr,
):
pid = tl.program_id(0)
num_blocks = tl.cdiv(n_elements, BLOCK_SIZE)
local_sum = tl.zeros((1,), dtype=tl.float32)
for block_id in range(pid, num_blocks, CORE_NUM):
offsets = block_id * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
mask = offsets < n_elements
pred = tl.load(pred_ptr + offsets, mask=mask, other=0.0)
target = tl.load(target_ptr + offsets, mask=mask, other=0.0)
# Elementwise 阶段
diff = pred - target
loss_elem = diff * diff # MSELoss 为例
# 块内归约
local_sum += tl.sum(loss_elem, axis=0)
# 跨块归约
tl.atomic_add(output_ptr, local_sum / n_elements)
关键要点
- 单 kernel 融合:elementwise 变换和归约在同一 kernel 完成,中间结果仅存在于寄存器/UB 中
- 原子操作汇总:多个 program 的局部结果通过
tl.atomic_add汇聚到全局输出 - reduction 参数:注意 PyTorch 损失函数的
reduction参数('mean'/'sum'/'none'),'none'时退化为纯 elementwise - 使用 VEC_CORE_NUM:此类算子不涉及
tl.dot,使用向量核心 - 数值稳定性:中间计算用 float32,避免半精度溢出
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 · 62 lines · 189 tokens per session scan A 08350d3e623d
triton-ascend-elementwise-reduce-fused is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 189 tokens to every session and 805 once invoked, about $0.0009 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
triton-ascend-reduce
An optimization guide for reduction operations in Triton on Ascend hardware, including sums, maxima, cumulative operations, softmax, and normalization.
triton-ascend-matmul
An optimization guide for matrix multiplication in Triton on Ascend hardware, covering tiled computation, work distribution, and large inner dimensions.
triton-ascend-elementwise
An optimization guide for Triton kernels where every tensor element receives the same independent operation, such as addition, activation, casting, or clamping.
triton-ascend-optimization
A general performance guide for Triton kernels on Ascend hardware, covering block-size selection, grid setup, memory alignment, automatic tuning, and numeric precision.
triton-ascend-attention
An optimization guide for Transformer-style attention operations in Triton on Ascend hardware, including QKV computation, online softmax, and causal masking.
triton-ascend-elementwise-reduce-fused
An optimization guide for Triton kernels that first transform each tensor element and then combine the results with a sum, mean, or other reduction.