gluon-gpr-opt

Apply loop unroll and N-slice tiling to reduce GPR pressure in Gluon GEMM kernels.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/leonling-ll/claude-skills --skill gluon-gpr-opt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gluon-gpr-opt
Source: https://github.com/leonling-ll/claude-skills/tree/main/gluon-gpr-opt
Command: npx skills add https://github.com/leonling-ll/claude-skills --skill gluon-gpr-opt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

General-purpose registers (GPRs) pressure and LDS- and MFMA-bound stalls limit performance of Gluon GEMM kernels on CDNA3 and CDNA4 GPUs. This skill provides a structured approach to reduce GPR pressure and improve pipeline overlap by applying a two-stage optimization: Stage 1 loop unroll ×2 to eliminate k%2 modulo overhead, and Stage 2 N-slice tiling to split the B tile into left/right halves, enabling concurrent data movement and computation across gfx942/MI300X/MI308X/MI325X (CDNA3) and gfx950/MI350 (CDNA4).

Core Features & Use Cases

  • Stage 1: Loop Unroll ×2 eliminates the k%2 modulo overhead by hardcoding g_idx and l_idx, enabling the compiler to resolve LDS slot accesses statically.
  • Stage 2: N-Slice splits the B tile into halves to hide DMA/loads behind MFMA, reducing pipeline bubbles on CDNA4 and providing alternate paths on CDNA3.
  • Use cases include large BLOCK_N and MFMA-heavy configurations where maximizing throughput and hiding latencies is critical.

Quick Start

Apply Stage 1 loop unroll ×2 first; if residual bubbles remain, enable Stage 2 N-slice tiling and validate improvements.

Frequently Asked Questions about gluon-gpr-opt

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

FAQPage Schema
How do I reduce GPR pressure in Gluon GEMM kernels on CDNA3 GPUs?

To reduce GPR pressure in Gluon GEMM kernels on CDNA3 GPUs, apply Stage 1 loop unroll ×2 to eliminate k%2 modulo overhead and statically resolve LDS slot accesses, then apply Stage 2 N-slice tiling to hide DMA loads behind MFMA operations.

What is N-slice tiling and how does it accelerate MFMA operations on CDNA4?

N-slice tiling accelerates MFMA operations on CDNA4 by splitting the B tile into left and right halves, enabling concurrent data movement and computation to reduce pipeline bubbles and hide latency in large BLOCK_N configurations.

Does the Gluon GEMM GPR optimization work with both MI300X and MI350 GPUs?

Yes, the Gluon GEMM GPR optimization works with both MI300X and MI350 GPUs, utilizing architecture-specific primitives like buffer_load and ds_write on CDNA3, and async_copy and commit_group on CDNA4.

How to apply loop unroll ×2 to eliminate k%2 modulo overhead in Gluon GEMM?

To eliminate k%2 modulo overhead in Gluon GEMM, apply Stage 1 loop unroll ×2 by hardcoding g_idx and l_idx, which enables the compiler to resolve LDS slot accesses statically without dynamic modulo calculations.

Why does N-slice tiling require K to be constexpr in Gluon GEMM kernels?

N-slice tiling and double-buffered LDS with local prefetch require K to be constexpr in Gluon GEMM kernels to ensure static resolution of loop iterations and enable the compiler to apply Stage 1 loop unroll ×2 effectively.

What are the limitations of using loop unroll and N-slice tiling for GPR optimization?

Limitations of loop unroll and N-slice tiling for GPR optimization include requiring K to be constexpr, targeting only CDNA3/CDNA4 architectures, and needing validation of residual pipeline bubbles after Stage 1 before enabling Stage 2.