gluon-beyond-loop-opt

Apply XCD remapping and epilogue slicing to Gluon GEMM kernels.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill identifies and applies two advanced optimizations to a Gluon GEMM kernel: XCD-aware PID remapping to improve L2 cache reuse for matrix B and epilogue M-slicing to reduce register pressure and hide store latency, enabling higher MFMA throughput on CDNA GPUs.

Core Features & Use Cases

  • Stage 1: XCD-aware PID remapping with grouped swizzle improves L2 hit rates for B reads by distributing PIDs across XCDs and reusing B tiles across M-block groups.
  • Stage 2: Epilogue M-slicing reduces VGPR pressure by slicing the final accumulator into smaller live portions, overlapping MFMA with buffer_store to hide latency.
  • Use Case: Optimizing a large GEMM kernel on MI300X/MI350 where B tiles are large and L2 bandwidth is a bottleneck.

Quick Start

Run the /gluon-beyond-loop-opt skill to enable XCD remapping and epilogue slicing on your Gluon GEMM kernel and verify correctness against a reference matmul.

Frequently Asked Questions about gluon-beyond-loop-opt

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

FAQPage Schema
How do I improve L2 cache reuse for matrix B in Gluon GEMM kernels on MI300X?

To reduce register pressure in Gluon GEMM kernels, apply epilogue M-slicing. This technique slices the final accumulator into smaller live portions, overlapping MFMA operations with buffer_store instructions to hide store latency and lower VGPR pressure.

What is XCD remapping and how does it optimize GEMM performance on CDNA GPUs?

XCD remapping is an optimization technique for GEMM kernels that improves L2 cache efficiency on CDNA GPUs. It distributes program IDs across XCDs using a grouped swizzle pattern, maximizing matrix B tile reuse across M-block groups for higher throughput.

How do I reduce register pressure in Gluon GEMM kernels with large accumulator shapes?

To reduce register pressure in Gluon GEMM kernels, apply epilogue M-slicing. This technique slices the final accumulator into smaller live portions, overlapping MFMA operations with buffer_store instructions to hide store latency and lower VGPR pressure.

Does the Gluon GEMM optimization support tuning controls for XCD remapping and group sizes?

Yes, the Gluon GEMM optimization requires the kernel to expose NUM_XCDS and GROUP_SIZE_M controls. These parameters are necessary for tuning XCD remapping and ensuring compatibility with Gluon kernels on MI300X and MI350 GPUs.

When should I apply beyond-loop GEMM optimizations for high MFMA utilization?

Apply beyond-loop GEMM optimizations when targeting MI300X or MI350 GPUs with large M, N, and K shapes where L2 bandwidth is a bottleneck. These optimizations maximize MFMA utilization by improving cache efficiency and reducing register spills.

How to verify correctness after applying XCD remapping and epilogue slicing to a Gluon kernel?

To verify correctness after applying XCD remapping and epilogue slicing, run the optimization skill to execute the modified Gluon GEMM kernel and compare its output against a reference matmul implementation to ensure numerical accuracy.