Skip to content
Copy ID

Previously ATLAS-R-003

PreprintPreprintOpen Access

NeuroGenesis: A Self-Optimizing Compiler with Transformer IR Encoding and Reinforcement Learning

  • Dhadi Sai Praneeth Reddy1
  1. 1 Atlas AI Labs

01

Brief

Problem
Compiler optimization passes are hand-written heuristics. Learned approaches such as MLGO and AutoPhase improve on them, but still choose among predefined passes.
Approach
NeuroGenesis encodes compiler IR with a Transformer and trains a reinforcement-learning policy to discover optimization rules autonomously.
Contribution
A 0.28 reduction in execution cost relative to the LLVM baseline (0.00), outperforming MLGO and AutoPhase.

02

Status

Preprint
  1. Idea
  2. Experiments
  3. Drafting
  4. Review
  5. Released (current stage)

03

Abstract

Compiler optimization passes are hand-written heuristics. Learned approaches such as MLGO and AutoPhase improve on them, but still choose among predefined passes. NeuroGenesis encodes compiler IR with a Transformer and trains a reinforcement-learning policy to discover optimization rules autonomously. A 0.28 reduction in execution cost relative to the LLVM baseline (0.00), outperforming MLGO and AutoPhase.

04

Identifiers

05

Key results

  • 0.28

    +0.28 vs LLVM

    Execution-cost reduction

    Relative to the LLVM baseline (0.00).

  • 0.00

    LLVM baseline

    Reference point for the reduction.

  • 2

    Learned optimizers outperformed

    MLGO and AutoPhase.

MethodExecution-cost reduction
LLVM (baseline)0.00
NeuroGenesis0.28
Table 1. Execution-cost reduction relative to the LLVM baseline (higher is better).

Execution-cost reduction vs. LLVM

LLVM baseline: 0LLVM baseline0NeuroGenesis: 0.28NeuroGenesis0.28
Chart 1. Execution-cost reduction vs. LLVM
View as table
LLVM baseline0
NeuroGenesis0.28
Methodology and caveats

Reported as reduction in execution cost against the LLVM baseline. Benchmark suite, hardware and run count to be added. MLGO and AutoPhase values are in the paper and will be added to the table once published here.

06

Write-up

Approach

NeuroGenesis treats optimization as something the compiler can learn rather than something engineers must hand-write.

  1. Program IR
  2. Transformer encoder
  3. RL policy
  4. Optimization rules
  5. Optimized program
NeuroGenesis pipeline: IR is encoded by a Transformer, an RL policy proposes optimization rules, and the result is measured by execution cost.

Results

Measured as reduction in execution cost against the LLVM baseline, NeuroGenesis achieves 0.28 (baseline: 0.00) and outperforms the learned-optimizer baselines MLGO and AutoPhase. See Key results above.

07

Cite this work

Reddy, D. S. P. (n.d.). NeuroGenesis: A Self-Optimizing Compiler with Transformer IR Encoding and Reinforcement Learning [Preprint]. Atlas AI Labs. https://dspraneeth07.in/research/neurogenesis
.bib .ris

Want to discuss or collaborate on this work?

Questions, replications, reviews and collaborations are all welcome.