gluon-lds-opt

Optimizes Gluon GEMM kernel layouts to eliminate LDS bank conflicts on Coprocessor Design's NEXT-GEN GPUs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fix LDS (Local Data Share) bank conflicts in a Gluon GEMM kernel that loads tiles into shared memory via async_copy or buffer_load. Symptoms: high SQ_LDS_BANK_CONFLICT hardware counter, high-cycle s_waitcnt lgkmcnt(0) before MFMA in ATT traces, or ds_read instructions on the critical path in the amdgcn ISA. Two strategies: (1) swizzling — change SwizzledSharedLayout parameters from trivial (1,1,1) to bank-conflict-free (8,1,8); (2) padding — use PaddedSharedLayout with DistributedLinearLayout for global loads. Bank conflicts can reduce LDS throughput by 8–32x and dominate kernel runtime. Applies to both CDNA3 (gfx942) and CDNA4 (gfx950). Use /lds-bank-conflict to measure conflicts before and after. Trigger for any mention of LDS bank conflicts, ds_read stalls, lgkmcnt stalls, or SwizzledSharedLayout in a Gluon kernel.

Core Features & Use Cases

  • Swizzle-based mitigation: convert trivial layouts to bank-conflict-free SwizzledSharedLayout parameters tuned for CDNA3/4.
  • Padding-based mitigation: switch to DistributedLinearLayout + PaddedSharedLayout to explicitly control data placement.
  • Profiling guidance: measure SQ_LDS_BANK_CONFLICT with /kernel-perf-analysis and inspect ATT traces for ds_read stalls.

Quick Start

Apply bank-conflict-free SwizzledSharedLayout settings (e.g., SwizzledSharedLayout(8, 2, 8, order=[1, 0])) to your Gluon GEMM tiles and profile the LDS performance.

Frequently Asked Questions about gluon-lds-opt

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

FAQPage Schema
Why does my Gluon GEMM kernel have high SQ_LDS_BANK_CONFLICT counters and lgkmcnt stalls?

LDS bank conflicts in Gluon GEMM kernels cause high SQ_LDS_BANK_CONFLICT counters and lgkmcnt stalls, reducing shared memory throughput by 8–32x and dominating runtime during tile loads.

How do I fix LDS bank conflicts in a GEMM kernel loading tiles via async_copy on CDNA3 GPUs?

Fix LDS bank conflicts by changing SwizzledSharedLayout parameters from trivial (1,1,1) to bank-conflict-free settings like (8,2,8) tuned for CDNA3, or by applying PaddedSharedLayout with DistributedLinearLayout for global loads.

Does the bank-conflict-free SwizzledSharedLayout mitigation apply to both CDNA3 and CDNA4 architectures?

Yes, the swizzle-based and padding-based LDS bank conflict mitigation strategies apply to both CDNA3 (gfx942) and CDNA4 (gfx950) GPUs, particularly when using async_copy or buffer_load for BLOCK_M=256, BLOCK_K=64, BLOCK_N=256 configurations.

What is the best way to verify LDS bank conflicts before and after changing shared memory layouts?

Verify LDS bank conflicts by measuring the SQ_LDS_BANK_CONFLICT hardware counter using /lds-bank-conflict and /kernel-perf-analysis, and inspect ATT traces for ds_read stalls and high-cycle s_waitcnt lgkmcnt(0) before MFMA operations.

When should I use DistributedLinearLayout padding instead of swizzling to resolve shared memory bank conflicts?

Use DistributedLinearLayout with PaddedSharedLayout when swizzling alone is insufficient, allowing explicit control over data placement for global loads to eliminate bank conflicts that put ds_read instructions on the critical path in amdgcn ISA.