CompilerDream: Learning a Compiler World Model for General Code Optimization
Chaoyi Deng, Jialong Wu, Ningya Feng, Jianmin Wang, Mingsheng Long

TL;DR
CompilerDream introduces a model-based reinforcement learning framework that learns a comprehensive compiler world model, enabling effective and general code optimization across diverse scenarios and languages, surpassing existing methods.
Contribution
It presents a novel compiler world model and an RL-based agent trained on large datasets, achieving superior generalization and optimization performance.
Findings
Outperforms LLVM's built-in optimizations in various benchmarks.
Achieves state-of-the-art results in code value prediction and end-to-end optimization.
Demonstrates strong zero-shot generalization across datasets and languages.
Abstract
Effective code optimization in compilers is crucial for computer and software engineering. The success of these optimizations primarily depends on the selection and ordering of the optimization passes applied to the code. While most compilers rely on a fixed sequence of optimization passes, current methods to find the optimal sequence either employ impractically slow search algorithms or learning methods that struggle to generalize to code unseen during training. We introduce CompilerDream, a model-based reinforcement learning approach to general code optimization. CompilerDream comprises a compiler world model that accurately simulates the intrinsic properties of optimization passes and an agent trained on this model to produce effective optimization strategies. By training on a large-scale program dataset, CompilerDream is equipped to serve as a general code optimizer across various…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Software Testing and Debugging Techniques
