A Reinforcement Learning Environment for Automatic Code Optimization in the MLIR Compiler

Mohammed Tirichine, Nassim Ameur, Nazim Bendib, Iheb Nassim Aouadj, Bouchama Djad +2 more
9/17/2024
cs.LGcs.DCcs.SE

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Code optimization is a crucial task that aims to enhance code performance. However, this process is often tedious and complex, highlighting the necessity for automatic code optimization techniques. Reinforcement Learning (RL) has emerged as a promising approach for tackling such complex optimization problems. In this project, we introduce MLIR RL, an RL environment for the MLIR compiler, dedicated to facilitating MLIR compiler research and enabling automatic code optimization. We propose a multi-discrete formulation of the action space where the action space is the Cartesian product of simpler action subspaces. We also propose a new method, called level pointers, to reduce the size of the action space related to the loop interchange transformation. This enables more efficient and effective learning of the policy. To demonstrate the effectiveness of MLIR RL, we train an RL agent to optimize MLIR Linalg code, targeting CPU. The code is generated from two domain-specific frameworks: deep-learning models generated from PyTorch, and LQCD (Lattice Quantum Chromodynamics) code generated from an LQCD compiler. The result of this work is a research environment that allows the community to experiment with novel ideas in RL-driven loop-nest optimization.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tirichine2024reinforcement,
  title  = {A Reinforcement Learning Environment for Automatic Code Optimization in the MLIR Compiler},
  author = {Mohammed Tirichine and Nassim Ameur and Nazim Bendib and Iheb Nassim Aouadj and Bouchama Djad and Rafik Bouloudene and Riyadh Baghdadi},
  year   = {2024},
  eprint = {2409.11068},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2409.11068v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2409.11068.svg)](https://codeofpaper.com/paper/2409.11068)

Discussion