triton-ascend-case-reduction-mean-large

Optimize large-scale mean reductions on the last axis for Triton on Ascend Atlas A2/A3.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill optimizes large-scale mean reductions along the last axis using row-wise tiling to reduce kernel thread blocks and in-kernel partitioning to avoid UB, targeting Ascend Atlas A2/A3 with Triton for 2D reductions where the reducing axis is large.

Core Features & Use Cases

  • Row-wise tiling to reduce total thread blocks and improve cache locality.
  • In-kernel sub-blocking to avoid cache/buffer overflows and ensure stable performance.
  • Autotune-ready configurations to explore optimal BLOCK_SIZE_M, SUB_BLOCK_SIZE_M, and BLOCK_SIZE_N for different grid sizes.
  • Use Case: large-scale mean reductions on prominent 2D tensors where the reduce axis dominates.

Quick Start

Run the Triton Ascend kernel with tuned BLOCK_SIZE_M, SUB_BLOCK_SIZE_M, and BLOCK_SIZE_N for your input shapes to achieve optimal performance.

Frequently Asked Questions about triton-ascend-case-reduction-mean-large

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

FAQPage Schema
How do I optimize large-scale mean reductions on Ascend using Triton?

Optimize large-scale mean reductions on Ascend by applying row-wise tiling to reduce thread blocks and in-kernel sub-blocking to avoid cache overflows. This approach targets 2D tensors where the reducing axis dominates.

Does Triton autotune work for 2D reduction kernels on Atlas A2 or A3?

Yes, Triton autotune works for 2D reduction kernels on Atlas A2/A3 by exploring configurations for BLOCK_SIZE_M, SUB_BLOCK_SIZE_M, and BLOCK_SIZE_N to find optimal grid settings for peak performance.

Why does my Triton kernel hit UB overflows during large 2D mean reductions?

UB overflows during large 2D mean reductions occur when in-kernel data exceeds buffer limits. Applying in-kernel sub-blocking partitions the reduction data to avoid cache and buffer overflows, ensuring stable performance.

What are the best block size parameters for Triton mean reduction on Ascend?

The best block size parameters for Triton mean reduction on Ascend are BLOCK_SIZE_M, SUB_BLOCK_SIZE_M, and BLOCK_SIZE_N. These must be tuned via autotune to match your specific input shapes and grid sizes.

When should I use row-wise tiling for mean reduction on Ascend hardware?

Use row-wise tiling for mean reduction on Ascend when processing 2D tensors with a moderate non-reducing axis and a large reducing axis. This technique improves cache locality and reduces total kernel thread blocks.