Skip to main content
QUICK REVIEW

[论文解读] CNN2Gate: Toward Designing a General Framework for Implementation of Convolutional Neural Networks on FPGA

Alireza Ghaffari, Yvon Savaria|arXiv (Cornell University)|Apr 6, 2020
Advanced Neural Network Applications参考文献 30被引用 10
一句话总结

CNN2Gate 是一种基于 OpenCL 的自动化框架,通过 ONNX 解析、定点量化和强化学习驱动的设计空间探索,将 CNN 模型编译并优化以部署于 FPGA。其在 Intel Arria 10 FPGA 上实现了 AlexNet 的 18ms 推理延迟和 VGG-16 的 205ms 推理延迟,实现了高效、可扩展且硬件感知的 FPGA 映射,且无需专家级低层设计知识。

ABSTRACT

Convolutional Neural Networks (CNNs) have a major impact on our society because of the numerous services they provide. On the other hand, they require considerable computing power. To satisfy these requirements, it is possible to use graphic processing units (GPUs). However, high power consumption and limited external IOs constrain their usability and suitability in industrial and mission-critical scenarios. Recently, the number of researches that utilize FPGAs to implement CNNs are increasing rapidly. This is due to the lower power consumption and easy reconfigurability offered by these platforms. Because of the research efforts put into topics such as architecture, synthesis and optimization, some new challenges are arising to integrate such hardware solutions to high-level machine learning software libraries. This paper introduces an integrated framework (CNN2Gate) that supports compilation of a CNN model for an FPGA target. CNN2Gate exploits the OpenCL synthesis workflow for FPGAs offered by commercial vendors. CNN2Gate is capable of parsing CNN models from several popular high-level machine learning libraries such as Keras, Pytorch, Caffe2 etc. CNN2Gate extracts computation flow of layers, in addition to weights and biases and applies a "given" fixed-point quantization. Furthermore, it writes this information in the proper format for OpenCL synthesis tools that are then used to build and run the project on FPGA. CNN2Gate performs design-space exploration using a reinforcement learning agent and fits the design on different FPGAs with limited logic resources automatically. This paper reports results of automatic synthesis and design-space exploration of AlexNet and VGG-16 on various Intel FPGA platforms. CNN2Gate achieves a latency of 205 ms for VGG-16 and 18 ms for AlexNet on the FPGA.

研究动机与目标

  • 解决缺乏集成化、自动化工具将高层 CNN 模型映射到 FPGA 上的问题,且对专家硬件知识依赖极低。
  • 通过结合定点量化和硬件感知优化,实现在资源受限 FPGA 上高效、低延迟的推理。
  • 通过自动化的设计空间探索和资源适配,支持在多种 FPGA 平台上的可扩展部署。
  • 通过统一的 OpenCL 基础合成管道,弥合高层机器学习框架(如 Keras、PyTorch)与 FPGA 硬件之间的鸿沟。

提出的方法

  • 使用 ONNX 格式解析来自主流框架(Keras、PyTorch、Caffe2)的训练后 CNN 模型,以提取层计算流程、权重和偏置。
  • 应用预定义的定点量化方案,以降低模型精度并提升硬件效率。
  • 使用商业厂商工具流(如 Intel OpenCL SDK)生成适用于 FPGA 合成的 OpenCL 兼容代码。
  • 采用强化学习智能体执行自动化设计空间探索,并根据资源约束将 CNN 映射到不同 FPGA 目标。
  • 支持流水线内核执行,将卷积和池化层融合为单一处理单元,以提升吞吐量。
  • 利用硬件配置参数(如 CONV 单元数量、缓冲区大小)指导不同 FPGA 资源下的合成与适配过程。

实验结果

研究问题

  • RQ1自动化框架能否在极少人工干预下将多种 CNN 架构映射到 FPGA 上?
  • RQ2强化学习在优化 CNN 在 FPGA 上的资源利用率和推理延迟方面效果如何?
  • RQ3定点量化在多大程度上能保持模型精度,同时减少 FPGA 上的硬件占用面积和功耗?
  • RQ4与手工优化的 RTL 设计相比,自动化高层综合管道在延迟和资源效率方面表现如何?

主要发现

  • CNN2Gate 在 Intel Arria 10 FPGA 上实现了 AlexNet 的 18ms 推理延迟和 VGG-16 的 205ms 推理延迟,证明了自动化实现低延迟部署的可行性。
  • 该框架成功在更大的 FPGA(如 Arria 10)上合成 AlexNet 和 VGG-16,但在小型 Cyclone V FPGA 上因控制逻辑开销过大而无法适配。
  • 在相同 FPGA 上,VGG-16 所需的块 RAM 数量比 AlexNet 多 8%,反映出更深网络架构对内存使用的影响。
  • 尽管使用了更多 FPGA 资源,CNN2Gate 的性能密度(0.266 GOP/s/DSP)仍高于文献 [20] 中的可比设计,表明其在每 DSP 上的效率更高。
  • 对于 VGG-16,CNN2Gate 的延迟比 [8] 低 18%,且使用的 DSP 更少,表明其在大型网络上的优化效率更优。
  • 尽管手工优化的 RTL 设计(如 [10])在原始速度上优于 CNN2Gate,但 CNN2Gate 显著提升了可扩展性和自动化程度,大幅减少了对专家级硬件调优的需求。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。