arXiv:2511.06120cs.PLcs.LG2025-11被引 1

用深度学习预测代码变换合法性,加速编译器优化训练。

A Deep Learning Model for Predicting Transformation Legality

  • 构建新模型,输入代码与变换列表,输出合法性判断。
  • 测试集F1达0.91,实际应用中训练速度提升一倍。
  • 适合需要快速训练的编译器优化研究者使用。

编译器需检查代码变换的合法性以保证多步变换的正确性。虽然合法性检查通常需精确计算,但在某些场景下可采用近似预测模型,如训练用于调度预测的强化学习(RL)代理。本文提出一种近似合法性检查方法,设计了一种新型深度学习模型,输入代码表示和一组变换,预测其是否合法。实验表明,在随机生成程序的测试集上F1分数达到0.91。为进一步验证实用性,将该模型用于替代训练一个用于自动代码优化的RL代理中的合法性检查。结果表明,该替换使代理训练步数增加一倍,训练更快,且CPU资源消耗减少约80%,内存减少约35%。使用该方法训练的代理在Polybench基准测试中性能仅下降4%,与传统方法相当。

原文摘要 · Abstract (English)

Compilers must check the legality of code transformations to guarantee the correctness of applying a sequence of code transformations to a given code. While such a legality check needs to be precisely computed in general, we can use an approximate legality prediction model in certain cases, such as training a reinforcement learning (RL) agent for schedule prediction. In this paper, we propose an approximate method for legality checks. We propose a novel DL model for predicting the legality of transformations. The model takes the code representation and a list of transformations as input and predicts whether applying those transformations to the code is legal. We implement and evaluate the proposed model, demonstrating its effectiveness. Our evaluation shows an F1 score of 0.91 on a test set of randomly generated programs. To further evaluate the model in a practical scenario, we used the model to replace the legality check used during the training of an RL agent designed for automatic code optimization. We demonstrate that such a replacement enables the agent to train on twice as many steps, resulting in faster training and reducing resource usage by approximately 80\% for CPU and 35\% for RAM. The agent trained using this approach maintains comparable performance, with only a 4\% reduction on benchmarks from the Polybench suite compared to the traditional method.

深度学习编译优化RL训练

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。