基于大型语言模型的策略合成用于可扩展的等式饱和
LLM-Guided Strategy Synthesis for Scalable Equality Saturation
AI总结:
本文提出EggMind框架,通过领域特定语言EqSatL和LLM引导的代理工作流,高效合成可重用的等式饱和策略,提升资源质量平衡,减少成本和内存消耗。
摘要:
等式饱和(EqSat)是一种强大的优化范式,通过e-graph紧凑表示等价程序,并延迟承诺直到提取选择最低成本的程序。使EqSat有效需要不仅领域特定的重写规则,还需要领域特定的策略。目前,策略设计仍主要依赖手动操作,成为自动化e-graph编译器的主要障碍。最近的规则合成框架可以自动从语义规范推断出大型重写词汇表,但也会扩大重写空间并进一步加剧e-graph爆炸。尽管大型语言模型(LLMs)使自动化策略合成成为可能,但直接演化后端代码在实践中仍无效。搜索缺乏可重用的策略抽象和可操作的反馈,并容易触发e-graph爆炸或收敛到劣质设计。我们提出了EggMind,一种基于LLM的端到端框架,用于合成可重用的EqSat策略。其核心是引入领域特定语言EqSatL,以显式和可检查的方式表示EqSat策略。然后提出一种LLM引导的代理工作流,配备新的技术包括证明衍生的重写动机缓存和可处理性 指导,以高效搜索高质量策略,同时在e-graph增长下保持合成的稳定性。评估显示,EggMind在向量化基准上显著提高了资源质量平衡,相对于完整EqSat,最终成本减少了45.1%,峰值RAM减少了69.1%。我们进一步展示相同的方法论有效转移到基于XLA的张量编译器,并在逻辑综合案例研究中通过增强的重写空间展示了其实际潜力。
英文摘要:
Equality saturation (EqSat) is a powerful optimization paradigm that compactly represents many equivalent programs in an e-graph and delays commitment until extraction selects a lowest-cost program. Making EqSat effective, therefore, requires not only domain-specific rewrite rules but also domain-specific strategies. Today, much of this strategy design is still manual, making it a major obstacle to automating e-graph-based compilers. Recent rule-synthesis frameworks can automatically infer large rewrite vocabularies from semantic specifications, but they also enlarge the rewrite space and further exacerbate e-graph explosion. Although large language models (LLMs) make automated strategy synthesis plausible, directly evolving backend code remains ineffective in practice. The search lacks reusable strategy abstractions and actionable feedback, and can easily trigger e-graph explosion or converge to poor designs. We present EggMind, an LLM-guided, end-to-end framework for synthesizing reusable EqSat strategies. At its core, EggMind introduces a domain-specific language, EqSatL, to represent EqSat strategies as explicit and inspectable artifacts. It then proposes an LLM-guided agentic workflow, equipped with novel techniques including proof-derived rewrite motif caching and tractability guidance, to search efficiently for high-quality strategies while keeping synthesis stable under e-graph growth. Evaluation shows that EggMind substantially improves the resource-quality trade-off on vectorization benchmarks, reducing final cost by 45.1% and peak RAM by 69.1% relative to full EqSat. We further show that the same methodology transfers effectively to an XLA-based tensor compiler, and demonstrate its practical potential in a logic-synthesis case study with augmented rewrite spaces.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。