arrow
Return

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

delete2026-01-01
delete0
PRE
AI
T
Tirichine, Mohammed *
N
Nassim Ameur
N
Nazim Bendib
I
Iheb Nassim Aouadj
D
Djad Bouchama
R
Rafik Bouloudene
R
Riyadh Baghdadi
DOI:10.1109/CGO68049.2026.11394838delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
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.
Keywords:
Automatic Code Optimization
Reinforcement Learning
MLIR
Deep Learning
Machine Learning
Compiler

Journal

2
2026 IEEE/ACM INTERNATIONAL SYMPOSIUM ON CODE GENERATION AND OPTIMIZATION, CGO
IF:
0
Papers:
48
Citations:
0

Organization

N
new york university
Scholars:
6.1K
Papers: 2.9K
Citations: 1