triton-ascend-ascend-hardware-constraints

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

A reference for Ascend hardware limits and compiler restrictions that affect Triton kernels. It explains storage areas such as UB and L0 memory, which hold data during vector and matrix operations.

In plain words
What is it for?
Use it when selecting matrix tiles or vector block sizes, diagnosing compiler crashes, and reviewing memory access patterns for Ascend kernels.
Why use it?
It helps prevent memory-overflow and compiler failures by connecting tile sizes, data types, access patterns, and loop bounds to the device's limits.

Skill for Claude CodeCodex

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

Good fit Use it when selecting matrix tiles or vector block sizes, diagnosing compiler crashes, and reviewing memory access patterns for Ascend kernels.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-ascend-hardware-constraints"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-ascend-hardware-constraints.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,205 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.00079 $0.01205
Opus 5 $0.00039 $0.00602
Sonnet 5 $0.00016 $0.00241
Haiku 4.5 $0.00008 $0.00120

Measured 9d ago against content hash 3f1edab7057d, 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-ascend-hardware-constraints 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/fundamentals/triton-ascend-ascend-hardware-constraints/SKILL.md · 92 lines

How it starts

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

Ascend 硬件约束与编译器限制

不同型号的硬件具体容量不同,算子生成时会同步传入硬件信息文档,以下公式中的容量值请参考该文档。

1. 存储层级预算

CUBE 路径(matmul / tl.dot)

Matmul 数据走 L0A/L0B/L0C,不经过 UB

缓冲区 用途 约束公式
L0A 左矩阵 A tile (m0 × k0) m0 × k0 × sizeof(A.dtype) ≤ L0A容量
L0B 右矩阵 B tile (k0 × n0) k0 × n0 × sizeof(B.dtype) ≤ L0B容量
L0C 结果 C tile (m0 × n0),支持累加 m0 × n0 × sizeof(C.dtype) ≤ L0C容量

计算示例(以某硬件 L0A = 64KB 为例):

  • fp16(2 字节/元素):可容纳 32K 个元素 → BLOCK_M=128, BLOCK_K=256 恰好填满
  • fp32(4 字节/元素):可容纳 16K 个元素 → BLOCK_M=128, BLOCK_K=128 恰好填满

选择 tile 尺寸时,确保三个缓冲区都不超限。fp32 占用是 fp16 的 2 倍,需相应缩小 tile。

VEC 路径(element-wise / reduce / norm)

向量运算数据走 UB:

缓冲区 用途 约束公式
UB 所有活跃 tensor 和中间变量 BLOCK_SIZE × sizeof(dtype) × 活跃tensor数 × multi_buffer系数 ≤ UB容量

编译器启用 auto-multi-buffer 后,实际占用约为基础量的 2~3 倍。kernel 中的中间变量(如 tl.where 产生的临时缓冲)也占用 UB,实际占用会显著高于 BLOCK_SIZE × sizeof(dtype) × 输入数

tile 选择策略:从较大 BLOCK_SIZE 开始尝试,遇到 ub overflow 编译错误时逐级缩小。

2. bishengIR 编译器已知限制

2.1 range() 边界不可混用运行时变量

# 编译器崩溃(bishengIR SIGABRT)
for k in range(start_n, start_m + BLOCK, BLOCK_K):
    ...

start_nstart_m 是运行时值,BLOCKBLOCK_Ktl.constexpr。这种混合用法会导致编译器内部错误。

规避方案:使用全 constexpr 的 range,在循环体内用运行时 if 跳过无效迭代:

for k in range(0, N, BLOCK_K):  # N 和 BLOCK_K 都是 constexpr
    # 可选:运行时条件跳过无效块
    ...

2.2 复杂 mask + tl.where 导致 HiVM 错误

当嵌套 mask 组合传入 tl.where 时,编译器后端可能报 hivm.hir.vsel: Unsupported op for finding the root alloc

规避方案:用乘法替代 tl.where,将 bool mask 转为 float 后与数据相乘:

# 触发 hivm.hir.vsel 错误
a = tl.where(tri_mask & bounds_mask, a, 0.0)

# 规避:mask 转 float 后相乘
a = a * tri_mask.to(tl.float16) * bounds_mask.to(tl.float16)

2.3 其他编译器限制

详见 debugging 文档中的「禁止使用的语法」完整列表。

3. Strided memory access 的性能代价

Ascend 硬件对非连续内存访问有显著性能惩罚。当 kernel 的核心路径包含 stride > 1 的内存访问模式(如 pooling 的滑窗、dilated convolution 的间隔采样),Triton 生成的代码需要逐元素或小块 gather,而 CANN 原生算子可能使用硬件数据搬运单元(MTE)的专用模式,性能差距可达数十倍。

Read the full file on GitHub · 92 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 · 92 lines · 79 tokens per session scan A 3f1edab7057d

Subscribe to this mod's changes

triton-ascend-ascend-hardware-constraints 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 1,205 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-09-03.

Related

Other skills, from other repositories

spark-environment-setup

Set up a working ML training/inference environment on NVIDIA DGX Spark (GB10, aarch64, CUDA 13). Use when installing PyTorch/Unsloth/TRL/vLLM on DGX Spark, hitting libcudart or wheel-ABI errors on aarch64, or choosing between NGC containers and bare pip installs.

wshobson/agents · 76 tokens

spark-memory-thermal-ops

Manage unified memory and thermals during long-running ML jobs on NVIDIA DGX Spark. Use when planning memory headroom for a training run on GB10, when a job OOMs on unified memory, or when monitoring temperature and power during multi-hour training.

wshobson/agents · 59 tokens

spark-training-gotchas

Preflight and diagnose the ten known failure modes for ML training on NVIDIA DGX Spark. Use when a training run on DGX Spark fails to start, OOMs below the 128GB limit, slows down mid-run, or before any multi-hour training job on GB10.

wshobson/agents · 63 tokens

llama-cpp

Runs LLM inference on CPU, Apple Silicon, and consumer GPUs without NVIDIA hardware. Use for edge deployment, M1/M2/M3 Macs, AMD/Intel GPUs, or when CUDA is unavailable. Supports GGUF quantization (1.5-8 bit) for reduced memory and 4-10× speedup vs PyTorch on CPU.

davila7/claude-code-templates · 76 tokens

minicpm5-deploy-vllm-ascend

Deploy MiniCPM5-2B with vLLM on Huawei Ascend NPU using vLLM-Ascend. Use when the user mentions vLLM-Ascend, Ascend NPU, Huawei Ascend, CANN, torchnpu, davinci devices, or wants an OpenAI-compatible MiniCPM5 server on Ascend hardware.

OpenBMB/MiniCPM · 87 tokens

minicpm5-deploy-litert

Run MiniCPM5-2B or MiniCPM5-1B on-device with Google's LiteRT-LM runtime — the litert-lm CLI or its OpenAI-compatible server on a desktop, the Kotlin API or the AI Edge Gallery app on Android, the same .litertlm bundle on CPU or GPU. Use when the user says "LiteRT", "LiteRT-LM", "litertlm", ".litertlm", "Android"…

OpenBMB/MiniCPM · 121 tokens