Binary size reduction is an increasingly important optimization objective for compilers. One emerging technique is function merging, where multiple similar functions are merged into one, thereby eliminating redundancy. The SOTA approach to perform the merging is based on sequence alignment, where functions are viewed as linear sequences of instructions that are then matched in a way maximizing their alignment. In this paper, we consider a significantly generalized formulation of the problem by allowing reordering of branches within each function, subsequently allowing for more flexible matching and better merging. We show that this makes the problem NP-hard, and thus we study it through the lens of parameterized algorithms and complexity, where we identify certain parameters of the input that govern its complexity. We look at two natural parameters: the branching factor and nesting depth of input functions. Concretely, our input consists of two functions $F_1, F_2,$ where each $F_i$ has size $n_i,$ branching factor $b_i,$ and nesting depth $d_i.$ Our task is to reorder the branches of $F_1$ and $F_2$ in a way that yields linearizations achieving the maximum sequence alignment. Let $n=\max(n_1, n_2),$ and define $b, d$ similarly. Our results are as follows: - A simple algorithm running in time $2^{O(bd)} n^2,$ establishing that the problem is fixed-parameter tractable (FPT) with respect to all four parameters $b_1,d_1, b_2, d_2.$ - An algorithm running in time $2^{O(bd_2)} n^7,$ showing that even when one of the functions has an unbounded nesting depth, the problem remains in FPT. - A hardness result showing that the problem is NP-hard even when constrained to constant $d_1, b_2, d_2.$ To the best of our knowledge, this is the first systematic study of function merging with branch reordering from an algorithmic or complexity-theoretic perspective.


翻译:二进制规模缩减已成为编译器日益重要的优化目标。其中一种新兴技术是函数合并,即将多个相似函数合并为一个,从而消除冗余。当前最先进的合并方法基于序列比对:将函数视为指令的线性序列,通过最大化对齐程度的方式进行匹配。本文考虑该问题的一个显著泛化形式,允许在每个函数内部对分支进行重排,从而支持更灵活的对齐与更优的合并。我们证明该问题具有NP难性,因此通过参数化算法与复杂性的视角进行研究,识别出决定问题复杂性的输入参数。我们考察两个自然参数:输入函数的分支因子与嵌套深度。具体地,输入包含两个函数$F_1, F_2$,其中每个$F_i$的规模为$n_i$,分支因子为$b_i$,嵌套深度为$d_i$。任务是重排$F_1$与$F_2$的分支,使得生成的线性化序列达到最大序列对齐。设$n=\max(n_1, n_2)$,并类似定义$b, d$。我们的研究成果如下: - 一个运行时间为$2^{O(bd)} n^2$的简单算法,证明该问题关于四个参数$b_1,d_1,b_2,d_2$是固定参数可解(FPT)的。 - 一个运行时间为$2^{O(bd_2)} n^7$的算法,表明即使其中一个函数具有无界嵌套深度,问题仍属于FPT。 - 一个难度结果表明:即使在常数$d_1, b_2, d_2$约束下,该问题仍是NP难的。 据我们所知,这是从算法或计算复杂性角度对带分支重排的函数合并问题进行的首次系统性研究。

0
下载
关闭预览

相关内容

在数学和计算机科学之中,算法(Algorithm)为一个计算的具体步骤,常用于计算、数据处理和自动推理。精确而言,算法是一个表示为有限长列表的有效方法。算法应包含清晰定义的指令用于计算函数。 来自维基百科: 算法
【博士论文】模型合并:理论基础与算法研究
专知会员服务
15+阅读 · 5月7日
【阿姆斯特丹博士论文】带约束学习的优化算法
专知会员服务
20+阅读 · 2025年4月4日
【牛津博士论文】序列机器学习的应用与方法论,137页pdf
《图强化学习在组合优化中的应用》综述
专知会员服务
60+阅读 · 2024年4月10日
【2023新书】并行算法,Parallel Algorithms ,400页pdf
专知会员服务
72+阅读 · 2023年8月6日
深度学习组合优化,30页ppt,阿姆斯特丹Wouter Kool讲授
专知会员服务
27+阅读 · 2021年2月27日
机器学习组合优化
专知会员服务
111+阅读 · 2021年2月16日
干货|掌握机器学习数学基础之优化[1](重点知识)
机器学习研究会
10+阅读 · 2017年11月19日
各种相似性度量及Python实现
机器学习算法与Python学习
11+阅读 · 2017年7月6日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 4月18日
Arxiv
14+阅读 · 2023年9月27日
VIP会员
最新内容
综述 | 世界动作模型:少做梦,多行动
专知会员服务
3+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
5+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
4+阅读 · 6月23日
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
8+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
4+阅读 · 6月22日
《量子技术的军事任务技术适配与利用》
专知会员服务
5+阅读 · 6月22日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员