triton-ascend-a5-matmul-vector

Guides Cube/Vector fused MatMul kernel optimization on Ascend A5 hardware.

6|1|Updated Apr 19, 2026
One-click install
npx skills add https://github.com/xchang1121/op-autoresearch --skill triton-ascend-a5-matmul-vector-xchang1121
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: triton-ascend-a5-matmul-vector
Source: https://github.com/xchang1121/op-autoresearch/tree/main/skills/triton-ascend/guides/triton-ascend-a5-matmul-vector
Command: npx skills add https://github.com/xchang1121/op-autoresearch --skill triton-ascend-a5-matmul-vector-xchang1121

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing efficient MatMul kernels with fused elementwise post-processing (bias, ReLU, GELU, quantization) on Atlas A5 (Ascend950) hardware requires correct use of Cube/Vector affinity APIs, and mistakes in synchronization or buffer layout cause deadlocks, data corruption, or silent performance regressions. ## Core Features & Use Cases - Two-stage fused-cv scheduling: Provides a proven pattern of one cube scope loop plus one vector scope loop with a single shared UB buffer and paired sync_block_set/wait events. - Dataflow and indexing rules: Covers L0C-to-UB fixpipe with NZ2ND/ROW_SPLIT, sub_vec_id output offsets, and constexpr buffer allocation constraints. - Hard boundary rules: Explicitly forbids affinity APIs for pure MatMul or pure Vector kernels and supplies a recommended plain Triton GEMM template instead. - Use Case: When implementing a Linear + bias + ReLU operator in Triton-Ascend for A5, follow this guide to fuse the post-processing into the GEMM kernel without writing intermediate results back to global memory. ## Quick Start Ask the agent to write a fused MatMul plus ReLU Triton kernel for Ascend A5 following this guide's two-stage Cube/Vector scheduling pattern.

Frequently Asked Questions about triton-ascend-a5-matmul-vector

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fuse MatMul with ReLU or bias in a Triton Ascend kernel?▼

Use a two-stage structure: a cube scope loop that runs tl.dot and pushes results to a UB buffer via al.fixpipe, and a vector scope loop that reads the buffer with bl.to_tensor, applies the post-processing, and stores to GM. Pair the stages with sync_block_set/wait events.

When should I use Ascend A5 affinity APIs like al.fixpipe?▼

Use affinity APIs only for CV-fused kernels that combine tl.dot with fusable vector post-processing such as GELU, ReLU, bias-add, or quantization. Pure MatMul and pure Vector kernels must use native Triton, since affinity APIs add extra data movement and synchronization overhead there.

Why does my fused Cube/Vector kernel deadlock or produce wrong tiles?▼

Deadlocks occur when sync_block_set/wait five-tuples (producer, consumer, event_id, src_pipe, dst_pipe) do not match exactly. Wrong outputs usually come from missing the buffer-free event (EVT1), which lets cube overwrite c_ub before vector finishes reading it.

Does ROW_SPLIT require special output indexing in the vector scope?▼

Yes. With FixpipeDualDstMode.ROW_SPLIT each sub-vector core sees half the rows, so the output row offset must add sub_vec_id * (BLOCK_M // 2). Omitting this makes both sub-vectors write to the same GM region and corrupt results.

Can bl.alloc use runtime values for buffer shapes?▼

No. bl.alloc shapes must be tl.constexpr, and the same applies to bl.subview and bl.to_tensor target shapes. Passing runtime integers raises a get_buffer_ty() error at compile time.