CompilerDream: Learning a Compiler World Model for General Code Optimization
School of Software, BNRist Tsinghua University Beijing China(软件学院、北师大清华大学北京中国);Tsinghua University(清华大学)
Chaoyi Deng, Jialong Wu, Ningya Feng, Jianmin Wang, Mingsheng Long
备注:
KDD 2025 camera-ready version with extended appendix. Code is available at https://github.com/thuml/CompilerDream. This update additionally fixes an issue in Table 6 where the dataset names in three rows were ordered incorrectly
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 application scenarios and source-code languages. Our extensive experiments first highlight CompilerDream's strong optimization capabilities for autotuning, where it leads the CompilerGym leaderboard. More importantly, the zero-shot generalization ability of large-scale trained compiler world model and agent, excels across diverse datasets, surpassing LLVM's built-in optimizations and other state-of-the-art methods in both settings of value prediction and end-to-end code optimization.
Toward Compiler World Models: Learning Latent Dynamics for Efficient Tensor Program Search
Hangzhou Institute for Advanced Study, University of Chinese Academy of Sciences(中国科学院大学杭州高等研究院);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学)
University of Amsterdam(阿姆斯特丹大学);Qualcomm Technologies Netherlands B.V.(高通技术荷兰有限公司);Qualcomm AI Research(高通人工智能研究院);Qualcomm Technologies, Inc.(高通技术公司)