triton-ascend-case-elemwise-zeros

triton-ascend-case-elemwise-zeros is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 67 tokens per session (431 once invoked), scanned A, original, Apache-2.0.

A tuning guide for creating small tensors with operations such as zeros, arange, full, and their variants on Ascend hardware. It shows how to use fewer processing blocks for small shapes.

In plain words
What is it for?
Use it when optimizing small element-by-element tensor creation tasks, typically with around thousands of elements, in Triton for Ascend.
Why use it?
Small tensor jobs can be slowed by starting and scheduling many parallel blocks. Using fewer blocks can reduce that overhead.

Skill for Claude CodeCodex

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

Good fit Use it when optimizing small element-by-element tensor creation tasks, typically with around thousands of elements, in Triton for Ascend.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-elemwise-zeros"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-elemwise-zeros.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 431 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.00067 $0.00431
Opus 5 $0.00034 $0.00216
Sonnet 5 $0.00013 $0.00086
Haiku 4.5 $0.00007 $0.00043

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

Security

Grade A, and why

triton-ascend-case-elemwise-zeros 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 11d 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-elemwise-zeros/SKILL.md · 39 lines

What it actually says

Zeros 创建张量优化案例

任务特征

  • 操作类型:Elemwise类型,包含torch的arange、full、zeros、zeros_like等创建张量的操作
  • 数据尺寸:(2, 256, 16),数据shape较小
  • 数据类型:float32
  • 任务特点:可以按照轴的顺序(可flatten为一根轴),外层并行,内层向量化

优化:小shape少核处理

# 内核代码
block_start = pid * BLOCK_SIZE
offsets = block_start + tl.arange(0, BLOCK_SIZE)
mask = offsets < n_elements
zeros = tl.zeros((BLOCK_SIZE,), dtype=tl.float32)
tl.store(output_ptr + offsets, zeros, mask=mask)

优化内容

  • 通过设置BLOCK_SIZE的大小,来调整并行,提高性能
  • Shape较小时,核数尽量减小,可以避免多核启动和调度开销

总结

  1. 在Ascend平台上,shape较小的时候,核数尽量减小,可以避免多核启动和调度开销,实现性能优化
  2. 对于单纯的Elementwise操作,将多根轴的元素展开为一根轴,然后在这根轴上进行切分
  3. 将block分配给每个线程块,若UB存不下,可考虑多次切分
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. 11d ago First seen · 39 lines · 67 tokens per session scan A fddc8cc71cda

Subscribe to this mod's changes

triton-ascend-case-elemwise-zeros is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 67 tokens to every session and 431 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-08-30.

Related

Other skills, from other repositories

cardputer-buddy

Iterate on the Cardputer-Adv MicroPython app bundle (Claude Buddy, Snake, Hello) after the device is already provisioned via m5-onboard. Use when the user wants to add a new app, push a single changed .py without re-flashing, watch device serial logs, or run a one-shot REPL command. Trigger on "add an app", "push to…

anthropics/claude-plugins-official · 109 tokens

doca-argp

Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring docaargpinit → register params → docaargpstart → docaargpdestroy in order; picking a parameter type from the full public enum (DOCAARGPTYPESTRING, INT, BOOLEAN, DEVICE, DEVICEREP…

NVIDIA/skills · 267 tokens

holoscan-install-wheel

Install Holoscan SDK Python wheel via pip into a venv. Use for Python installs; not for native C++/apt or Conda installs.

NVIDIA/skills · 37 tokens

zener-language

Read or edit Zener HDL, package APIs, and tool-managed dependencies.

diodeinc/pcb · 19 tokens

embedded-stm32

Best practices for embedded C/C++ development on STM32 microcontrollers using the HAL, covering peripherals, DMA, interrupts, memory constraints, and hardware-focused testing. Use when writing STM32 HAL code, configuring peripherals generated by STM32CubeMX, working with interrupts or DMA, debugging with SWD/JTAG…

Mindrally/skills · 87 tokens

001-commands-inventory

Use when you need to generate a checklist document with embedded commands inventory, following the embedded template exactly and producing INVENTORY-COMMANDS-JAVA.md in the project root. This should trigger for requests such as Create embedded commands inventory checklist; Generate INVENTORY-COMMANDS-JAVA.md; Use…

jabrena/plinth · 92 tokens