triton-ascend-case-index-put

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

An optimization pattern for indexed assignment, which writes values into positions chosen by index arrays. It loads index data into fast on-chip memory so a loop can reuse it.

In plain words
What is it for?
Use it for irregular index-based writes where the same index data is accessed multiple times inside a loop.
Why use it?
Reading the same indexes repeatedly from global memory adds delay. Loading them once and reusing them reduces those repeated memory accesses.

Skill for Claude CodeCodex

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

Good fit Use it for irregular index-based writes where the same index data is accessed multiple times inside a loop.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-index-put"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-index-put.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 649 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.00073 $0.00649
Opus 5 $0.00036 $0.00324
Sonnet 5 $0.00015 $0.00130
Haiku 4.5 $0.00007 $0.00065

Measured 12d ago against content hash ad962172062c, 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-index-put 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 12d 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-index-put/SKILL.md · 57 lines

What it actually says

Index Put 索引赋值优化案例

任务特征

  • 操作类型:索引赋值,根据索引映射将数据写入目标缓冲区
  • 数据尺寸:输入分数(16384, 4),组缓冲区(8, 65536)
  • 特点:不规则内存访问,需逐元素处理以避免写冲突

优化:批量加载 + 数据复用

错误:简单方式:循环内重复加载

for i in tl.range(0, BLOCK_SIZE):
    if start_idx + i < total_elements:
        # 每次循环都从全局内存加载索引
        unit_idx = tl.load(unit_indices_ptr + start_idx + i)
        pos_idx = tl.load(position_map_ptr + start_idx + i)

问题:每次循环都访问全局内存,延迟高,效率低。

正确:优化方式:批量加载到UB,循环内复用

# 循环外:批量加载一片索引数据到UB(统一缓冲区)
unit_indices_tile = tl.load(unit_indices_ptr + offsets, mask=mask, other=0)
position_map_tile = tl.load(position_map_ptr + offsets, mask=mask, other=0)

# 循环内:通过get_element从UB中取数,复用数据
for i in tl.range(0, BLOCK_SIZE):
    if start_idx + i < total_elements:
        # 从UB中取数,避免重复访问全局内存
        unit_idx = tl.get_element(unit_indices_tile, [i])
        pos_idx = tl.get_element(position_map_tile, [i])
        # 后续处理...

优化内容

  • 在循环外,通过一次tl.load操作将整个BLOCK_SIZE的索引数据批量加载到UB
  • 在循环内,通过tl.get_element从UB中逐个取出索引值
  • 将多次全局内存访问转换为一次批量加载+多次片上缓存访问
  • 显著降低内存访问延迟

总结

[通用优化] 当需要在循环中多次访问同一片数据时,应先批量加载到片上缓存(UB),然后通过get_element逐个取用,实现数据复用,减少全局内存访问次数,提升性能。

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. 12d ago First seen · 57 lines · 73 tokens per session scan A ad962172062c

Subscribe to this mod's changes

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

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

HA Integration Dev

Home Assistant custom integration development in Python. Covers customcomponents, DataUpdateCoordinator, configflow, OAuth2, conversation agent, HACS publishing, device registry, entity platforms, services, repair issues, diagnostics, Bluetooth integrations, and multi-coordinator patterns.

tonylofgren/aurora-smart-home · 55 tokens

xpu-port

Execute a single-target CUDA-to-XPU port of a PyTorch repo with libcst-based scan, mechanical rewrite, and CPU FP64 vs target-dtype correctness verify on one forward pass. Use when the request says "port" — "port my repo to XPU", "port my repo at to XPU", "rewrite the CUDA calls to XPU", "apply the mechanical…

intel/gpu-ai-skills · 193 tokens

triton-lang

Triton language skill for Python GPU kernel authoring. Use when writing Triton kernels with @triton.jit, tl.load/store, masking, atomics, benchmarking with triton.testing, or integrating kernels into PyTorch. Activates on queries about Triton, tl.constexpr, block pointers, Triton benchmarking, or PyTorch custom ops.

mohitmishra786/low-level-dev-skills · 76 tokens

pywayne-cv-camera-model

Camera model wrapper for cameramodels C++ library via pybind11. Use when working with pywayne.cv.cameramodel module to load camera models from YAML configuration files, access camera properties (model type, image size, parameters), perform projection operations (liftprojective, spacetoplane), and export camera…

wangyendt/wayne-skills · 71 tokens