triton-ascend-case-matmul-swizzle2d

Optimize large-scale matrix multiplication on Ascend NPU with Swizzle2D tiling.

258|48|Updated Jun 22, 2020
One-click install
npx skills add https://github.com/mindspore-ai/akg --skill triton-ascend-case-matmul-swizzle2d-mindspore-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: triton-ascend-case-matmul-swizzle2d
Source: https://github.com/mindspore-ai/akg/tree/main/akg_agents/python/akg_agents/op/resources/skills/triton-ascend/cases/triton-ascend-case-matmul-swizzle2d
Command: npx skills add https://github.com/mindspore-ai/akg --skill triton-ascend-case-matmul-swizzle2d-mindspore-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a strategy to efficiently run large-scale matrix multiplication on Ascend NPUs by fixing the number of active cores and applying Swizzle2D tiling to improve cache locality and throughput.

Core Features & Use Cases

  • Fixed-core launch strategy: Bind a fixed number of AI cores (e.g., 20) and have each core loop over multiple blocks to balance work across the hardware.
  • Swizzle2D tiling: Reorder compute blocks within groups to maximize data reuse and cache efficiency.
  • Adaptive grouping direction: Choose row- or column-first grouping based on M vs N to minimize redundant data loads.
  • Use case: Large C = A[M,K] × B[K,N] with M and N in the millions, where the strategy yields higher sustained throughput.

Quick Start

Run the provided Triton Ascend kernel template and set core count to 20 for stable, high-performance execution.

Frequently Asked Questions about triton-ascend-case-matmul-swizzle2d

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

FAQPage Schema
How do I optimize large-scale matrix multiplication on Ascend NPU?

Optimize large-scale matrix multiplication on Ascend NPU by applying fixed-core execution and Swizzle2D tiling. This Triton-based kernel binds a fixed number of AI cores and reorders compute blocks to maximize data reuse and cache efficiency for very large matrices.

What is Swizzle2D tiling in Triton kernel optimization?

Swizzle2D tiling in Triton kernel optimization reorders compute blocks within groups to maximize data reuse and cache efficiency. It adapts block grouping direction row- or column-first based on M versus N dimensions to minimize redundant data loads.

How do I run a Triton kernel on Ascend NPU with fixed-core execution?

Run a Triton kernel on Ascend NPU with fixed-core execution by binding a fixed number of AI cores, such as 20, and having each core loop over multiple blocks. This balances work across the hardware for stable, high-performance execution.

When should I use adaptive block grouping for high-throughput matrix multiplication?

Use adaptive block grouping for high-throughput matrix multiplication when processing very large matrices with M and N in the millions. It chooses row- or column-first grouping based on M versus N to minimize redundant data loads and yield higher sustained throughput.

Does the Swizzle2D matmul optimization work for small matrices on Ascend?

The Swizzle2D matmul optimization targets large-scale matrices with M and N in the millions. It is designed for high-throughput scenarios on Ascend NPU where fixed-core execution and adaptive block sizing can significantly improve cache locality.

Why does my Ascend NPU matmul kernel have low throughput with large matrices?

Ascend NPU matmul kernels may have low throughput with large matrices due to poor cache locality and unbalanced work. Applying a fixed-core launch strategy with Swizzle2D tiling reorders compute blocks to maximize data reuse and balances work across active AI cores.