Papers
Topics
Authors
Recent
Search
2000 character limit reached

RTLRewriter: Methodologies for Large Models aided RTL Code Optimization

Published 4 Sep 2024 in cs.AR, cs.AI, and cs.SE | (2409.11414v1)

Abstract: 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.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (55)
  1. C. Wolf, J. Glaser, and J. Kepler, “Yosys-a free verilog synthesis suite,” in Proceedings of the 21st Austrian Workshop on Microelectronics (Austrochip), vol. 97, 2013.
  2. R. Pasko, P. Schaumont, V. Derudder, S. Vernalde, and D. Durackova, “A new algorithm for elimination of common subexpressions,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 18, no. 1, pp. 58–68, 1999.
  3. M. N. Wegman and F. K. Zadeck, “Constant propagation with conditional branches,” ACM Transactions on Programming Languages and Systems (TOPLAS), vol. 13, no. 2, pp. 181–210, 1991.
  4. D. Chen and J. Cong, “Register binding and port assignment for multiplexer optimization,” in ASP-DAC 2004: Asia and South Pacific Design Automation Conference 2004 (IEEE Cat. No. 04EX753).   IEEE, 2004, pp. 68–73.
  5. P. Pišteka, K. Jelemenská, and M. Kolesár, “Reduction of multiplexer trees using modified lookup table.”
  6. Z. Wang, H. You, J. Wang, M. Liu, Y. Su, and Y. Zhang, “Optimization of multiplexer combination in rtl logic synthesis,” in 2023 International Symposium of Electronics Design Automation (ISEDA).   IEEE, 2023, pp. 121–125.
  7. J. Cocke, “Global common subexpression elimination,” in Proceedings of a symposium on Compiler optimization, 1970, pp. 20–24.
  8. R. Metzger and S. Stroud, “Interprocedural constant propagation: An empirical study,” ACM Letters on Programming Languages and Systems (LOPLAS), vol. 2, no. 1-4, pp. 213–232, 1993.
  9. B. Buchberger and R. Loos, “Algebraic simplification,” in Computer algebra: symbolic and algebraic computation.   Springer, 1982, pp. 11–43.
  10. J. Carette, “Understanding expression simplification,” in Proceedings of the 2004 international symposium on Symbolic and algebraic computation, 2004, pp. 72–79.
  11. J. Knoop, O. Rüthing, and B. Steffen, “Partial dead code elimination,” ACM Sigplan Notices, vol. 29, no. 6, pp. 147–158, 1994.
  12. R. Gupta, D. Benson, and J. Z. Fang, “Path profile guided partial dead code elimination using predication,” in Proceedings 1997 International Conference on Parallel Architectures and Compilation Techniques.   IEEE, 1997, pp. 102–113.
  13. K. D. Cooper, L. T. Simpson, and C. A. Vick, “Operator strength reduction,” ACM Transactions on Programming Languages and Systems (TOPLAS), vol. 23, no. 5, pp. 603–625, 2001.
  14. C. E. LaForest and J. G. Steffan, “Efficient multi-ported memories for fpgas,” in Proceedings of the 18th annual ACM/SIGDA international symposium on Field programmable gate arrays, 2010, pp. 41–50.
  15. J. Ma, G. Zuo, K. Loughlin, X. Cheng, Y. Liu, A. M. Eneyew, Z. Qi, and B. Kasikci, “A hypervisor for shared-memory fpga platforms,” in Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems, 2020, pp. 827–844.
  16. Y. Zhou, K. M. Al-Hawaj, and Z. Zhang, “A new approach to automatic memory banking using trace-based address mining,” in Proceedings of the 2017 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays, 2017, pp. 179–188.
  17. B.-C. Lai, B.-Y. Chen, B.-E. Chen, and Y.-D. Hsin, “Remap+: An efficient banking architecture for multiple writes of algorithmic memory,” IEEE Transactions on Very Large Scale Integration (VLSI) Systems, vol. 28, no. 3, pp. 660–671, 2019.
  18. J. Park and P. C. Diniz, “Synthesis of pipelined memory access controllers for streamed data applications on fpga-based computing engines,” in Proceedings of the 14th international symposium on Systems synthesis, 2001, pp. 221–226.
  19. R. S. Shelar, M. P. Desai, and H. Narayanan, “Decomposition of finite state machines for area, delay minimization,” in Proceedings 1999 IEEE International Conference on Computer Design: VLSI in Computers and Processors (Cat. No. 99CB37040).   IEEE, 1999, pp. 620–625.
  20. M. Liu, T.-D. Ene, R. Kirby, C. Cheng, N. Pinckney, R. Liang, J. Alben, H. Anand, S. Banerjee, I. Bayraktaroglu et al., “Chipnemo: Domain-adapted llms for chip design,” arXiv preprint arXiv:2311.00176, 2023.
  21. J. Blocklove, S. Garg, R. Karri, and H. Pearce, “Chip-chat: Challenges and opportunities in conversational hardware design,” in 2023 ACM/IEEE 5th Workshop on Machine Learning for CAD (MLCAD).   IEEE, 2023, pp. 1–6.
  22. Y. Fu, Y. Zhang, Z. Yu, S. Li, Z. Ye, C. Li, C. Wan, and Y. C. Lin, “Gpt4aigchip: Towards next-generation ai accelerator design automation via large language models,” in 2023 IEEE/ACM International Conference on Computer Aided Design (ICCAD).   IEEE, 2023, pp. 1–9.
  23. Y. Zhang, Y. Fu, Z. Yu, K. Zhao, C. Wan, C. Li, and Y. C. Lin, “Data4aigchip: An automated data generation and validation flow for llm-assisted hardware design,” 2024.
  24. H. Wu, Z. He, X. Zhang, X. Yao, S. Zheng, H. Zheng, and B. Yu, “Chateda: A large language model powered autonomous agent for eda,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 2024.
  25. S. Thakur, B. Ahmad, H. Pearce, B. Tan, B. Dolan-Gavitt, R. Karri, and S. Garg, “Verigen: A large language model for verilog code generation,” arXiv preprint arXiv:2308.00708, 2023.
  26. S. Liu, W. Fang, Y. Lu, Q. Zhang, H. Zhang, and Z. Xie, “Rtlcoder: Outperforming gpt-3.5 in design rtl generation with our open-source dataset and lightweight solution,” arXiv preprint arXiv:2312.08617, 2023.
  27. M. DeLorenzo, A. B. Chowdhury, V. Gohil, S. Thakur, R. Karri, S. Garg, and J. Rajendran, “Make every move count: Llm-based high-quality rtl code generation using mcts,” arXiv preprint arXiv:2402.03289, 2024.
  28. Y. Tsai, M. Liu, and H. Ren, “Rtlfixer: Automatically fixing rtl syntax errors with large language models,” arXiv preprint arXiv:2311.16543, 2023.
  29. Z. Pei, H.-L. Zhen, M. Yuan, Y. Huang, and B. Yu, “Betterv: Controlled verilog generation with discriminative guidance,” arXiv preprint arXiv:2402.03375, 2024.
  30. X. Yao, H. Li, T. H. Chan, W. Xiao, M. Yuan, Y. Huang, L. Chen, and B. Yu, “Hdldebugger: Streamlining hdl debugging with large language models,” arXiv preprint arXiv:2403.11671, 2024.
  31. Z. Wang, L. Chen, J. Wang, X. Li, Y. Bai, X. Li, M. Yuan, J. Hao, Y. Zhang, and F. Wu, “A circuit domain generalization framework for efficient logic synthesis in chip design,” arXiv preprint arXiv:2309.03208, 2023.
  32. Z. Wang, J. Wang, D. Zuo, J. Yunjie, X. Xia, Y. Ma, H. Jianye, M. Yuan, Y. Zhang, and F. Wu, “A hierarchical adaptive multi-task reinforcement learning framework for multiplier circuit design,” in Forty-first International Conference on Machine Learning, 2024.
  33. T. Liu, Y. Sun, L. Chen, X. Li, M. Yuan, and E. F. Young, “A unified parallel framework for lut mapping and logic optimization,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 2024.
  34. X. Li, X. Li, L. Chen, X. Zhang, M. Yuan, and J. Wang, “Logic synthesis with generative deep neural networks,” arXiv preprint arXiv:2406.04699, 2024.
  35. ——, “Circuit transformer: End-to-end circuit design by predicting the next gate,” arXiv preprint arXiv:2403.13838, 2024.
  36. M. Liu, N. Pinckney, B. Khailany, and H. Ren, “Verilogeval: Evaluating large language models for verilog code generation,” in 2023 IEEE/ACM International Conference on Computer Aided Design (ICCAD).   IEEE, 2023, pp. 1–8.
  37. N. F. Liu, K. Lin, J. Hewitt, A. Paranjape, M. Bevilacqua, F. Petroni, and P. Liang, “Lost in the middle: How language models use long contexts,” Transactions of the Association for Computational Linguistics, vol. 12, pp. 157–173, 2024.
  38. T. Chen and C. Guestrin, “Xgboost: A scalable tree boosting system,” 2016, pp. 785–794.
  39. J. Wei, X. Wang, D. Schuurmans, M. Bosma, F. Xia, E. Chi, Q. V. Le, D. Zhou et al., “Chain-of-thought prompting elicits reasoning in large language models,” Advances in Neural Information Processing Systems, vol. 35, pp. 24 824–24 837, 2022.
  40. Y. Gao, Y. Xiong, X. Gao, K. Jia, J. Pan, Y. Bi, Y. Dai, J. Sun, and H. Wang, “Retrieval-augmented generation for large language models: A survey,” arXiv preprint arXiv:2312.10997, 2023.
  41. Y. E. Ioannidis, “Query optimization,” ACM Computing Surveys (CSUR), vol. 28, no. 1, pp. 121–123, 1996.
  42. A. Aizawa, “An information-theoretic perspective of tf–idf measures,” Information Processing & Management, vol. 39, no. 1, pp. 45–65, 2003.
  43. P. Auer, “Using confidence bounds for exploitation-exploration trade-offs,” Journal of Machine Learning Research, vol. 3, no. Nov, pp. 397–422, 2002.
  44. J. Marques-Silva and T. Glass, “Combinational equivalence checking using satisfiability and recursive learning,” in Proceedings of the conference on Design, automation and test in Europe, 1999, pp. 33–es.
  45. A. Sayed-Ahmed, D. Große, M. Soeken, and R. Drechsler, “Equivalence checking using gröbner bases,” in 2016 Formal Methods in Computer-Aided Design (FMCAD).   IEEE, 2016, pp. 169–176.
  46. P. Godefroid, M. Y. Levin, D. A. Molnar et al., “Automated whitebox fuzz testing.” in NDSS, vol. 8, 2008, pp. 151–166.
  47. J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, Aleman et al., “Gpt-4 technical report,” arXiv preprint arXiv:2303.08774, 2023.
  48. S. Coward, G. A. Constantinides, and T. Drane, “Automatic datapath optimization using e-graphs,” in 2022 IEEE 29th Symposium on Computer Arithmetic (ARITH).   IEEE, 2022, pp. 43–50.
  49. A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” arXiv preprint arXiv:2010.11929, 2020.
  50. H. Touvron, L. Martin, K. Stone, P. Albert, A. Almahairi, Y. Babaei, N. Bashlykov, S. Batra, P. Bhargava, S. Bhosale et al., “Llama 2: Open foundation and fine-tuned chat models,” arXiv preprint arXiv:2307.09288, 2023.
  51. X. Bi, D. Chen, G. Chen, S. Chen, D. Dai et al., “Deepseek llm: Scaling open-source language models with longtermism,” arXiv preprint arXiv:2401.02954, 2024.
  52. S. Williams and M. Baxter, “Icarus verilog: open-source verilog more than a year later,” Linux Journal, vol. 2002, no. 99, p. 3, 2002.
  53. R. Brayton and A. Mishchenko, “Abc: An academic industrial-strength verification tool,” in Computer Aided Verification: 22nd International Conference, CAV 2010, Edinburgh, UK, July 15-19, 2010. Proceedings 22.   Springer, 2010, pp. 24–40.
  54. S. Robertson, H. Zaragoza et al., “The probabilistic relevance framework: Bm25 and beyond,” Foundations and Trends® in Information Retrieval, vol. 3, no. 4, pp. 333–389, 2009.
  55. A. Liaw, M. Wiener et al., “Classification and regression by randomforest,” R news, vol. 2, no. 3, pp. 18–22, 2002.
Citations (2)

Summary

No one has generated a summary of this paper yet.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Continue Learning

We haven't generated follow-up questions for this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 2 tweets with 1 like about this paper.