High-Level Synthesis (HLS) enables rapid development of FPGA accelerators, yet achieving high-quality results (QoR) remains challenging due to the large and irregular design space induced by compiler directives (a.k.a pragmas). Selecting effective configurations requires reasoning over complex interactions between program structure, memory behavior, and often conflicting objectives such as latency and resource utilization. Prior model-driven approaches exhibit limited generalization across kernels and fail to capture higher-level optimization intent. Recently, Large Language Models (LLMs) capture code semantics and high-level intent, but their sequential representations hinder modeling of structural dependencies and global trade-offs, leading to suboptimal HLS designs. We present MailoHLS, a hybrid framework that combines LLM-based semantic reasoning with GNN-based structural modeling for objective-aware directive optimization. By integrating structural embeddings via cross-attention and leveraging PEFT with objective-conditioned LoRA adapters and Pareto-driven optimization, MailoHLS enables joint reasoning over code semantics, structure, and design trade-offs. Across seen and unseen kernels, MailoHLS achieves up to 12.42x and 8.4x speedup (9.48x and 4.97x geometric mean) for latency optimization, consistently producing near-Pareto-optimal designs. On fully unseen applications, it reaches up to 10.2x speedup (6.58x geometric mean), outperforming high-end LLMs and prior approaches while narrowing the gap to the Pareto frontier.
翻译:高层次综合(HLS)能够快速开发FPGA加速器,但由于编译器指令(即编译指示)带来的庞大且不规则的设计空间,实现高质量结果(QoR)仍具有挑战性。选择有效配置需要推理程序结构、内存行为以及延迟和资源利用率等往往相互冲突的目标之间的复杂交互。先前的模型驱动方法在跨内核的泛化能力上存在局限,且无法捕捉高层优化意图。近来,大语言模型(LLM)能够捕获代码语义和高层意图,但其序列化表示阻碍了对结构依赖关系和全局权衡的建模,导致HLS设计次优。我们提出MailoHLS——一种结合LLM语义推理与GNN结构建模的混合框架,用于目标感知的指令优化。通过交叉注意力机制集成结构嵌入,并利用基于目标条件LoRA适配器的参数高效微调(PEFT)与帕累托驱动优化,MailoHLS实现了对代码语义、结构与设计权衡的联合推理。在已知和未知内核上,MailoHLS在延迟优化方面实现了最高12.42倍和8.4倍的加速比(几何均值分别为9.48倍和4.97倍),始终能生成接近帕累托最优的设计。在全未见过的应用中,它达到最高10.2倍加速比(几何均值6.58倍),优于高级LLM及先前方法,同时缩小了与帕累托前沿的差距。