triton-ascend-example-matmul

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

A complete example of tiled matrix multiplication in Triton for Ascend hardware. Matrix multiplication combines rows and columns of number tables and is used throughout machine learning.

In plain words
What is it for?
Use it when generating or adapting matrix-multiplication kernels with 2D blocks, tiled memory access, and Ascend compute cores.
Why use it?
It gives a reference for splitting large matrices into smaller blocks, handling edges with masks, and repeatedly accumulating across the shared dimension.

Skill for Claude CodeCodex

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

Good fit Use it when generating or adapting matrix-multiplication kernels with 2D blocks, tiled memory access, and Ascend compute cores.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-example-matmul"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-example-matmul.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 935 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.00935
Opus 5.5 $0.00029 $0.00374
Sonnet 5.5 $0.00015 $0.00187
Haiku 4.5 $0.00007 $0.00093

Measured 2mo ago against content hash 55ad24f54eaa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

triton-ascend-example-matmul 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 2mo 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/examples/triton-ascend-example-matmul/SKILL.md · 91 lines

What it actually says

矩阵乘法 — Triton Ascend 实现示例

import torch
import triton
import triton.language as tl


@triton.jit
def matmul_kernel(
    a_ptr, b_ptr, c_ptr,
    M, N, K,
    stride_am, stride_ak,
    stride_bk, stride_bn,
    stride_cm, stride_cn,
    CORE_NUM: tl.constexpr,
    BLOCK_M: tl.constexpr, BLOCK_K: tl.constexpr, BLOCK_N: tl.constexpr,
):
    NUM_BLOCKS_M = tl.cdiv(M, BLOCK_M)
    NUM_BLOCKS_N = tl.cdiv(N, BLOCK_N)
    NUM_BLOCKS = NUM_BLOCKS_M * NUM_BLOCKS_N
    pid = tl.program_id(0)

    for block_idx in range(pid, NUM_BLOCKS, CORE_NUM):
        bm = block_idx // NUM_BLOCKS_N
        bn = block_idx % NUM_BLOCKS_N
        acc = tl.zeros((BLOCK_M, BLOCK_N), dtype=tl.float32)

        for k in range(0, K, BLOCK_K):
            a_off_m = bm * BLOCK_M + tl.arange(0, BLOCK_M)
            a_off_k = k + tl.arange(0, BLOCK_K)
            a_mask = (a_off_m < M)[:, None] & (a_off_k < K)[None, :]
            a = tl.load(a_ptr + a_off_m[:, None] * stride_am
                        + a_off_k[None, :] * stride_ak,
                        mask=a_mask, other=0.0)

            b_off_k = k + tl.arange(0, BLOCK_K)
            b_off_n = bn * BLOCK_N + tl.arange(0, BLOCK_N)
            b_mask = (b_off_k < K)[:, None] & (b_off_n < N)[None, :]
            b = tl.load(b_ptr + b_off_k[:, None] * stride_bk
                        + b_off_n[None, :] * stride_bn,
                        mask=b_mask, other=0.0)
            acc += tl.dot(a, b)

        c_off_m = bm * BLOCK_M + tl.arange(0, BLOCK_M)
        c_off_n = bn * BLOCK_N + tl.arange(0, BLOCK_N)
        c_mask = (c_off_m < M)[:, None] & (c_off_n < N)[None, :]
        tl.store(c_ptr + c_off_m[:, None] * stride_cm
                 + c_off_n[None, :] * stride_cn,
                 acc, mask=c_mask)


class ModelNew(torch.nn.Module):
    def __init__(self):
        super().__init__()
        try:
            self.CUBE_CORE_NUM = torch_npu.npu.npu_config.get_device_limit(0).get("cube_core_num", 20)
        except:
            self.CUBE_CORE_NUM = 20

    def forward(self, A, B):
        if not A.is_contiguous():
            A = A.contiguous()
        if not B.is_contiguous():
            B = B.contiguous()
        M, K = A.shape
        _, N = B.shape
        C = torch.empty((M, N), dtype=torch.float32, device=A.device)
        BLOCK_M, BLOCK_K, BLOCK_N = 128, 256, 128
        grid = (self.CUBE_CORE_NUM,)
        matmul_kernel[grid](
            A, B, C, M, N, K,
            A.stride(0), A.stride(1), B.stride(0), B.stride(1),
            C.stride(0), C.stride(1),
            CORE_NUM=self.CUBE_CORE_NUM,
            BLOCK_M=BLOCK_M, BLOCK_K=BLOCK_K, BLOCK_N=BLOCK_N)
        return C
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. 2mo ago First seen · 91 lines · 73 tokens per session scan A 55ad24f54eaa

Subscribe to this mod's changes

triton-ascend-example-matmul is a skill published in the GitHub repository mindspore-ai/akg (266 stars, last pushed 2d ago), licensed Apache-2.0. It adds 73 tokens to every session and 935 once invoked, about $0.0003 per session on Opus 5.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

triton-ascend-example-matmul compared with skills from other repositories

triton-ascend-example-matmul next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
triton-ascend-example-matmulmindspore-ai/akgSkill2662d agoApache-2.0A73Claude Code, Codex
triton-ascend-examples-mindsporewenyi-li/awesome-agent-kernel-skillsSkill105mo agononeA75Claude Code, Codex
spark-environment-setupwshobson/agentsSkill43k6d agoMITA76Claude Code
spark-memory-thermal-opswshobson/agentsSkill43k6d agoMITA59Claude Code
spark-training-gotchaswshobson/agentsSkill43k6d agoMITA63Claude Code
inference-serving-llama-cppdavila7/claude-code-templatesSkill34ktodayMITA80Claude Code, Codex
supercomputertrycua/cuaSkill32ktodayMITA0Claude Code, Codex