model-release

MoonMath's AMD Attention Kernel: Open-Source Speed Leap That Actually Matters

HIP-based kernel for MI300X GPUs outperforms AMD's AITER v3, with real gains in video diffusion

By AI·Reporter·June 22, 2026·~4 min read

Takeaways

  • MoonMath's open-source attention kernel beats AMD's AITER v3, with real-world 1.23× speedup in video diffusion
  • One-instruction assembly wrappers enable precise control while leveraging compiler optimizations
  • Smart memory placement (K in LDS, V in L1, Q in registers) drives significant performance gains
  • Open-sourcing under MIT could accelerate AMD GPU optimizations, potentially shifting the AI hardware landscape

MoonMath AI's new open-source attention kernel for AMD's MI300X GPU isn't just benchmark noise, it's a genuine leap forward that translates to real-world speedups. Let's cut through the hype and examine why this matters.

First, the facts: This bf16 forward attention kernel, written in HIP and open-sourced under MIT, consistently outperforms AMD's own AITER v3. But the real story is how they did it, and what it means for AI workloads on AMD hardware.

The secret sauce? One-instruction assembly wrappers. It's a clever hack that gives precise control over GPU instructions while letting the compiler handle the grunt work:

c
__device__ __forceinline__ void asm_mfma(bf16x4_t a, bf16x4_t b, fp32x4_t& c) {
    asm volatile("v_mfma_f32_16x16x16_bf16 %0, %1, %2, %0"
                 : "+v"(c) : "v"(a), "v"(b));
}

This isn't just elegant, it's effective. By combining fine-grained control with compiler optimizations, MoonMath threads the needle between hand-tuned assembly and high-level abstractions.

The kernel's architecture is tailored to the MI300X's quirks, running eight waves per block in two groups of four. It's not just about raw compute, smart memory placement is key. K matrices stream from HBM to LDS, V matrices stay hot in L1, and Q matrices live in registers. This data choreography squeezes every ounce of performance from the hardware.

But does it actually deliver? The benchmarks say yes:

Shape (B, H, S, D)RoundMoonMath (ms)AITER v3 (ms)Speedup
(2, 24, 8192, 128)RTNE3.0833.7921.23×
(2, 24, 16384, 128)RTNE11.67014.6911.26×
(4, 16, 16384, 128)RTZ15.05516.1831.07×

Across all shapes and rounding modes, MoonMath's kernel shows geometric mean speedups of 1.18× (RTNE), 1.15× (RTNA), and 1.08× (RTZ) over AITER v3. Impressive, but synthetic benchmarks often lie.

The real test? Practical workloads. When integrated into the SGLang diffusion framework for Wan2.1-T2V-1.3B, it achieved a 1.23× speedup in end-to-end video generation on MI300X hardware. No quality regression, just faster results. That's the kind of improvement that actually matters to researchers and developers.

Let's be clear: This kernel isn't a panacea. It's MI300X-specific and lacks features like causal masking or grouped-query attention. But for its target use case, it's a significant step forward.

The open-source MIT license is crucial here. It's not just about one team's optimization, it's an invitation for the entire AI and HPC community to build on this work. In a field dominated by closed-source NVIDIA optimizations, this kind of open innovation on AMD hardware is vital for healthy competition.

MoonMath's kernel proves there's still substantial headroom for optimizing fundamental AI operations, even on newer hardware. It's a reminder that clever software can sometimes rival hardware upgrades in impact. For anyone working with AMD GPUs in AI, this isn't just an interesting paper, it's a tangible boost to your capabilities.

The takeaway? Don't write off AMD for AI workloads just yet. With innovations like this, the performance gap might be closing faster than you think.

Related reads

Reported and explained by AI·Reporter.

MoonMath AI Attention Kernel for AMD MI300X: Benchmarks, Performance Gains · AI·Reporter