A Deep Learning Model for Predicting Transformation Legality

📅 2025-11-08
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the high computational cost of verifying the legality of code transformations in compiler optimization. We propose an end-to-end deep learning model that directly learns the mapping between program representations and multi-step transformation sequences, replacing traditional precise but inefficient compiler-based legality checks. Our approach innovatively integrates abstract syntax tree encoding with sequential modeling of transformation histories to enable efficient, approximate legality prediction. Evaluated on a standard benchmark, the model achieves an F1 score of 0.91. When integrated into a reinforcement learning–driven automated optimization framework, it reduces training steps by 2×, decreases CPU and memory overhead by 80% and 35%, respectively, while incurring only a 4% degradation in end-to-end performance. These results demonstrate substantial acceleration of correctness-sensitive optimization search—without compromising soundness guarantees—thereby enabling scalable, reliable compiler auto-tuning.

Technology Category

Application Category

📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

Predicting legality of code transformations using deep learning
Replacing precise compiler checks with approximate legality model
Accelerating reinforcement learning training for automatic code optimization
Innovation

Methods, ideas, or system contributions that make the work stand out.

Deep learning model predicts code transformation legality
Model inputs are code representation and transformation list
Approximate legality check accelerates reinforcement learning training
🔎 Similar Papers
No similar papers found.
A
Avani Tiwari
Department of Computer Science, New York University Abu Dhabi, Abu Dhabi, UAE
Y
Yacine Hakimi
Laboratoire de Méthodes de Conception de Systèmes, Ecole nationale Supérieure d’Informatique, Oued Smar, BP M68, 16309, Algiers, Algeria
Riyadh Baghdadi
Riyadh Baghdadi
Assistant Professor (NYUAD); Global Network Assistant Professor (NYU); Research Affiliate (MIT)
CompilersMachine LearningAutomatic optimizationDeep learning frameworks