arXiv:2610.34914cs.DCOct 2026

Manuscript Offprint

arXiv:2610.34914

Waypoint: Analytically Modeling GEMM for CPUs

Srinidhi N, Sunanda Somwase, Hemant Kumar Chandrakant Chandavar, Eashan Dash, Varun Agrawal, Prakash Raghavendra

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Srinidhi N

Advanced Micro Devices Inc

India

Srinidhi.N@amd.com

Eashan Dash

Advanced Micro Devices Inc

India

Eashan.Dash@amd.com

Sunanda Somwase

Advanced Micro Devices Inc

India

SomwaseSunanda.Vishnu@amd.com

Varun Agrawal

Advanced Micro Devices Inc

India

Varun.Agrawal@amd.com

Hemant Kumar Chandrakant

Chandavar

Advanced Micro Devices Inc

India

hkcc375@gmail.com

Prakash Raghavendra

Advanced Micro Devices Inc

India

Prakash.Raghavendra@amd.com

Abstract

High-performance General Matrix Multiplication (GEMM) implementations rely on breaking down GEMM into carefully selected tiles to achieve peak performance. We present WAYPOINT, a new analytical model to automatically identify the optimal tile size for a given hardware and input matrix shape. WAYPOINT estimates the achievable performance for a given tile choice by capturing all the architectural effects including interactions with memory hierarchy, instruction-level parallelism, and multi-threading. Using the estimates as a proxy, we search through the space of possible tile sizes to identify the one that maximizes performance. Additionally, WAYPOINT helps hardware designers estimate realistic performance on experimental hardware optimizations. We build a new GEMM library LIBZENMM for CPUs that uses WAYPOINT to automatically break down GEMM and achieve performance that matches state-of-the-art GEMM libraries and helps accelerate LLM inference on CPUs achieving 1.36−1.98×1.36 - 1.98 \times speedups.

1 Introduction

Matrix Multiplication operations make up for a large part of the core computation in several modern machine learning based applications such as image processing, recommendation systems, and more recently, Large Language Model (LLM) inference. To ensure that these applications run efficiently, it is crucial to optimize the performance of General Matrix Multiplication (GEMM) operations on the underlying hardware. While the industry has moved towards developing specialized hardware accelerators such as GPUs, CPUs remain important for cost-sensitive use cases and small-scale inference workloads. Hardware vendors continue to enhance CPU architectures with new features aimed at improving GEMM performance.

On CPUs, improving GEMM performance involves careful coordination between the hardware and the software that implements GEMM operations. Hardware designers continue to innovate and introduce features that push the peak performance achievable. At the same time, software implementations optimize the use of these hardware features to achieve high performance.

A naive 3-loop implementation of the matrix multiplication algorithm is far from achieving peak performance. Instead, the libraries use specialized hardware features (e.g. vector/matrix instructions), and carefully organize the input matrices in memory so as to reduce the cost of accessing them for the computation. They do so by breaking down the GEMM operation into smaller units called tiles. For each tile, the libraries use vector/matrix instructions to compute the output, and between successive tiles, they ensure that memory accesses are efficient.

The tile sizes are critical to achieving high performance and need to be chosen carefully. Selecting suboptimal tile sizes can lead to inefficient memory accesses and underutilization of the hardware’s computational capabilities. The right tile depends both on the hardware and the specific input matrix size that the application invokes [31]. Therefore, an ideal solution would adapt the tile sizes not only to the hardware but also to specific input sizes.

Existing state-of-the-art GEMM libraries [16, 30] identify the tile sizes that are either optimal for a given hardware, or the specific class of shapes (e.g., tall and skinny [23], irregular [31]) but do not adapt them to the application’s needs. Many techniques are used to identify the tile sizes for a given hardware such as - manual expert-driven tuning resulting in handwritten assembly, automated empirical analysis [7, 10], and analytical modeling [24, 26, 31].

In this paper we propose a new analytical model to derive optimal tile sizes that are tailored not just for the hardware but also for the specific input matrix sizes that the application uses. Our model addresses another crucial challenge that the hardware designers face when innovating to accelerate performance on future hardware. They need to be able

© 2026 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo, EPYC, AOC-BLAS, AOC-DLP, PACE, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.

Srinidhi N, Sunanda Somwase, Hemant Kumar Chandrakant Chandavar, Eashan Dash, Varun Agrawal, and Prakash Raghavendra

to estimate the realistic performance achievable on experimental hardware designs. They routinely propose new ISA extensions (e.g. AMX [21], ACE [33], APX [20]) aimed at optimizing GEMM performance.

Existing analytical models address the challenge partially. They provide a Roofline [32] estimate of the maximum achievable performance. But depending on the matrix sizes, the realistic achievable performance is far from the Roofline.

Building a realistic performance model requires accounting for different architectural effects that are accompanied with a GEMM operation such as cache effects, pipelining, multi-threaded execution, and memory bandwidth limitations. The traditional Roofline model makes simplistic assumptions to over-approximate the peak performance achievable. It assumes that either the cost of computation dominates the cost of accessing data (i.e. compute-bound) or vice versa (i.e. memory-bound), which rarely holds true in practice. Therefore, a more nuanced model that captures both computation and memory access costs accurately is necessary to predict realistic GEMM performance.

In what follows, we describe our contribution - a new analytical model WAYPOINT that is parametric both in the hardware architecture, and the application's needs (input matrix sizes). WAYPOINT provides accurate estimates of the realistic performance achievable, aiding hardware designers, and identifies the optimal tile sizes, enabling automatic and efficient GEMM implementations.

We build our model in two stages. First, we develop WAYPOINT-STRICT, to provide realistic estimates of GEMM performance on a given hardware independent of the software implementation. We prove theoretically that WAYPOINT-STRICT is tighter than the Roofline model and show empirically that state-of-the-art GEMM libraries realize these estimates. In compute-bound scenario, WAYPOINT-STRICT accounts for the cost of additional instructions that are always issued with the main compute instruction. Similarly for the memory-bound scenario, WAYPOINT-STRICT uses more accurate bandwidth values to calculate the time it takes to fetch data. As a result, in both scenarios, WAYPOINT provides estimates that are tighter than the Roofline.

Second, we refine WAYPOINT-STRICT for a tile based GEMM implementation resulting in WAYPOINT-TILE that estimates GEMM performance for a specific tile size. Using WAYPOINT-TILE's estimates, we search through possible tile sizes to select the optimal one. Building WAYPOINT-TILE is challenging because it requires accurately modeling the interaction between the tile size and the memory hierarchy, including cache levels, cache line sizes, and memory bandwidth limitations. WAYPOINT-TILE accurately estimates the number of cache misses that are imposed by a tile size and adds the associated miss costs. In building WAYPOINT-TILE, we identify several insights that allow us to rule out certain tile sizes and narrow down the search for an optimal one.

Empirically, we evaluate the accuracy of both WAYPOINT-STRICT and WAYPOINT-TILE against state-of-the-art GEMM libraries. We find that WAYPOINT-STRICT estimates are consistently closer to the observed performance (a geomean of 1.096×1.096\times). Similarly, we compare the estimate of the best tile size identified by WAYPOINT-TILE and find that the model is accurate in predicting realistic performance (a geomean of 1.012×1.012\times). These accuracy results allow us to confidently use the models for identifying the optimal tile size and estimating the performance on future hardware.

We develop a GEMM library LIBZENMM that uses WAYPOINT-TILE to select the best tile size for each input matrix size and hardware configuration. LIBZENMM performs comparable to state-of-the-art GEMM libraries across different hardware configurations and input sizes. Further on new hardware configurations, LIBZENMM is able to quickly adapt and achieve near-peak performance without any manual tuning. Finally, we use LIBZENMM to accelerate LLM inference on CPUs achieving 1.36−1.98×1.36 - 1.98 \times speedups on new hardware.

To summarize, our contributions are,

  • An accurate implementation agnostic analytical model WAYPOINT-STRICT, to estimate GEMM performance that is parametric in both the hardware architecture and the application’s needs. A more refined model, WAYPOINT-TILE that is specific to a tile-based GEMM implementation and used in practice to identify the optimal tile-size.

  • A GEMM library LIBZENMM that uses WAYPOINT-TILE to automatically select optimal tiling parameters for a given GEMM shape and hardware configuration, achieving near-peak performance without extensive manual or automated tuning.

• Using LIBZENMM, we accelerate LLM inference on current and future CPUs.

References (14)