triton-cuda-api

triton-cuda-api is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 69 tokens per session (2,816 once invoked), scanned A, original, Apache-2.0.

A reference for Triton CUDA's core programming functions and their parameters. It explains how to identify program blocks, load and store memory, reduce values, perform dot products, and use atomic updates.

In plain words
What is it for?
Use it to look up APIs such as tl.load, tl.store, tl.sum, tl.dot, tl.atomic, tl.program_id, and grid-size calculations.
Why use it?
It provides the exact function shapes and argument meanings needed when writing or checking Triton kernels.

Skill for Claude CodeCodex

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

Good fit Use it to look up APIs such as tl.load, tl.store, tl.sum, tl.dot, tl.atomic, tl.program_id, and grid-size calculations.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-cuda-api"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-cuda-api.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,816 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.00069 $0.02816
Opus 5 $0.00034 $0.01408
Sonnet 5 $0.00014 $0.00563
Haiku 4.5 $0.00007 $0.00282

Measured 6d ago against content hash 64c66001e273, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

triton-cuda-api 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 6d 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-cuda/guides/triton-cuda-api/SKILL.md · 316 lines

How it starts

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

Triton CUDA API 参考手册

本文档提供 Triton 核心 API 的详细参考,包括函数签名、参数说明和使用示例。

1. 内核装饰器

@triton.jit

@triton.jit
def kernel_function(...):
    pass
  • 作用: 将 Python 函数编译为 GPU 内核
  • 约束: 函数内部不能使用 returnbreakcontinue 语句

2. 程序 ID 与网格 API

tl.program_id(axis)

pid = tl.program_id(axis)  # axis: 0, 1, or 2
  • 参数: axis - 维度轴 (0, 1, 2)
  • 返回: 当前程序在该轴上的 ID
  • 用途: 确定当前程序块处理的数据范围

tl.num_programs(axis)

num_pids = tl.num_programs(axis)  # axis: 0, 1, or 2
  • 参数: axis - 维度轴 (0, 1, 2)
  • 返回: 该轴上的总程序数
  • 用途: 计算网格大小和边界条件

triton.cdiv(a, b)

grid_size = triton.cdiv(total_elements, block_size)
  • 参数: a, b - 被除数和除数
  • 返回: 向上取整的除法结果
  • 用途: host 侧使用,计算启动网格大小

3. 内存操作 API

tl.load(pointer, mask=None, other=None, boundary_check=None)

data = tl.load(ptr + offsets, mask=mask, other=0.0)
  • 参数:
    • pointer: 内存指针
    • mask: 布尔掩码,True 表示有效位置
    • other: 掩码为 False 时的默认值
    • boundary_check: 边界检查维度 (0, 1) 或 None
  • 返回: 加载的张量数据
  • 用途: 从全局内存加载数据

tl.store(pointer, value, mask=None, boundary_check=None)

tl.store(ptr + offsets, result, mask=mask)
  • 参数:
    • pointer: 内存指针
    • value: 要存储的值
    • mask: 布尔掩码,True 表示有效位置
    • boundary_check: 边界检查维度 (0, 1) 或 None
  • 用途: 将数据存储到全局内存

tl.make_block_ptr(base, shape, strides, offsets, block_shape, order)

block_ptr = tl.make_block_ptr(
    base=ptr,                    # 基础指针
    shape=(M, N),                # 完整矩阵形状
    strides=(stride_m, stride_n), # 步长
    offsets=(start_m, start_n),   # 当前块偏移
    block_shape=(BLOCK_M, BLOCK_N), # 块形状
    order=(1, 0)                 # 内存布局顺序
)
  • 参数:
    • base: 基础内存指针
    • shape: 完整张量的形状
    • strides: 每个维度的步长
    • offsets: 当前块的起始偏移
    • block_shape: 当前块的大小
    • order: 内存布局顺序 (1, 0) 表示行主序
  • 返回: 块指针对象
  • 用途: 高效访问 2D 数据块

tl.advance(ptr, offsets)

block_ptr = tl.advance(block_ptr, (BLOCK_M, 0))
  • 参数:
    • ptr: 块指针
    • offsets: 各维度的偏移量
  • 返回: 移动后的块指针
  • 用途: 移动块指针到下一个位置

Read the full file on GitHub · 316 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. 6d ago First seen · 316 lines · 69 tokens per session scan A 64c66001e273

Subscribe to this mod's changes

triton-cuda-api is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 29d ago), licensed Apache-2.0. It adds 69 tokens to every session and 2,816 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.