CN110059817B - 一种实现低资源消耗卷积器的方法 - Google Patents

一种实现低资源消耗卷积器的方法 Download PDF

Info

Publication number
CN110059817B
CN110059817B CN201910310484.2A CN201910310484A CN110059817B CN 110059817 B CN110059817 B CN 110059817B CN 201910310484 A CN201910310484 A CN 201910310484A CN 110059817 B CN110059817 B CN 110059817B
Authority
CN
China
Prior art keywords
convolver
convolution
core
addition
cores
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910310484.2A
Other languages
English (en)
Other versions
CN110059817A (zh
Inventor
黄以华
吴黄涛
黄文津
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sun Yat Sen University
Original Assignee
Sun Yat Sen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sun Yat Sen University filed Critical Sun Yat Sen University
Priority to CN201910310484.2A priority Critical patent/CN110059817B/zh
Publication of CN110059817A publication Critical patent/CN110059817A/zh
Application granted granted Critical
Publication of CN110059817B publication Critical patent/CN110059817B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Biomedical Technology (AREA)
  • Pure & Applied Mathematics (AREA)
  • Biophysics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Neurology (AREA)
  • Complex Calculations (AREA)

Abstract

本发明涉及一种实现低资源消耗卷积器的方法,将卷积器的乘法核内部进行拆解,将乘法核内部具有相同偏移量的数据进行相加,形成卷积加法核;根据每个卷积加法核所对应的偏移量,对卷积加法核的结果进行相应的移位,并通过加法树算出最终的卷积结果。本发明的硬件消耗相比传统方法大约节省5~10%的LUT资源(FPGA实现),并且具有易于部署及方便重用等优点。

Description

一种实现低资源消耗卷积器的方法
技术领域
本发明涉及深度学习技术领域,更具体的,涉及一种基于FPGA(FieldProgrammable Gate Array)的实现低资源消耗卷积器的方法。
背景技术
深度卷积神经网络广泛用于计算机视觉、图像分类、物体识别等领域,但是训练网络所需庞大的数据集和复杂的计算过程,限制了网络部署的平台,特别是在低功耗,计算资源有限等平台,尤其是移动设备和嵌入式设备等。将深度卷积神经网络从服务器集群迁移到移动平台中执行,是目前的研究热点和大趋势。
在卷积神经网络中,卷积层的计算量占据总体计算量90%以上,因此,卷积层运算的加速是卷积神经网络加速的重要组成部分。通用处理器CPU和GPU等在执行通用的处理任务时具有很高的性能表现,但是卷积神经网络的计算包含大量并行的非线性函数运算,向量运算和卷积运算,而通用处理器的硬件结构并不是一种高并行度的结构,缺乏对这类运算的加速能力,因此,通用处理器执行卷积神经网络的性能不尽如人意。所以,卷积神经网络的加速器必须要能够实现以下两个功能:(1)充分利用卷积神经网络中层与层之间,层内各个卷积器的并行度;(2)定制化的计算模块——卷积运算模块。
FPGA是一种可编程逻辑器件,随着半导体技术的不断升级和发展,现在主流的FPGA包含了丰富的逻辑计算,存储和布线资源,可以让研究人员有足够的设计空间来定制专用卷积神经网络加速硬件结构,并且充分利用卷积神经网络计算的并行特性。
目前大多数研究的主要内容都是设计一个合适计算框架来对卷积神经网络进行加速,常见的框架有Dataflow、SIMD和SIMT等等。研究的重点在于数据和计算单元——卷积运算核的配合,而非对卷积运算核的优化,大部分的研究都是通过调用FPGA内部的DSP单元来实现卷积运算,或者进一步搭建树状的卷积运算核来减少计算延时,这类卷积运算核包含了通用的乘法器,然而,卷积器的权重值在整个卷积过程都是固定的,因此,在卷积运算核中使用通用乘法器会导致不必要的资源开销,消耗较大的计算机资源而且效率低下。
发明内容
为了解决现有的深度卷积神经网络技术在进行网络训练时需要消耗较大计算机资源的不足,本发明提供了一种基于FPGA的实现低资源(LUT6资源)消耗卷积器的方法。
为实现以上发明目的,采用的技术方案是:
一种实现低资源消耗卷积器的方法,包括以下步骤:
将卷积器的乘法核内部进行拆解,将乘法核内部具有相同偏移量的数据进行相加,形成卷积加法核;根据每个卷积加法核所对应的偏移量,对卷积加法核的结果进行相应的移位,并通过加法树算出最终的卷积结果。
优选的,所述的方法在FPGA的基础单元Lut6中实现。
优选的,在FPGA的基础单元Lut6中,对于N个M Bit数据与N个M Bit数据的卷积器,将卷积器N个乘法核内部进行拆解,将N个乘法核内部具有相同偏移量的N个M Bit数据进行相加,形成M个卷积加法核。
优选的,所述的M个卷积加法核的每个加法核输出一个最终的加法结果。
优选的,M个卷积加法核的每个加法核的计算结果,都应进行一个额外的移位操作,移位操作的偏移量由其操作数的原本偏移量决定。
优选的,所述的M个卷积加法核的每个加法核通过一个完全二叉树固定。
与现有技术相比,本发明的有益效果是:
1.在FPGA上部署相比传统方法更省LUT资源,本发明计算了最大的是M个N操作数的加法核,通过本发明的结构,在最耗LUT6资源的加法核中并没有移位操作,用的是原始的M比特数据进行运算。相比传统方法中在计算量最大的乘法核中进行大位数的操作数计算,本发明能节省部分FPGA中的LUT6的算资源。
2.本发明在卷积神经网络的FPGA实现中,具有更易部署,易重用的优点。
本发明的提出是源于神经网络的FPGA实现,本发明的卷积结构是固定的,加法核通过一个完全二叉树固定,因此在后续的矩阵变换都不需要进行调整,只需要更换成对应的卷积加法核即可,相比大框架重新部署,大大的提高了效率。
附图说明
图1为本发明的流程图。
图2为实施例2的卷积器结构示意图。
具体实施方式
附图仅用于示例性说明,不能理解为对本专利的限制;
以下结合附图和实施例对本发明做进一步的阐述。
实施例1
如图1所示,一种实现低资源消耗卷积器的方法,包括以下步骤:
将卷积器的乘法核内部进行拆解,将乘法核内部具有相同偏移量的数据进行相加,形成卷积加法核;根据每个卷积加法核所对应的偏移量,对卷积加法核的结果进行相应的移位,并通过加法树算出最终的卷积结果。
作为一个优选的实施例,所述的方法在FPGA的基础单元Lut6中实现。
作为一个优选的实施例,在FPGA的基础单元Lut6中,对于N个M Bit数据与N个MBit数据的卷积器,将卷积器N个乘法核内部进行拆解,将N个乘法核内部具有相同偏移量的N个M Bit数据进行相加,形成M个卷积加法核。
作为一个优选的实施例,所述的M个卷积加法核的每个加法核输出一个最终的加法结果,位数会比操作数的M比特大。
作为一个优选的实施例,M个卷积加法核的每个加法核的计算结果,都应进行一个额外的移位操作,移位操作的偏移量由其操作数的原本偏移量决定。
作为一个优选的实施例,所述的M个卷积加法核的每个加法核通过一个完全二叉树固定。
实施例2
本实施例选取5个8Bit数据与5个8Bit数据的卷积器。
具体的实现步骤如图2所示。标识E所标注的部分为特殊的卷积加法核,其操作数都为C所标注的数据。即这个特殊的加法核,其操作数是取自传统的乘法核里面具有相同偏移位置的5个数据,并且输入这个加法核的数据是不进行移位操作的,只取了最原始的8比特数据。
上述的特殊的卷积加法核中,进行了5个8比特数据的全加操作。每个加法核输出一个最终的加法结果,位数为11bit。每个加法核都是将拥有相同偏移量的8比特数据进行相加,可以得出,对于每个加法核的计算结果,都应进行一个额外的移位操作,偏移量由其操作数的原本的偏移量决定(0~8-1),如图2标注D所示的数据,即为加法核对应的偏移量。最后,将这8个数据进行相加,得到最终的结果。
传统乘法器结构的卷积器在FPGA中进行硬件实现的RTL示意图及资源消耗如表格1所示。
Figure BDA0002031294040000041
表格1传统乘法器结构卷积器资源消耗统计。
在传统乘法器结构的卷积器中,5对数据(10个8bit数据)分别输入乘法器模块中,乘法结果输出传进加法器组成的加法树中,经过3层加法树计算最终得到卷积结果。表格1列出了单个乘法器核消耗的资源数及总消耗资源数(相应的加法树消耗的资源可以从表中算出),本发明的卷积器在FPGA中进行硬件实现的RTL示意图及资源消耗如表格2所示。
Figure BDA0002031294040000042
Figure BDA0002031294040000051
表格2本发明卷积器资源消耗统计
而在基于本发明的卷积器中,5对数据(10个8bit数据),每队数据中,第一个数被第二个数的每一比特选通一次,将5对数据中相应比特位选通的数据汇总成组(一共8组)一起传入本发明声明的特殊加法核中,产生8个输出,并最终通过加法树累加到一起得出卷积结果。表格2列出了单个特殊加法核消耗的资源数及总消耗资源数(相应加法树消耗的资源可以从表中算出)
可见,实际应用中,本发明能比传统方法节省约16%的硬件资源。
显然,本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明权利要求的保护范围之内。

Claims (5)

1.一种实现低资源消耗卷积器的方法,其特征在于,包括以下步骤:
将卷积器的乘法核内部进行拆解,将乘法核内部具有相同偏移量的数据进行相加,形成卷积加法核;根据每个卷积加法核所对应的偏移量,对卷积加法核的结果进行相应的移位,并通过加法树算出最终的卷积结果;
在FPGA的基础单元Lut6中,对于N个M Bit数据与N个M Bit数据的卷积器,将卷积器N个乘法核内部进行拆解,将N个乘法核内部具有相同偏移量的N个M Bit数据进行相加,形成M个卷积加法核。
2.根据权利要求1所述的一种实现低资源消耗卷积器的方法,其特征在于,所述的方法在FPGA的基础单元Lut6中实现。
3.根据权利要求1所述的一种实现低资源消耗卷积器的方法,其特征在于,所述的M个卷积加法核的每个加法核输出一个最终的加法结果。
4.根据权利要求1所述的一种实现低资源消耗卷积器的方法,其特征在于,M个卷积加法核的每个加法核的计算结果,都应进行一个额外的移位操作,移位操作的偏移量由其操作数的原本偏移量决定。
5.根据权利要求1所述的一种实现低资源消耗卷积器的方法,其特征在于,所述的M个卷积加法核的每个加法核通过一个完全二叉树固定。
CN201910310484.2A 2019-04-17 2019-04-17 一种实现低资源消耗卷积器的方法 Active CN110059817B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910310484.2A CN110059817B (zh) 2019-04-17 2019-04-17 一种实现低资源消耗卷积器的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910310484.2A CN110059817B (zh) 2019-04-17 2019-04-17 一种实现低资源消耗卷积器的方法

Publications (2)

Publication Number Publication Date
CN110059817A CN110059817A (zh) 2019-07-26
CN110059817B true CN110059817B (zh) 2023-06-13

Family

ID=67319318

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910310484.2A Active CN110059817B (zh) 2019-04-17 2019-04-17 一种实现低资源消耗卷积器的方法

Country Status (1)

Country Link
CN (1) CN110059817B (zh)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6490121B1 (en) * 2000-03-31 2002-12-03 Seagate Technology Llc Accelerated servo control calculations method and apparatus for a disc drive
WO2015051105A1 (en) * 2013-10-02 2015-04-09 The Penn State Research Foundation Techniques and devices for performing arithmetic

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5530661A (en) * 1994-10-05 1996-06-25 Winnov Data bit-slicing apparatus and method for computing convolutions
US20160013773A1 (en) * 2012-11-06 2016-01-14 Pavel Dourbal Method and apparatus for fast digital filtering and signal processing
US10810696B2 (en) * 2015-12-16 2020-10-20 Stc.Unm System and methods for computing 2-D convolutions and cross-correlations
CN106951395B (zh) * 2017-02-13 2018-08-17 上海客鹭信息技术有限公司 面向压缩卷积神经网络的并行卷积运算方法及装置
JP7029321B2 (ja) * 2017-04-20 2022-03-03 パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ 情報処理方法、情報処理装置およびプログラム
CN107656990A (zh) * 2017-09-14 2018-02-02 中山大学 一种基于字和词两个层面特征信息的文本分类方法
CN109063825B (zh) * 2018-08-01 2020-12-29 清华大学 卷积神经网络加速装置

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6490121B1 (en) * 2000-03-31 2002-12-03 Seagate Technology Llc Accelerated servo control calculations method and apparatus for a disc drive
WO2015051105A1 (en) * 2013-10-02 2015-04-09 The Penn State Research Foundation Techniques and devices for performing arithmetic

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
软判决维特比译码及其FPGA实现;徐永键,等;《IT时代周刊》论文专版(第300期);第116-119页 *
高效实时的抽取滤波器的FPGA实现;陈俊;汪学刚;;电子科技大学学报(第06期);第29-32页 *

Also Published As

Publication number Publication date
CN110059817A (zh) 2019-07-26

Similar Documents

Publication Publication Date Title
US11531541B2 (en) Processing apparatus and processing method
Zendegani et al. RoBA multiplier: A rounding-based approximate multiplier for high-speed yet energy-efficient digital signal processing
Guo et al. Software-hardware codesign for efficient neural network acceleration
TWI795519B (zh) 計算裝置、機器學習運算裝置、組合處理裝置、神經網絡芯片、電子設備、板卡及執行機器學習計算的方法
CN108733348B (zh) 融合向量乘法器和使用其进行运算的方法
CN110163358B (zh) 一种计算装置及方法
Sun et al. A high-performance accelerator for large-scale convolutional neural networks
Shi et al. Design of parallel acceleration method of convolutional neural network based on fpga
An et al. 29.3 an 8.09 tops/w neural engine leveraging bit-sparsified sign-magnitude multiplications and dual adder trees
CN109389213B (zh) 存储装置及方法、数据处理装置及方法、电子装置
Shivapakash et al. A power efficient multi-bit accelerator for memory prohibitive deep neural networks
Yin et al. FPGA-based high-performance CNN accelerator architecture with high DSP utilization and efficient scheduling mode
Wang et al. High-performance mixed-low-precision cnn inference accelerator on fpga
CN110059817B (zh) 一种实现低资源消耗卷积器的方法
CN117421703A (zh) 一种深度符号回归加速器及深度符号回归方法
Zhan et al. Field programmable gate array‐based all‐layer accelerator with quantization neural networks for sustainable cyber‐physical systems
CN111882050A (zh) 基于fpga的用于提高bcpnn速度的设计方法
Qureshi et al. NeuroMAX: a high throughput, multi-threaded, log-based accelerator for convolutional neural networks
Kishore et al. Implementation of braun and baugh-wooley multipliers using qca
CN112036561B (zh) 数据处理方法、装置、电子设备及存储介质
CN113034343B (zh) 参数自适应的高光谱图像分类gpu并行方法
CN110506255A (zh) 节能型可变功率加法器及其使用方法
Jo et al. Bit-serial multiplier based neural processing element with approximate adder tree
Bokade et al. CLA based 32-bit signed pipelined multiplier
CN110059814A (zh) 一种基于fpga的查找表式卷积运算硬件结构

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant