Agent skill

Build Triton Ascend Vector Add

by Krusty84 in Krusty84/triton-ascend-agent-dev-kit

Build and debug masked one-dimensional elementwise kernels for Triton-Ascend, including launch wrappers and PyTorch/NPU correctness checks.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Build Triton Ascend Vector Add

skills CLI
$ npx skills add Krusty84/triton-ascend-agent-dev-kit --skill build-triton-ascend-vector-add -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Krusty84/triton-ascend-agent-dev-kit build-triton-ascend-vector-add --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Krusty84/triton-ascend-agent-dev-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/build-triton-ascend-vector-add .claude/skills/build-triton-ascend-vector-add && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
build-triton-ascend-vector-add
GitHub stars
106
Token cost
~584 tokens
SKILL.md length
176 words
Files
1
Skills in repo
23
Repo updated
First seen
Licence
Apache-2.0

At a glance

Build and debug masked one-dimensional elementwise kernels for Triton-Ascend, including launch wrappers and PyTorch/NPU correctness checks.

  • Works in 5 steps: Require both inputs to have the same… → Allocate the output with… → Assign one contiguous block to each… → …
  • An agent needs a minimal Triton-Ascend kernel scaffold
  • SKILL.md covers Goal, Workflow, Implementation Pattern and Ascend Guardrails, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Build Triton Ascend Vector Add is an agent skill from Krusty84/triton-ascend-agent-dev-kit. Build and debug masked one-dimensional elementwise kernels for Triton-Ascend, including launch wrappers and PyTorch/NPU correctness checks. Use when an agent needs a minimal Triton-Ascend kernel scaffold or must apply program IDs, pointer offsets, tail masks, constexpr block sizes, and launch grids to vector operations.

Its SKILL.md is about 580 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Deep learning. It works with PyTorch. The repository describes itself as: A toolkit for AI agents used for development on Triton-Ascend for Ascend NPU. The licence is Apache-2.0.

When your agent uses it

  • An agent needs a minimal Triton-Ascend kernel scaffold
  • Must apply program IDs
  • Pointer offsets
  • Constexpr block sizes

Example prompts

  • “/build-triton-ascend-vector-add”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Require both inputs to have the same shape, dtype, device, and supported layout.
  2. Allocate the output with torch.empty_like and use output.numel() as the logical length.
  3. Assign one contiguous block to each Triton program.
  4. Mask every load and store so non-divisible tail elements never access invalid memory.
  5. Derive the launch grid from the selected BLOCK_SIZE.

What it can do on your machine

Read from SKILL.md and the folder at commit 4ab5ee7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Build Triton Ascend Vector Add loads about 584 tokens when it runs. Until then it costs about 88 tokens; SKILL.md has 176 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~584

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Krusty84/triton-ascend-agent-dev-kit at commit 4ab5ee7, republished under its Apache-2.0 licence (© Krusty84). 176 words, ~584 tokens.

Download SKILL.mdSave it as .claude/skills/build-triton-ascend-vector-add/SKILL.md (or your agent's skills folder).
name
build-triton-ascend-vector-add
description
Build and debug masked one-dimensional elementwise kernels for Triton-Ascend, including launch wrappers and PyTorch/NPU correctness checks. Use when an agent needs a minimal Triton-Ascend kernel scaffold or must apply program IDs, pointer offsets, tail masks, constexpr block sizes, and launch grids to vector operations.

Build Triton-Ascend Vector Add

Goal

Implement a standalone NPU kernel that computes elementwise addition for arbitrary tensor lengths. Reuse the same pattern for other one-dimensional elementwise operations.

Workflow

  1. Require both inputs to have the same shape, dtype, device, and supported layout.
  2. Allocate the output with torch.empty_like and use output.numel() as the logical length.
  3. Assign one contiguous block to each Triton program.
  4. Mask every load and store so non-divisible tail elements never access invalid memory.
  5. Derive the launch grid from the selected BLOCK_SIZE.

Implementation Pattern

python
@triton.jit
def add_kernel(x_ptr, y_ptr, out_ptr, n_elements, BLOCK_SIZE: tl.constexpr):
    pid = tl.program_id(0)
    offsets = pid * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
    mask = offsets < n_elements
    x = tl.load(x_ptr + offsets, mask=mask, other=0.0)
    y = tl.load(y_ptr + offsets, mask=mask, other=0.0)
    tl.store(out_ptr + offsets, x + y, mask=mask)


def add(x, y):
    assert x.shape == y.shape and x.dtype == y.dtype and x.device == y.device
    out = torch.empty_like(x)
    n = out.numel()
    grid = lambda meta: (triton.cdiv(n, meta["BLOCK_SIZE"]),)
    add_kernel[grid](x, y, out, n, BLOCK_SIZE=1024)
    return out

Ascend Guardrails

  • Import torch_npu before executing on device="npu".
  • Treat BLOCK_SIZE as a compile-time meta-parameter and pass it by keyword.
  • Use flat addressing only for contiguous tensors. Call contiguous() explicitly or implement stride-aware addressing for non-contiguous inputs.
  • Keep the same tail mask on corresponding loads and stores.
  • Start with BLOCK_SIZE=1024, then tune only when representative benchmarks justify it.

Verification

Compare against x + y with torch.testing.assert_close. Include at least one length that is not divisible by BLOCK_SIZE, an empty-or-minimal supported length, and every dtype the operator claims to support.

© Krusty84, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/build-triton-ascend-vector-add of Krusty84/triton-ascend-agent-dev-kit.

Open the folder on GitHubat commit 4ab5ee7

Compare with similar skills

Build Triton Ascend Vector Add next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Build Triton Ascend Vector Add compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Build Triton Ascend Vector Add this skillKrusty84/triton-ascend-agent-dev-kit106—~584Automated safety check: PassApache-2.0
Add Uint Supportpytorch/pytorch104k2 repos~2.3kAutomated safety check: PassCustom licence
CLIP Image-Text MatchingOrchestra-Research/AI-Research-SKILLs13k7 repos~1.7kAutomated safety check: PassMIT
Add Torch Shapes Examplefacebook/pyrefly7.1k—~1.3kAutomated safety check: PassMIT
MUSA GPU Training Optimizeropen-infra-skills/infra-skills141—~1.7kAutomated safety check: PassApache-2.0
Ghstack CIpytorch/pytorch104k—~1.4kAutomated safety check: PassCustom licence

Similar skills

  • Add Uint Support

    pytorch/pytorch

    Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.

    104k GitHub starsUsed in 2 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • CLIP Image-Text Matching

    Orchestra-Research/AI-Research-SKILLs

    Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

    13k GitHub starsUsed in 7 repos~1.7k tokens
    AI & LLM EngineeringAuto-check passed
  • Add Torch Shapes Example

    facebook/pyrefly

    Official

    A skill your agent uses when adding a new PyTorch model to Pyrefly's shape-tracking example corpus under tensor-shapes/pyrefly-torch-stubs/examples — i.e.

    7.1k GitHub stars~1.3k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • MUSA GPU Training Optimizer

    open-infra-skills/infra-skills

    Profiles, benchmarks and tunes AI training workloads on Moore Threads MUSA GPUs with a measurement-first process that keeps model behavior unchanged.

    141 GitHub stars~1.7k tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Ghstack CI

    pytorch/pytorch

    Manage CI for PyTorch ghstack stacks by running CI where its results are useful now and deferring other PRs with [no-ci].

    104k GitHub stars~1.4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Depth Estimation

    SharpAI/DeepCamera

    Real-time depth map privacy transforms using Depth Anything v2 (CoreML + PyTorch)

    3.1k GitHub stars~945 tokensUpdated 24 days ago
    AI & LLM EngineeringAuto-check passed

More from Krusty84/triton-ascend-agent-dev-kit

All 23 skills in this repo
  • Triton-Ascend Token Pool Assignment

    Krusty84/triton-ascend-agent-dev-kit

    Implements request-to-token-pool copies for Triton kernels on Ascend NPUs, replacing loop-carried vector offsets with fixed-offset block loops that compile reliably.

    106 GitHub stars~564 tokensUpdated 1 mo ago
    Auto-check passed
  • Triton-Ascend Batch Token Reorder

    Krusty84/triton-ascend-agent-dev-kit

    Writes a Triton kernel pattern for Ascend NPU that gathers several indexed token rows per program into an on-chip buffer and stores one contiguous output tile, for MoE-style token reordering.

    106 GitHub stars~597 tokensUpdated 1 mo ago
    Auto-check passed
  • Triton-Ascend Binned MoE Routing

    Krusty84/triton-ascend-agent-dev-kit

    Builds Triton-Ascend kernels that pack sorted token assignments into fixed expert-capacity tensors, restore top-k outputs and compute router-weight gradients on Ascend NPUs.

    106 GitHub stars~662 tokensUpdated 1 mo ago
    Auto-check passed
  • Triton-Ascend Fused Attention

    Krusty84/triton-ascend-agent-dev-kit

    Guides building a FlashAttention-v2-style fused forward attention kernel for Triton-Ascend on Ascend NPU, with online softmax, causal staging and float32 accumulation.

    106 GitHub stars~753 tokensUpdated 1 mo ago
    Auto-check passed
  • Triton-Ascend Fused Softmax

    Krusty84/triton-ascend-agent-dev-kit

    Builds a fused row-wise softmax kernel for Triton-Ascend that reads and writes each row once, handling padding, strides and masked loads on Ascend NPUs.

    106 GitHub stars~636 tokensUpdated 1 mo ago
    Auto-check passed
  • Build Triton Ascend Layer Norm

    Krusty84/triton-ascend-agent-dev-kit

    Build a fused forward LayerNorm kernel for Triton-Ascend with row-wise mean and variance reductions, float32 accumulation, affine weight and bias, and masked feature tiles.

    106 GitHub stars~659 tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Build Triton Ascend Vector Add

What does Build Triton Ascend Vector Add do?

Build and debug masked one-dimensional elementwise kernels for Triton-Ascend, including launch wrappers and PyTorch/NPU correctness checks. Build Triton Ascend Vector Add is an agent skill from Krusty84/triton-ascend-agent-dev-kit. Build and debug masked one-dimensional elementwise kernels for Triton-Ascend, including launch wrappers and PyTorch/NPU correctness checks.

When should I use Build Triton Ascend Vector Add?

Build Triton Ascend Vector Add fits situations like: an agent needs a minimal Triton-Ascend kernel scaffold; must apply program IDs; pointer offsets; constexpr block sizes.

How do I install Build Triton Ascend Vector Add in Claude Code?

Run `npx skills add Krusty84/triton-ascend-agent-dev-kit --skill build-triton-ascend-vector-add -a claude-code`. Or copy the skill folder (skills/build-triton-ascend-vector-add in Krusty84/triton-ascend-agent-dev-kit) into .claude/skills/build-triton-ascend-vector-add in your project. Claude Code loads it when a task matches its description.

How do I install Build Triton Ascend Vector Add in Codex?

Run `npx skills add Krusty84/triton-ascend-agent-dev-kit --skill build-triton-ascend-vector-add -a codex`. Or copy the skill folder (skills/build-triton-ascend-vector-add in Krusty84/triton-ascend-agent-dev-kit) into .agents/skills/build-triton-ascend-vector-add in your project. Codex loads it when a task matches its description.

Can I use Build Triton Ascend Vector Add in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Krusty84/triton-ascend-agent-dev-kit --skill build-triton-ascend-vector-add -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/build-triton-ascend-vector-add, .gemini/skills/build-triton-ascend-vector-add, .github/skills/build-triton-ascend-vector-add and .opencode/skills/build-triton-ascend-vector-add in your project.

What does Build Triton Ascend Vector Add need to run?

SKILL.md names no scripts, command-line tools or credentials: Build Triton Ascend Vector Add is instructions for the agent only. Our summary lists: Python 3.

Does Build Triton Ascend Vector Add access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Build Triton Ascend Vector Add safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Build Triton Ascend Vector Add use?

Build Triton Ascend Vector Add is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Build Triton Ascend Vector Add use?

About 584 tokens (SKILL.md is roughly 2.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Build Triton Ascend Vector Add?

Skills that share tags, products or a category with Build Triton Ascend Vector Add: Add Uint Support (pytorch/pytorch, 104k stars), CLIP Image-Text Matching (Orchestra-Research/AI-Research-SKILLs, 13k stars), Add Torch Shapes Example (facebook/pyrefly, 7.1k stars) and MUSA GPU Training Optimizer (open-infra-skills/infra-skills, 141 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Build Triton Ascend Vector Add?

Krusty84 (a GitHub user) maintains it in Krusty84/triton-ascend-agent-dev-kit, which has 106 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on August 15, 2026.

Source: Krusty84/triton-ascend-agent-dev-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.