arXiv:2409.11414cs.ARcs.AI2024-09被引 54

用大模型自动优化硬件电路代码,减少人工迭代。

RTLRewriter: Methodologies for Large Models aided RTL Code Optimization

  • 用大模型结合多模态分析和检索增强生成优化代码
  • 引入成本感知蒙特卡洛树搜索,提升重写效率与质量
  • 提供工业级与学术级双基准测试集,适配不同场景

寄存器传输级(RTL)代码优化在数字电路早期综合阶段对提升效率和性能至关重要。当前优化高度依赖经验丰富的工程师手动调整,常需多次迭代并依赖综合反馈。现有编译器方法难以应对复杂设计。本文提出RTLRewriter框架,利用大模型优化RTL代码。通过电路分割流水线实现快速综合与高效重写;提出多模态程序分析,融入关键的可视化图示信息作为优化线索;设计专用搜索引擎,检索有用的优化指南、算法与代码片段,增强模型生成能力;此外,引入成本感知蒙特卡洛树搜索(C-MCTS)算法,有效管理多样检索内容并引导重写结果。同时,提出快速验证流水线以降低验证开销。为满足产业与学术需求,构建两个基准套件:大型重写基准(Large Rewriter Benchmark),针对复杂场景下的大规模电路分割、优化权衡与验证挑战;小型重写基准(Small Rewriter Benchmark),覆盖更广泛的场景与模式。与Yosys、E-graph等主流编译器对比显示显著提升,验证了大模型在电路设计早期阶段的潜力。基准数据集已开源:https://github.com/yaoxufeng/RTLRewriter-Bench。

原文摘要 · Abstract (English)

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.

硬件优化大模型RTL生成电路设计

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。