RTLRewriter:大模型辅助的RTL代码优化方法
RTLRewriter: Methodologies for Large Models aided RTL Code Optimization
AI总结:
针对RTL代码优化依赖人工、现有编译器方法难以应对复杂设计的问题,提出集成大模型的RTLRewriter框架,结合电路划分、多模态分析等技术及两个基准套件,实现比传统编译器更优的优化效果。
摘要:
寄存器传输级(RTL)代码优化对于在早期综合阶段提升数字电路的效率与性能至关重要。当前,优化工作高度依赖经验丰富的工程师手动完成,通常需要根据综合反馈进行多轮迭代。相比之下,现有的基于编译器的方法难以应对复杂设计。本文提出了RTLRewriter,这是一个利用大模型优化RTL代码的创新框架。该框架采用电路划分流水线实现快速综合与高效改写;提出多模态程序分析方法,将关键的可视化电路图信息作为优化线索;设计了专用搜索引擎,用于识别有用的优化指南、算法和代码片段,以增强模型生成优化后RTL的能力。此外,我们提出了成本感知蒙特卡洛树搜索(C-MCTS)算法用于高效改写,该算法可管理多样化的检索内容并引导改写结果。我们还提出了快速验证流水线以降低验证成本。为满足工业界与学术界的需求,我们构建了两个基准测试套件:大型改写基准(Large Rewriter Benchmark),针对涉及大规模电路划分、优化权衡与验证挑战的复杂场景;小型改写基准(Small Rewriter Benchmark),面向更广泛的场景与模式设计。我们与Yosys、E-graph等成熟编译器的对比分析显示出显著的性能提升,凸显了将大模型集成到电路设计早期阶段的优势。我们的基准测试可在https://github.com/yaoxufeng/RTLRewriter-Bench获取。
英文摘要:
Register Transfer Level (RTL) code optimization is crucial for enhancing the efficiency and performance of digital circuits during early synthesis stages. Currently, optimization relies heavily on manual efforts by skilled engineers, often requiring multiple iterations based on synthesis feedback. In contrast, existing compiler-based methods fall short in addressing complex designs. This paper introduces RTLRewriter, an innovative framework that leverages large models to optimize RTL code. A circuit partition pipeline is utilized for fast synthesis and efficient rewriting. A multi-modal program analysis is proposed to incorporate vital visual diagram information as optimization cues. A specialized search engine is designed to identify useful optimization guides, algorithms, and code snippets that enhance the model ability to generate optimized RTL. Additionally, we introduce a Cost-aware Monte Carlo Tree Search (C-MCTS) algorithm for efficient rewriting, managing diverse retrieved contents and steering the rewriting results. Furthermore, a fast verification pipeline is proposed to reduce verification cost. To cater to the needs of both industry and academia, we propose two benchmarking suites: the Large Rewriter Benchmark, targeting complex scenarios with extensive circuit partitioning, optimization trade-offs, and verification challenges, and the Small Rewriter Benchmark, designed for a wider range of scenarios and patterns. Our comparative analysis with established compilers such as Yosys and E-graph demonstrates significant improvements, highlighting the benefits of integrating large models into the early stages of circuit design. We provide our benchmarks at https://github.com/yaoxufeng/RTLRewriter-Bench.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。