triton-ascend-case-reduction-weighted-swiglu

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

A Triton Ascend guide for optimizing the backward pass of Weighted SwiGLU, a neural-network operation that applies weights and computes gradients.

In plain words
What is it for?
Use it when tuning a fused elementwise-and-reduction kernel for large 3D neural-network tensors on Ascend hardware.
Why use it?
It shows how reshaping a 3D tensor and splitting rows can simplify parallel work and improve memory access during a reduction.

Skill for Claude CodeCodex

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

Good fit Use it when tuning a fused elementwise-and-reduction kernel for large 3D neural-network tensors on Ascend hardware.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/triton-ascend-case-reduction-weighted-swiglu
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-weighted-swiglu
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-weighted-swiglu

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-reduction-weighted-swiglu"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-reduction-weighted-swiglu.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 780 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.00097 $0.00780
Opus 5.5 $0.00039 $0.00312
Sonnet 5.5 $0.00019 $0.00156
Haiku 4.5 $0.00010 $0.00078

Measured 3mo ago against content hash c6e22c848913, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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

akg_agents/python/akg_agents/op/resources/skills/triton-ascend/cases/triton-ascend-case-reduction-weighted-swiglu/SKILL.md · 65 lines

What it actually says

Weighted SwiGLU Backward 融合算子优化

任务特征

  • 数据尺寸:(16, 1024, 2048) × 3,3D融合算子
  • 特点:先逐元素操作,再reduce最后一根轴

优化 1:Reshape 降维

# 将前两个维度(B, M)合并为单个维度BM
x_reshaped = x.reshape(BM, N)
weight_reshaped = weight.reshape(BM, N)
grad_reshaped = grad.reshape(BM, N)

weighted_x_reshaped = weighted_x.reshape(BM, N)
grad_weight_reshaped = grad_weight.reshape(BM, N)
grad_x_reshaped = grad_x.reshape(BM)

优势:简化并行策略,优化内存访问模式,提高内核执行效率。

优化 2:行二次切分

for bm_start in range(0, BLOCK_SIZE_BM, SUB_BLOCK_SIZE_BM):
    bm_offsets = pid * BLOCK_SIZE_BM + bm_start + tl.arange(0, SUB_BLOCK_SIZE_BM)
    bm_mask = bm_offsets < BM

Autotune 配置

# (AI core=40)
# 1. grid=512>40,reduce轴切分较小,UB占满 -> 1105.84 us
triton.Config({'BLOCK_SIZE_BM': 32, 'SUB_BLOCK_SIZE_BM': 32, 'BLOCK_SIZE_N': 128})

# 2. grid=1024>40,reduce轴切分增至256 -> 1110.47 us
triton.Config({'BLOCK_SIZE_BM': 16, 'SUB_BLOCK_SIZE_BM': 16, 'BLOCK_SIZE_N': 256})

# 3. grid=2048>40,reduce轴切分增至512 -> 1091.26 us 最优
triton.Config({'BLOCK_SIZE_BM': 8, 'SUB_BLOCK_SIZE_BM': 8, 'BLOCK_SIZE_N': 512})

# 4. grid=32<40,reduce轴切分较大,UB占满 -> 1098.53 us
triton.Config({'BLOCK_SIZE_BM': 512, 'SUB_BLOCK_SIZE_BM': 8, 'BLOCK_SIZE_N': 512})

# 5. grid=40,有尾块,reduce轴切分较大,UB占满 -> 1094.60 us
triton.Config({'BLOCK_SIZE_BM': 416, 'SUB_BLOCK_SIZE_BM': 8, 'BLOCK_SIZE_N': 512})

总结

  1. Reshape降维可简化并行策略,优化内存访问
  2. 在优先占满UB前提下为reduce轴分配较大切分尺寸
  3. Grid数较大时,可能性能更优(配置3)
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. 3mo ago First seen · 65 lines · 97 tokens per session scan A c6e22c848913

Subscribe to this mod's changes

triton-ascend-case-reduction-weighted-swiglu is a skill published in the GitHub repository mindspore-ai/akg (269 stars, last pushed yesterday), licensed Apache-2.0. It adds 97 tokens to every session and 780 once invoked, about $0.0004 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.

Related

triton-ascend-case-reduction-weighted-swiglu compared with skills from other repositories

triton-ascend-case-reduction-weighted-swiglu next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
triton-ascend-case-reduction-weighted-swiglumindspore-ai/akgSkill269yesterdayApache-2.0A97Claude Code, Codex
triton-ascend-case-reduction-prod-smallwenyi-li/awesome-agent-kernel-skillsSkill116mo agononeA95Claude Code, Codex
triton-ascend-case-reduction-weighted-swigluwenyi-li/awesome-agent-kernel-skillsSkill116mo agononeA97Claude Code, Codex
triton-ascend-case-elemwise-zeroswenyi-li/awesome-agent-kernel-skillsSkill116mo agononeA67Claude Code, Codex
triton-ascend-case-reduction-sum-largewenyi-li/awesome-agent-kernel-skillsSkill116mo agononeA92Claude Code, Codex
agent-platform-model-registrygoogle/skillsSkill26kyesterdayApache-2.0A60Claude Code, Codex
llm-evaluationsickn33/agentic-awesome-skillsSkill51ktodayMITA25Claude Code