triton-ascend-case-elemwise-concat

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

An optimization pattern that combines several slice operations and a concatenation into one kernel. Slicing selects part of a tensor, while concatenation joins those parts together.

In plain words
What is it for?
Use it for fused Triton operations that take slices from multiple tensors and join them along one dimension on Ascend hardware.
Why use it?
Reading whole inputs and storing intermediate slices causes unnecessary memory traffic. Loading only needed sections and calculating output positions avoids extra intermediate results.

Skill for Claude CodeCodex

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

Good fit Use it for fused Triton operations that take slices from multiple tensors and join them along one dimension on Ascend hardware.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-elemwise-concat"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-elemwise-concat.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 880 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.00880
Opus 5 $0.00036 $0.00440
Sonnet 5 $0.00015 $0.00176
Haiku 4.5 $0.00007 $0.00088

Measured 11d ago against content hash 763157736a1c, 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-concat 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-concat/SKILL.md · 65 lines

What it actually says

Slice + Concat 融合算子优化案例

任务特征

  • 操作类型:融合算子,6个slice + 1个concat融合在一个kernel中
  • 数据尺寸:7个大小为(128, 50, 128)的输入,切片[128, 32, 48, 48, 48, 48, 48]后在W维度拼接,输出(128, 50, 400)
  • 任务特点:算子融合,避免中间结果的存储和多次内存访问

优化 1:精确切片加载

# 只load需要的切片部分,而不是整个输入
# Input 1: 只load前128个元素
w_offs_1 = tl.arange(0, SLICE_1)  # SLICE_1=128
input_offs = base_in_offs + w_offs_1[None, None, :] * stride_in_w
data = tl.load(x1_ptr + input_offs, mask=mask_1, other=0.0)

# Input 2: 只load前32个元素
w_offs_2 = tl.arange(0, SLICE_2)  # SLICE_2=32
input_offs = base_in_offs + w_offs_2[None, None, :] * stride_in_w
data = tl.load(x2_ptr + input_offs, mask=mask_2, other=0.0)

优化内容

  • 在kernel内部只load每个输入需要的切片部分(如128、32、48)
  • 通过 w_offs = tl.arange(0, SLICE_SIZE) 精确控制load的元素数量
  • 减少不必要的内存访问,提高内存带宽利用率

优化 2:索引计算实现拼接

# 通过调整输出索引实现拼接,而非使用triton的cat指令
w_out_offset = 0

# Input 1写入位置: output[0:128]
output_offs = base_out_offs + (w_out_offset + w_offs_1)[None, None, :] * stride_out_w
tl.store(output_ptr + output_offs, data, mask=mask_1)
w_out_offset += SLICE_1  # 更新为128

# Input 2写入位置: output[128:160]
output_offs = base_out_offs + (w_out_offset + w_offs_2)[None, None, :] * stride_out_w
tl.store(output_ptr + output_offs, data, mask=mask_2)
w_out_offset += SLICE_2  # 更新为160

优化内容

  • 通过维护输出偏移量(w_out_offset)并动态调整输出地址索引,将不同输入的数据写入到输出的不同位置
  • 避免使用triton的cat指令,直接通过地址计算完成拼接
  • 减少中间步骤和额外的数据搬运开销

总结

  1. 对于concat操作,应在kernel内精确load需要的切片部分,避免load完整数据后再切片
  2. 可通过索引计算直接将数据store到目标位置实现拼接,无需使用额外的cat指令
  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. 11d ago First seen · 65 lines · 73 tokens per session scan A 763157736a1c

Subscribe to this mod's changes

triton-ascend-case-elemwise-concat 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 880 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

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

pypto-case-matvec

A matrix–vector multiplication workaround for cases where K is greater than 65,535. It replaces matrix multiplication with element-by-element multiplication followed by summing.

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

triton-ascend-case-reduction-mean-medium

A guide to optimizing medium-sized mean operations that reduce values along the first axis of a tensor.

wenyi-li/awesome-agent-kernel-skills · 82 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

instrument-data-to-allotrope

Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV. Use this skill when scientists need to standardize instrument data for LIMS systems, data lakes, or downstream analysis. Supports auto-detection of instrument types. Outputs include full…

anthropics/knowledge-work-plugins · 123 tokens

exploratory-data-analysis

Perform bounded, local exploratory analysis of explicitly supported scientific files. Use for redacted CSV/TSV/JSON profiles; optional NumPy, HDF5, FASTA/FASTQ, and basic image metadata inspection; missingness/leakage audits; outlier and transformation sensitivity; and rigorous EDA report scaffolds. Other domain…

K-Dense-AI/scientific-agent-skills · 83 tokens