paperbot · PL 论文追踪

全部论文 待读 收藏

P2 EPSO: A Caching-Based Efficient Superoptimizer for BPF Bytecode

EPSO:面向 BPF 字节码的基于缓存的高效超优化器
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 2/10 · 论文研究 eBPF 字节码的超优化与缓存技术,属于编译优化和程序合成领域,未涉及用户核心关注的 PL 与 AI 交叉(如 LLM 用于静态分析、浮点程序分析、贝叶斯程序分析),但工业落地案例可能有一定参考价值。引用 0 inbox
Qian Zhu, Yuxuan Liu, Ziyuan Zhu, Shangqing Liu, Lei Bu
crossref: 2026-09-12

AI 速览

一句话:EPSO 通过离线超优化发现重写规则并缓存复用,实现对 eBPF 字节码高质量、低开销的自动优化。

eBPF 允许开发者在不修改内核源码的前提下扩展内核功能,但内核验证器对加载的程序施加了严格安全约束(如程序大小限制),加上 eBPF 多用于性能敏感场景,高效优化因此十分关键。现有编译器(如 Clang)优化能力有限,而许多保持语义的变换会被验证器拒绝,导致手工设计优化规则既困难又效果受限。超优化能自动发现最优变换,但计算开销大、难以扩展。为此,作者提出 EPSO:一种基于缓存的超优化器,先离线通过超优化自动发现重写规则,再在运行时复用这些规则,以极小的运行时开销获得高质量优化。作者在 Linux 内核及 Cilium、Katran、hXDP、Sysdig、Tetragon、Tracee 等 eBPF 项目的基准上评估:EPSO 共发现 795 条重写规则,相比 Clang 输出程序大小最多减少 68.87%(平均 24.37%),在所有基准上优于当前最优的 BPF 优化器 K2,并在 92.68% 的基准上优于 Merlin;同时程序运行时间平均降低 6.60%,提升了网络应用的吞吐并降低了延迟。

问题
eBPF 程序受内核验证器的严格安全约束(如程序大小限制)且常用于性能关键场景,而现有编译器优化支持有限、手工规则设计困难,使有效优化成为难题。
方法
采用基于缓存的超优化思路:离线执行超优化自动发现保持语义的重写规则并缓存,在线阶段复用这些规则对 BPF 字节码进行低运行时开销的高质量变换。
评估
在 Linux 内核及 Cilium、Katran、hXDP、Sysdig、Tetragon、Tracee 等项目的基准上评估,共发现 795 条重写规则,程序大小平均减少 24.37%(最高 68.87%),全面优于 K2、在 92.68% 基准上优于 Merlin,运行时间平均降低 6.60%。
原文摘要(Abstract)

Extended Berkeley Packet Filter (eBPF) allows developers to extend Linux kernel functionality without modifying its source code. To ensure system safety, an in-kernel safety checker, the verifier, enforces strict safety constraints (e.g., a limited program size) on eBPF programs loaded into the kernel. These constraints, combined with eBPF’s performance-critical use cases, make effective optimization essential. However, existing compilers (e.g., Clang) offer limited optimization support, and many semantics-preserving transformations are rejected by the verifier, which makes handcrafted optimization rule design both challenging and limited in effectiveness.Superoptimization overcomes the limitations of rule-based methods by automatically discovering optimal transformations, but its high computational cost limits scalability. To address this, we propose EPSO, a caching-based superoptimizer that discovers rewrite rules via offline superoptimization, and reuses them to achieve high-quality optimizations with minimal runtime overhead. We evaluate EPSO on benchmarks from the Linux kernel and several eBPF-based projects, including Cilium, Katran, hXDP, Sysdig, Tetragon, and Tracee. EPSO discovers 795 rewrite rules and achieves up to 68.87% (avg. 24.37%) reduction in program size compared to Clang’s output, outperforming the state-of-the-art BPF optimizer K2 on all benchmarks and Merlin on 92.68% of them. Additionally, EPSO reduces program runtime by an average of 6.60%, improving throughput and lowering latency in network applications.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9457,
  title = {EPSO: A Caching-Based Efficient Superoptimizer for BPF Bytecode},
  author = {Qian Zhu and Yuxuan Liu and Ziyuan Zhu and Shangqing Liu and Lei Bu},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00242}
}