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-2dgit 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-2d)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-2d"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-2d/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-2d"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-case-elemwise-broadcast-2d.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.00079 | $0.00855 |
| Opus 5 | $0.00039 | $0.00428 |
| Sonnet 5 | $0.00016 | $0.00171 |
| Haiku 4.5 | $0.00008 | $0.00085 |
Grade A, and why
triton-ascend-case-elemwise-broadcast-2d 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.
What it actually says
2D Broadcast Division 优化案例
任务特征(两种配置)
配置1:(131072, 16) / (1, 16)
- broadcast第一根轴
- broadcast轴shape大(131072),非broadcast轴shape小(16)
配置2:(2048, 131072) / (2048, 1)
- broadcast第二根轴
- broadcast轴中等(2048),非broadcast轴shape大(131072)
优化 1:小维度完整处理不切分
# N维度较小(N=16),完整处理不切分
offs_n = tl.arange(0, N) # N=16
# divisor所有行共享,在循环外加载一次
divisor = tl.load(divisor_ptr + offs_n) # shape: (N,)
# 内层循环:每次处理SUB_M行
for sub_start in range(row_start, row_end, SUB_M):
offs_m = sub_start + tl.arange(0, SUB_M)
dividend = tl.load(dividend_ptr + dividend_offs, mask=mask_2d, other=0.0)
output = dividend / divisor # divisor广播: (N,) -> (SUB_M, N)
优化内容
- 由于N维度较小(N=16),选择完整处理不切分,最大化UB利用率
- divisor所有行共享,在循环外加载一次,循环内自动广播复用
- 维度大小决定是否切分,而非广播方向
优化 2:Grid切分配置
# NUM_BLOCKS控制核数,SUB_M控制内部每次处理行数
triton.Config({'NUM_BLOCKS': 40, 'SUB_M': 512}), # 8.55us,最优,核数=40,用满物理核
triton.Config({'NUM_BLOCKS': 64, 'SUB_M': 512}), # 9.83us,核数>40,调度开销大
triton.Config({'NUM_BLOCKS': 40, 'SUB_M': 256}), # 9.78us,ub未用满
triton.Config({'NUM_BLOCKS': 40, 'SUB_M': 1024}), # 超ub
grid = lambda meta: (meta['NUM_BLOCKS'],)
优化内容
- 通过grid切分M维度,控制核数≤40
- SUB_M=512时在UB利用率和寄存器压力之间达到平衡
优化 3:通用2D调度方法
对于一般的2D shape,通用调度方法:
- 核间并行(NUM_BLOCKS):沿M维度切分,分配到不同计算核
- 核内行切分(SUB_M):控制每次处理的行数,平衡UB利用率
- 列向量化(BLOCK_N):沿N维度分块加载,实现连续访问和向量化
总结
- 对于较小的维度,应完整处理不切分以最大化UB利用率
- 通过固定NUM_BLOCKS实现核间并行,核内参数切分控制数据粒度
- 可通过autotune参数进行调优
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.
- 11d ago First seen · 71 lines · 79 tokens per session scan A 2afa5ec5c161
triton-ascend-case-elemwise-broadcast-2d is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 79 tokens to every session and 855 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.