Abstract: General Matrix Multiplication (GEMM) is a critical operation in deep learning, yet optimizing its performance across diverse hardware remains a challenge due to the vast configuration space of tiling parameters. This paper introduces a novel approach by modeling the configuration search as a Markov Decision Process (MDP). We propose two algorithms: Greedy Best-First Search (G-BFS) and Neighborhood Actor Advantage Critic (N-A2C). These methods leverage performance locality to navigate the search space efficiently. Experimental results on an Nvidia Titan Xp GPU demonstrate that our approach achieves up to 40% speedup over state-of-the-art methods while exploring only 0.1% of the configuration space.
Introduction
Deep learning relies heavily on GEMM operations, which form the mathematical foundation for both dense and convolutional layers. To maximize execution speed, compilers employ tiling—a technique that breaks large matrices into smaller blocks (tiles) to fit within a processor's high-speed cache memory.
Finding the optimal tile size is a complex optimization problem because the ideal configuration depends on specific hardware architectures (GPU, CPU, or TPU) and the dimensions of the matrices involved. The resulting configuration space is astronomical, making exhaustive search impossible. Traditional frameworks like TVM often rely on machine learning tuners (e.g., XGBoost) or manual heuristics, which can be slow to converge or prone to getting trapped in local optima.
Methodology
This research shifts the paradigm from treating configuration search as a "black box" to modeling it as a Markov Decision Process (MDP). The authors define a "neighborhood" where one configuration is adjacent to another if it can be reached by minor adjustments to tile sizes (e.g., doubling one dimension while halving another).
Two primary algorithms were developed to navigate this space:
- Greedy Best-First Search (G-BFS): A heuristic method using a priority queue to explore promising neighboring configurations based on real-time hardware performance measurements.
- Neighborhood Actor Advantage Critic (N-A2C): A Reinforcement Learning (RL) approach where an "Actor" network learns a policy to select the best direction in the configuration space, while a "Critic" network predicts state performance to guide the learning process.
Key Insights and Results
The core innovation is the exploitation of performance locality: the observation that configurations with similar parameters tend to exhibit similar performance. By defining an action space that moves between neighbors, the algorithms can effectively "walk" toward the optimal setting.
Experiments conducted on an Nvidia Titan Xp GPU using matrix sizes typical of perceptron networks ($512 \times 512$ to $2048 \times 2048$) yielded significant improvements:
- Performance Gains: The proposed methods achieved 24% faster execution than the state-of-the-art XGBoost tuner in TVM and 40% faster than Google's RNN-based controller.
- Search Efficiency: These performance gains were realized while sampling only 0.1% of the total search space.
- Robustness: The N-A2C method demonstrated lower variance across trials, consistently finding high-performance settings even in complex, noisy landscapes.
Conclusion and Future Work
By treating compiler optimization as a navigation problem within a structured neighborhood, this work provides a highly efficient alternative to traditional black-box tuning. While the current study focuses on GEMM on high-end GPUs, the underlying logic of neighborhood search is broadly applicable. Future research will explore extending these methods to other deep learning operators, such as depthwise and dilated convolutions, and evaluating performance on edge devices and specialized AI accelerators.
Summary updated