A Deep Learning Model for Predicting Transformation Legality
Avani Tiwari, Yacine Hakimi, Riyadh Baghdadi
编译器必须检查代码转换的合法性,以保证将代码转换序列应用于给定代码转换的正确性。 虽然这种合法性检查需要精确计算,但在某些情况下,我们可以使用近似的合法性预测模型,例如训练强化学习(RL)代理进行时间表预测。 在本文中,我们提出了一个近似的合法性检查方法。 我们提出了一种新的DL模型,用于预测变换的合法性。 该模型将代码表示和转换列表作为输入,并预测将这些转换应用于代码是否合法。 我们实施和评估拟议的模型,证明其有效性。 我们的评估显示,在一组随机生成的程序的测试中,F1的得分为0.91。 为了在实用场景中进一步评估模型,我们使用该模型来替换用于自动代码优化的RL代理训练时使用的合法性检查。 我们证明,这种替换使代理能够训练两倍的步骤,从而加快训练速度,减少CPU的资源使用量约80%,RAM减少35%。 使用这种方法训练的代理保持可比的性能,与传统方法相比,Polybench套件的基准仅减少了4%。
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 tr...