WO2024004221A1 - 演算処理装置、演算処理方法、及び演算処理プログラム - Google Patents

演算処理装置、演算処理方法、及び演算処理プログラム Download PDF

Info

Publication number
WO2024004221A1
WO2024004221A1 PCT/JP2022/026524 JP2022026524W WO2024004221A1 WO 2024004221 A1 WO2024004221 A1 WO 2024004221A1 JP 2022026524 W JP2022026524 W JP 2022026524W WO 2024004221 A1 WO2024004221 A1 WO 2024004221A1
Authority
WO
WIPO (PCT)
Prior art keywords
decimal point
unit
calculation
point position
division unit
Prior art date
Application number
PCT/JP2022/026524
Other languages
English (en)
French (fr)
Inventor
祐輔 堀下
彩希 八田
大祐 小林
優也 大森
健 中村
周平 吉田
宥光 飯沼
寛之 鵜澤
Original Assignee
日本電信電話株式会社
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 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to PCT/JP2022/026524 priority Critical patent/WO2024004221A1/ja
Publication of WO2024004221A1 publication Critical patent/WO2024004221A1/ja

Links

Classifications

    • 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

Definitions

  • the disclosed technology relates to an arithmetic processing device, an arithmetic processing method, and an arithmetic processing program.
  • Patent Document 1 describes a technology related to a data processing device that avoids significant deterioration in data processing results while realizing miniaturization and low power consumption of the device.
  • the data processing device of this technology has a decimal point position control circuit configured to set the decimal point position of N-bit fixed length data corresponding to each of a plurality of layers constituting a multilayer neural network.
  • the data processing device is configured to perform arithmetic processing corresponding to each of a plurality of layers according to a processing algorithm of a multilayer neural network on N-bit fixed length data in which a decimal point position is set. It has a circuit.
  • the decimal point position of the calculation data used for convolution calculation is dynamically controlled for each input image and layer, and the range and decimal precision that can be expressed by the calculation data are optimized. Therefore, there is a technique to suppress the decline in inference accuracy.
  • a calculation result of CNN is analyzed in units of one frame or one layer, and a decimal point position that reflects the analysis result is applied to the calculation process of the next frame. While it is possible to improve the inference accuracy of the next frame with a simple hardware configuration without using floating point calculations, there are also the following issues. First, in low frame rate videos, the temporal correlation between frames becomes low, making it difficult to improve inference accuracy.
  • the disclosed technology has been developed in view of the above points, and aims to provide an arithmetic processing device, an arithmetic processing method, and an arithmetic processing program that can optimize the decimal point position and suppress deterioration of arithmetic accuracy. shall be.
  • a first aspect of the present disclosure is an arithmetic processing device, which includes an arithmetic unit that executes an arithmetic operation corresponding to each layer constituting a neural network and outputs an arithmetic result, and a processor that is divided into one or more units for the arithmetic result.
  • an analysis section that performs an analysis according to the calculation result belonging to the division unit for each division unit, and outputs the analysis result for each division unit; a decimal point position determination unit that determines a decimal point position indicating a dynamic range for each division unit; and a quantization unit that performs quantization.
  • a second aspect of the present disclosure is an arithmetic processing method, which executes a computation corresponding to each layer constituting a neural network, outputs a computation result, and divides the computation result into one or more units. perform an analysis according to the calculation result belonging to the division unit, output the analysis result for each division unit, and determine the decimal point position indicating the dynamic range for each division unit based on the output analysis result for each division unit.
  • a computer executes a process of determining the calculation result and quantizing the calculation result into fixed-point data having a decimal point position determined for the division unit to which the calculation result belongs.
  • a third aspect of the present disclosure is a calculation processing program that executes calculations corresponding to each layer constituting a neural network, outputs calculation results, and divides the calculation results into one or more units. perform an analysis according to the calculation result belonging to the division unit, output the analysis result for each division unit, and determine the decimal point position indicating the dynamic range for each division unit based on the output analysis result for each division unit. is determined, and the computer is caused to perform a process of quantizing the calculation result so that it becomes fixed-point data having a decimal point position determined for the division unit to which the calculation result belongs.
  • FIG. 1 is a block diagram showing the hardware configuration of the object detection device of this embodiment.
  • FIG. 2 shows an example of a layer structure of a convolutional neural network for realizing object detection processing.
  • FIG. 3 is a diagram showing the internal structure of the feature map in this embodiment.
  • FIG. 4 is a block diagram showing an example of the hardware configuration of the accelerator in this embodiment.
  • FIG. 5A shows a case where the size of the decimal point position control unit is 4 ⁇ 4, the PE calculation target block size is 6 ⁇ 6, and each PE uses a 3 ⁇ 3 kernel to perform convolution calculation processing with padding 1 and stride 1. It shows.
  • FIG. 5B shows a case where each PE executes convolution calculation processing with padding 1 and stride 2 using a 3 ⁇ 3 kernel on the feature map output shown in FIG.
  • FIG. 5A shows a case where each PE executes convolution processing with padding 1 and stride 1 using a 3 ⁇ 3 kernel on the feature map output shown in FIG. 5B.
  • FIG. 6 is a block diagram showing an example of the hardware configuration of the PE.
  • FIG. 2 is a block diagram showing an example of the hardware configuration of a calculation unit.
  • FIG. 8 is a diagram showing an example of a hardware configuration for performing digit alignment of calculation data in which a plurality of decimal point positions coexist.
  • the analysis unit in this embodiment is an example of analysis using four types of decimal point positions.
  • FIG. 9B shows an example of the analysis results of the analysis section.
  • FIG. 10 is a flowchart showing the flow of calculation processing in the PE.
  • FIG. 10 is a flowchart showing the flow of calculation processing in the PE.
  • FIG. 11 is a block diagram showing an example of the hardware configuration of a PE in the second embodiment.
  • FIG. 12 shows the reference relationships of the feature map analysis results.
  • FIG. 13 shows an example of a method for determining the decimal point position by the decimal point position determination unit for the analysis result of the feature map.
  • Patent Document 1 discloses a method of dynamically controlling the decimal point position of fixed-point data for each layer constituting a neural network.
  • a counter measures the number of times that an intermediate calculation result of each layer constituting the neural network exceeds the upper or lower limit of the dynamic range of fixed-point data and overflows. Then, in this method, the decimal point position is adjusted based on the counter value so that an overflow will not occur when the next calculation is executed.
  • FIG. 1 is a block diagram showing the hardware configuration of an object detection device 1 of this embodiment.
  • the object detection device 1 includes a CPU (Central Processing Unit) 11, a camera module 12, a main memory 13, and an accelerator 14, which are connected via a system bus 19.
  • the camera module 12 is capable of capturing still images or moving images at a predetermined frame rate, and sequentially stores the captured image data in the main memory 13.
  • the main memory 13 is a work memory necessary for software processing of the CPU 11, and also stores image data taken by the camera module 12, parameters necessary for execution of the accelerator 14, calculation results output by the accelerator 14, etc. .
  • the main memory 13 stores an arithmetic processing program.
  • the CPU 11 is responsible for controlling the entire object detection device 1, and controls the execution timing of the camera module 12 and the accelerator 14, for example.
  • the accelerator 14 reads the image data stored in the main memory 13 and executes object detection processing using a convolutional neural network on the read image data.
  • FIG. 2 shows an example of a layer structure of a convolutional neural network for realizing object detection processing.
  • the input image is an image that has a width of 448 pixels, a height of 448 pixels, and is composed of three color components, RGB.
  • convolution processing or pooling processing using a plurality of different kernels for each layer is performed on the input image to generate a feature map for each channel. Thereafter, the detection unit performs full connection on the feature maps to generate final layer data.
  • the final layer data includes coordinate information indicating the relative position of the object with respect to the input image, reliability indicating whether the object exists at the coordinates, class classification probability, etc. .
  • the class classification probability is a probability indicating what class the object belongs to (person, car, dog, cat, etc.). By referring to this information, the CPU 11 can detect what kind of object exists in what position in the input image.
  • the individual feature amounts constituting the feature map and the parameter values such as the kernel and bias used during the convolution calculation are 8-bit fixed-point data.
  • the circuit scale of the accelerator and the required capacity of the main memory 13 can be significantly reduced compared to when handling 32-bit floating point data or the like.
  • FIG. 3 is a diagram showing the internal structure of the feature map in this embodiment.
  • the feature map is divided into a plurality of spatially different units, and each divided unit has different decimal point position information (hereinafter, the divided units will be referred to as decimal point position control units (or blocks). ).
  • the size of the decimal point position control unit is assumed to be 4 in width and 4 in height (hereinafter referred to as 4 ⁇ 4).
  • the decimal point position control unit can have any size such as 32 ⁇ 32, 8 ⁇ 8, 8 ⁇ 4, 4 ⁇ 1, etc., and can have any shape such as square or rectangle.
  • the size and shape of the decimal point position control unit do not necessarily have to be the same for all layers, and can vary depending on the size of the feature map of each layer and the settings of the kernel size, padding, stride, etc. applied to the convolution operation. It is also possible to change.
  • the spatial size of the feature map is divided into blocks, and each block, which is a unit of division, can have information on a plurality of decimal point positions.
  • the feature map is an example of the calculation result of the present disclosure.
  • the decimal point position control unit is a block obtained by dividing the spatial size of the feature map.
  • a block is an example of a division unit of the present disclosure. In the following, a 3 ⁇ 3 block is assumed.
  • FIG. 4 is a block diagram showing an example of the hardware configuration of the accelerator 14 in this embodiment.
  • the accelerator 14 includes an arithmetic processing section 100 and a cache memory 110.
  • the arithmetic processing unit 100 is an example of the arithmetic processing device of the present disclosure.
  • the Cache memory 110 is connected to main memory 13 via system bus 19.
  • the cache memory 110 serves as a buffer located between the arithmetic processing section 100 and the main memory 13, and plays the role of reducing the data transfer band between the arithmetic processing section 100 and the main memory 13.
  • the arithmetic processing unit 100 includes a control unit 200, a DMAC 210, and a plurality of PEs (Processing Engines) 220 (hereinafter, the symbols for the DMAC and PEs will be omitted).
  • the control unit 200 sets operational parameters for the DMAC and each PE, and also manages data to be supplied to each PE.
  • the DMAC reads the feature map, kernels necessary for convolution calculations, parameters such as bias, and decimal point position information within the feature map from the cache memory 110 in accordance with the operating parameters set by the control unit 200.
  • the read data is supplied to each PE, and each PE executes arithmetic processing in parallel.
  • the feature map generated by the calculation processing by the PE and the decimal point position information inside the feature map are stored in the cache memory 110 via the DMAC, and read out from the cache memory 110 again during the calculation processing of the next layer.
  • FIG. 5 is a diagram showing the relationship between the arithmetic processing unit and decimal point position control unit of each PE. As shown by the dotted line frame in FIG. 5, each PE performs convolution calculation processing on the feature map in units of predetermined blocks.
  • FIG. 5A shows a case where the size of the decimal point position control unit is 4 ⁇ 4, the PE calculation target block size is 6 ⁇ 6, and each PE uses a 3 ⁇ 3 kernel to perform convolution calculation processing with padding 1 and stride 1. It shows. In this case, since nine different types of decimal point positions coexist in the calculation target blocks of each PE, it is necessary to supply nine types of decimal point position information to each PE.
  • Each PE uses the supplied nine types of decimal point position information to align the decimal point of the convolution processing result, integrates the decimal point positions into one, and outputs the result.
  • the decimal point position indicates the dynamic range of data. Selecting and outputting the decimal point position using the decimal point position information referred to here is nothing but determining the dynamic range of the data of that PE.
  • FIG. 5B shows a case where each PE executes convolution calculation processing with padding 1 and stride 2 using a 3 ⁇ 3 kernel on the feature map output shown in FIG. 5A. Similar to FIG. 5A, since nine different types of decimal point position information coexist in the calculation target block of each PE, it is necessary to supply nine types of decimal point position information to each PE. Each PE uses the supplied nine types of decimal point position information to align the decimal point of the convolution processing result, integrates the decimal point positions into one, and outputs the result. In the case of FIG. 5B, since the stride is 2, the feature map width and height are half the size of the input, so the size of the decimal point position control unit inside the feature map is also half the size of the input.
  • FIG. 5C shows a case where each PE executes convolution processing with padding 1 and stride 1 using a 3 ⁇ 3 kernel on the feature map output shown in FIG. 5B.
  • each PE executes convolution processing with padding 1 and stride 1 using a 3 ⁇ 3 kernel on the feature map output shown in FIG. 5B.
  • 16 different types of decimal point position information coexist in the operation target block of each PE, it is necessary to supply 16 types of decimal point position information to each PE.
  • Each PE uses the supplied 16 types of decimal point position information to align the decimal point of the convolution processing result, integrates the decimal point positions into one, and outputs the result.
  • each PE uses a kernel of a predetermined size to perform convolution calculation processing with a predetermined padding and a predetermined stride on the feature map output.
  • a maximum of four types of decimal point positions coexist within a 3 ⁇ 3 feature map (one block). In this way, a block, which is a unit of division, has a plurality of decimal point positions.
  • nine types of decimal point position information are required in the case shown in FIGS.
  • the decimal point position information required for calculation can be reduced compared to when floating point data is used. can be significantly reduced.
  • FIG. 6 is a block diagram showing an example of the hardware configuration of the PE.
  • the PE in the calculation processing section 100 includes a calculation section 300, a delay buffer 310, an analysis section 320, a decimal point position determination section 330, and a quantization section 340.
  • the functional processing of each part of the PE will be described below.
  • the calculation unit 300 performs CNN calculation.
  • the calculation unit 300 performs a convolution calculation using the input feature map and kernel, and performs calculation processing such as bias addition and activation function processing on the convolution calculation result.
  • the calculation unit 300 executes calculations corresponding to each layer constituting the neural network through processing explained in detail below, and outputs a feature map as the calculation result.
  • the calculation unit 300 has a plurality of filter processing units corresponding to the block size to be calculated by the PE, and each filter processing unit performs a maximum of 3 ⁇ 3 convolution calculation, bias addition, and activation function processing, and calculates characteristics as the calculation result.
  • Input a1 is a feature map input (3 ⁇ 3)
  • a2 is a kernel (3 ⁇ 3)
  • Output b1 is a feature map output
  • b2 is decimal point position information.
  • the feature map and kernel input to each filter processing unit are multiplied by a 3 ⁇ 3 multiplier.
  • the 3 ⁇ 3 multiplication results are subjected to digit alignment processing for the decimal point position, they are all added together with the cumulative addition results for the input channels, and are output to the subsequent stage as the product-sum calculation results.
  • the product-sum operation result is also stored in the RAM, and cumulatively added to the 3 ⁇ 3 multiplication result in the next input channel.
  • the decimal point position of the 3 ⁇ 3 feature map input to the filter processing unit will be considered.
  • the cumulative addition result for input channels stored in the RAM may also have a decimal point position different from that of the feature map input to the filter processing unit. Therefore, the filter processing unit performs digit alignment of these decimal point positions before executing the 3 ⁇ 3 addition, and outputs the decimal point position information after digit alignment to the subsequent stage. This decimal point position information after digit adjustment is also referred to during bias addition.
  • the feature quantities output from each filter processing unit are again subjected to digit alignment in the digit alignment processing unit located after the filter processing unit, and the decimal point positions within the PE operation target block are integrated into one. Then, all feature amounts and decimal point position information with digit alignment are output from the calculation unit 300.
  • FIG. 8 is a diagram showing an example of a hardware configuration for performing digit alignment of calculation data in which multiple decimal point positions coexist.
  • FIG. 8 shows an example of a 3 ⁇ 3 feature map having a maximum of four types of decimal point positions and digit alignment of decimal point position information of cumulative addition results for input channels.
  • Input c1 is decimal point position information (up to four types) of feature map input
  • c2 is decimal point position information of kernel
  • c3 decimal point position information of cumulative addition results for input channels.
  • the output d1 is the 3 ⁇ 3 multiplication result (after digit adjustment)
  • the output d2 is the cumulative addition result for the input channel (after digit adjustment).
  • the decimal point position after 3 ⁇ 3 multiplication is generated from the decimal point position information of the feature map input and the decimal point position information of the kernel.
  • up to five types of decimal point position information are generated together with the decimal point position information of the cumulative addition results for the input channels.
  • one decimal point position is selected as the decimal point position after digit alignment.
  • Various methods can be considered for selecting the decimal point position, such as the method with the highest integer precision in fixed-point data or the method with the highest decimal precision.
  • the amount of shift of the fixed-point data is generated so that the maximum five types of decimal point positions are all aligned.
  • the feature map input and the cumulative addition result for the input channels are shifted by the generated shift amount and output by the barrel shifter.
  • the hardware configuration example of the calculation section 300 has been described above, and the processing after the calculation section 300 will be explained with reference to FIG. 6 again.
  • the feature map output from the calculation unit 300 is input to the delay buffer 310 and the analysis unit 320.
  • the delay buffer 310 holds the feature map as the calculation result output from the calculation unit 300 until the optimal decimal point position, which will be described later, is determined.
  • the analysis unit 320 is a processing unit that performs analysis according to the calculation result belonging to the division unit for each division unit that is divided into one or more units for the feature map that is the calculation result, and outputs the analysis result for each division unit. It is.
  • the analysis unit 320 attempts quantization rounding to the target bit width of fixed-point data at a plurality of predetermined decimal point positions, and counts the number of times the data after quantization and rounding overflows for each decimal point position. Note that a plurality of decimal point positions are an example of the division unit of the present disclosure, and the number of overflows counted for each decimal point position is an example of the calculation result belonging to the division unit of the present disclosure.
  • the analysis unit 320 in this embodiment performs quantization rounding on the feature quantity output from the calculation unit 300 using four types of decimal point positions, and performs quantization rounding for each decimal point position. Counts the number of times the data after rounding overflows.
  • FIG. 9B shows an example of an analysis result of the analysis unit 320.
  • MSE Mel Squared Error
  • RMSE Root Mean Squared Error
  • SN ratio etc.
  • the decimal point position determination unit 330 determines the decimal point position for each block, which is a division unit, based on the plurality of analysis results for each division unit output by the analysis unit 320.
  • the optimum decimal point position is selected and outputted from a plurality of predetermined decimal point positions with reference to the analysis result of the analysis unit 320.
  • the quantization unit 340 quantizes the feature map so that it becomes fixed-point data having a decimal point position determined for the division unit to which the feature map belongs.
  • the quantization section 340 refers to the feature map before quantization and rounding held in the delay buffer 310, performs quantization and rounding using the optimal decimal point position determined by the decimal point position determining section 330, and performs quantization and rounding on the feature map after quantization and rounding. Output the feature map.
  • FIG. 10 is a flowchart showing the flow of calculation processing in the PE.
  • the CPU 11 reads the arithmetic processing program from the main memory 13, expands it to the cache memory 110, and executes the arithmetic processing by each part of the PE.
  • step S100 the calculation unit 300 executes calculations corresponding to each layer configuring the neural network, and outputs a feature map as the calculation result.
  • the feature map output here is held in the delay buffer 310 as a calculation result until the optimal decimal point position is determined.
  • step S102 the analysis unit 320 analyzes the feature map that is the calculation result for each division unit (block) divided into one or more units, according to the calculation result belonging to the division unit, and performs analysis for each division unit. Output the analysis results.
  • the division unit is a block of multiple decimal point positions.
  • the result of the analysis is the number of overflows counted per decimal point position.
  • step S104 the analysis unit 320 determines the optimal decimal point position for each block, which is the division unit, based on the plurality of analysis results for each division unit to be output.
  • step S106 the quantization unit 340 quantizes the feature map so that it becomes fixed-point data having a decimal point position determined for the division unit to which the feature map belongs.
  • step S108 the arithmetic processing unit 100 outputs the feature map after quantization and rounding.
  • the decimal point position can be optimized and deterioration in calculation accuracy can be suppressed.
  • the feature map before quantization and rounding is held in the delay buffer 310 until the optimal decimal point position is determined by the processing of the analysis unit 320 and the decimal point position determination unit 330. While it was possible to perform quantization processing using the optimal decimal point position for the feature map, it required hardware such as a delay buffer.
  • the target decimal point position is determined by referring to spatially adjacent and already analyzed results within the feature map. Since the target decimal point position can be determined without waiting for the analysis of the feature map to be completed, the delay buffer for holding the feature map can be reduced.
  • FIG. 11 is a block diagram showing an example of the hardware configuration of a PE in the second embodiment.
  • the second embodiment does not include a delay buffer 310 for holding the feature map before quantization and rounding.
  • each PE has a holding unit 400 for holding analysis results of feature maps. Since the holding unit 400 only needs to hold several analysis results for one block to be calculated, the circuit scale can be reduced compared to a delay buffer that holds all feature map outputs of the block to be calculated.
  • the holding unit 400 can determine the decimal point position for the division unit to which the held calculation result belongs. After that, the calculation result can be output.
  • FIG. 12 shows the reference relationships of the feature map analysis results.
  • dotted blocks are blocks for which convolution calculation and feature map analysis by PE have already been completed.
  • the feature map analysis results of these blocks are stored in the analysis result holding unit 400 shown in FIG. 11.
  • the PE in this embodiment refers to the feature map analysis results of blocks adjacent to the upper left, upper, upper right, and left of the block to be calculated, and determines the target decimal point position.
  • various methods can be considered, such as referring only to the feature map analysis result of the block adjacent to the left, and the smaller the number of blocks to be referred to, the smaller the required capacity of the holding unit 400 is.
  • FIG. 13 shows an example of a method for determining the decimal point position of the decimal point position determination unit 330 for the analysis result of the feature map.
  • decimal point position 2 is adopted as the target decimal point position for the upper left adjacent block, and as a result, the number of overflows of the feature quantity due to quantization rounding is 0.
  • target decimal point positions adopted for the upper adjacent block, upper right adjacent block, and left adjacent block and the number of overflows of the feature amount obtained as a result are shown.
  • the decimal point position determination unit 330 in this embodiment calculates the average number of overflows per block from these results, for example, and selects the decimal point position with the highest decimal precision from among the decimal point positions where the average number of overflows is 10 or less. .
  • the feature map before quantization and rounding output from the calculation unit 300 is subjected to quantization and rounding processing to become fixed point data having the target decimal point position, and then output. In this way, the decimal point position determining section 330 can determine the decimal point position of the division unit based on the analysis results of one or more division units spatially adjacent to the division unit.
  • the arithmetic processing that the CPU reads and executes the software (program) in each of the above embodiments may be executed by various processors other than the CPU.
  • the processor is a PLD (Programmable Logic Device) whose circuit configuration can be changed after manufacturing, such as an FPGA (Field-Programmable Gate Array), a GPU (Graphics Processing Unit), and identification of ASIC (Application Specific Integrated Circuit), etc.
  • An example is a dedicated electric circuit that is a processor having a circuit configuration specifically designed to execute the processing.
  • arithmetic processing may be executed by one of these various processors, or by a combination of two or more processors of the same type or different types (for example, a combination of multiple FPGAs, a CPU and an FPGA, etc.). ) can also be executed.
  • the hardware structure of these various processors is, more specifically, an electric circuit that is a combination of circuit elements such as semiconductor elements.
  • the program (arithmetic processing program) is stored (installed) in the main memory 13 in advance, but the present invention is not limited to this.
  • the program can be installed on CD-ROM (Compact Disk Read Only Memory), DVD-ROM (Digital Versatile Disk Read Only Memory), and USB (Universal Serial Bus) stored in a non-transitory storage medium such as memory It may be provided in the form of Further, the program may be downloaded from an external device via a network.
  • the processor includes: Executes calculations corresponding to each layer that makes up the neural network, outputs the calculation results, The calculation results are divided into one or more units, and each division unit is analyzed according to the calculation result belonging to the division unit, and the analysis result is output for each division unit, Based on the output analysis results for each division unit, determine the decimal point position for each division unit, quantizing the calculation result so that it becomes fixed-point data having a decimal point position determined for the division unit to which the calculation result belongs;
  • An arithmetic processing unit configured as follows.
  • a non-transitory storage medium storing a program executable by a computer to perform arithmetic processing, Executes calculations corresponding to each layer that makes up the neural network, outputs the calculation results, The calculation results are divided into one or more units, and each division unit is analyzed according to the calculation result belonging to the division unit, and the analysis result is output for each division unit, Based on the output analysis results for each division unit, determine the decimal point position for each division unit, quantizing the calculation result so that it becomes fixed-point data having a decimal point position determined for the division unit to which the calculation result belongs; Non-transitory storage medium.

Abstract

演算処理装置は、ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力する演算部と、演算結果について1又は複数の単位で分割された分割単位ごとに、分割単位に属する演算結果に応じた解析を行い、分割単位ごとに解析結果を出力する解析部と、解析部の出力する分割単位ごと解析結果に基づき、分割単位ごとにダイナミックレンジを示す小数点位置を決定する小数点位置決定部と、演算結果に対し、演算結果が属する分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う量子化部と、を含む。

Description

演算処理装置、演算処理方法、及び演算処理プログラム
 開示の技術は、演算処理装置、演算処理方法、及び演算処理プログラムに関する。
 特許文献1には、装置の小型化と低電力化を実現しながら、データ処理の結果に著しい劣化が生じることを避けるデータ処理装置に関する技術が記載されている。この技術のデータ処理装置は、多層ニューラルネットワークを構成する複数の層のそれぞれに対応して、Nビットの固定長データの小数点位置を設定するように構成された小数点位置制御回路を有している。また、データ処理装置は、小数点位置が設定されたNビットの固定長データに対して、多層ニューラルネットワークの処理アルゴリズムに従って、複数の層のそれぞれに対応する演算処理を行うように構成された演算処理回路を有している。
国際特許出願公開第WO2022/003855号
 固定小数点演算を用いたCNNの推論処理において、入力される画像や層ごとに畳み込み演算に用いる演算データの小数点位置を動的に制御し、演算データが表現可能な値域や小数精度を最適化することで、推論精度の低下を抑制する技術が存在する。当該技術では、1フレームないしは1層単位でCNNの演算処理結果を解析し、当該解析結果を反映した小数点位置を次フレームの演算処理に適用する。浮動小数点演算等を用いず、シンプルなハードウェア構成で次フレームの推論精度向上が可能である一方、次のような課題点も存在する。第1に、低フレームレートの映像においてはフレーム間の時間方向の相関が低くなり、推論精度の向上が難しくなる。第2に、最適な小数点位置の反映に1フレーム分のレイテンシを要し、現在処理中のフレーム、又は静止画に当該技術を適用しようとした場合、同一画像に対して2フレーム分の推論処理が必要となる。第3に、画像や層ごとに小数点位置を制御するため、特徴マップ内で必要な値域や小数精度に偏りが生じている場合に適応的に小数点位置を制御できない。偏りが生じてしまうと、特徴マップ内部で局所的には演算精度の劣化がより大きくなる箇所が発生してしまう。
 開示の技術は、上記の点に鑑みてなされたものであり、小数点位置を最適化し、演算精度の劣化を抑制することができる演算処理装置、演算処理方法、演算処理プログラムを提供することを目的とする。
 本開示の第1態様は、演算処理装置であって、ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力する演算部と、前記演算結果について1又は複数の単位で分割された分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力する解析部と、前記解析部の出力する分割単位ごと解析結果に基づき、前記分割単位ごとにダイナミックレンジを示す小数点位置を決定する小数点位置決定部と、前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う量子化部と、を含む。
 本開示の第2態様は、演算処理方法であって、ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力し、前記演算結果について1又は複数の単位で分割した分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力し、出力された分割単位ごと解析結果に基づき、前記分割単位ごとにダイナミックレンジを示す小数点位置を決定し、前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う、処理をコンピュータが実行する。
 本開示の第3態様は、演算処理プログラムであって、ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力し、前記演算結果について1又は複数の単位で分割した分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力し、出力された分割単位ごと解析結果に基づき、前記分割単位ごとにダイナミックレンジを示す小数点位置を決定し、前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う、処理をコンピュータに実行させる。
 開示の技術によれば、小数点位置を最適化し、演算精度の劣化を抑制することができる。
図1は、本実施形態の物体検出装置のハードウェア構成を示すブロック図である。 図2は、物体検出処理を実現するための畳み込みニューラルネットワークのレイヤー構造の一例を示している。 図3は、本実施形態における特徴マップの内部構造を示す図である。 図4は、本実施形態におけるアクセラレータのハードウェア構成例を示すブロック図である。 図5Aは、小数点位置制御単位のサイズを4×4、PEの演算対象ブロックサイズを6×6とし、各PEが3×3カーネルを用いてパディング1、ストライド1の畳み込み演算処理を実行した場合を示している。 図5Bは、図5Aで示した特徴マップ出力に対し、各PEが3×3カーネルを用いてパディング1、ストライド2の畳み込み演算処理を実行した場合を示している。 図5Cは、図5Bで示した特徴マップ出力に対し、各PEが3×3カーネルを用いてパディング1、ストライド1の畳み込み演算処理を実行した場合を示している。 図6は、PEのハードウェア構成例を示すブロック図である。 演算部のハードウェア構成例を示すブロック図である。 図8は、複数の小数点位置が混在する演算データの桁合わせを行うためのハードウェア構成例を示す図である。 図9Aは、に示すように、本実施形態における解析部は4種類の小数点位置を用いた解析の例である。 図9Bは、解析部の解析結果の一例を示している。 図10は、PEにおける演算処理の流れを示すフローチャートである。 図11は、第2実施形態におけるPEのハードウェア構成例を示すブロック図である。 図12は、特徴マップ解析結果の参照関係を示している。 図13は、特徴マップの解析結果に対する小数点位置決定部の小数点位置決定手法の一例を示している。
 以下、開示の技術の実施形態の一例を、図面を参照しつつ説明する。なお、各図面において同一又は等価な構成要素及び部分には同一の参照符号を付与している。また、図面の寸法比率は、説明の都合上誇張されており、実際の比率とは異なる場合がある。
 まず、本開示の技術の前提とする概要及び技術について説明する。深層学習(ディープラーニング)へのニーズが高まり、自動運転や監視・モニタリング等様々な分野への応用が期待されている。特に近年では、カメラ等のエッジ端末内でディープラーニングの大規模な演算処理を可能とするため、専用のハードウェアアクセラレータの開発が盛んになっている。ソフトウェアでディープラーニングの演算処理を行う場合、演算処理で扱うデータを32ビット浮動小数点データとするのが一般的である。一方、ディープラーニング専用のハードウェアアクセラレータにおいては、演算処理で扱うデータを8~16ビット等の固定小数点データに制限することが多い。これは、ハードウェアアクセラレータのチップ面積の削減や、電力性能の向上を図るためである。
 固定小数点データは浮動小数点データと比較し取りうるダイナミックレンジが狭く、浮動小数点データを用いた場合よりも演算精度が劣化する場合がある。本課題に対し、特許文献1において、ニューラルネットワークを構成する層ごとに、固定小数点データの小数点位置を動的に制御する手法が開示されている。当該手法では、ニューラルネットワークを構成する層ごとの中間演算結果が固定小数点データのダイナミックレンジの上限、又は下限を超えてオーバーフローが発生した回数をカウンタで計測する。そして、当該手法では、当該カウンタ値に基づいて次の演算実行時にオーバーフローを発生させないよう小数点位置の調整を行う。これにより、固定小数点データのダイナミックレンジを演算結果の傾向に合わせて動的に変更可能となり、固定小数点データを用いた場合においても演算精度の劣化を抑制することができる。しかしながら、上記に挙げた課題点を有している。
 本実施形態の技術では、特徴マップ内部で適応的に小数点位置を変更可能とすることで、従来技術よりも低レイテンシで最適な小数点位置を反映可能とし、かつ、演算精度の劣化を抑制する。また、量子化誤差の低減による推論精度の向上が期待できる。
 以下、本実施形態の構成について説明する。
[第1実施形態]
 図1は、本実施形態の物体検出装置1のハードウェア構成を示すブロック図である。物体検出装置1は、CPU(Central Processing Unit)11、カメラモジュール12、メインメモリ13、及びアクセラレータ14から構成され、それらはシステムバス19を介して接続されている。カメラモジュール12は所定のフレームレートで静止画、又は動画を撮影可能であり、撮影した画像データを順次メインメモリ13へと格納する。メインメモリ13はCPU11のソフトウェア処理に必要なワークメモリであるとともに、カメラモジュール12によって撮影された画像データや、アクセラレータ14の実行に必要なパラメータ、及びアクセラレータ14が出力する演算結果等の格納を行う。メインメモリ13には演算処理プログラムが格納される。CPU11は物体検出装置1全体の制御を担い、例えばカメラモジュール12やアクセラレータ14の実行タイミングを制御する。アクセラレータ14はメインメモリ13に格納された画像データを読み出し、読み出した画像データに対し畳み込みニューラルネットワークによる物体検出処理を実行する。
 図2を参照して、アクセラレータ14が実行する物体検出処理の一例について説明する。図2は、物体検出処理を実現するための畳み込みニューラルネットワークのレイヤー構造の一例を示している。図2に示す例において、入力画像は幅448ピクセル、高さ448ピクセル、RGBの3つの色成分から構成される画像である。特徴抽出部において、入力画像に対し、各レイヤーで異なる複数のカーネルを用いた畳み込み演算処理、又はプーリング演算処理等が実行され1ch分ごとの特徴マップが生成される。その後、検出部において、特徴マップに対して全結合が行われ最終層のデータが生成される。物体検出処理の場合、最終層のデータには入力画像に対する物体の相対位置を示す座標情報や、当該座標に物体が存在するか否かを示す信頼度、又はクラス分類確率等が含まれている。クラス分類確率とは、当該物体がどのようなクラスに属するか(人なのか車なのか、犬なのか猫なのか等)を示す確率である。これらの情報をCPU11が参照することで、入力画像の中からどのような物体が、どのような位置に存在するかを検出できる。
 本実施形態において、特徴マップを構成する個々の特徴量、及び畳み込み演算時に用いるカーネル、バイアス等のパラメータ値は、8ビットの固定小数点データとする。これにより、32ビット等の浮動小数点データを扱う場合に比べて、アクセラレータの回路規模やメインメモリ13の必要容量を大幅に削減できる。
 図3は、本実施形態における特徴マップの内部構造を示す図である。本実施形態において、特徴マップは空間的に異なる複数の単位に分割され、分割された単位ごとに異なる小数点位置情報を有するものとする(以後、分割された単位を小数点位置制御単位(又はブロック)と呼ぶ)。本実施形態では小数点位置制御単位のサイズを幅4、高さ4(以後、4×4と記載する)として扱うものとする。小数点位置制御単位は32×32、8×8、8×4、4×1など任意のサイズを取ることができ、正方形や長方形など任意の形状を取ることができる。また、小数点位置制御単位のサイズや形状は必ずしも全レイヤーで共通のものでなくてもよく、各レイヤーの特徴マップのサイズや、畳み込み演算に適用するカーネルサイズ、パディング、ストライド等の設定に応じて変更することも可能である。このように、特徴マップの空間的なサイズにおいてブロックに分割される、また、分割単位であるブロックにおいては複数の小数点位置の情報を持つことができる。なお、特徴マップが本開示の演算結果の一例である。また、小数点位置制御単位が、特徴マップの空間的なサイズを分割したブロックである。ブロックが、本開示の分割単位の一例である。以下では、3×3のブロックを想定する。
 図4は、本実施形態におけるアクセラレータ14のハードウェア構成例を示すブロック図である。アクセラレータ14は演算処理部100とキャッシュメモリ110から構成される。なお演算処理部100が、本開示の演算処理装置の一例である。
 キャッシュメモリ110はシステムバス19を介してメインメモリ13と接続されている。キャッシュメモリ110は演算処理部100とメインメモリ13の中間に位置するバッファとして、演算処理部100とメインメモリ13間のデータ転送帯域を削減する役割を担っている。演算処理部100は制御部200、DMAC210、及び複数のPE(Processing Engine)220により構成される(以下、DMAC及びPEについて符号を省略する)。制御部200はDMACや各PEに対して動作パラメータの設定を行うとともに、各PEへ供給するデータの管理等を行う。DMACは制御部200により設定された動作パラメータに従って、特徴マップ、畳み込み演算に必要なカーネル、バイアス等のパラメータ、及び特徴マップ内部の小数点位置情報をキャッシュメモリ110から読み出す。読み出されたデータは各々のPEに供給され、各PEは並列に演算処理を実行する。PEによる演算処理により生成された特徴マップ、及び特徴マップ内部の小数点位置情報はDMACを介してキャッシュメモリ110へと格納され、次のレイヤーの演算処理時に再びキャッシュメモリ110から読み出される。
 図5は、各PEの演算処理単位と小数点位置制御単位の関係を示す図である。図5の点線枠で示すように、各PEは特徴マップを所定のブロック単位で畳み込み演算処理を実行する。図5Aは、小数点位置制御単位のサイズを4×4、PEの演算対象ブロックサイズを6×6とし、各PEが3×3カーネルを用いてパディング1、ストライド1の畳み込み演算処理を実行した場合を示している。この場合、各PEの演算対象ブロックには異なる9種類の小数点位置が混在するため、各PEに対して9種類の小数点位置情報を供給する必要がある。各PEは供給された9種類の小数点位置情報を用いて畳み込み演算処理結果の小数点位置合わせを実行し、小数点位置を1つに統合した上で出力する。なお、小数点位置は、データのダイナミックレンジを示す。ここでいう小数点位置情報を用いて、小数点位置を選択、出力することは、そのPEのデータのダイナミックレンジを決定していることに他ならない。
 図5Bは、図5Aで示した特徴マップ出力に対し、各PEが3×3カーネルを用いてパディング1、ストライド2の畳み込み演算処理を実行した場合を示している。図5Aと同様に各PEの演算対象ブロックには異なる9種類の小数点位置情報が混在するため、各PEに対して9種類の小数点位置情報を供給する必要がある。各PEは供給された9種類の小数点位置情報を用いて畳み込み演算処理結果の小数点位置合わせを実行し、小数点位置を1つに統合した上で出力する。図5Bの場合、ストライド2であるために特徴マップ幅、及び高さは入力の半分のサイズとなるため、特徴マップ内部の小数点位置制御単位のサイズも同様に入力の半分のサイズとなる。
 図5Cは、図5Bで示した特徴マップ出力に対し、各PEが3×3カーネルを用いてパディング1、ストライド1の畳み込み演算処理を実行した場合を示している。この場合、各PEの演算対象ブロックには異なる16種類の小数点位置情報が混在するため、各PEに対して16種類の小数点位置情報を供給する必要がある。各PEは供給された16種類の小数点位置情報を用いて畳み込み演算処理結果の小数点位置合わせを実行し、小数点位置を1つに統合した上で出力する。
 以上のように、特徴マップ出力に対し、各PEが所定のサイズのカーネルを用いて所定のパディング、所定のストライドの畳み込み演算処理を実行する。ここで、浮動小数点データを用いた場合を考えると、図5A~図5Cのいずれの場合においても、各PEの演算対象ブロック内部に6×6=36種類の小数点位置情報(指数)が混在することとなる。3×3の特徴マップ内(1ブロック)には最大4種類の複数の小数点位置が混在する。このように、分割単位であるブロックには、複数の小数点位置を有する。一方、図5A及び図5Bに示した場合に必要な小数点位置情報は9種類、図5Cに示した場合に必要な小数点位置情報は16種類となる。よって、本実施形態のように特徴マップ内部を所定のブロックの単位に分割し、それぞれの単位で小数点位置を制御することで、浮動小数点データを用いた場合に比べて演算に必要な小数点位置情報を大幅に削減することが可能である。
 図6は、PEのハードウェア構成例を示すブロック図である。演算処理部100におけるPEは、演算部300と、遅延バッファ310と、解析部320と、小数点位置決定部330と、量子化部340とを含む。以下、PEの各部の機能的な処理について説明する。
 演算部300はCNN演算を行う。演算部300は、入力された特徴マップ、及びカーネルを用いて畳み込み演算を実行し、畳み込み演算結果に対してバイアス加算、及び活性化関数処理等の演算処理を実行する。演算部300は、下記に詳細に説明する処理により、ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果として特徴マップを出力する。
 ここで、図7を参照して演算部300のハードウェア構成例について説明する。演算部300はPEの演算対象ブロックサイズに相当する複数のフィルタ処理部を有し、それぞれのフィルタ処理部は最大3×3の畳み込み演算、バイアス加算、活性化関数処理を行い、演算結果として特徴量を1つ出力する。入力のa1は特徴マップ入力(3×3)、a2はカーネル(3×3)である。出力のb1は特徴マップ出力、b2は小数点位置情報である。各フィルタ処理部に対して入力された特徴マップ、及びカーネルは3×3の乗算器により乗算される。3×3の乗算結果は、小数点位置の桁合わせ処理が施された後、入力チャネルに対する累積加算結果とともに全て加算され、積和演算結果として後段に出力される。また、積和演算結果はRAMにも格納され、次の入力チャネルにおける3×3の乗算結果と累積加算される。
 ここで、図5を参照してフィルタ処理部に入力される3×3の特徴マップの小数点位置について考える。図5A~図5Cのいずれの場合においても、3×3の特徴マップ内に最大4種類の小数点位置が混在する可能性がある。また、RAMに格納されている入力チャネルに対する累積加算結果においても、フィルタ処理部に入力される特徴マップとは異なる小数点位置を有する可能性がある。よって、フィルタ処理部は3×3加算を実行する前にこれらの小数点位置の桁合わせを行い、桁合わせ後の小数点位置情報を後段へと出力する。この桁合わせ後の小数点位置情報はバイアス加算時にも参照される。
 それぞれのフィルタ処理部から出力された特徴量は、フィルタ処理部後段に位置する桁合わせ処理部において再度桁合わせが実行され、PEの演算対象ブロック内部における小数点位置が1つに統合される。そして、桁合わせがなされた全特徴量と小数点位置情報が演算部300より出力される。
 図8は、複数の小数点位置が混在する演算データの桁合わせを行うためのハードウェア構成例を示す図である。図8では特に、最大4種類の小数点位置を有する3×3の特徴マップと、入力チャネルに対する累積加算結果の小数点位置情報の桁合わせを例として示している。入力のc1は特徴マップ入力の小数点位置情報(最大4種類)、c2はカーネルの小数点位置情報、c3は入力チャネルに対する累積加算結果の小数点位置情報である。出力のd1は3×3乗算結果(桁あわせ後)、d2は入力チャネルに対する累積加算結果(桁あわせ後)である。まず、特徴マップ入力の小数点位置情報、及びカーネルの小数点位置情報から3×3の乗算後の小数点位置の生成を行う。この結果、入力チャネルに対する累積加算結果の小数点位置情報と合わせて、最大5種類の小数点位置情報が生成される。これらの5種類の小数点位置情報の中から、1つの小数点位置を桁合わせ後の小数点位置として選択する。小数点位置の選択の手法としては、固定小数点データにおける整数精度が最も高いもの、あるいは小数精度が最も高いもの、等様々な手法が考えられる。その後、最大5種類の小数点位置が全て揃うよう、固定小数点データのシフト量を生成する。更に、バレルシフタにより特徴マップ入力、及び入力チャネルに対する累積加算結果が生成したシフト量分それぞれシフトされ出力される。
 以上、演算部300のハードウェア構成例について説明してきたが、再び図6を参照して演算部300以降の処理について説明する。演算部300から出力された特徴マップは遅延バッファ310、及び解析部320に入力される。遅延バッファ310は、後述する最適小数点位置が決定されるまで演算部300から出力された演算結果として特徴マップを保持する。
 解析部320は、演算結果である特徴マップについて1又は複数の単位で分割された分割単位ごとに、分割単位に属する演算結果に応じた解析を行い、分割単位ごとに解析結果を出力する処理部である。解析部320は予め定めた複数の小数点位置で目標とする固定小数点データのビット幅への量子化丸めを試し、それぞれの小数点位置に対して量子化丸め後のデータがオーバーフローした回数をカウントする。なお、複数の小数点位置が本開示の分割単位の一例であり、小数点位置ごとにカウントされたオーバーフローの回数が本開示の分割単位に属する演算結果の一例である。
 ここで、図9を参照して解析部320の処理例について説明する。図9において、小数点位置=Nとした場合、固定小数点データのLSBが2^(-N)を表現可能であるものとする。図9Aに示すように、本実施形態における解析部320は4種類の小数点位置を用いて、演算部300から出力される特徴量に対して量子化丸めを行い、それぞれの小数点位置に対して量子化丸め後のデータがオーバーフローした回数をカウントする。解析部320の実行する解析手法には様々な手法が考えられ、本実施形態で説明した手法の他、それぞれの小数点位置で量子化丸めを行った際の量子化誤差を累積加算する手法、又はMSE(Mean Squared Error)、RMSE(Root Mean Squared Error)、SN比等を算出してもよい。図9Bは、解析部320の解析結果の一例を示している。小数点位置が左にずれるほど小数精度が高くなる一方、量子化丸めによりオーバーフローする可能性は高くなるため、小数点位置=4以降はオーバーフローが発生している。ここで、再び図6を参照して小数点位置決定部330の処理について説明する。
 小数点位置決定部330は、解析部320の出力する分割単位ごとの複数の解析結果に基づき、分割単位であるブロックごとの小数点位置を決定する。解析部320の解析結果を参照し、予め定めた複数の小数点位置の中から最適な小数点位置を選択して出力する。本実施形態における小数点位置決定部330は、解析部320から得られる各小数点位置の量子化丸めによるオーバーフロー回数を参照し、オーバーフロー回数が最も少なく、かつ小数精度が最も高いものを選択する。図9に示した例においては、小数点位置決定部330は小数点位置=2を最適な小数点位置として決定する。
 量子化部340は、特徴マップに対し、特徴マップが属する分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う。量子化部340は、遅延バッファ310に保持されている量子化丸め前の特徴マップを参照し、小数点位置決定部330により決定された最適な小数点位置により量子化丸めを施し、量子化丸め後の特徴マップを出力する。
 次に、演算処理部100のPEにおける作用について説明する。図10は、PEにおける演算処理の流れを示すフローチャートである。CPU11が演算処理プログラムをメインメモリ13から読み出して、キャッシュメモリ110に展開して、PEの各部による演算処理を実行する。
 ステップS100において、演算部300は、ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果として特徴マップを出力する。ここで出力された特徴マップは、遅延バッファ310において、最適小数点位置が決定されるまで演算結果として保持される。
 ステップS102において、解析部320は、演算結果である特徴マップについて1又は複数の単位で分割された分割単位(ブロック)ごとに、分割単位に属する演算結果に応じた解析を行い、分割単位ごとに解析結果を出力する。分割単位は複数の小数点位置のブロックである。解析結果は、小数点位置ごとのカウントされたオーバーフローの回数である。
 ステップS104において、解析部320は、小数点位置決定部330は、出力する分割単位ごとの複数の解析結果に基づき、分割単位であるブロックごとの最適な小数点位置を決定する。
 ステップS106において、量子化部340は、特徴マップに対し、特徴マップが属する分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う。
 ステップS108において、演算処理部100は、量子化丸め後の特徴マップを出力する。
 以上説明したように本実施形態によれば、小数点位置を最適化し、演算精度の劣化を抑制することができる。
[第2の実施形態]
 第1実施形態のPEでは、解析部320及び小数点位置決定部330の処理により最適な小数点位置が決定するまで、量子化丸め前の特徴マップを遅延バッファ310に保持していた。特徴マップに対して最適な小数点位置を用いた量子化処理が可能であった一方、遅延バッファ等のハードウェアが必要であった。第2実施形態のPEでは、特徴マップ内部において空間的に隣接し、かつ既に解析済みの結果を参照することにより目標とする小数点位置を決定する。特徴マップの解析完了を待たずとも目標とする小数点位置を決定することができるため、特徴マップを保持するための遅延バッファを削減することができる。
 図11は、第2実施形態におけるPEのハードウェア構成例を示すブロック図である。第1実施形態と異なり、第2実施形態では量子化丸め前の特徴マップを保持するための遅延バッファ310を設けていない。また、各PEは特徴マップの解析結果を保持するための保持部400を有する。保持部400は1つの演算対象ブロックにつき数個の解析結果を保持すればよいため、演算対象ブロックの特徴マップ出力を全て保持する遅延バッファよりも回路規模を削減可能である。このように演算部300から出力される演算結果である特徴マップを保持するための保持部400を更に有することで、保持部400は保持する演算結果が属する分割単位に対し小数点位置が決定された後、当該演算結果を出力することができる。
 図12は、特徴マップ解析結果の参照関係を示している。図12において、点模様のブロックは既にPEによる畳み込み演算、及び特徴マップの解析が完了しているブロックである。また、これらのブロックの特徴マップ解析結果は、図11に示した解析結果の保持部400に格納されている。本実施形態におけるPEは、演算対象ブロックに対して左上、上、右上、左に隣接するブロックの特徴マップ解析結果を参照し、目標とする小数点位置を決定するものとする。この他にも、左に隣接するブロックの特徴マップ解析結果のみを参照する等様々な方法が考えられ、参照するブロックが少ないほど保持部400の必要容量は小さくなる。
 図13は、特徴マップの解析結果に対する小数点位置決定部330の小数点位置決定手法の一例を示している。図13において、左上隣接ブロックに対して小数点位置=2が目標小数点位置として採用され、その結果として量子化丸めによる特徴量のオーバーフロー回数が0回であったことを示している。同様に、上隣接ブロック、右上隣接ブロック、左隣接ブロックについても採用された目標小数点位置と、その結果として得られた特徴量のオーバーフロー回数が示されている。本実施形態における小数点位置決定部330は、例えばこれらの結果から1ブロックあたりの平均オーバーフロー回数を算出し、平均オーバーフロー回数が10回以下の小数点位置の中から最も小数精度の高い小数点位置を選択する。図12において平均オーバーフロー回数が10回以下で、かつ最も小数精度の高いものは小数点位置=4であるため、小数点位置決定部330は小数点位置=4を目標小数点位置として出力する。目標小数点位置となるよう、演算部300から出力された量子化丸め前の特徴マップは目標小数点位置を有する固定小数点データとなるよう量子化丸め処理が施され出力される。このように、小数点位置決定部330は、分割単位に空間的に隣接する1又は複数の分割単位における解析結果に基づき、当該分割単位の小数点位置を決定することできる。
 なお、上記各実施形態でCPUがソフトウェア(プログラム)を読み込んで実行した演算処理を、CPU以外の各種のプロセッサが実行してもよい。この場合のプロセッサとしては、FPGA(Field-Programmable Gate Array)等の製造後に回路構成を変更可能なPLD(Programmable Logic Device)、GPU(Graphics Processing Unit)、及びASIC(Application Specific Integrated Circuit)等の特定の処理を実行させるために専用に設計された回路構成を有するプロセッサである専用電気回路等が例示される。また、演算処理を、これらの各種のプロセッサのうちの1つで実行してもよいし、同種又は異種の2つ以上のプロセッサの組み合わせ(例えば、複数のFPGA、及びCPUとFPGAとの組み合わせ等)で実行してもよい。また、これらの各種のプロセッサのハードウェア的な構造は、より具体的には、半導体素子等の回路素子を組み合わせた電気回路である。
 また、上記各実施形態では、プログラム(演算処理プログラム)がメインメモリ13に予め記憶(インストール)されている態様を説明したが、これに限定されない。プログラムは、CD-ROM(Compact Disk Read Only Memory)、DVD-ROM(Digital Versatile Disk Read Only Memory)、及びUSB(Universal Serial Bus)メモリ等の非一時的(non-transitory)記憶媒体に記憶された形態で提供されてもよい。また、プログラムは、ネットワークを介して外部装置からダウンロードされる形態としてもよい。
 以上の実施形態に関し、更に以下の付記を開示する。
 (付記項1)
 メモリと、
 前記メモリに接続された少なくとも1つのプロセッサと、
 を含み、
 前記プロセッサは、
 ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力し、
 前記演算結果について1又は複数の単位で分割した分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力し、
 出力された分割単位ごと解析結果に基づき、前記分割単位ごとに小数点位置を決定し、
 前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う、
 ように構成されている演算処理装置。
 (付記項2)
 演算処理を実行するようにコンピュータによって実行可能なプログラムを記憶した非一時的記憶媒体であって、
 ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力し、
 前記演算結果について1又は複数の単位で分割した分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力し、
 出力された分割単位ごと解析結果に基づき、前記分割単位ごとに小数点位置を決定し、
 前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う、
 非一時的記憶媒体。

Claims (7)

  1.  ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力する演算部と、
     前記演算結果について1又は複数の単位で分割された分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力する解析部と、
     前記解析部の出力する分割単位ごと解析結果に基づき、前記分割単位ごとにダイナミックレンジを示す小数点位置を決定する小数点位置決定部と、
     前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う量子化部と、
     を含む演算処理装置。
  2.  前記演算部から出力される演算結果を保持するための保持部を更に有し、
     前記保持部は保持する演算結果が属する分割単位に対し小数点位置が決定された後、当該演算結果を出力する、請求項1記載の演算処理装置。
  3.  前記小数点位置決定部は、
     分割単位に空間的に隣接する1又は複数の分割単位における解析結果に基づき、当該分割単位の小数点位置を決定する、請求項1記載の演算処理装置。
  4.  前記演算部の前記演算結果を特徴マップとし、前記特徴マップの空間的なサイズを分割したブロックを前記分割単位とする、請求項1に記載の演算処理装置。
  5.  前記演算部の前記演算結果を特徴マップとし、前記演算部の演算では、所定のサイズのカーネルを用いて所定のパディング、所定のストライドの畳み込み演算処理を行うことにより、前記分割単位に複数の小数点位置を有し、
     前記解析部による前記解析は、前記分割単位ごとに、複数の小数点位置のうち、前記演算結果においてオーバーフロー回数をカウントし、
     前記小数点位置決定部は、前記分割単位ごとに、オーバーフロー回数が少な最も少なく、かつ小数精度が最も高い小数点位置を当該分割単位の小数点位置とする、請求項1に記載の演算処理装置。
  6.  ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力し、
     前記演算結果について1又は複数の単位で分割した分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとに解析結果を出力し、
     出力された分割単位ごと解析結果に基づき、前記分割単位ごとにダイナミックレンジを示す小数点位置を決定し、
     前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う、
     処理をコンピュータが実行する演算処理方法。
  7.  ニューラルネットワークを構成する各層に対応する演算を実行し、演算結果を出力し、
     前記演算結果について1又は複数の単位で分割した分割単位ごとに、前記分割単位に属する前記演算結果に応じた解析を行い、前記分割単位ごとにダイナミックレンジを示す解析結果を出力し、
     出力された分割単位ごと解析結果に基づき、前記分割単位ごとに小数点位置を決定し、
     前記演算結果に対し、前記演算結果が属する前記分割単位に対して決定された小数点位置を有する固定小数点データとなるよう量子化を行う、
     処理をコンピュータに実行させる演算処理プログラム。
PCT/JP2022/026524 2022-07-01 2022-07-01 演算処理装置、演算処理方法、及び演算処理プログラム WO2024004221A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2022/026524 WO2024004221A1 (ja) 2022-07-01 2022-07-01 演算処理装置、演算処理方法、及び演算処理プログラム

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2022/026524 WO2024004221A1 (ja) 2022-07-01 2022-07-01 演算処理装置、演算処理方法、及び演算処理プログラム

Publications (1)

Publication Number Publication Date
WO2024004221A1 true WO2024004221A1 (ja) 2024-01-04

Family

ID=89381845

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2022/026524 WO2024004221A1 (ja) 2022-07-01 2022-07-01 演算処理装置、演算処理方法、及び演算処理プログラム

Country Status (1)

Country Link
WO (1) WO2024004221A1 (ja)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018139266A1 (ja) * 2017-01-30 2018-08-02 富士通株式会社 演算処理装置、情報処理装置、方法、およびプログラム
WO2020065874A1 (ja) * 2018-09-27 2020-04-02 株式会社ソシオネクスト ネットワーク量子化方法、推論方法及びネットワーク量子化装置
EP3709224A1 (en) * 2017-10-30 2020-09-16 Shanghai Cambricon Information Technology Co., Ltd Information processing method and terminal device
CN111930681A (zh) * 2019-05-13 2020-11-13 中科寒武纪科技股份有限公司 一种计算装置及相关产品

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018139266A1 (ja) * 2017-01-30 2018-08-02 富士通株式会社 演算処理装置、情報処理装置、方法、およびプログラム
EP3709224A1 (en) * 2017-10-30 2020-09-16 Shanghai Cambricon Information Technology Co., Ltd Information processing method and terminal device
WO2020065874A1 (ja) * 2018-09-27 2020-04-02 株式会社ソシオネクスト ネットワーク量子化方法、推論方法及びネットワーク量子化装置
CN111930681A (zh) * 2019-05-13 2020-11-13 中科寒武纪科技股份有限公司 一种计算装置及相关产品

Similar Documents

Publication Publication Date Title
US11347964B2 (en) Hardware circuit
US11068776B2 (en) Convolutional neural network based data processing apparatus, method for controlling the same, and storage medium storing program
US20180046906A1 (en) Sparse convolutional neural network accelerator
US10402196B2 (en) Multi-dimensional sliding window operation for a vector processor, including dividing a filter into a plurality of patterns for selecting data elements from a plurality of input registers and performing calculations in parallel using groups of the data elements and coefficients
US11823420B2 (en) Image data compression
US10169295B2 (en) Convolution operation device and method
US11663743B2 (en) Image data decompression
WO2024004221A1 (ja) 演算処理装置、演算処理方法、及び演算処理プログラム
US6809422B2 (en) One-chip image processing apparatus
JP4621944B2 (ja) 画像フィルタ装置、方法およびコンピュータプログラム
WO2022145016A1 (ja) データ処理装置、データ処理方法、及びデータ処理プログラム
JP6580381B2 (ja) 画像処理装置および画像処理方法
US11663453B2 (en) Information processing apparatus and memory control method
CN113452994A (zh) 图像数据压缩
US20210397864A1 (en) Hardware Accelerator for Integral Image Computation
GB2619574A (en) Image data decompression
CN117273072A (zh) 数据处理方法、装置、电子设备及存储介质
GB2587590A (en) Median determination
GB2587591A (en) Median determination
GB2587760A (en) Median determination

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22949494

Country of ref document: EP

Kind code of ref document: A1