triton-ascend-case-reduction-sum-fused

triton-ascend-case-reduction-sum-fused is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 83 tokens per session (635 once invoked), scanned A, original, Apache-2.0.

A guide to optimizing a fused operation that first transforms each value and then adds the results along a dimension.

In plain words
What is it for?
Use it when implementing or tuning elementwise-plus-sum reduction kernels in Triton on Ascend hardware.
Why use it?
It explains how to reorganize the calculation and split rows so the reduction does less inefficient work, especially when processing uneven blocks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when implementing or tuning elementwise-plus-sum reduction kernels in Triton on Ascend hardware.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-fused
Install

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.

Any agent
npx skills add mindspore-ai/akg --skill triton-ascend-case-reduction-sum-fused
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for triton-ascend-case-reduction-sum-fused

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-fused/github.svg)](https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-fused)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-fused"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-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.

agentmods 80×15 button for triton-ascend-case-reduction-sum-fused

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-fused"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-reduction-sum-fused.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 635 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00083 $0.00635
Opus 5 $0.00042 $0.00318
Sonnet 5 $0.00017 $0.00127
Haiku 4.5 $0.00008 $0.00064

Measured 9d ago against content hash cfdf0724aab8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

triton-ascend-case-reduction-sum-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.

akg_agents/python/akg_agents/op/resources/skills/triton-ascend/cases/triton-ascend-case-reduction-sum-fused/SKILL.md · 60 lines

What it actually says

Reduction + Elementwise 融合算子优化

任务特征

  • 数据尺寸:(1000, 8192), (8192,),融合算子
  • 特点:先进行向量化逐元素操作,再沿列方向求和归约

优化 1:行二次切分

pid = tl.program_id(0)
for m_start in range(0, BLOCK_SIZE_M, SUB_BLOCK_SIZE_M):
    m_offsets = pid * BLOCK_SIZE_M + m_start + tl.arange(0, SUB_BLOCK_SIZE_M)

优化 2:计算重组

# 错误:简单
total_sum = 0.0
for n_offset in range(0, N, BLOCK_SIZE):
    total_sum += tl.sum(tl.where(mask, t3, 0.0))

# 正确:优化
acc = tl.zeros([SUB_BLOCK_SIZE_M, BLOCK_SIZE_N], dtype=tl.float32)
for n_start in range(0, N, BLOCK_SIZE_N):
    acc += tl.where(mask, t3, 0.0)
total_sum = tl.sum(acc, axis=1)

Autotune 配置

# (AI core=40)
# 1. grid=20<40 -> 91.69 us
triton.Config({'BLOCK_SIZE_M': 50, 'SUB_BLOCK_SIZE_M': 25, 'BLOCK_SIZE_N': 256})

# 2. grid=40,SUB切分含尾块 -> 53.30 us
triton.Config({'BLOCK_SIZE_M': 25, 'SUB_BLOCK_SIZE_M': 4, 'BLOCK_SIZE_N': 2048})

# 3. grid=40,SUB切分不含尾块 -> 47.58 us 最优
triton.Config({'BLOCK_SIZE_M': 25, 'SUB_BLOCK_SIZE_M': 25, 'BLOCK_SIZE_N': 256})

# 4. grid>40,且非核数整数倍 -> 79.00 us
triton.Config({'BLOCK_SIZE_M': 20, 'SUB_BLOCK_SIZE_M': 20, 'BLOCK_SIZE_N': 256})

总结

融合算子优化逻辑以reduce为主。grid等于核数、SUB切分不含尾块时性能最优。

Changes

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.

  1. 9d ago First seen · 60 lines · 83 tokens per session scan A cfdf0724aab8

Subscribe to this mod's changes

triton-ascend-case-reduction-sum-fused is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 83 tokens to every session and 635 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

triton-ascend-case-reduction-weighted-swiglu

A performance-optimization method for a specialized 3D tensor operation using Weighted SwiGLU during backward computation. It reshapes data and divides work to improve parallel processing while keeping within on-chip memory limits.

wenyi-li/awesome-agent-kernel-skills · 97 tokens

triton-ascend-case-reduction-prod-small

A guide to optimizing small product reductions, which multiply a group of tensor values into one result.

wenyi-li/awesome-agent-kernel-skills · 95 tokens

triton-ascend-case-reduction-sum-large

A guide to optimizing large two-dimensional sum reductions when the non-reduced axis is very large and the reduced axis is medium-sized.

wenyi-li/awesome-agent-kernel-skills · 92 tokens

triton-ascend-case-elemwise-zeros

An optimization for creating small tensors with zeros, arange, or full in Triton Ascend. Triton Ascend is a programming environment for running tensor operations on Ascend hardware.

wenyi-li/awesome-agent-kernel-skills · 67 tokens

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…

google/skills · 85 tokens

agent-platform-model-registry

Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.

google/skills · 60 tokens