triton-ascend-error-fix

triton-ascend-error-fix is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 57 tokens per session (1,955 once invoked), scanned A, original, Apache-2.0.

A troubleshooting guide for common Triton Ascend kernel failures, including on-chip memory overflow and compiler errors caused by complex masks or addresses.

In plain words
What is it for?
Use it to diagnose UB or CBUF overflow, simplify pointer calculations, and replace mask expressions that trigger Ascend compiler errors.
Why use it?
It gives safer starting block sizes and simpler code patterns for kernels that exceed hardware storage or fail during backend compilation.

Skill for Claude CodeCodex

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

Good fit Use it to diagnose UB or CBUF overflow, simplify pointer calculations, and replace mask expressions that trigger Ascend compiler errors.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-error-fix"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-error-fix.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,955 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.00057 $0.01955
Opus 5 $0.00028 $0.00978
Sonnet 5 $0.00011 $0.00391
Haiku 4.5 $0.00006 $0.00196

Measured 9d ago against content hash ff500f9a4e89, 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-error-fix 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 9d 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/evolved-fix/triton-ascend-error-fix/SKILL.md · 191 lines

How it starts

The opening of the file, as written. The whole thing — 191 lines — stays where its author put it; the contents beside it link to each section on GitHub.

1. UB / CBUF 溢出

  • 报错特征: cbuf overflow
  • 根因: 分块参数(BLOCK_M/N/K)过大,超出 Ascend UB 容量
  • 修复: 减小分块参数,通常 BLOCK_M=64, BLOCK_N=128 是安全起点
# 错误:分块过大导致 UB overflow
BLOCK_M, BLOCK_N, BLOCK_K = 128, 256, 256

# 修复:安全起始点
# CUBE (matmul fp16): BLOCK_M=64, BLOCK_N=64, BLOCK_K=32
# CUBE (matmul fp32): BLOCK_M=32, BLOCK_N=32, BLOCK_K=32
# VEC (elementwise):  BLOCK_SIZE=1024~2048
BLOCK_M, BLOCK_N, BLOCK_K = 64, 64, 32

4D tensor 矩阵乘法中 batch 维度额外占用 UB 空间,建议将 batch 展开到 grid 维度而非内层循环。

2. BiShengIR / HiVM 编译失败

  • 报错特征: hivm.hir.vsel: Unsupported op for finding the root allocFailed to run BiShengHIR pipeline
  • 根因: 编译器后端不支持复杂的 mask 组合或指针运算模式

2a. 内联地址计算过于复杂

# 错误
tl.store(c_ptr + off_m[:, None] * stride_cm + off_n[None, :] * stride_cn, acc, mask=mask)

# 修复:拆分为中间变量
c_ptrs = c_ptr + off_m[:, None] * stride_cm + off_n[None, :] * stride_cn
tl.store(c_ptrs, acc, mask=mask)

2b. tl.where + 复杂 mask 导致 vsel 错误

# 错误:嵌套 mask + tl.where 触发 hivm.hir.vsel 错误
a_tri_mask = a_offsets_k[None, :] >= a_offsets_m[:, None]
a_valid_mask = a_mask_m & a_mask_k
a = tl.where(a_tri_mask & a_valid_mask, a, 0.0)

# 修复:改用乘法替代 tl.where(将 bool mask 转为 float 后相乘)
a_tri_mask = (a_offsets_k[None, :] >= a_offsets_m[:, None]).to(tl.float16)
a_valid_mask = (a_mask_m).to(tl.float16) * (a_mask_k).to(tl.float16)
a = a * a_tri_mask * a_valid_mask

3. Triton 语法限制违反

3a. 禁止 continue / break / return

# 错误:unsupported AST node type: Continue
for i in range(N):
    if condition:
        continue
    do_work()

# 修复:用 if-else 包裹
for i in range(N):
    if not condition:
        do_work()

3b. constexpr 索引错误

# 错误:ValueError('unsupported tensor index: constexpr[0]')
result = tl.sum(data, axis=0)
tl.atomic_add(out_ptr, result[0])

# 修复:tl.sum 已返回标量,直接使用
result = tl.sum(data, axis=0)
tl.atomic_add(out_ptr, result)

3c. tensor.cast 类型不兼容

# 错误:cast incompatible shapes
result = tl.dot(a_fp16, b_fp16)

# 修复:显式指定 fp32 累加器
result = tl.dot(a_fp16, b_fp16, acc=tl.zeros([M, N], dtype=tl.float32))

Read the full file on GitHub · 191 lines

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. 9d ago First seen · 191 lines · 57 tokens per session scan A ff500f9a4e89

Subscribe to this mod's changes

triton-ascend-error-fix is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 57 tokens to every session and 1,955 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-09-03.