arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.07356cs.ARcs.PL
收藏

使用检索增强大型语言模型优化高层次综合设计

Optimizing High-Level Synthesis Designs with Retrieval-Augmented Large Language Models

Haocheng Xu, Haotian Hu, Sitao Huang

AI总结:

针对高层次综合(HLS)代码优化依赖专业知识和繁琐迭代的问题,提出基于检索增强LLM的RALAD框架,利用少样本学习和top-k搜索动态获取领域知识,在编译任务中达到80%成功率,延迟改进较通用LLM提升3.7-19倍。

摘要:

高层次综合(HLS)允许硬件设计者使用C/C++/OpenCL等高级编程语言创建硬件设计,从而极大地提高了硬件设计的生产力。然而,现有的HLS流程需要程序员的硬件设计专业知识,并依赖程序员的手动代码转换和指令注释来指导编译器优化。优化HLS设计需要非平凡的HLS专业知识和繁琐的HLS代码优化迭代过程。自动化HLS代码优化已成为一项迫切需求。最近,在大量代码和编程任务上训练的大型语言模型(LLMs)展现出了卓越的代码理解能力,表明其能够直接处理特定领域的编程查询,而无需耗费大量人力进行微调。在这项工作中,我们提出了一种新颖的基于检索增强LLM的方法,以有效地优化高层次综合(HLS)程序。我们提出的方法利用了少样本学习,使大型语言模型能够通过自然语言提示掌握特定领域的知识。我们提出了一个独特的框架,即检索增强大型语言模型辅助设计(RALAD),旨在提升LLMs在HLS代码优化任务中的性能。RALAD采用先进的嵌入技术和top-k搜索算法,从庞大的数据库中动态获取相关知识,从而为复杂的编程查询提供符合上下文的适当响应。我们在两个特定领域实现了RALAD,利用相对较小的语言模型,在编译任务中达到了80%的惊人成功率,并在延迟改进方面比通用LLMs高出3.7至19倍。

英文摘要:

High-level synthesis (HLS) allows hardware designers to create hardware designs with high-level programming languages like C/C++/OpenCL, which greatly improves hardware design productivity. However, existing HLS flows require programmers' hardware design expertise and rely on programmers' manual code transformations and directive annotations to guide compiler optimizations. Optimizing HLS designs requires non-trivial HLS expertise and tedious iterative process in HLS code optimization. Automating HLS code optimizations has become a burning need. Recently, large language models (LLMs) trained on massive code and programming tasks have demonstrated remarkable proficiency in comprehending code, showing the ability to handle domain-specific programming queries directly without labor-intensive fine-tuning. In this work, we propose a novel retrieval-augmented LLM-based approach to effectively optimize high-level synthesis (HLS) programs. Our proposed method leverages few-shot learning, enabling large language models to adopt domain-specific knowledge through natural language prompts. We propose a unique framework, Retrieve Augmented Large Language Model Aided Design (RALAD), designed to enhance LLMs' performance in HLS code optimization tasks. RALAD employs advanced embedding techniques and top-\emph{k} search algorithms to dynamically source relevant knowledge from extensive databases, thereby providing contextually appropriate responses to complex programming queries. Our implementation of RALAD on two specialized domains, utilizing comparatively smaller language models, achieves an impressive 80\% success rate in compilation tasks and outperforms general LLMs by 3.7 -- 19$\times$ in latency improvement.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑