paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Flan: An Expressive and Efficient Datalog Compiler for Program Analysis

Flan:面向程序分析的高表达力高效 Datalog 编译器
POPL 8(POPL)2024匹配度 4/10 · 论文提出面向程序分析的 Datalog 编译器 Flan,属于静态分析/程序语言基础设施,但未涉及 LLM/Agent、浮点或贝叶斯程序分析,与用户关注的 PL 与 AI 交叉方向不直接匹配。引用 9 inbox
Supun Abeysinghe, Anxhelo Xhebraj, Tiark Rompf
crossref: 2026-09-10

AI 速览

一句话:提出嵌入 Scala 的 Datalog 编译器 Flan,用多阶段编程生成专用代码,兼顾表达力与性能。

现有 Datalog 系统在程序分析中面临表达力与性能难以兼得的问题:Soufflé 性能高但缺少与宿主语言的无缝互操作,Flix、Datafun、Formulog 等扩展语言灵活但常牺牲性能。本文提出 Flan,一个完全嵌入 Scala 的 Datalog 编译器,利用多阶段编程为整个计算生成专用代码,并与宿主语言无缝集成。其简单算子接口支持任意聚合、用户定义函数、格,以及二分/多路连接和树/哈希表索引等多种执行策略。基准评测显示,Flan 与主流 Datalog 引擎相比具有竞争力的性能,在实际重要工作负载上相对最先进系统取得加速。

问题
Datalog 适合程序分析,但现有系统难以同时兼顾可扩展表达力、与宿主语言互操作和高性能编译。
方法
将 Datalog 完全嵌入 Scala,利用多阶段编程生成专用代码,并通过简单算子接口支持聚合、UDF、格与多种连接/索引策略。
评估
在多种基准上与成熟 Datalog 引擎对比,显示有竞争力的性能,并在实际重要工作负载上相对最先进系统取得加速。
原文摘要(Abstract)

Datalog has gained prominence in program analysis due to its expressiveness and ease of use. Its generic fixpoint resolution algorithm over relational domains simplifies the expression of many complex analyses. The performance and scalability issues of early Datalog approaches have been addressed by tools such as Soufflé through specialized code generation. Still, while pure Datalog is expressive enough to support a wide range of analyses, there is a growing need for extensions to accommodate increasingly complex analyses This has led to the development of various extensions, such as Flix, Datafun, and Formulog, which enhance Datalog with features like arbitrary lattices and SMT constraints. Most of these extensions recognize the need for full interoperability between Datalog and a full-fledged programming language, a functionality that high-performance systems like Soufflé lack. Specifically, in most cases, they construct languages from scratch with first-class Datalog support, allowing greater flexibility. However, this flexibility often comes at the cost of performance due to the conflicting requirements of prioritizing modularity and abstraction over efficiency. Consequently, achieving both flexibility and compilation to highly-performant specialized code poses a significant challenge. In this work, we reconcile the competing demands of expressiveness and performance with Flan, a Datalog compiler fully embedded in Scala that leverages multi-stage programming to generate specialized code for enhanced performance. Our approach combines the flexibility of Flix with Soufflé’s performance, offering seamless integration with the host language that enables the addition of powerful extensions while generating specialized code for the entire computation. Flan’s simple operator interface allows the addition of an extensive set of features, including arbitrary aggregates, user-defined functions, and lattices, with multiple execution strategies such as binary and multi-way joins, supported by different indexing structures like specialized trees and hash tables, with minimal effort. We evaluate our system on a variety of benchmarks and compare it to established Datalog engines. Our results demonstrate competitive performance and speedups in the range of to compared to state-of-the-art systems for workloads of practical importance.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2634,
  title = {Flan: An Expressive and Efficient Datalog Compiler for Program Analysis},
  author = {Supun Abeysinghe and Anxhelo Xhebraj and Tiark Rompf},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {POPL},
  year = {2024},
  doi = {10.1145/3632928}
}