arXiv:2410.19225cs.LGcs.AI2024-10AAAI被引 15

用分层专家混合模型提升FPGA代码优化的通用性,让软件开发者也能高效设计硬件指令。

Hierarchical Mixture of Experts: Generalizable Learning for High-Level Synthesis

  • 构建两级专家混合架构,从节点、基本块到图层面捕捉程序特征。
  • 在新内核上测试时性能比基线模型平均提升23.7%,且稳定适应不同领域。
  • 适合想用AI自动优化FPGA代码的软硬件交叉开发者使用。

高层综合(HLS)是用于设计现场可编程门阵列(FPGA)的常用工具,可通过编译源代码生成FPGA电路。源代码包含一个程序(称作“内核”)和若干指示硬件综合的指令(如并行化、流水线等)。虽然软件开发者容易编写程序,但设计这些指令需大量硬件知识,成为主要挑战。近年来,一些机器学习方法(如图神经网络,GNN)被用于通过性能预测自动化指令设计,但在新内核上应用时,因领域差异大,性能常不理想。本文提出一种两层分层专家混合(Hierarchical MoE)模型结构,可灵活适配任意GNN模型。不同专家网络可学习表示空间中不同区域的特征,并利用旧内核与新内核间的相似模式。低层MoE在程序的三个自然粒度(节点、基本块、图)上应用MoE;高层MoE则整合三者特征进行最终决策。为确保训练稳定,提出两阶段训练策略以避免专家极化。大量实验验证了该模型的有效性。代码已公开于 https://github.com/weikai-li/HierarchicalMoE。

原文摘要 · Abstract (English)

High-level synthesis (HLS) is a widely used tool in designing Field Programmable Gate Array (FPGA). HLS enables FPGA design with software programming languages by compiling the source code into an FPGA circuit. The source code includes a program (called "kernel") and several pragmas that instruct hardware synthesis, such as parallelization, pipeline, etc. While it is relatively easy for software developers to design the program, it heavily relies on hardware knowledge to design the pragmas, posing a big challenge for software developers. Recently, different machine learning algorithms, such as GNNs, have been proposed to automate the pragma design via performance prediction. However, when applying the trained model on new kernels, the significant domain shift often leads to unsatisfactory performance. We propose a more domain-generalizable model structure: a two-level hierarchical Mixture of Experts (MoE), that can be flexibly adapted to any GNN model. Different expert networks can learn to deal with different regions in the representation space, and they can utilize similar patterns between the old kernels and new kernels. In the low-level MoE, we apply MoE on three natural granularities of a program: node, basic block, and graph. The high-level MoE learns to aggregate the three granularities for the final decision. To train the hierarchical MoE stably, we further propose a two-stage training method to avoid expert polarization. Extensive experiments verify the effectiveness of the proposed hierarchical MoE. We publicized our codes at https://github.com/weikai-li/HierarchicalMoE.

FPGA专家混合机器学习代码优化

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