Skip to main content
QUICK REVIEW

[Paper Review] Compiler-Level Matrix Multiplication Optimization for Deep Learning

Huaqing Zhang, Xiaolin Cheng|arXiv (Cornell University)|Sep 23, 2019
Parallel Computing and Optimization TechniquesComputer Science34 references6 citations
TL;DR

This paper proposes two novel compiler-level optimization techniques—Greedy Best-First Search (G-BFS) and Neighborhood Actor Advantage Critic (N-A2C)—for matrix multiplication (GEMM) in deep learning workloads. By leveraging neighborhood configuration relationships in a Markov Decision Process, both methods achieve 24% and 40% lower GEMM computation time than XGBoost and RNN-based tuners, respectively, while exploring only 0.1% of the configuration space on 1024×1024 matrices.

ABSTRACT

An important linear algebra routine, GEneral Matrix Multiplication (GEMM), is a fundamental operator in deep learning. Compilers need to translate these routines into low-level code optimized for specific hardware. Compiler-level optimization of GEMM has significant performance impact on training and executing deep learning models. However, most deep learning frameworks rely on hardware-specific operator libraries in which GEMM optimization has been mostly achieved by manual tuning, which restricts the performance on different target hardware. In this paper, we propose two novel algorithms for GEMM optimization based on the TVM framework, a lightweight Greedy Best First Search (G-BFS) method based on heuristic search, and a Neighborhood Actor Advantage Critic (N-A2C) method based on reinforcement learning. Experimental results show significant performance improvement of the proposed methods, in both the optimality of the solution and the cost of search in terms of time and fraction of the search space explored. Specifically, the proposed methods achieve 24% and 40% savings in GEMM computation time over state-of-the-art XGBoost and RNN methods, respectively, while exploring only 0.1% of the search space. The proposed approaches have potential to be applied to other operator-level optimizations.

Motivation & Objective

  • To address the performance bottleneck in deep learning inference and training caused by suboptimal GEMM kernel generation on diverse hardware.
  • To reduce reliance on manual, hardware-specific tuning of GEMM operators in deep learning frameworks.
  • To enable efficient, automated search for high-performance GEMM configurations across varied hardware platforms.
  • To improve search efficiency and solution quality in large, complex configuration spaces for tensor operator optimization.

Proposed method

  • The G-BFS method uses a heuristic-guided, greedy search strategy to explore neighboring configurations in the GEMM configuration space, prioritizing those with expected performance gains.
  • The N-A2C method applies reinforcement learning using an Actor-Critic framework with a neighborhood-based action space to iteratively improve configuration choices.
  • Both methods model GEMM optimization as a Markov Decision Process (MDP), defining state transitions based on tiling and layout transformations.
  • The configuration space is defined by tiling parameters across multiple levels, with states represented as tuples of tile sizes for matrices A, B, and C.
  • The N-A2C method uses a reward signal based on measured kernel execution time to train the policy network, while G-BFS uses a heuristic score to prioritize next steps.
  • Both approaches are evaluated within the TVM compiler framework on an NVIDIA Titan XP GPU for GEMM workloads of varying sizes.

Experimental results

Research questions

  • RQ1Can a heuristic-based search method like G-BFS efficiently explore the GEMM configuration space to find high-performance kernels with minimal search cost?
  • RQ2Can a reinforcement learning approach such as N-A2C outperform existing state-of-the-art tuning methods in both solution quality and search efficiency?
  • RQ3How does the performance of G-BFS and N-A2C compare to XGBoost and RNN-based tuners in terms of computation time reduction and fraction of configuration space explored?
  • RQ4To what extent do these methods scale to larger matrix sizes, such as 2048×2048, in terms of search efficiency and solution quality?

Key findings

  • The N-A2C method achieved 40% lower GEMM computation time than the RNN-based tuner while exploring only 0.1% of the configuration space for 1024×1024 matrices.
  • The G-BFS method reduced computation time by 24% compared to the XGBoost tuner under the same 0.1% search space constraint.
  • Both methods discovered optimal configurations faster than XGBoost and RNN methods, with N-A2C showing superior performance on larger matrices due to multi-step planning.
  • The proposed methods exhibited lower variance in performance across 10 trials, indicating more stable and reliable tuning behavior.
  • The N-A2C method outperformed G-BFS on larger matrix sizes (e.g., 2048×2048), demonstrating the benefit of sequential decision-making in complex search spaces.
  • The results confirm that both G-BFS and N-A2C are effective and generalizable for compiler-level optimization of tensor operators with large configuration spaces.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.