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.
npx skills add mindspore-ai/akg --skill triton-ascend-case-elemwise-broadcast-3dgit clone --depth 1 https://github.com/mindspore-ai/akgWrote 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.
[](https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-3d)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-3d"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-3d/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.
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-3d"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-3d.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00078 | $0.00787 |
| Opus 5 | $0.00039 | $0.00394 |
| Sonnet 5 | $0.00016 | $0.00157 |
| Haiku 4.5 | $0.00008 | $0.00079 |
Grade A, and why
triton-ascend-case-elemwise-broadcast-3d 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.
What it actually says
跨轴 3D Broadcast 优化案例
任务特征
- 操作类型:跨轴broadcast,broadcast第一、三根轴
- 数据尺寸:(65536, 128, 16) / (1, 128, 1)
- 特点:第一维很大,第三维很小,属于跨轴broadcast
优化:两阶段 Kernel 策略
当跨轴broadcast中最后一维特别小时(如W=16),如果直接处理会导致向量化效果差。
阶段1:Broadcast Kernel(多核并行)
# 先将(1, H, 1) broadcast到(1, H, W)
input2_broadcast = torch.empty(1, H, W, dtype=input2.dtype, device=input2.device)
grid_broadcast = lambda meta: (meta['NUM_H_CORES'],)
broadcast_kernel_parallel[grid_broadcast](
input2, input2_broadcast,
input2.stride(1),
input2_broadcast.stride(1), input2_broadcast.stride(2),
H=H, W=W,
)
阶段2:Division Kernel(Reshape为2D)
# 将3D问题转换为2D处理
input1_flat = input1.reshape(B, HW).contiguous() # (B, HxW)
input2_flat = input2_broadcast.reshape(1, HW).contiguous() # (1, HxW)
output_flat = torch.empty(B, HW, dtype=input1.dtype, device=input1.device)
grid_div = lambda meta: (meta['NUM_CORES'],)
div_flatten_kernel[grid_div](
input1_flat, input2_flat, output_flat,
B, HW,
input1_flat.stride(0), input1_flat.stride(1),
input2_flat.stride(1),
output_flat.stride(0), output_flat.stride(1),
)
优化内容
- 第一阶段kernel:先将需要broadcast的维度展开,沿H维度映射到多核并行处理
- 第二阶段kernel:将3D reshape为2D,把第一维(B)映射到多核,核内对HW维度切分(SUB_HW=512),向量化维度大大提升
这种方法通过预先broadcast+reshape,避免了最后一维过小导致的向量化效率问题。
通用优化方案
连续broadcast(相邻维度)
通过reshape将相邻维度合并为一维,转换为单轴broadcast。
跨轴broadcast(不相邻维度)
- 第一维映射到多核上实现并行
- 核内对其他维度按需进行切分
总结
当跨轴broadcast中最后一维特别小时,采用两阶段kernel:先broadcast展开+reshape为2D,再进行标准的多核并行处理,提升向量化效率。
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.
- 12d ago First seen · 73 lines · 78 tokens per session scan A 08080ca50969
triton-ascend-case-elemwise-broadcast-3d is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 78 tokens to every session and 787 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.
Other skills, from other repositories
text-transformer
Text encoding, decoding, and transformation utilities - Base64, URL, HTML, hashing, case conversion, and string manipulation.
triton-ascend-case-matmul-large-k
A case study for optimizing matrix multiplication when the shared K dimension is much larger than the output dimensions. It uses Split-K to divide that dimension across cores, then combines the partial results.
triton-ascend-case-reduction-amin-atomic
A case study for optimizing amin reductions with atomic operations when the non-reduced dimension is small and the reduced dimension is very large. An amin reduction finds the smallest value.
triton-ascend-case-index-histogram
A case study for speeding up histogram calculations, which count how many values fall into each group or range.
triton-ascend-case-matmul-swizzle2d
A case study for optimizing matrix multiplication in Triton on Ascend hardware using 2D block swizzling and a fixed number of cores.
triton-ascend-case-elemwise-broadcast-2d
A specialized optimization for 2D broadcast division on Triton, a system for writing GPU computation kernels. It targets cases where one dimension is large and the other is small.