TECHNOLOGY

ONNX Runtime Arm FP16 GEMM: transposed B needs the matching right-hand-side packer

In this article
THE QUICK TAKE

The 1.32 SME/SME2 FP16 path supports transposed B through layout-aware packing; verify leading dimensions and actual accelerated dispatch.

ONNX Runtime 1.32.0 adds transposed-B support to the KleidiAI SME/SME2 FP16 GEMM path. The linked PR propagates B layout through MLAS and uses the matching packing route. A mathematically supported transpose can therefore still miss acceleration if the runtime does not carry its layout contract to the optimized implementation.

Transpose semantics and storage layout differ

The transpose flag describes the logical multiplication, while leading dimensions and buffer layout describe how values are stored. A packer must interpret both correctly. A proposed small test uses a nonsymmetric B matrix so an incorrect transpose cannot accidentally match the reference. Compare packed execution with straightforward multiplication of the same logical matrices, and record physical dimensions separately from the post-transpose mathematical shape.

Leading dimensions remain explicit conditions

The PR validates leading dimensions while propagating layout. Include padded rows or columns where supported, plus a rejected invalid case. An exactly compact matrix alone cannot cover every stride calculation. Do not repair an invalid layout silently in the test harness unless that materialization is part of the application path being evaluated. Otherwise the optimized packer never sees the boundary that the qualification intended to inspect.

Fallback correctness can hide missing acceleration

The motivating issue was a performance fallback, so correct outputs before the change were possible. Numerical equality does not prove the new KleidiAI path ran. Combine it with dispatch evidence and measure preparation separately from repeated GEMM. A short process dominated by weight packing may show a different effect from a long-lived session reusing packed weights. Both are legitimate workloads, but they answer different performance questions.

Scope the architecture claim

The release targets SME/SME2 FP16 GEMM support, not every Arm CPU or all matrix datatypes. Preserve the runtime build and selected hardware path with results. This article reports layout-aware acceleration and proposed tests without new timing claims. A useful conclusion shows that a previously fallback transposed-B case now executes the intended optimized route while preserving numerical output and declared layout constraints.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles