The ever increasing memory requirements of several applications has led to increased demands which might not be met by embedded devices. Constraining the usage of memory in such cases is of paramount importance. It is important that such code size improvements should not have a negative impact on the runtime. Improving the execution time while optimizing for code size is a non-trivial but a significant task. The ordering of standard optimization sequences in modern compilers is fixed, and are heuristically created by the compiler domain experts based on their expertise. However, this ordering is sub-optimal, and does not generalize well across all the cases. We present a reinforcement learning based solution to the phase ordering problem, where the ordering improves both the execution time and code size. We propose two different approaches to model the sequences: one by manual ordering, and other based on a graph called Oz Dependence Graph (ODG). Our approach uses minimal data as training set, and is integrated with LLVM. We show results on x86 and AArch64 architectures on the benchmarks from SPEC-CPU 2006, SPEC-CPU 2017 and MiBench. We observe that the proposed model based on ODG outperforms the current Oz sequence both in terms of size and execution time by 6.19% and 11.99% in SPEC 2017 benchmarks, on an average.
翻译:一些应用程序的不断增长的记忆要求导致越来越多的需求,而这些需求可能无法通过嵌入装置得到满足。 限制在这类情况下使用记忆至关重要。 重要的是,这种代码尺寸的改进不应对运行时间产生消极影响。 改进执行时间,同时优化代码大小是一项非三重但重要的任务。 在现代汇编器中,定出标准优化序列是固定的,并且是由汇编者域专家根据其专长黑手党创建的。 但是,这一订单是次最佳的,没有在所有案例中全面推广。 我们提出了一个基于强化学习的阶段订单解决方案,因为在此阶段订单上,订单既能改善执行时间和代码大小。 我们提出了两种不同的方法来模拟序列:一个是手动订购,另一个是用名为Ozz Decondistants图(ODG)的图表。 我们的方法使用最低限度的数据作为培训设置,并与LLVM 整合。 我们展示了2006年SPEC-CPU、 SPEC-CPU 201717年和 MiBER99年标准基准、 SBER 6-19 标准以目前的平均时间序列为基础。