🤖 AI Summary
This work addresses the challenge of automatically refactoring real-world software into high-level synthesis (HLS)-compatible code, a task hindered by language constraints and fundamental disparities between software and hardware design paradigms. Existing approaches suffer from limited flexibility, poor scalability, and excessive computational overhead. To overcome these limitations, we propose a large language model (LLM)-driven multi-agent workflow that integrates a self-evolving memory mechanism with automated refactoring tools. By enabling cross-task knowledge accumulation and synergistic LLM-tool co-optimization, our method achieves efficient, low-overhead, fully automated HLS code generation and performance tuning. Evaluated on eleven complex real-world benchmarks, our approach matches or surpasses state-of-the-art solutions on nine, delivering a 6.51× geometric mean speedup over the best pragma-tuning tool and a 1.20× improvement over optimized open-source designs, with less than a 20% increase in resource utilization.
📝 Abstract
High-Level Synthesis (HLS) provides a fast path from concepts to silicon, but converting real-world software into synthesizable HLS code remains challenging due to restrictive language support and the gap between software and hardware programming practices. Existing automated and LLM-based refactoring approaches partially address this problem, yet they often lack flexibility, struggle to scale, and incur high computational costs. We introduce AgRefactor, an LLM-based multi-agent workflow for refactoring software into HLS-compatible programs. AgRefactor incorporates a self-evolving memory system that accumulates and retrieves factual and strategic knowledge across tasks, improving robustness and efficiency on unseen programs. To reduce cost and enhance scalability, it integrates automated refactoring tools, enabling agents to balance LLM-driven rewrites with efficient tool-based transformations. On 9 out of 11 challenging real-world benchmarks, which are 5-10x longer than the most complex cases studied in prior work, AgRefactor outperforms or matches the state-of-the-art automated refactoring tool and a strong LLM-based baseline built on the same framework backbone. Further agentic performance optimization yields a 6.51x geometric mean speedup over the SoTA pragma tuning tool and a 1.20x speedup over optimized open-source designs with less than 20% extra resources. AgRefactor is fully-automated and open-sourced.