WO2020075287A1 - 演算処理装置 - Google Patents

演算処理装置 Download PDF

Info

Publication number
WO2020075287A1
WO2020075287A1 PCT/JP2018/038076 JP2018038076W WO2020075287A1 WO 2020075287 A1 WO2020075287 A1 WO 2020075287A1 JP 2018038076 W JP2018038076 W JP 2018038076W WO 2020075287 A1 WO2020075287 A1 WO 2020075287A1
Authority
WO
WIPO (PCT)
Prior art keywords
cumulative addition
data
storage memory
unit
processing
Prior art date
Application number
PCT/JP2018/038076
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 CN201880096920.4A priority Critical patent/CN112639838A/zh
Priority to JP2020549920A priority patent/JP7012168B2/ja
Priority to PCT/JP2018/038076 priority patent/WO2020075287A1/ja
Publication of WO2020075287A1 publication Critical patent/WO2020075287A1/ja
Priority to US17/183,720 priority patent/US20210182656A1/en

Links

Images

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
    • 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
    • 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/50Adding; Subtracting
    • G06F7/505Adding; Subtracting in bit-parallel fashion, i.e. having a different digit-handling circuit for each denomination
    • G06F7/506Adding; Subtracting in bit-parallel fashion, i.e. having a different digit-handling circuit for each denomination with simultaneous carry generation for, or propagation over, two or more stages
    • G06F7/507Adding; Subtracting in bit-parallel fashion, i.e. having a different digit-handling circuit for each denomination with simultaneous carry generation for, or propagation over, two or more stages using selection between two conditionally calculated carry or sum values
    • 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/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Definitions

  • the present invention relates to an arithmetic processing device, and more specifically, to a circuit configuration of an arithmetic processing device that performs deep learning using a convolutional neural network.
  • CNN Convolutional Neural Network
  • FIG. 18 is a diagram showing a flow of image recognition processing by deep learning using CNN.
  • image recognition by deep learning using CNN an object included in an image is recognized by sequentially performing processing in a plurality of processing layers of CNN on input image data (pixel data). Final calculation result data is obtained.
  • the processing layer of the CNN is a Convolution layer (convolution layer) that performs Convolution processing including convolution calculation processing, non-linear processing, reduction processing (pooling processing), and all inputs (pixel data) are multiplied by filter coefficients and cumulatively added. It is roughly classified into a FullConnect layer (full connection layer) that performs FullConnect processing. However, there are convolutional neural networks that do not have a FullConnect layer.
  • Image recognition by deep learning using CNN is performed as follows.
  • convolution calculation processing Convolution processing
  • a combination of reduction processing (pooling processing) for reducing a partial area of the quantity map is set as one processing layer, and this is performed a plurality of times (in a plurality of processing layers).
  • These processes are processes of the convolutional layer (Convolution layer).
  • the pooling process has variations such as max pooling that extracts the maximum value of the neighborhood 4 pix and reduces it to 1/2 x 1/2, and average pooling that calculates the average value of the neighborhood 4 pix (not extraction).
  • FIG. 19 is a diagram showing the flow of the Convolution process.
  • input image data is subjected to filter processing with different filter coefficients, and all of these are cumulatively added, whereby data corresponding to one pixel is created.
  • non-linear conversion and reduction processing pooling processing
  • oFM output feature amount map
  • the output feature map (oFM) as the input feature map (iFM) and performing filter processing with different filter coefficients, the above Convolution processing is repeated. In this way, the Convolution process is performed a plurality of times to obtain the output feature amount map (oFM).
  • the image data is read as a one-dimensional data string.
  • a FullConnect process is performed a plurality of times (in a plurality of processing layers) in which each data of a one-dimensional data string is multiplied by a different coefficient and cumulative addition is performed. These processes are processes of the fully connected layer (FullConnect layer).
  • the probability that the target object included in the image is detected is output as the subject estimation result that is the final calculation result.
  • the probability that a dog is detected is 0.01 (1%)
  • the probability that a cat is detected is 0.04 (4%)
  • the probability that a boat is detected is 0.94 (94%)
  • the probability of detecting a bird is 0.02 (2%).
  • the relationship between the FM (Feature Map) size and the number of FMs (number of FM faces) in the (K-1) th layer and the Kth layer may be as shown in the following equation. In many cases, optimization is difficult when determining the memory size of a circuit.
  • FM size [K] 1/4 ⁇ FM size [K-1]
  • FM number [K] 2 ⁇ FM number [K-1]
  • CNN is generally implemented by software processing using a high-performance PC or GPU (Graphics Processing Unit).
  • PC Graphics Processing Unit
  • GPU Graphics Processing Unit
  • Patent Document 1 discloses an arithmetic processing device in which a plurality of arithmetic processing units are respectively provided with arithmetic blocks and a plurality of memories so as to improve the efficiency of arithmetic processing.
  • the operation block and the buffer which forms a pair with it perform convolution operation processing in parallel via the relay section, and exchange cumulative addition data between the operation sections. As a result, even if the input network is large, it is possible to create inputs to the activation processing at once.
  • Patent Document 1 is an asymmetrical configuration having a vertical relationship (having directionality), and the intermediate addition intermediate result passes through all arithmetic blocks in cascade connection. Therefore, when trying to deal with a large network, the intermediate addition result must repeatedly pass through the relay unit and the redundant data holding unit, a long cascade connection path is formed, and processing time is required. Further, when a huge network is finely divided, the same data or filter coefficient may be read (reread) from the DRAM (external memory) a plurality of times, which may increase the access amount to the DRAM.
  • Patent Document 1 does not describe a specific control method for avoiding such a possibility and is not considered.
  • the present invention can avoid the problem that calculation cannot be performed at one time when the number of filter coefficients is too large to fit in WBUF or when the number of iFMs is too large to fit in IBUF.
  • An object is to provide an arithmetic processing device.
  • a first aspect of the present invention is an arithmetic processing device for deep learning that performs a Convolution process and a FullConnect process, and a data storage memory that stores input feature amount map data, and data that manages and controls the data storage memory.
  • a data storage memory management unit having a storage memory control circuit; a filter coefficient storage memory storing filter coefficients, and a filter coefficient storage memory management unit managing and controlling the filter coefficient storage memory
  • An external memory that stores the input feature amount map data and the output feature amount map data; a data input unit that obtains the input feature amount map data from the external memory; and the filter coefficient from the external memory
  • Input the filter coefficient input section With a configuration of N parallels and output M parallels (N, a positive number of M ⁇ 1), the input feature amount map data is acquired from the data storage memory, the filter coefficient is acquired from the filter coefficient storage memory, and a filter is obtained.
  • An arithmetic unit that performs processing, cumulative addition processing, nonlinear arithmetic processing, and pooling processing; and a data output unit that connects M parallel data output from the arithmetic unit and outputs the output characteristic amount map data to the external memory.
  • a cumulative addition result storage memory for temporarily recording an intermediate result of the cumulative addition processing for each pixel of the input feature amount map, and a cumulative addition for receiving an effective data to generate an address and writing the address in the cumulative addition result storage memory
  • a result storage memory storage unit and a cumulative addition result storage memory reading unit that reads specified data from the cumulative addition result storage memory.
  • a cumulative addition result storage memory management unit and a controller that controls the inside of the arithmetic processing unit, wherein the arithmetic unit executes a filter arithmetic unit that executes filter processing in N parallels and an arithmetic result of the filter arithmetic unit.
  • a first adder for cumulatively adding all a second adder for cumulatively adding the result of the cumulative addition process of the first adder in a subsequent stage, and a flip-flop for holding the result of the cumulative addition process of the second adder
  • an arithmetic control unit for controlling the inside of the arithmetic unit, wherein the arithmetic control unit performs the filter processing and the cumulative addition in the middle of the filter processing and the cumulative addition processing for calculating a specific pixel of the output feature amount map.
  • the arithmetic control unit temporarily stores an intermediate result in the cumulative addition result storage memory when the filter processing and the cumulative addition processing executable by all the filter coefficients stored in the filter coefficient storage memory are finished.
  • the continuation of the cumulative addition process may be controlled.
  • the arithmetic control unit temporarily stores an intermediate result in the cumulative addition result storage memory when all the filter processing and the cumulative addition processing that can be executed by all the inputtable input feature amount map data are finished, and stores the data.
  • the continuation of the cumulative addition process may be controlled.
  • the cumulative addition result storage memory management unit reads a cumulative addition result storage memory from the cumulative addition result storage memory and writes the result to the external memory, and a cumulative addition result storage memory reading unit that reads the cumulative addition result from the external memory.
  • a cumulative addition result storage memory storage unit for storing in a cumulative addition result storage memory, wherein the arithmetic control unit is in the middle of a filter process and a cumulative addition process for calculating a specific pixel of the output feature amount map,
  • the intermediate result is written from the cumulative addition result storage memory to the external memory, and the input feature amount map data stored in the data storage memory or the filter coefficient stored in the filter coefficient storage memory is updated to perform cumulative addition processing. If you want to continue with, continue the cumulative addition result written in the external memory It may be controlled to perform a continuation of the accumulation processing by reading from memory the accumulation result storage memory.
  • the arithmetic processing apparatus According to the arithmetic processing apparatus according to each aspect of the present invention, it is possible to temporarily store the intermediate result of cumulative addition in pixel units of iFM size, so that all iFM data cannot fit in IBUF or the WBUF is filtered. It is possible to avoid the problem that the calculation cannot be performed at one time because the coefficients do not fit.
  • FIG. 8 is an image diagram of dividing the iFM data and inputting the divided iFM data to a calculation unit in the second embodiment of the present invention.
  • arithmetic processing apparatus In the arithmetic processing apparatus according to a second embodiment of the present invention is an image diagram showing an operation in updating n 1 times in the course of iFM data in Convolution process.
  • 8 is a flowchart showing control performed by an arithmetic control unit in the arithmetic processing device according to the second embodiment of the present invention.
  • 10B is a flowchart showing a flow of iFM data update control in step S22 of FIG. 10A. It is an image figure which updates iFM data and a filter coefficient on the way in the arithmetic processing unit concerning a 3rd embodiment of the present invention.
  • FIG. 1 is an image diagram for obtaining an output feature amount map (oFM) from an input feature amount map (iFM) by the Convolution process.
  • An oFM is obtained by performing processing such as filter processing, cumulative addition, nonlinear conversion, pooling (reduction) on the iFM.
  • processing such as filter processing, cumulative addition, nonlinear conversion, pooling (reduction) on the iFM.
  • information necessary to calculate one pixel (one pixel) of oFM information (iFM data and filter coefficient) of all pixels in the vicinity of the coordinates of the iFM corresponding to the output (one pixel of oFM) is necessary. is there.
  • FIG. 2 is an image diagram showing a case where the WBUF (filter coefficient storage memory) storing the filter coefficients is insufficient in the Convolution process.
  • the WBUF filter coefficient storage memory
  • WBUF can store only filter coefficients corresponding to three pieces of iFM data.
  • the first three iFM data are multiplied by corresponding filter coefficients and cumulatively added, and the result (cumulative addition result) is temporarily stored (step 1).
  • the filter coefficients stored in WBUF are updated (step 2), the latter three iFMs are multiplied by the corresponding filter coefficients, and further cumulatively added (step 3).
  • the cumulative addition result of (step 1) and the cumulative addition result of (step 3) are added.
  • non-linear processing and booling processing are performed to obtain 1 pixel data (oFM data) at the coordinates (X, Y) of the oFM.
  • FIG. 3 is an image diagram showing an operation when the filter coefficient is updated once in the middle in the Convolution process in the present embodiment.
  • different filter coefficients are applied to all the input iFM data, and all of them are integrated to calculate one pixel data of the oFM (oFM data).
  • the total number of filter coefficient elements is 9 ⁇ N ⁇ M.
  • N and M vary depending on the network, but may be a huge size exceeding tens of millions. In such a case, since it is impossible to put a huge WBUF that can store all the filter coefficients, it is necessary to update the data stored in the WBUF on the way. However, if the WBUF size is small enough to form even one pixel data (oFM data) of oFM (specifically, if it is smaller than 9N), the filter coefficient must be reread in pixel units of oFM. It's gone and very inefficient.
  • an SRAM (hereinafter referred to as SBUF (cumulative addition result storage memory)) having the same (or larger) capacity as the iFM size (one iFM) is prepared. Then, all the cumulative additions that can be executed by the filter coefficients stored in WBUF are performed, and the intermediate results (cumulative addition results) are written (stored) in SBUF (cumulative addition result storage memory) in pixel units.
  • SBUF cumulative addition result storage memory
  • FIG. 4 is a block diagram showing the overall configuration of the arithmetic processing device according to the present embodiment.
  • the arithmetic processing device 1 includes a controller 2, a data input unit 3, a filter coefficient input unit 4, an IBUF (data storage memory) management unit 5, a WBUF (filter coefficient storage memory) management unit 6, and an arithmetic unit (calculation). Block) 7, data output unit 8, and SBUF (cumulative addition result storage memory) management unit 11.
  • the data input unit 3, the filter coefficient input unit 4, and the data output unit 8 are connected to a DRAM (external memory) 9 via a bus 10.
  • the arithmetic processing device 1 generates an output feature amount map (oFM) from the input feature amount map (iFM).
  • oFM output feature amount map
  • the IBUF management unit 5 has a memory (data storage memory, IBUF) for storing input feature amount map (iFM) data, and a management / control circuit (data storage memory control circuit) for the data storage memory.
  • IBUF data storage memory
  • iFM input feature amount map
  • management / control circuit data storage memory control circuit
  • the IBUF management unit 5 counts the number of valid data in the input data (iFM data) and converts it into coordinates, further converts it into an IBUF address (address in IBUF), and stores the data in the data storage memory.
  • the iFM data is extracted from the IBUF by a predetermined method.
  • the WBUF management unit 6 has a filter coefficient storage memory (filter coefficient storage memory, WBUF) and a filter coefficient storage memory management / control circuit (filter coefficient storage memory control circuit).
  • the WBUF management unit 6 refers to the status of the IBUF management unit 5 and extracts from the WBUF the filter coefficient corresponding to the data to be retrieved from the IBUF management unit 5.
  • the DRAM 9 stores iFM data, oFM data and filter coefficients.
  • the data input unit 3 acquires an input feature amount map (iFM) from the DRAM 9 by a predetermined method and passes it to the IBUF (data storage memory) management unit 5.
  • the data output unit 8 writes the output feature amount map (oFM) data in the DRAM 9 by a predetermined method.
  • the data output unit 8 concatenates the M parallel data output from the arithmetic unit 7 and outputs the concatenated data to the DRAM 9.
  • the filter coefficient input unit 4 acquires the filter coefficient from the DRAM 9 by a predetermined method and transfers it to the WBUF (filter coefficient storage memory) management unit 6.
  • FIG. 5 is a block diagram showing the configuration of the SBUF management unit 11.
  • the SBUF management unit 11 includes an SBUF (cumulative addition result storage memory) storage unit 111, an SBUF (cumulative addition result storage memory) 112, and an SBUF (cumulative addition result storage memory) reading unit 113.
  • the SBUF 112 is a buffer for temporarily storing an intermediate result of cumulative addition in each pixel unit (pixel unit) of the iFM.
  • the SBUF reading unit 113 reads desired data (cumulative addition result) from the SBUF 112.
  • the SBUF storage unit 111 When receiving the valid data (cumulative addition result), the SBUF storage unit 111 generates an address and writes the address in the SBUF 112.
  • the calculation unit 7 acquires data from the IBUF (data storage memory) management unit 5 and filter coefficients from the WBUF (filter coefficient storage memory) management unit 6. Further, the calculation unit 7 acquires the data (cumulative addition result) read by the SBUF reading unit 113 from the SBUF 112, and performs data processing such as filter processing, cumulative addition, non-linear calculation, and pooling processing. The data (cumulative addition result) subjected to the data processing by the calculation unit 7 is stored in the SBUF 112 by the SBUF storage unit 111. The controller 2 controls the entire circuit.
  • the processing for the required number of layers is repeatedly executed in multiple processing layers. Then, the arithmetic processing device 1 outputs the subject estimation result as final output data, and obtains the subject estimation result by processing the final output data using a processor (or a circuit).
  • FIG. 6 is a diagram showing a configuration of the arithmetic unit 7 of the arithmetic processing device according to the present embodiment.
  • the number of input channels of the arithmetic unit 7 is N (N is a positive number of 1 or more), that is, the input data (iFM data) is N-dimensional, and N-dimensional input data is processed in parallel (input N parallel).
  • the number of output channels of the arithmetic unit 7 is M (M is a positive number of 1 or more), that is, output data is M-dimensional, and M-dimensional input data is output in parallel (output M parallel).
  • M is a positive number of 1 or more
  • the iFM data (d_0 to d_N-1) and the filter coefficient (k_0 to k_N-1) are input for each channel (ich_0 to ich_N-1), and one channel is input.
  • Output oFM data This processing is performed in M layers in parallel, and M pieces of oFM data och_0 to och_M-1 are output.
  • the calculation unit 7 has a configuration in which the number of input channels is N and the number of output channels is M, and the parallelism is N ⁇ M. Since the number of input channels N and the number of output channels M can be set (changed) according to the size of CNN, they are appropriately set in consideration of processing performance and circuit scale.
  • the arithmetic unit 7 includes an arithmetic control unit 71 that controls each unit in the arithmetic unit. Further, the calculation unit 7 includes a filter calculation unit 72, a first adder 73, a second adder 74, an FF (flip-flop) 75, a non-linear conversion unit 76, and a pooling processing unit 77 for each layer. Prepare There is exactly the same circuit for each face, and there are M such layers.
  • the arithmetic control unit 71 issues a request to the preceding stage of the arithmetic unit 7 so that predetermined data is input to the filter arithmetic unit 72.
  • the filter calculation unit 72 is internally configured so that the multiplier and the adder can be simultaneously executed in N parallels, performs filter processing on input data, and outputs the result of the filter processing in N parallels.
  • the first adder 73 adds all the results of the filter processing in the filter calculation unit 72 that are executed and output in N parallels. That is, the first adder 73 can be said to be a spatial-direction cumulative adder.
  • the second adder 74 cumulatively adds the calculation results of the first adder 73 input in a time division manner. That is, the second adder 74 can be said to be a cumulative adder in the time direction.
  • the second adder 74 starts the process with an initial value of zero and starts the process with the value stored in the SBUF (cumulative addition result storage memory) 112 as the initial value.
  • SBUF cumulative addition result storage memory
  • This switching is performed by the controller 2 based on the phase of cumulative addition that is currently being performed. Specifically, for each operation (phase), the controller 2 gives an instruction to the operation control unit 71 such as a destination for writing the operation result, and when the operation is completed, the controller 2 is notified of the operation end. At that time, the controller 2 gives an instruction to switch the input of the initial value of the second adder 74, judging from the phase of the cumulative addition currently being performed.
  • the arithmetic control unit 71 uses the second adder 74 and the FF 75 to perform all cumulative additions that can be executed by the filter coefficients stored in WBUF, and to calculate the intermediate result (cumulative addition intermediate result) as SBUF (cumulative addition result).
  • the data is written (stored) in the storage memory 112 in pixel units.
  • An FF 75 for holding the cumulative addition result is provided at the subsequent stage of the second adder 74.
  • the arithmetic control unit 71 temporarily stores the intermediate result in the SBUF 112 during the filtering process / cumulative addition process for calculating the data (oFM data) of a specific pixel (pixel) of the oFM, and stores it in another pixel of the oFM. Control to perform processing. Then, the arithmetic control unit 71 returns to the first pixel after storing the cumulative addition intermediate result for all the pixels in the SBUF 112, reads the value stored in the SBUF 112, and sets it as the initial value of the cumulative addition processing, and the continuation of the cumulative addition is performed. Control to run.
  • the timing of storing the intermediate cumulative addition result in the SBUF 112 is the time when the filter / cumulative addition processing that can be executed by all the filter coefficients stored in the WBUF is finished, and the filter coefficient stored in the WBUF is stored. When is updated, control is performed so as to continue the processing.
  • the non-linear conversion unit 76 performs a non-linear calculation process using an Activate function or the like on the result of cumulative addition in the second adder 74 and the FF 75.
  • nonlinear calculation processing is performed by polygonal line approximation.
  • the pooling processing unit 77 performs pooling processing such as selecting and outputting the maximum value (Max Pooling) from the plurality of data input from the non-linear conversion unit 76 and calculating an average value (Average Pooling).
  • the processing in the non-linear conversion unit 76 and the pooling processing unit 77 can be omitted by the arithmetic control unit 71.
  • the number of input channels N and the number of output channels M can be set (changed) according to the size of CNN in the arithmetic unit 7, so that the processing performance and the circuit scale are taken into consideration. And set it appropriately. Further, since there is no hierarchical relationship in the N parallel processing, the cumulative addition is a tournament type, a long path unlike cascade connection does not occur, and the latency is short.
  • FIG. 7A is a flowchart showing the flow of control performed by the arithmetic control unit in the arithmetic processing device according to this embodiment.
  • step S5 enter the "arithmetic unit execution loop" (step S4). Then, "coefficient storage determination” is performed (step S5). In the “coefficient storage determination”, it is determined whether or not the filter coefficient stored in the WBUF is the desired one. If the “coefficient storage determination” result is OK, the process proceeds to "data storage determination” (step S6). If the “coefficient storage determination” result is not OK, the process waits until the “coefficient storage determination” result is OK.
  • step S6 it is determined whether the iFM data stored in IBUF is the desired one. If the “data storage determination” result is OK, the process proceeds to “execution of arithmetic unit” (step S7). If the “data storage determination” result is not OK, the process waits until the “data storage determination” result is OK.
  • step S7 the operation unit performs filter / cumulative addition processing.
  • the filter / cumulative addition processing that can be executed by all the filter coefficients stored in WBUF is finished, the flow ends. If not, the process is repeated by returning to steps S1, S3 and S4.
  • the second number is set.
  • the cumulative addition by the adder 74 is n 2 times, and the number of times the intermediate result is once written to the SBUF 112 is n 1 .
  • FIG. 7B is a flowchart showing the flow of filter coefficient update control in step S2 of FIG. 7A.
  • step S11 the filter coefficient is read into WBUF.
  • step S12 the number of times the filter coefficient is updated is counted. If the filter coefficient update is the first, the process proceeds to step S13, and the cumulative addition initial value is set to zero. If the filter coefficient update is not the first, the process proceeds to step S14, and the cumulative addition initial value is set to the value stored in SBUF.
  • step S15 the number of times the filter coefficient is updated is counted.
  • the process proceeds to step S16, and the output destination of the data (cumulative addition result) is set to the non-linear conversion unit. If the filter coefficient update is not the last, the process proceeds to step S17, and the output destination of the data (cumulative addition result) is SBUF.
  • the cumulative addition initial value (step S13 or S14) and the output destination of the data (cumulative addition result) (step S16 or S17) are passed to the calculation control unit of the calculation unit as status information, and the calculation control is performed.
  • the department controls each switch according to the status.
  • the first embodiment of the present invention deals with the case where there are many filter coefficients (when WBUF is small), but the same problem occurs even when there are too many iFM data instead of filter coefficients. That is, consider the case where only a part of the iFM data can be stored in the IBUF. At this time, if the iFM data stored in the IBUF is updated midway to calculate the data (oFM data) of one pixel (one pixel) of the oFM, the data (oFM data) of the pixel next to the oFM is calculated. Therefore, it is necessary to reread the iFM data.
  • the iFM data required for processing one pixel of oFM is only the neighborhood information of the same pixel.
  • a data buffer IBUF
  • IBUF data buffer
  • FIG. 8 is an image diagram in which the iFM data is divided and input to the calculation unit in the present embodiment.
  • FIG. 9 is an image diagram showing an operation when updating the iFM data n 1 times in the middle of the Convolution process in the present embodiment.
  • each data of the first iFM group (iFM_0) is multiplied by a filter coefficient to perform cumulative addition, and an intermediate result (cumulative addition intermediate result) is written to SBUF (cumulative addition result storage memory) 112.
  • SBUF cumulative addition result storage memory
  • the configuration for carrying out this embodiment is the same as the configuration of the first embodiment shown in FIGS. 4 to 6, and therefore its explanation is omitted.
  • the second adder 74 performs all the cumulative additions that can be executed by the iFM data stored in the IBUF, and outputs the intermediate result (cumulative addition intermediate result) to the SBUF (cumulative addition).
  • the result is written (stored) in the result storage memory) 112 in pixel units.
  • the timing of storing the cumulative addition intermediate result in the SBUF 112 is the time when all the filter / cumulative addition processing that can be executed by the inputtable iFM data is completed, and the processing continues when the iFM data is updated. Control to carry out.
  • FIG. 10A is a flowchart showing the control performed by the arithmetic control unit in the arithmetic processing device according to the present embodiment.
  • the Convolution process is started, first, the "iFM number loop 1" is entered (step S21). Then, the iFM data stored in IBUF is updated (step S22). Next, the "iFM number loop 2" is entered (step S23).
  • step S24 enter the "arithmetic unit execution loop" (step S24). Then, "coefficient storage determination” is performed (step S25). In the “coefficient storage determination”, it is determined whether or not the filter coefficient stored in the WBUF is the desired one. If the "coefficient storage determination" result is OK, the process proceeds to "data storage determination” (step S26). If the “coefficient storage determination” result is not OK, the process waits until the “coefficient storage determination” result is OK.
  • step S26 it is determined whether the iFM data stored in IBUF is the desired one. If the “data storage determination” result is OK, the process proceeds to “execution of arithmetic unit” (step S27). If the “data storage determination” result is not OK, the process waits until the “data storage determination” result is OK.
  • step S27 the operation unit performs filter / cumulative addition processing.
  • the filter / cumulative addition processing that can be executed on all the iFM data stored in the IBUF is completed, the flow ends. If not, the process returns to steps S21, S23 and S24 to repeat the process.
  • FIG. 10B is a flowchart showing the flow of the iFM data update control in step S22 of FIG. 10A.
  • step S31 the iFM data is read into the IBUF.
  • step S32 the number of times the iFM data is updated is counted. If the iFM data is updated first, the process proceeds to step S33, and the cumulative addition initial value is set to zero. If the iFM data update is not the first, the process proceeds to step S34, and the cumulative addition initial value is set to the value stored in SBUF.
  • step S35 the number of updates of the iFM data is counted. If the iFM data has been updated last, the process proceeds to step S36, and the output destination of the data (cumulative addition result) is set to the nonlinear conversion unit. If the iFM data update is not the final, the process proceeds to step S37, and the output destination of the data (cumulative addition result) is SBUF.
  • the cumulative addition initial value (step S33 or S34) and the output destination of the data (cumulative addition result) (step S36 or S37) are passed to the calculation control unit of the calculation unit as status information, and the calculation control is performed.
  • the department controls each switch according to the status.
  • the first embodiment is a case where all the filter coefficients cannot be stored in the WBUF
  • the second embodiment is a case where all the iFM data cannot be stored in the IBUF, but there are cases where both occur simultaneously. That is, as the third embodiment, a case will be described in which all filter coefficients cannot be stored in WBUF and all iFM data cannot be stored in IBUF.
  • FIG. 11 is an image diagram of updating the iFM data and the filter coefficient on the way in the present embodiment.
  • each data of the first iFM group (iFM_0) is multiplied by a filter coefficient to perform cumulative addition, and an intermediate result (cumulative addition intermediate result) is written to SBUF (cumulative addition result storage memory) 112.
  • the iFM group stored in IBUF is updated (the second iFM group (iFM_1) is read into IBUF), and the filter coefficient group stored in WBUF is updated.
  • the cumulative addition intermediate result is taken out from the SBUF 112 as an initial value
  • each data of the second iFM group (iFM_1) is multiplied by the filter coefficient to perform cumulative addition
  • the intermediate result (cumulative addition intermediate result) is SBUF ( The cumulative addition result storage memory) 112 is written.
  • FIG. 12A is a flowchart showing the control performed by the arithmetic control unit in the arithmetic processing device according to the present embodiment.
  • FIG. 12A shows an example in which the update frequency of the filter coefficient group is higher than the update frequency of the iFM data. The one with the highest update frequency is the inner loop.
  • the "IFM number loop 1" is entered (step S41). Then, the iFM data stored in the IBUF is updated (step S42). Next, the "iFM number loop 2" is entered (step S43). Then, the filter coefficient stored in WBUF is updated (step S44). Next, the "iFM number loop 3" is entered (step S45).
  • step S46 enter the "arithmetic unit execution loop" (step S46). Then, "coefficient storage determination” is performed (step S47). In the “coefficient storage determination”, it is determined whether or not the filter coefficient stored in the WBUF is the desired one. If the "coefficient storage determination" result is OK, the process proceeds to "data storage determination” (step S48). If the “coefficient storage determination” result is not OK, the process waits until the “coefficient storage determination” result is OK.
  • step S48 it is determined whether the iFM data stored in IBUF is the desired one. If the “data storage determination” result is OK, the process proceeds to “execution of arithmetic unit” (step S49). If the “data storage determination” result is not OK, the process waits until the “data storage determination” result is OK.
  • step S49 the arithmetic unit performs filter / cumulative addition processing.
  • the filter / cumulative addition processing that can be executed on all the iFM data stored in the IBUF is completed, the flow ends. If not, the process returns to steps S41, S43, and S46 to repeat the process.
  • FIG. 12B is a flowchart showing the flow of the iFM data update control in step S42 and the filter coefficient update control in step S44 of FIG. 12A.
  • step S51 update control of iFM data, which is an outer loop, is performed.
  • step S52 the number of times the iFM data is updated is counted. If the iFM data is updated first, the process proceeds to step S53, and the value Si 1 is set to zero. If the iFM data update is not the first, the process proceeds to step S54, and the value Si 1 is set to the value stored in SBUF.
  • step S55 the number of times the iFM data is updated is counted. If the iFM data has been updated last, the process proceeds to step S56, and Od 1 is used as the nonlinear conversion unit. If the iFM data update is not the last, the process proceeds to step S57, and Od 1 is set to SBUF.
  • step S61 update control of the filter coefficient, which is the inner loop, is performed.
  • step S62 the filter coefficient is read into WBUF.
  • step S62 the number of times the filter coefficient is updated is counted. If the filter coefficient is updated first, the process proceeds to step S63, and the cumulative addition initial value is set to the value Si 1 . If the filter coefficient update is not the first, the process proceeds to step S64, and the cumulative addition initial value is set to the value stored in SBUF.
  • step S65 the number of times the filter coefficient is updated is counted.
  • the process proceeds to step S66, and the output destination of the data (cumulative addition result) is set to Od 1 . If the filter coefficient update is not the final, the process proceeds to step S67, and the output destination of the data (cumulative addition result) is SBUF.
  • step S66 or S67 the output of the value Si 1 (step S53 or S54), Od 1 (step S56 or S57), the initial cumulative addition value (step S63 or S64), and the data (cumulative addition result)
  • the destination (step S66 or S67) is passed to the arithmetic control unit of the arithmetic unit as status information, and the arithmetic control unit controls each switch according to the status.
  • the cumulative addition by the second adder 74 is n 3 times, and the number of times the intermediate result is once written in the SBUF is n 1 ⁇ n 2 .
  • the CNN filter size is changeable, so that both the Convolution processing and the FullConnect processing are easily supported.
  • specific control that supports even if the number of iFMs> N and the number of oFMs> M, and the number of iFMs increases as N and M increase
  • the method corresponding to the case where the number of parameters and the number of parameters are large is shown. That is, it is possible to cope with the expansion of the CNN network.
  • the IBUF is rewritten sequentially, so it is necessary to reread all the iFMs m times. For this reason, the DRAM access amount increases and desired performance cannot be obtained. Therefore, if a plurality of SBUFs are prepared for the respective oFMs, the SBUF can store the cumulative addition result for all m planes, and it is possible to prevent re-reading, but the circuit scale increases.
  • the coefficient is multiplied to perform cumulative addition, and the intermediate addition result is stored in the second SBUF.
  • cumulative addition is performed using the value of the second SBUF as an initial value, and the intermediate addition result is stored in the second SBUF.
  • the SBUF when the number of oFMs requires the number of faces that exceeds the output parallelism M, the SBUF must be provided with SBUFs for the number of faces of the oFM output by one output channel in order to prevent re-reading. As a result, SRAM increases and the circuit scale increases.
  • FIG. 14 is a diagram showing an image of the Convolution process in the arithmetic processing device according to the present embodiment.
  • an SBUF having the same (or larger) capacity as the iFM size (one iFM) is prepared. That is, the SBUF has a size capable of storing the intermediate result of cumulative addition for all pixels on the iFM1 surface.
  • the cumulative addition intermediate result created during the processing of one oFM is temporarily written to the DRAM. This is performed for m planes.
  • the output intermediate result of the cumulative addition is read from the DRAM and continuously processed.
  • FIG. 14 shows a Convolution processing image in the case of generating two oFM data (oFM0 and oFM1).
  • cumulative addition is performed with the value of SBUF as an initial value, and the intermediate addition result is stored in SBUF.
  • the cumulative addition intermediate result stored in SBUF is sequentially transferred to the DRAM as an intermediate result of the oFM0 data.
  • the intermediate result of the oFM1 data stored in the DRAM is stored in the SBUF to be the initial value.
  • cumulative addition is performed using the value of SBUF as an initial value, and the intermediate addition result is stored in the second SBUF.
  • the data acquired from the DRAM is temporarily stored in SBUF. Then, the state becomes the same as in the case where the initial value is stored in SBUF, and the process can be started from there as before. Even at the end of the processing, non-linear processing or the like is performed before it is output to the DRAM.
  • the present embodiment has a demerit that the processing speed is reduced by outputting the intermediate addition result to the DRAM.
  • the processing of the present embodiment can be applied without substantially increasing the number of circuits, so that the latest network can be applied if a slight performance degradation can be tolerated.
  • FIG. 15 is a block diagram showing the overall configuration of the arithmetic processing device according to this embodiment.
  • the arithmetic processing unit 20 shown in FIG. 15 differs from the arithmetic processing unit 1 of the first embodiment shown in FIG. 1 in the configuration of the SBUF (cumulative addition result storage memory) management unit.
  • SBUF cumulative addition result storage memory
  • FIG. 16 is a block diagram showing the configuration of the SBUF management unit 21 of this embodiment.
  • the SBUF management unit 21 includes an SBUF control unit 210, a first SBUF storage unit 211, a second SBUF storage unit 212, an SBUF 112, a first SBUF reading unit 213, and a second SBUF reading unit 214. Equipped with.
  • the SBUF 112 is a buffer for temporarily storing an intermediate result of cumulative addition in each pixel unit (pixel unit) of the iFM.
  • the first SBUF storage unit 211 and the first SBUF reading unit 213 are I / Fs for reading and writing values in the DRAM.
  • the first SBUF storage unit 211 When the first SBUF storage unit 211 receives data (intermediate result) from the DRAM 9 via the data input unit 3, it generates an address and writes it in the SBUF 112.
  • the second SBUF storage unit 212 receives the valid data (cumulative addition intermediate result) from the calculation unit 7, the second SBUF storage unit 212 generates an address and writes the address in the SBUF 112.
  • the first SBUF reading unit 213 reads desired data (intermediate result) from the SBUF 112 and writes it in the DRAM 9 via the data output unit 8.
  • the second SBUF reading unit 214 reads desired data (cumulative addition midway result) from the SBUF 112 and outputs it to the arithmetic unit 7 as an initial value of cumulative addition.
  • the calculation unit 7 acquires data from the IBUF (data storage memory) management unit 5 and the filter coefficient from the WBUF (filter coefficient storage memory) management unit 6. In addition, the calculation unit 7 acquires the data read from the SBUF 112 by the second SBUF reading unit 214 (cumulative addition intermediate result) and performs data processing such as filter processing, cumulative addition, nonlinear calculation, and pooling processing. The data subjected to the data processing by the arithmetic unit 7 (cumulative addition intermediate result) is stored in the SBUF 112 by the second SBUF storage unit 212.
  • the SBUF control unit 210 controls loading of an initial value (cumulative addition intermediate result) from DRAM to SBUF and writing of an intermediate result from SBUF to DRAM.
  • the first SBUF storage unit 211 receives the data (initial value) from the DRAM 9 via the data input unit 3, generates the address, and writes the address in the SBUF 112. .
  • the SBUF control unit 210 acquires data from the DRAM 9 and loads it into the SBUF 112 when an rtrig (reading trigger) is input from the host controller 2.
  • the SBUF control unit 210 transmits a rend (reading end) signal to the host controller 2 and waits for the next operation.
  • the first SBUF reading unit 213 reads desired data (intermediate result) from the SBUF 112 and writes it in the DRAM 9 via the data output unit 8. Specifically, at the time of output to the DRAM, when the wtrig (write trigger) signal is output from the SBUF control unit 210 to the host controller 2, all the data in the SBUF is output to the data output unit 8 and when the end, The SBUF control unit 210 transmits a rend (reading end) signal to the host controller 2 and waits for the next operation.
  • the SBUF control unit 210 also controls the first SBUF storage unit 211, the second SBUF storage unit 212, the first SBUF reading unit 213, and the second SBUF reading unit 214. Specifically, the SBUF control unit 210 outputs a trig (trigger) signal when giving an instruction, and receives an end (end) signal when the processing ends.
  • a trig trigger
  • end end
  • the data input unit 3 loads the cumulative addition intermediate result (intermediate result) from the DRAM 9 in response to a request from the SBUF management unit 21.
  • the data output unit 8 writes the cumulative addition intermediate result (intermediate result) to the DRAM 9 in response to the request from the SBUF management unit 21.
  • FIG. 17A is a flowchart showing the control performed by the arithmetic control unit in the arithmetic processing device according to the present embodiment.
  • the "IFM number loop 1" is entered (step S71). Then, the iFM data stored in IBUF is updated (step S72). Next, the "oFM number loop” is entered (step S73). Then, the data stored in SBUF is updated (step S74). Next, the "iFM number loop 2" is entered (step S75). Then, the filter coefficient stored in WBUF is updated (step S76). Next, the "iFM number loop 3" is entered (step S77).
  • step S78 enter the "arithmetic unit execution loop" (step S78). Then, "coefficient storage determination” is performed (step S79). In the “coefficient storage determination”, it is determined whether or not the filter coefficient stored in the WBUF is the desired one. If the “coefficient storage determination” result is OK, the process proceeds to “data storage determination” (step S80). If the “coefficient storage determination” result is not OK, the process waits until the “coefficient storage determination” result is OK.
  • step S80 it is determined whether or not the iFM data stored in IBUF is the desired one. If the “data storage determination” result is OK, the process proceeds to “execution of arithmetic unit” (step S81). If the “data storage determination” result is not OK, the process waits until the “data storage determination” result is OK.
  • step S81 the arithmetic unit performs filter / cumulative addition processing.
  • the filter / cumulative addition process that can be executed on all the iFM data stored in the IBUF is completed, the process proceeds to "SBUF save" (step S82). If not, the process is repeated by returning to steps S75, S77 and S78.
  • step S82 the data stored in SBUF is saved in the DRAM. After that, the process returns to steps S71 and S73, the process is repeated, and the flow ends when all the calculations are completed.
  • FIG. 17B is a flowchart showing the flow of the iFM data update control in step S72 of FIG. 17A.
  • step S91 the iFM data is read into the IBUF.
  • step S92 the number of times the iFM data is updated is counted. If the iFM data is updated first, the process proceeds to step S93, and the value Si 1 is set to zero. If the iFM data update is not the first, the process proceeds to step S94, and the value Si 1 is set to the value stored in SBUF.
  • step S95 the number of times the iFM data is updated is counted. If the iFM data has been updated last, the process proceeds to step S96, and Od 1 is used as the nonlinear conversion unit. If the iFM data update is not the last, the process proceeds to step S97, and Od 1 is set to SBUF.
  • FIG. 17C is a flowchart showing the flow of filter coefficient update control in step S76 of FIG. 17A.
  • step S101 the filter coefficient is read into WBUF.
  • step S102 the number of times the filter coefficient is updated is counted. If the filter coefficient update is the first, the process proceeds to step S103, and the cumulative addition initial value is set to the value Si 1 . If the filter coefficient update is not the first, the process proceeds to step S104, and the cumulative addition initial value is set to the value stored in SBUF.
  • step S105 the number of times the filter coefficient is updated is counted. If the filter coefficient update is the last, the process proceeds to step S106, and the output destination of the data (cumulative addition result) is set to Od 1 . If the filter coefficient update is not the last, the process proceeds to step S107, and the output destination of the data (cumulative addition result) is SBUF.
  • the output destination (step S106 or S107) of the cumulative addition result is passed to the arithmetic control unit of the arithmetic unit as status information, and the arithmetic control unit controls each switch according to the status.
  • step S111 the number of times of iFM loop 1 is determined. If the iFM loop 1 is the first one, no processing is performed (end). If the iFM loop 1 is not the first, the process proceeds to step S112, and the SBUF value is read from the DRAM.
  • FIG. 17E is a flowchart showing the flow of SBUF evacuation control in step S82 of FIG. 17A.
  • step S121 the number of times of the iFM loop 1 is determined. If the iFM loop 1 is the last one, no processing is performed (end). If the iFM loop 1 is not the last, the process proceeds to step S122, and the SBUF value is written in the DRAM.
  • the cumulative addition by the second adder 74 is n 3
  • the number of times the intermediate result is once written in the SBUF is n 2
  • the number of times the intermediate result is written in the DRAM is n 1 .
  • the control flow in FIG. 17A assumes that the update frequency of the filter coefficient group is higher than the update frequency of the iFM group. On the contrary, it is assumed that the update frequency of the filter coefficient group is not less than the update frequency of the iFM group. This is because if the iFM group is updated first, the iFM group must be reread when the filter coefficient is updated.
  • Each component is for explaining the function and processing related to each component.
  • a single configuration may simultaneously realize the functions and processes related to a plurality of components.
  • Each component may be realized individually or as a whole by a computer including one or more processors, logical circuits, memories, input / output interfaces, and computer-readable recording media.
  • a program for realizing each component or the entire function is recorded on a recording medium, and the recorded program is read into a computer system and executed, thereby realizing the various functions and processes described above. May be.
  • the processor is at least one of a CPU, a DSP (Digital Signal Processor), and a GPU (Graphics Processing Unit).
  • the logic circuit is at least one of an ASIC (Application Specific Integrated Circuit) and an FPGA (Field-Programmable Gate Array).
  • the “computer system” here may include hardware such as an OS and peripheral devices.
  • the “computer system” also includes a homepage providing environment (or a display environment) if a WWW system is used.
  • the "computer-readable recording medium” means a writable non-volatile memory such as a flexible disk, a magneto-optical disk, a ROM, a flash memory, a portable medium such as a CD-ROM, a hard disk built in a computer system, or the like. Storage device.
  • a “computer-readable recording medium” refers to a volatile memory (for example, a DRAM (Dynamic)) in a computer system that serves as a server or a client when a program is transmitted through a network such as the Internet or a communication line such as a telephone line. Random (Access @ Memory)), which includes a program that is held for a certain period of time.
  • a volatile memory for example, a DRAM (Dynamic)
  • a network such as the Internet or a communication line such as a telephone line.
  • Random Access @ Memory
  • the above program may be transmitted from a computer system that stores the program in a storage device or the like to another computer system via a transmission medium or by a transmission wave in the transmission medium.
  • the "transmission medium” for transmitting the program refers to a medium having a function of transmitting information such as a network (communication network) such as the Internet or a communication line (communication line) such as a telephone line.
  • the program may be for realizing a part of the functions described above.
  • a so-called difference file difference file (difference program) may be used.
  • the present invention can be widely applied to arithmetic processing devices that perform deep learning using a convolutional neural network.

Landscapes

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

Abstract

演算処理装置において、演算制御部は、出力特徴量マップの特定のピクセルを算出するためのフィルタ処理および累積加算処理の途中で、一旦途中結果を前記累積加算結果格納メモリに格納して別のピクセルの処理を行い、すべてのピクセルについて累積加算処理の途中結果を前記累積加算結果格納メモリに格納し終えたら最初のピクセルに戻り、前記累積加算結果格納メモリに格納した値を読み出して累積加算処理の初期値とし、累積加算処理の続きを実行するよう制御する。

Description

演算処理装置
 本発明は、演算処理装置、より詳しくは、畳み込みニューラルネットワークを用いたディープラーニングを行う演算処理装置の回路構成に関する。
 従来、複数の処理層が階層的に接続されたニューラルネットワークを用いて演算を実行する演算処理装置がある。特に画像認識を行う演算処理装置では、畳み込みニューラルネットワーク(Convolutional Neural Network、以下CNNという)を用いたディープラーニングが広く行われている。
 図18は、CNNを用いたディープラーニングによる画像認識の処理の流れを示す図である。CNNを用いたディープラーニングによる画像認識では、入力された画像データ(ピクセルデータ)に対して、CNNの複数の処理層における処理が順次施されることにより、画像に含まれる対象物が認識された最終的な演算結果データが得られる。
 CNNの処理層は、畳み込み演算処理、非線形処理、縮小処理(プーリング処理)等を含むConvolution処理を行うConvolution層(畳み込み層)と、全ての入力(ピクセルデータ)にフィルタ係数を乗じて累積加算するFullConnect処理を行うFullConnect層(全結合層)とに大きく分類される。ただし、FullConnect層がない畳み込みニューラルネットワークも存在する。
 CNNを用いたディープラーニングによる画像認識は以下のようにして行われる。まず、画像データに対して、ある領域を抽出してフィルタ係数(フィルタ係数)の異なる複数のフィルタを乗じて特徴量マップ(Feature Map、FM)を作成する畳み込み演算処理(Convolution処理)と、特徴量マップの一部領域を縮小する縮小処理(プーリング処理)の組合せを1つの処理層として、これを複数回(複数の処理層において)行う。これらの処理が、畳み込み層(Convolution層)の処理である。
 プーリング処理は、近傍4pixの最大値を抽出して1/2×1/2に縮小するmax poolingの他、近傍4pixの平均値を求める(抽出ではない)average poolingなどのバリエーションがある。
 図19は、Convolution処理の流れを示す図である。まず、入力された画像データに対して、夫々にフィルタ係数の異なるフィルタ処理を行い、これらを全て累積加算することにより、1ピクセルに対応するデータができる。作成されたデータに対し、非線形変換および縮小処理(プーリング処理)を行い、以上の処理を画像データの全ピクセルに対して行うことで、出力特徴量マップ(oFM)が1面分生成される。これを複数回繰り返すことでoFMを複数面生成する。実際の回路では上記全てがパイプライン処理される。
 さらに、上記出力特徴量マップ(oFM)を入力特徴量マップ(iFM)として、さらにフィルタ係数の異なるフィルタ処理を行うことにより、上述のConvolution処理を繰り返す。このようにして複数回のConvolution処理を行い、出力特徴量マップ(oFM)を得る。
 Convolution処理が進み、FMをある程度まで小さくしたところで、画像データを1次元のデータ列と読み変える。1次元のデータ列の各データに対して各々異なる係数を乗じて累積加算を行うFullConnect処理を複数回(複数の処理層において)行う。これらの処理が、全結合層(FullConnect層)の処理である。
 そして、FullConnect処理の後、最終的な演算結果である被写体推定結果として、画像に含まれる対象物が検出された確率(被写体検出の確率)が出力される。図18の例では、最終的な演算結果データとして、犬が検出された確率は0.01(1%)、猫が検出された確率は0.04(4%)、ボートが検出された確率は0.94(94%)、鳥が検出された確率は0.02(2%)である。
 このようにして、CNNを用いたディープラーニングによる画像認識は、高い認識率を実現できる。しかし、検出する被写体の種類を増やしたり、被写体検出精度を上げるためには、ネットワークを大きくする必要がある。そうするとデータ格納バッファやフィルタ係数格納バッファが必然的に大容量になるが、ASIC(Application Specific Integrated Circuit)にはあまり大容量のメモリを搭載できない。
 また、画像認識処理におけるディープラーニングでは、(K-1)層目とK層目におけるFM(Feature Map)サイズとFM数(FMの面数)の関係は次式のような関係になる場合が多く、回路としてメモリサイズを決定する際には最適化が困難である。
 FMサイズ[K]=1/4×FMサイズ[K-1]
 FM数[K]=2×FM数[K-1]
 例えば、CNNのバリエーションの1つであるYolo_v2に対応可能な回路のメモリのサイズを考える場合、FMサイズとFM数の最大値だけで決定しようとすると1GB程度必要となる。実際には、FM数とFMサイズは反比例的関係があるため、計算上メモリは3MB程度あれば十分ではあるが、電池駆動のモバイル機器に搭載するASICとしては、できるだけ消費電力やチップコストを小さくしたいニーズがあるため、メモリを極力小さくする工夫が必要となってくる。
 このような問題があることから、CNNは一般的には高性能PCやGPU(Graphics Processing Unit)を用いたソフトウエア処理で実装される。しかし、高速処理を実現するためには処理の重い部分をハードウェアで構成する必要がある。このようなハードウェア実装の例が、特許文献1に記載されている。
 特許文献1は、複数の演算処理ユニットの中にそれぞれ、演算ブロックと複数のメモリを搭載することにより演算処理の効率化を図るようにした演算処理装置を開示している。演算ブロックとそれと対になるバッファとは、中継部を介して畳み込み演算処理を並列に実行すると共に、演算部間で累積加算データを授受する。その結果、入力のネットワークが大きくても一度に活性化処理への入力を作成できる。
特開2017-151604号公報
特許文献1の構成は、上下関係のある(方向性を有する)非対称な構成であり、累積加算途中結果が演算ブロックすべてをカスケード接続して通過する。そのため、大きなネットワークに対応しようとすると、累積加算途中結果が何度も中継部と冗長データ保持部を経由しなければならず、長いカスケード接続パスが形成され、処理時間が掛かってしまう。また、巨大なネットワークを細かく分割した場合は、同じデータまたはフィルタ係数をDRAM(外部メモリ)から複数回、読み込みする(再読み込みする)ことにより、DRAMへのアクセス量が増える可能性がある。しかし、特許文献1にはこのような可能性を回避するための具体的な制御方法の記載がなく、考慮されていない。
 上述の事情を踏まえ、本発明は、フィルタ係数が多すぎてWBUFに入りきらない時や、iFM数が多すぎてIBUFに入りきらない時に、一度に計算できなくなるという問題を回避することができる演算処理装置を提供することを目的とする。
 本発明の第一の態様は、Convolution処理とFullConnect処理を行うディープラーニング用の演算処理装置であって、入力特徴量マップデータを格納するデータ格納メモリと、前記データ格納メモリを管理および制御するデータ格納メモリ制御回路とを有するデータ格納メモリ管理部と;フィルタ係数を格納するフィルタ係数格納メモリと、前記フィルタ係数格納メモリを管理および制御するフィルタ係数格納メモリ制御回路とを有するフィルタ係数格納メモリ管理部と;前記入力特徴量マップデータおよび出力特徴量マップデータを格納する外部メモリと;前記外部メモリから、前記入力特徴量マップデータを取得するデータ入力部と;前記外部メモリから、前記フィルタ係数を取得するフィルタ係数入力部と;入力N並列、出力M並列の構成(N、M≧1の正数)で、前記データ格納メモリから前記入力特徴量マップデータを取得し、前記フィルタ係数格納メモリから前記フィルタ係数を取得して、フィルタ処理、累積加算処理、非線形演算処理およびプーリング処理を行う演算部と;前記演算部から出力されるM並列のデータを連結して、出力特徴量マップデータとして前記外部メモリに出力するデータ出力部と;入力特徴量マップの各ピクセル単位で累積加算処理の途中結果を一時的に記録しておく累積加算結果格納メモリと、有効データを受けてアドレスを生成し前記累積加算結果格納メモリに書き込む累積加算結果格納メモリ格納部と、前記累積加算結果格納メモリから指定したデータを読み出す累積加算結果格納メモリ読み出し部と、からなる累積加算結果格納メモリ管理部と;前記演算処理装置内を制御するコントローラと;を有し、前記演算部は、N並列でフィルタ処理を実行するフィルタ演算部と、前記フィルタ演算部の演算結果を全て累積加算する第1加算器と、前記第1加算器の累積加算処理の結果を後段で累積加算する第2加算器と、前記第2加算器の累積加算処理の結果を保持するフリップフロップと、前記演算部内を制御する演算制御部と、を有し、前記演算制御部は、出力特徴量マップの特定のピクセルを算出するためのフィルタ処理および累積加算処理の途中で、フィルタ処理および累積加算処理に必要な全ての入力特徴量マップデータを前記データ格納メモリに格納することができない場合、または、フィルタ処理および累積加算処理に必要な全てのフィルタ係数を前記フィルタ係数格納メモリに格納することができない場合に、一旦途中結果を前記累積加算結果格納メモリに格納して別のピクセルの処理を行い、すべてのピクセルについて累積加算処理の途中結果を前記累積加算結果格納メモリに格納し終えたら最初のピクセルに戻り、前記累積加算結果格納メモリに格納した値を読み出して累積加算処理の初期値とし、累積加算処理の続きを実行するよう制御することを特徴とする。
 前記演算制御部は、前記フィルタ係数格納メモリに格納されているすべてのフィルタ係数で実行可能なフィルタ処理および累積加算処理を終えた時に、一旦途中結果を前記累積加算結果格納メモリに格納し、前記フィルタ係数格納メモリに格納されているフィルタ係数が更新されたら累積加算処理の続きを実行するように制御してもよい。
 前記演算制御部は、入力可能なすべての入力特徴量マップデータで実行可能なすべてのフィルタ処理および累積加算処理を終えた時に、一旦途中結果を前記累積加算結果格納メモリに格納し、前記データ格納メモリに格納されている入力特徴量マップデータが更新されたら累積加算処理の続きを実行するように制御してもよい。
 前記累積加算結果格納メモリ管理部は、前記累積加算結果格納メモリから累積加算途中結果を読み出して前記外部メモリに書き出す累積加算結果格納メモリ読み出し部と、前記外部メモリから累積加算途中結果を読み込んで前記累積加算結果格納メモリに格納する累積加算結果格納メモリ格納部と、を有し、前記演算制御部は、出力特徴量マップの特定のピクセルを算出するためのフィルタ処理および累積加算処理の途中で、途中結果を前記累積加算結果格納メモリから前記外部メモリに書き出し、前記データ格納メモリに格納されている入力特徴量マップデータまたは前記フィルタ係数格納メモリに格納されているフィルタ係数を更新して累積加算処理を続きから実施する場合は、前記外部メモリに書き出した累積加算途中結果を前記外部メモリから前記累積加算結果格納メモリに読み込んで累積加算処理の続きを実行するように制御してもよい。
 本発明の各態様に係る演算処理装置によれば、iFMサイズのピクセル単位で、累積加算の途中結果を一時保存することができるので、IBUFに全てのiFMデータが入りきらなくなったり、WBUFにフィルタ係数が入りきらなくなったりすることで一度に計算できなくなるという問題を回避することができる。
Convolution処理によって、入力特徴量マップ(iFM)から出力特徴量マップ(oFM)を得るイメージ図である。 Convolution処理において、フィルタ係数を格納しているWBUF(フィルタ係数格納メモリ)が不足している場合を示すイメージ図である。 本発明の第1実施形態に係る演算処理装置における、Convolution処理においてフィルタ係数を途中で1回更新する場合の動作を示すイメージ図である。 本発明の第1実施形態に係る演算処理装置の全体構成を示すブロック図である。 本発明の第1実施形態に係る演算処理装置における、SBUF管理部の構成を示すブロック図である。 本発明の第1実施形態に係る演算処理装置の演算部の構成を示す図である。 本発明の第1実施形態に係る演算処理装置において、演算制御部が行う制御の流れを示すフローチャートである。 図7AのステップS2におけるフィルタ係数更新制御の流れを示すフローチャートである。 本発明の第2実施形態において、iFMデータを分割して演算部に入力するイメージ図である。 本発明の第2実施形態に係る演算処理装置における、Convolution処理においてiFMデータを途中でn回更新する場合の動作を示すイメージ図である。 本発明の第2実施形態に係る演算処理装置において、演算制御部が行う制御を示すフローチャートである。 図10AのステップS22におけるiFMデータ更新制御の流れを示すフローチャートである。 本発明の第3実施形態に係る演算処理装置において、iFMデータおよびフィルタ係数を途中で更新するイメージ図である。 本発明の第3実施形態に係る演算処理装置において、演算制御部が行う制御を示すフローチャートである。 図12AのステップS42におけるiFMデータ更新制御およびステップS44におけるフィルタ係数更新制御の流れを示すフローチャートである。 1つの出力チャネルが生成しなければならないoFM数m=2のケースにおいて、2つのSBUFをそれぞれのoFM用として用意した場合の、Convolution処理イメージを示す図である。 本発明の第4実施形態に係る演算処理装置におけるConvolution処理のイメージを示す図である。 本発明の第4実施形態に係る演算処理装置の全体構成を示すブロック図である。 本発明の第4実施形態に係る演算処理装置におけるSBUF管理部の構成を示すブロック図である。 本発明の第4実施形態に係る演算処理装置において、演算制御部が行う制御を示すフローチャートである。 図17AのステップS72におけるiFMデータ更新制御の流れを示すフローチャートである。 図17AのステップS76におけるフィルタ係数更新制御の流れを示すフローチャートである。 図17AのステップS74におけるSBUF更新制御の流れを示すフローチャートである。 図17AのステップS82におけるSBUF退避制御の流れを示すフローチャートである。 CNNを用いたディープラーニングによる画像認識の処理の流れを示す図である。 従来技術に係るConvolution処理の流れを示す図である。
 本発明の実施形態について、図面を用いて説明する。まず、本発明の実施形態の構成を採用する背景について説明する。
 図1は、Convolution処理によって、入力特徴量マップ(iFM)から出力特徴量マップ(oFM)を得るイメージ図である。iFMに、フィルタ処理、累積加算、非線形変換、プーリング(縮小)などの処理を施すことにより、oFMを得る。oFMの1ピクセル(1画素)を計算するのに必要な情報として、出力(oFMの1ピクセル)に対応するiFMの座標の近傍にある全てのピクセルの情報(iFMデータおよびフィルタ係数)が必要である。
 図2は、Convolution処理において、フィルタ係数を格納しているWBUF(フィルタ係数格納メモリ)が不足している場合を示すイメージ図である。図2の例では、6枚のiFMの座標(X,Y)の近傍にある9ピクセルの情報(iFMデータおよびフィルタ係数)から、oFMの座標(X,Y)の1ピクセルのデータ(oFMデータ)を算出する。この際、IBUF(データ格納メモリ)から読み出した各々のiFMデータに対して、WBUF(フィルタ係数格納メモリ)から読み出したフィルタ係数を掛けて累積加算する。
 図2のように、WBUFの大きさが小さい場合、全てのiFMデータに対応するフィルタ係数をWBUFに格納することができない。図2の例では、WBUFは、3枚のiFMデータに対応するフィルタ係数しか格納することができない。この場合、前半の3枚のiFMデータに各々対応するフィルタ係数を掛けて累積加算し、結果(累積加算結果)を一時的に記憶する(ステップ1)。次にWBUFに格納されているフィルタ係数を更新し(ステップ2)、後半の3枚のiFMに各々対応するフィルタ係数を掛けてさらに累積加算する(ステップ3)。そして、(ステップ1)の累積加算結果と(ステップ3)の累積加算結果を足し合わせる。その後、非線形処理およびブーリング処理を施すことにより、oFMの座標(X,Y)の1ピクセルのデータ(oFMデータ)を得る。
 この場合、oFMの次の座標のピクセルのデータ(oFMデータ)を算出する際、WBUFに格納されているフィルタ係数が更新されているため、WBUFは再度、DRAMからフィルタ係数を読み直す必要が生じる。このようなフィルタ係数の読み直しを、ピクセル数分行うため、DRAMの帯域を消費し、電力的にも無駄が生じる。
 (第1実施形態)
 次に、本発明の第1実施形態について、図面を用いて説明する。図3は、本実施形態における、Convolution処理においてフィルタ係数を途中で1回更新する場合の動作を示すイメージ図である。Convolution処理は、入力される全てのiFMデータに異なるフィルタ係数をかけ、それらを全て積算する事でoFMの1ピクセルのデータ(oFMデータ)が算出される。
 iFM数(枚数)=N、oFM数(枚数)=M、フィルタカーネルサイズを3×3(=9)とすると、フィルタ係数の総要素数は9×N×Mとなる。N、Mはネットワークによって変わるが、数千万を超える巨大な大きさとなる場合がある。このような場合、全てのフィルタ係数を保存できる巨大なWBUFを置くことは不可能なので、途中でWBUFに格納されるデータを更新する必要がある。しかし、WBUFのサイズがoFMの1ピクセルのデータ(oFMデータ)を形成する事すらできない小さい容量の場合(具体的には9Nより小さい場合)、oFMのピクセル単位でフィルタ係数を読み直さなければならなくなり、非常に効率が悪い。
 そこで本実施形態では、iFMのサイズ(iFM1枚分)と同じ(または、より大きい)容量を持つSRAM(以降SBUF(累積加算結果格納メモリ)と呼称)を用意する。そして、WBUFに格納されているフィルタ係数で実行可能な全ての累積加算を行い、その途中結果(累積加算結果)を、SBUF(累積加算結果格納メモリ)にピクセル単位で書き込む(格納する)。図3の例では、前半の3枚のiFMデータに各々対応するフィルタ係数を掛けて累積加算し、その途中結果を、SBUF(累積加算結果格納メモリ)に格納する。そして、WBUFに格納されるフィルタ係数を更新して続きの累積加算(後半の3枚の累積加算)を開始する時は、SBUFから取り出した値を累積加算初期値として、後半の3枚のiFMデータに各々対応するフィルタ係数を掛けて累積加算する。そして、この累積加算結果に、非線形処理およびブーリング処理を施すことにより、oFMの1ピクセルのデータ(oFMデータ)を得る。
 図4は、本実施形態に係る演算処理装置の全体構成を示すブロック図である。演算処理装置1は、コントローラ2と、データ入力部3と、フィルタ係数入力部4と、IBUF(データ格納メモリ)管理部5と、WBUF(フィルタ係数格納メモリ)管理部6と、演算部(演算ブロック)7と、データ出力部8と、SBUF(累積加算結果格納メモリ)管理部11を備える。データ入力部3と、フィルタ係数入力部4と、データ出力部8は、バス10を介して、DRAM(外部メモリ)9と接続されている。演算処理装置1は、入力特徴量マップ(iFM)から出力特徴量マップ(oFM)を生成する。
 IBUF管理部5は、入力特徴量マップ(iFM)データ格納用のメモリ(データ格納メモリ、IBUF)と、データ格納メモリの管理・制御回路(データ格納メモリ制御回路)を有する。IBUFは、それぞれが複数のSRAMから構成される。
 IBUF管理部5は、入力データ(iFMデータ)中の有効データ数をカウントして座標に変換し、さらにそれをIBUFアドレス(IBUFにおけるアドレス)に変換し、データをデータ格納メモリに格納するとともに、所定の方法でiFMデータをIBUFから取り出す。
 WBUF管理部6は、フィルタ係数格納用のメモリ(フィルタ係数格納メモリ、WBUF)と、フィルタ係数格納メモリの管理・制御回路(フィルタ係数格納メモリ制御回路)を有する。WBUF管理部6は、IBUF管理部5のステータスを参照して、IBUF管理部5から取り出すデータに対応するフィルタ係数をWBUFから取り出す。
 DRAM9は、iFMデータ、oFMデータおよびフィルタ係数を格納する。データ入力部3は、DRAM9から所定の方法で、入力特徴量マップ(iFM)を取得し、IBUF(データ格納メモリ)管理部5に渡す。データ出力部8は、DRAM9に所定の方法で、出力特徴量マップ(oFM)データを書き出す。具体的には、データ出力部8は、演算部7から出力されるM並列のデータを連結してDRAM9に出力する。フィルタ係数入力部4は、DRAM9から所定の方法で、フィルタ係数を取得し、WBUF(フィルタ係数格納メモリ)管理部6に渡す。
 図5は、SBUF管理部11の構成を示すブロック図である。SBUF管理部11は、SBUF(累積加算結果格納メモリ)格納部111と、SBUF(累積加算結果格納メモリ)112と、SBUF(累積加算結果格納メモリ)読み出し部113を備える。SBUF112は、iFMの各ピクセル単位(画素単位)で累積加算の途中結果を一時的に格納するためのバッファである。SBUF読み出し部113は、SBUF112から所望のデータ(累積加算結果)を読み出す。SBUF格納部111は、有効データ(累積加算結果)を受け取るとアドレスを生成してSBUF112に書き込む。
 演算部7は、IBUF(データ格納メモリ)管理部5からデータ、WBUF(フィルタ係数格納メモリ)管理部6からフィルタ係数を取得する。また、演算部7は、SBUF読み出し部113がSBUF112から読み出したデータ(累積加算結果)を取得して、フィルタ処理・累積加算・非線形演算・プーリング処理等のデータ処理を行う。演算部7がデータ処理を施したデータ(累積加算結果)は、SBUF格納部111によって、SBUF112に格納される。コントローラ2は、回路全体の制御を行う。
 CNNでは、複数の処理層において、必要な層数分の処理が繰り返し実行される。そして、演算処理装置1は最終出力データとして被写体推定結果を出力し、この最終出力データを、プロセッサ(回路でもよい)を用いて処理することにより被写体推定結果を得る。
 図6は、本実施形態に係る演算処理装置の演算部7の構成を示す図である。演算部7の入力チャネル数はN(Nは1以上の正数)、すなわち入力データ(iFMデータ)はN次元であり、N次元の入力データが並列して処理される(入力N並列)。
 演算部7の出力チャネル数はM(Mは1以上の正数)、すなわち出力データはM次元であり、M次元の入力データが並列して出力される(出力M並列)。図6に示すように、1つの層において、各チャネル(ich_0~ich_N-1)ごとに、iFMデータ(d_0~d_N-1)とフィルタ係数(k_0~k_N-1)が入力され、1個のoFMデータを出力する。この処理がM層、並行して行われ、M個のoFMデータoch_0~och_M-1が出力される。
 このように、演算部7は、入力チャネル数をN、出力チャネル数をMとして、並列度がN×Mとなる構成を取る。入力チャネル数Nおよび出力チャネル数Mの大きさは、CNNの大きさに応じて設定(変更)することができるので、処理性能や回路規模を勘案して適切に設定する。
 演算部7は、演算部内各部の制御を行う演算制御部71を備える。また、演算部7は、各層ごとに、フィルタ演算部72と、第1加算器73と、第2加算器74と、FF(フリップフロップ)75と、非線形変換部76と、プーリング処理部77を備える。面ごとに全く同じ回路が存在し、このような層がM個ある。
 演算制御部71が、演算部7の前段に対してリクエストを発行することにより、所定のデータがフィルタ演算部72に入力される。フィルタ演算部72は、内部で乗算器と加算器がN並列で同時に実行できるように構成されており、入力データのフィルタ処理を行い、フィルタ処理の結果をN並列で出力する。
 第1加算器73は、N並列で実行され出力されたフィルタ演算部72におけるフィルタ処理の結果を全て加算する。すなわち、第1加算器73は、空間方向の累積加算器ということができる。第2加算器74は、時分割で入力される第1加算器73の演算結果を累積加算する。すなわち、第2加算器74は、時間方向の累積加算器ということができる。
 本実施形態では、第2加算器74は、初期値をゼロとして処理をスタートするケースと、SBUF(累積加算結果格納メモリ)112に格納されている値を初期値として処理をスタートするケースの2通りがある。すなわち、図6に示すスイッチボックス78において、第2加算器74の初期値の入力が、ゼロとSBUF管理部11から取得した値(累積加算途中結果)とで切り替わる。
 この切り替えは、現在行われている累積加算のフェーズに基づいて、コントローラ2が行う。具体的には、1回の演算(フェーズ)ごとに、コントローラ2から演算制御部71に演算結果の書き出し先などの指示が来て、演算が終了するとコントローラ2に演算終了を通知する。その際、コントローラ2は現在行われている累積加算のフェーズから判断して、第2加算器74の初期値の入力を切り替える指示を行う。
 演算制御部71は、第2加算器74およびFF75によって、WBUFに格納されているフィルタ係数で実行可能な全ての累積加算を行い、その途中結果(累積加算途中結果)を、SBUF(累積加算結果格納メモリ)112にピクセル単位で書き込む(格納する)。第2加算器74の後段には、累積加算の結果を保持するためのFF75が設けられている。
 演算制御部71は、oFMの特定のピクセル(画素)のデータ(oFMデータ)を算出するためのフィルタ処理・累積加算処理の途中で、一旦途中結果をSBUF112に格納し、oFMの別のピクセルの処理を行うように制御する。そして、演算制御部71は、全てのピクセルについて累積加算途中結果をSBUF112に格納し終えたら最初のピクセルに戻り、SBUF112に格納した値を読み出して累積加算処理の初期値とし、累積加算の続きを実行するように制御する。
 本実施形態では、累積加算途中結果をSBUF112に格納するタイミングは、WBUFに格納されている全てのフィルタ係数で実行可能なフィルタ・累積加算処理を終えた時とし、WBUFに格納されているフィルタ係数が更新されたら処理の続きを実施するように制御する。
 非線形変換部76は、第2加算器74およびFF75での累積加算の結果に対して、Activate関数などによる非線形演算処理を行う。具体的な実装は特に規定しないが、例えば折れ線近似により非線形演算処理を行う。
 プーリング処理部77は、非線形変換部76から入力された複数のデータの中から最大値を選択出力(Max Pooling)する、平均値を算出(Average Pooling)する、などのプーリング処理を行う。なお、非線形変換部76とプーリング処理部77における処理は、演算制御部71により省略する事が可能となっている。
 このような構成により、演算部7において、入力チャネル数Nおよび出力チャネル数Mの大きさは、CNNの大きさに応じて設定(変更)することができるので、処理性能や回路規模を勘案して適切に設定する。また、上下関係がないN並列処理のため、累積加算はトーナメント式であり、カスケード接続のような長いパスが生じず、レイテンシが短い。
 図7Aは、本実施形態に係る演算処理装置において、演算制御部が行う制御の流れを示すフローチャートである。Convolution処理が開始されると、まず、「iFM数ループ1」に入る(ステップS1)。そして、WBUFに格納されているフィルタ係数を更新する(ステップS2)。次に、「iFM数ループ2」に入る(ステップS3)。
 次に、「演算部実行ループ」に入る(ステップS4)。そして、「係数格納判定」を行う(ステップS5)。「係数格納判定」では、WBUFに格納されているフィルタ係数が所望のものか否かを判定する。「係数格納判定」結果がOKの場合は、「データ格納判定」に進む(ステップS6)。「係数格納判定」結果がOKでない場合は、「係数格納判定」結果がOKになるまで待機する。
 ステップS6の「データ格納判定」では、IBUFに格納されているiFMデータが所望のものか否かを判定する。「データ格納判定」結果がOKの場合は、「演算部実行」に進む(ステップS7)。「データ格納判定」結果がOKでない場合は、「データ格納判定」結果がOKになるまで待機する。
 ステップS7の「演算部実行」では、演算部がフィルタ・累積加算処理を行う。WBUFに格納されている全てのフィルタ係数で実行可能なフィルタ・累積加算処理を終えると、フローは終了する。そうでない場合は、各ステップS1、S3、S4に戻って、処理を繰り返す。
 iFMデータ数がn×n×Nで、「iFM数ループ1」(ステップS1)の回数=n、「iFM数ループ2」(ステップS3)の回数=nと設定すると、第2加算器74による累積加算はn回、SBUF112に一旦中間結果として書き出す回数はn回となる。
 図7Bは、図7AのステップS2におけるフィルタ係数更新制御の流れを示すフローチャートである。まず、ステップS11において、WBUFにフィルタ係数を読み込む。そして、ステップS12において、フィルタ係数の更新回数をカウントする。フィルタ係数更新が最初の場合はステップS13に進み、累積加算初期値をゼロとする。フィルタ係数更新が最初でない場合はステップS14に進み、累積加算初期値をSBUFに格納されている値とする。
 次に、ステップS15において、フィルタ係数の更新回数をカウントする。フィルタ係数更新が最後の場合はステップS16に進み、データ(累積加算結果)の出力先を非線形変換部とする。フィルタ係数更新が最後でない場合はステップS17に進み、データ(累積加算結果)の出力先をSBUFとする。
 なお、フィルタ係数更新制御において、累積加算初期値(ステップS13またはS14)およびデータ(累積加算結果)の出力先(ステップS16またはS17)はステータス情報として演算部の演算制御部に渡され、演算制御部ではそのステータスに従って各部スイッチを制御する。
 (第2実施形態)
 本発明の第1実施形態は、フィルタ係数が多い場合(WBUFが小さい場合)に対処するものであったが、フィルタ係数でなく、iFMデータが多すぎるケースでも同様の問題が起こる。すなわち、iFMデータの一部しかIBUFに格納できないケースを考える。このとき、oFMの1ピクセル(1画素)のデータ(oFMデータ)を算出するためにIBUFに格納されているiFMデータを途中で更新すると、oFMの次のピクセルのデータ(oFMデータ)を算出するためにiFMデータの読み直しが必要となってしまう。
 なお、oFMの1ピクセルの処理に必要なiFMデータは同一ピクセルの近傍情報だけである。しかし、たとえ局所領域だけをIBUFに格納するとしても、ネットワークが巨大化して数千のiFMデータが必要となった場合や、規模削減のためにIBUFを極限まで削減する場合、データバッファ(IBUF)が不足し、iFMデータを分割して読み込むことは避けられない。
 そこで、本発明の第2実施形態では、iFMデータが多すぎる場合(IBUFが小さい場合)に対処できるようにする。なお、SBUF(累積加算結果格納メモリ)を設ける点は第1実施形態と同じである。図8は、本実施形態において、iFMデータを分割して演算部に入力するイメージ図である。
 まずiFMデータをn×N面のデータバッファ(IBUF_0~IBUF_N-1)に格納する。演算部で第2加算器74(時間方向の累積加算器)による累積加算はn回実施され、途中結果(累積加算途中結果)をSBUF(累積加算結果格納メモリ)112に書き出す。全てのピクセルに対して途中結果を書き出したら、次のiFMデータをn×N面読みこみ、累積加算途中結果を初期値としてSBUF112から取り出して累積加算演算を継続する。これをn回繰り返すことでn×N(=n×n×N)面の処理ができる。
 図9は、本実施形態における、Convolution処理においてiFMデータを途中でn回更新する場合の動作を示すイメージ図である。まず、最初のiFM群(iFM_0)の各データに対してフィルタ係数を掛けて累積加算を行い、途中結果(累積加算途中結果)をSBUF(累積加算結果格納メモリ)112に書き出す。そして、最初のiFM群(iFM_0)を使用してできる全ての計算を行う。
 次に、2番目のiFM群(iFM_1)をIBUFに読み込む。そして、累積加算途中結果を初期値としてSBUF112から取り出して、2番目のiFM群(iFM_1)の各データに対してフィルタ係数を掛けて累積加算を行い、途中結果(累積加算途中結果)をSBUF(累積加算結果格納メモリ)112に書き出す。そして、2番目のiFM群(iFM_1)を使用してできる全ての計算を行う。
 同じ動作を、n番目のiFM群(iFM_n)まで繰り返し、得られた累積加算結果に対して、非線形処理・縮小処理などのプーリング処理を行うことにより、oFMの1ピクセル(1画素)のデータ(oFMデータ)が得られる。このように、できる所までの全ての計算を行う点は、第1実施形態と同じである。
 本実施形態を行う構成は、図4~図6に示す第1実施形態の構成と同じであるので説明を省略する。第1実施形態と異なる点として、第2加算器74は、IBUFに格納されているiFMデータで実行可能な全ての累積加算を行い、その途中結果(累積加算途中結果)を、SBUF(累積加算結果格納メモリ)112にピクセル単位で書き込む(格納する)。
 また、本実施形態では、累積加算途中結果をSBUF112に格納するタイミングは、入力可能なiFMデータで実行可能な全てのフィルタ・累積加算処理を終えた時とし、iFMデータが更新されたら処理の続きを実施するように制御する。
 図10Aは、本実施形態に係る演算処理装置において、演算制御部が行う制御を示すフローチャートである。Convolution処理が開始されると、まず、「iFM数ループ1」に入る(ステップS21)。そして、IBUFに格納されているiFMデータを更新する(ステップS22)。次に、「iFM数ループ2」に入る(ステップS23)。
 次に、「演算部実行ループ」に入る(ステップS24)。そして、「係数格納判定」を行う(ステップS25)。「係数格納判定」では、WBUFに格納されているフィルタ係数が所望のものか否かを判定する。「係数格納判定」結果がOKの場合は、「データ格納判定」に進む(ステップS26)。「係数格納判定」結果がOKでない場合は、「係数格納判定」結果がOKになるまで待機する。
 ステップS26の「データ格納判定」では、IBUFに格納されているiFMデータが所望のものか否かを判定する。「データ格納判定」結果がOKの場合は、「演算部実行」に進む(ステップS27)。「データ格納判定」結果がOKでない場合は、「データ格納判定」結果がOKになるまで待機する。
 ステップS27の「演算部実行」では、演算部がフィルタ・累積加算処理を行う。IBUFに格納されている全てのiFMデータで実行可能なフィルタ・累積加算処理を終えると、フローは終了する。そうでない場合は、各ステップS21、S23、S24に戻って、処理を繰り返す。
 図10Bは、図10AのステップS22におけるiFMデータ更新制御の流れを示すフローチャートである。まず、ステップS31において、IBUFにiFMデータを読み込む。そして、ステップS32において、iFMデータの更新回数をカウントする。iFMデータ更新が最初の場合はステップS33に進み、累積加算初期値をゼロとする。iFMデータ更新が最初でない場合はステップS34に進み、累積加算初期値をSBUFに格納されている値とする。
 次に、ステップS35において、iFMデータの更新回数をカウントする。iFMデータ更新が最後の場合はステップS36に進み、データ(累積加算結果)の出力先を非線形変換部とする。iFMデータ更新が最後でない場合はステップS37に進み、データ(累積加算結果)の出力先をSBUFとする。
 なお、iFMデータ更新制御において、累積加算初期値(ステップS33またはS34)およびデータ(累積加算結果)の出力先(ステップS36またはS37)はステータス情報として演算部の演算制御部に渡され、演算制御部ではそのステータスに従って各部スイッチを制御する。
 (第3実施形態)
 第1実施形態は全てのフィルタ係数がWBUFに格納できないケースであり、第2実施形態は全てのiFMデータがIBUFに格納できないケースであったが、両方が同時に発生するケースもある。すなわち、第3実施形態として、全てのフィルタ係数がWBUFに格納できず、かつ、全てのiFMデータがIBUFに格納できないケースについて説明する。
 図11は、本実施形態において、iFMデータおよびフィルタ係数を途中で更新するイメージ図である。図11は、iFM群数n=2で、フィルタ係数更新が1回の例である。
 まず、最初のiFM群(iFM_0)の各データに対してフィルタ係数を掛けて累積加算を行い、途中結果(累積加算途中結果)をSBUF(累積加算結果格納メモリ)112に書き出す。
 次にWBUFに格納されるフィルタ係数群を更新する。そして、累積加算途中結果を初期値としてSBUF112から取り出して、iFM群(iFM_0)の各データに対してフィルタ係数を掛けて累積加算を行い、途中結果(累積加算途中結果)をSBUF112に書き出す。このように、最初のiFM群(iFM_0)を使用してできる全ての計算を行う。
 次に、IBUFに格納されるiFM群を更新し(2番目のiFM群(iFM_1)をIBUFに読み込み)、かつ、WBUFに格納されるフィルタ係数群を更新する。そして、累積加算途中結果を初期値としてSBUF112から取り出して、2番目のiFM群(iFM_1)の各データに対してフィルタ係数を掛けて累積加算を行い、途中結果(累積加算途中結果)をSBUF(累積加算結果格納メモリ)112に書き出す。
 次にWBUFに格納されているフィルタ係数を更新する。そして、累積加算途中結果を初期値としてSBUF112から取り出して、2番目のiFM群(iFM_1)の各データに対してフィルタ係数を掛けて累積加算を行い、途中結果(累積加算途中結果)をSBUF(累積加算結果格納メモリ)112に書き出す。このように、2番目のiFM群(iFM_1)を使用してできる全ての計算を行う。
 このようにして得られた累積加算結果に対して、非線形処理・縮小処理などのプーリング処理を行うことにより、oFMの1ピクセル(1画素)のデータ(oFMデータ)が得られる。このように、できる所までの全ての計算を行う点は、第1実施形態および第2実施形態と同じである。
 このように、本実施形態では、WBUFとIBUFの両方が不足する場合にも対応できる。
 図12Aは、本実施形態に係る演算処理装置において、演算制御部が行う制御を示すフローチャートである。図12Aは、フィルタ係数群の更新頻度がiFMデータの更新頻度より多い場合の例を示す。更新頻度の多い方が内側のループになる。
 Convolution処理が開始されると、まず、「iFM数ループ1」に入る(ステップS41)。そして、IBUFに格納されているiFMデータを更新する(ステップS42)。次に、「iFM数ループ2」に入る(ステップS43)。そして、WBUFに格納されているフィルタ係数を更新する(ステップS44)。次に、「iFM数ループ3」に入る(ステップS45)。
 次に、「演算部実行ループ」に入る(ステップS46)。そして、「係数格納判定」を行う(ステップS47)。「係数格納判定」では、WBUFに格納されているフィルタ係数が所望のものか否かを判定する。「係数格納判定」結果がOKの場合は、「データ格納判定」に進む(ステップS48)。「係数格納判定」結果がOKでない場合は、「係数格納判定」結果がOKになるまで待機する。
 ステップS48の「データ格納判定」では、IBUFに格納されているiFMデータが所望のものか否かを判定する。「データ格納判定」結果がOKの場合は、「演算部実行」に進む(ステップS49)。「データ格納判定」結果がOKでない場合は、「データ格納判定」結果がOKになるまで待機する。
 ステップS49の「演算部実行」では、演算部がフィルタ・累積加算処理を行う。IBUFに格納されている全てのiFMデータで実行可能なフィルタ・累積加算処理を終えると、フローは終了する。そうでない場合は、各ステップS41、S43、S46に戻って、処理を繰り返す。
 図12Bは、図12AのステップS42におけるiFMデータ更新制御およびステップS44におけるフィルタ係数更新制御の流れを示すフローチャートである。
 まず、外側のループであるiFMデータの更新制御を行う。ステップS51において、IBUFにiFMデータを読み込む。そして、ステップS52において、iFMデータの更新回数をカウントする。iFMデータ更新が最初の場合はステップS53に進み、値Siをゼロとする。iFMデータ更新が最初でない場合はステップS54に進み、値SiをSBUFに格納されている値とする。
 そして、ステップS55において、iFMデータの更新回数をカウントする。iFMデータ更新が最後の場合はステップS56に進み、Odを非線形変換部とする。iFMデータ更新が最後でない場合はステップS57に進み、OdをSBUFとする。
 次に、内側のループであるフィルタ係数の更新制御を行う。ステップS61において、WBUFにフィルタ係数を読み込む。そして、ステップS62において、フィルタ係数の更新回数をカウントする。フィルタ係数更新が最初の場合はステップS63に進み、累積加算初期値を値Siとする。フィルタ係数更新が最初でない場合はステップS64に進み、累積加算初期値をSBUFに格納されている値とする。
 そして、ステップS65において、フィルタ係数の更新回数をカウントする。フィルタ係数更新が最後の場合はステップS66に進み、データ(累積加算結果)の出力先をOdとする。フィルタ係数更新が最後でない場合はステップS67に進み、データ(累積加算結果)の出力先をSBUFとする。
 なお、iFMデータ更新制御およびフィルタ係数制御において、値Si(ステップS53またはS54)、Od(ステップS56またはS57)、累積加算初期値(ステップS63またはS64)およびデータ(累積加算結果)の出力先(ステップS66またはS67)はステータス情報として演算部の演算制御部に渡され、演算制御部ではそのステータスに従って各部スイッチを制御する。
 上述の制御フローでは、ループ数をnとして、n=n×n×nと分割している。ただし、「iFM数ループ1」(ステップS41)の回数=n、「iFM数ループ2」(ステップS43)の回数=n、「iFM数ループ3」(ステップS45)の回数=nである。このとき、第2加算器74による累積加算はn回、SBUFに一旦中間結果として書き出す回数はn×n回となる。
 このように、第1実施形態~第3実施形態では、動画に対応する高速処理を可能とし、かつCNNのフィルタサイズが変更可能である構成により、Convolution処理とFullConnect処理のどちらにも容易に対応可能な構成において、入力N並列・出力M並列の回路で、iFM数>N、oFM数>Mでも対応する具体的な制御、さらに、N、Mが増大して分割入力が必要な程、iFM数やパラメータ数が多くなるケースに対応する方法を示した。すなわち、CNNのネットワークが拡大しても対応することができる。
 (第4実施形態)
 1つの出力チャネルから複数のoFMを出力するケースにおいて、oFM数が出力並列度Mを上回る面数を必要とする場合について考える。図11に示す処理では、フィルタ係数およびiFMを、ともにこの処理の間に更新し、1つのoFMのデータを生成している。この処理において、さらに、1つの出力チャネルが生成しなければならないoFM数がm(m>1)であったとすると、図11に示す処理をm回繰り返して処理する方法が考えられる。
 この方法では、IBUFが順次書き換わっているので、iFM全てをm回読み直す必要が生じる。このため、DRAMアクセス量が多くなり、所望の性能を得られなくなる。そこで、複数のSBUFをそれぞれのoFM用に用意すれば、SBUFは累積加算結果をm面分全て格納することができ、読み直しを防ぐことができるが、回路規模が増大してしまう。
 そのような例として、図13は、1つの出力チャネルが生成しなければならないoFM数m=2のケースにおいて、2つのSBUFをそれぞれのoFM用として用意した場合の、Convolution処理イメージを示す図である。2つのoFMのデータ(oFM0とoFM1)を生成するため、読み直しを防ぐには、oFM0の累積加算結果を格納する第1のSBUFとoFM1の累積加算結果を格納する第2のSBUFが必要となる。
 まず、oFM0データ用として、最初のiFM群(n=0)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果を第1のSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、第1のSBUFの値を初期値として累積加算を行い、累積加算途中結果を第1のSBUFに格納する。
 次に、oFM1データ用として、WBUFに格納されているフィルタ係数を更新した後、最初のiFM群(n=0)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果を第2のSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、第2のSBUFの値を初期値として累積加算を行い、累積加算途中結果を第2のSBUFに格納する。
 次に、2番目のiFM群(n=1)をIBUFに読み込む。そして、oFM0データ用として、第1のSBUFの値を初期値として、2番目のiFM群(n=1)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果を第1のSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、第1のSBUFの値を初期値として累積加算を行い、累積加算途中結果を第1のSBUFに格納する。
 次に、oFM1データ用として、WBUFに格納されているフィルタ係数を更新した後、第2のSBUFの値を初期値として、2番目のiFM群(n=1)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果を第2のSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、第2のSBUFの値を初期値として累積加算を行い、累積加算途中結果を第2のSBUFに格納する。
 このようにして得られた累積加算結果(最終的に、第1および第2のSBUFに格納された値)に対して、非線形処理・縮小処理などのプーリング処理を行うことにより、2つのoFMのデータが得られる。
 このように、oFM数が出力並列度Mを上回る面数を必要とする場合、読み直しを防ぐには、SBUFは1つの出力チャネルが出力するoFMの面数分のSBUFを設ける必要があり、これによりSRAMが増加し回路規模が増大する。
 そこで、第4実施形態として、oFM数が増えても規模を増加せずに対応できる方法について説明する。図14は、本実施形態に係る演算処理装置におけるConvolution処理のイメージを示す図である。
 本実施形態においても、第1実施形態~第3実施形態と同様に、iFMのサイズ(iFM1枚分)と同じ(または、より大きい)容量を持つSBUFを用意する。すなわち、SBUFは、累積加算の途中結果を、iFM1面の全画素分、格納できる大きさである。
 本実施形態では、1つのoFM分の処理の途中で作成される累積加算途中結果を一旦DRAMに書き出す。これをm面分行う。iFMを更新して累積加算を続きから実施する場合は、出力した累積加算途中結果をDRAMから読み込んで継続処理する。
 本実施形態の処理の流れを、図14を用いて説明する。図14は、図13と同様に、2つのoFMのデータ(oFM0とoFM1)を生成する場合のConvolution処理イメージを示す。
 まず、oFM0データ用として、最初のiFM群(n=0)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果をSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、SBUFの値を初期値として累積加算を行い、累積加算途中結果をSBUFに格納する。SBUFに格納された累積加算途中結果は、oFM0データの中間結果として順次DRAMに転送される。
 次に、oFM1データ用として、WBUFに格納されているフィルタ係数を更新した後、最初のiFM群(n=0)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果をSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、SBUFの値を初期値として累積加算を行い、累積加算途中結果をSBUFに格納する。SBUFに格納された累積加算途中結果は、oFM1データの中間結果として順次DRAMに転送される。
 次に、2番目のiFM群(n=1)をIBUFに読み込む。そして、oFM0データ用として、DRAMに格納されたoFM0データの中間結果を初期値とするためにSBUFに格納する。次に、SBUFの値を初期値として2番目のiFM群(n=1)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果をSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、SBUFの値を初期値として累積加算を行い、累積加算途中結果をSBUFに格納する。このようにして得られた累積加算結果に対して、非線形処理・縮小処理などのプーリング処理を行うことにより、oFM0のデータを得る。
 次に、oFM1データ用として、WBUFに格納されているフィルタ係数を更新した後、DRAMに格納されたoFM1データの中間結果を初期値とするためにSBUFに格納する。次に、SBUFの値を初期値として2番目のiFM群(n=1)の各データに対してフィルタ係数を掛けて累積加算を行い、累積加算途中結果をSBUFに格納する。そして、WBUFに格納されているフィルタ係数を更新した後、SBUFの値を初期値として累積加算を行い、累積加算途中結果を第2のSBUFに格納する。このようにして得られた累積加算結果に対して、非線形処理・縮小処理などのプーリング処理を行うことにより、oFM1のデータを得る。
 このように、DRAMから取得したデータは一旦SBUFに格納される。そうすると、SBUFに初期値が入っているこれまでのケースと同じ状態になって、そこからこれまでどおり処理がスタートできる。処理の最後も、DRAMに出す前に非線形処理等を施してしまう。
 本実施形態は、累積加算途中結果をDRAMに出力する事で処理速度が低下してしまうデメリットがある。しかし、本実施形態の処理は、ほぼ回路の増大なしに対応できるため、多少の性能劣化を許容できれば、最新のネットワークに対応することができる。
 次に、本実施形態の処理を行うための構成について説明する。図15は、本実施形態に係る演算処理装置の全体構成を示すブロック図である。図15に示す演算処理装置20は、図1に示す第1実施形態の演算処理装置1と、SBUF(累積加算結果格納メモリ)管理部の構成が異なる。
 図16は、本実施形態のSBUF管理部21の構成を示すブロック図である。SBUF管理部21は、SBUF制御部210と、第1のSBUF格納部211と、第2のSBUF格納部212と、SBUF112と、第1のSBUF読み出し部213と、第2のSBUF読み出し部214とを備える。
 SBUF112は、iFMの各ピクセル単位(画素単位)で累積加算の途中結果を一時的に格納するためのバッファである。第1のSBUF格納部211および第1のSBUF読み出し部213は、DRAMに対して値を読み書きするためのI/Fである。
 第1のSBUF格納部211は、データ入力部3を介してDRAM9からデータ(中間結果)を受け取ると、アドレスを生成してSBUF112に書き込む。第2のSBUF格納部212は、演算部7から有効データ(累積加算途中結果)を受け取ると、アドレスを生成してSBUF112に書き込む。
 第1のSBUF読み出し部213は、SBUF112から所望のデータ(中間結果)を読み出し、データ出力部8を介してDRAM9に書き込む。第2のSBUF読み出し部214は、SBUF112から所望のデータ(累積加算途中結果)を読み出し、累積加算の初期値として演算部7に出力する。
 演算部7の構成は、図6に示す第1実施形態の演算部の構成と同じであるので、説明を省略する。演算部7は、IBUF(データ格納メモリ)管理部5からデータ、WBUF(フィルタ係数格納メモリ)管理部6からフィルタ係数を取得する。また、演算部7は、第2のSBUF読み出し部214がSBUF112から読み出したデータ(累積加算途中結果)を取得して、フィルタ処理・累積加算・非線形演算・プーリング処理等のデータ処理を行う。演算部7がデータ処理を施したデータ(累積加算途中結果)は、第2のSBUF格納部212によって、SBUF112に格納される。
 SBUF制御部210は、DRAMからSBUFへの初期値(累積加算途中結果)のロード、およびSBUFからDRAMへの中間結果のライトを制御する。DRAMからSBUFへの初期値のロードでは、上述のように、第1のSBUF格納部211が、データ入力部3を介してDRAM9からデータ(初期値)を受け取り、アドレスを生成してSBUF112に書き込む。
 具体的には、DRAMからの入力時には、SBUF制御部210は、上位のコントローラ2からrtrig(読み込みトリガー)が入力されると、DRAM9からデータを取得しSBUF112に取り込む。取り込みを完了したら、SBUF制御部210はrend(読み取り終了)信号を上位のコントローラ2に送信して次の動作を待つ。
 SBUFからDRAMへの結果のライトでは、上述のように、第1のSBUF読み出し部213が、SBUF112から所望のデータ(中間結果)を読み出し、データ出力部8を介してDRAM9に書き込む。具体的には、DRAMへの出力時には、SBUF制御部210から上位のコントローラ2にwtrig(書き込みトリガー)信号が出力されると、SBUF内のデータが全てデータ出力部8に出力され、終了したら、SBUF制御部210はrend(読み取り終了)信号を上位のコントローラ2に送信して次の動作を待つ。
 また、SBUF制御部210は、第1のSBUF格納部211、第2のSBUF格納部212、第1のSBUF読み出し部213、および第2のSBUF読み出し部214を制御する。具体的には、SBUF制御部210は、指示を行う時にはtrig(トリガー)信号を出力し、処理が終了するとend(終了)信号を受け取る。
 データ入力部3は、SBUF管理部21からのリクエストにより、累積加算途中結果(中間結果)をDRAM9からロードする。データ出力部8は、SBUF管理部21からのリクエストにより、累積加算途中結果(中間結果)をDRAM9にライトする。
 このような構成により、入力・出力とも膨大なFMとなる場合への対応ができる。
 図17Aは、本実施形態に係る演算処理装置において、演算制御部が行う制御を示すフローチャートである。
 Convolution処理が開始されると、まず、「iFM数ループ1」に入る(ステップS71)。そして、IBUFに格納されているiFMデータを更新する(ステップS72)。次に、「oFM数ループ」に入る(ステップS73)。そして、SBUFに格納されているデータを更新する(ステップS74)。次に、「iFM数ループ2」に入る(ステップS75)。そして、WBUFに格納されているフィルタ係数を更新する(ステップS76)。次に、「iFM数ループ3」に入る(ステップS77)。
 次に、「演算部実行ループ」に入る(ステップS78)。そして、「係数格納判定」を行う(ステップS79)。「係数格納判定」では、WBUFに格納されているフィルタ係数が所望のものか否かを判定する。「係数格納判定」結果がOKの場合は、「データ格納判定」に進む(ステップS80)。「係数格納判定」結果がOKでない場合は、「係数格納判定」結果がOKになるまで待機する。
 ステップS80の「データ格納判定」では、IBUFに格納されているiFMデータが所望のものか否かを判定する。「データ格納判定」結果がOKの場合は、「演算部実行」に進む(ステップS81)。「データ格納判定」結果がOKでない場合は、「データ格納判定」結果がOKになるまで待機する。
 ステップS81の「演算部実行」では、演算部がフィルタ・累積加算処理を行う。IBUFに格納されている全てのiFMデータで実行可能なフィルタ・累積加算処理を終えると、「SBUF退避」に進む(ステップS82)。そうでない場合は、各ステップS75、S77、S78に戻って、処理を繰り返す。
 ステップS82の「SBUF退避」では、SBUFに格納されているデータをDRAMに退避させる。その後、各ステップS71、S73に戻って、処理を繰り返し、全ての演算が終わるとフローは終了する。
 図17Bは、図17AのステップS72におけるiFMデータ更新制御の流れを示すフローチャートである。まず、ステップS91において、IBUFにiFMデータを読み込む。そして、ステップS92において、iFMデータの更新回数をカウントする。iFMデータ更新が最初の場合はステップS93に進み、値Siをゼロとする。iFMデータ更新が最初でない場合はステップS94に進み、値SiをSBUFに格納されている値とする。
 そして、ステップS95において、iFMデータの更新回数をカウントする。iFMデータ更新が最後の場合はステップS96に進み、Odを非線形変換部とする。iFMデータ更新が最後でない場合はステップS97に進み、OdをSBUFとする。
 図17Cは、図17AのステップS76におけるフィルタ係数更新制御の流れを示すフローチャートである。まず、ステップS101において、WBUFにフィルタ係数を読み込む。そして、ステップS102において、フィルタ係数の更新回数をカウントする。フィルタ係数更新が最初の場合はステップS103に進み、累積加算初期値を値Siとする。フィルタ係数更新が最初でない場合はステップS104に進み、累積加算初期値をSBUFに格納されている値とする。
 そして、ステップS105において、フィルタ係数の更新回数をカウントする。フィルタ係数更新が最後の場合はステップS106に進み、データ(累積加算結果)の出力先をOdとする。フィルタ係数更新が最後でない場合はステップS107に進み、データ(累積加算結果)の出力先をSBUFとする。
 なお、図17BのiFMデータ更新制御および図17Cのフィルタ係数制御において、値Si(ステップS93またはS94)、Od(ステップS96またはS97)、累積加算初期値(ステップS103またはS104)およびデータ(累積加算結果)の出力先(ステップS106またはS107)はステータス情報として演算部の演算制御部に渡され、演算制御部ではそのステータスに従って各部スイッチを制御する。
 図17Dは、図17AのステップS74におけるSBUF更新制御の流れを示すフローチャートである。ステップS111において、iFMループ1の回数を判定する。iFMループ1が最初の場合は処理を行わない(終了する)。iFMループ1が最初でない場合はステップS112に進み、DRAMからSBUF値をリードする。
 図17Eは、図17AのステップS82におけるSBUF退避制御の流れを示すフローチャートである。ステップS121において、iFMループ1の回数を判定する。iFMループ1が最後の場合は処理を行わない(終了する)。iFMループ1が最後でない場合はステップS122に進み、SBUF値をDRAMにライトする。
 上述の制御フローでは、ループ数をnとして、n=n×n×nと分割している。ただし、「iFM数ループ1」(ステップS71)の回数=n、「iFM数ループ2」(ステップS75)の回数=n、「iFM数ループ3」(ステップS77)の回数=nである。このとき、第2加算器74による累積加算はn回、SBUFに一旦中間結果として書き出す回数はn回、DRAMに中間結果を書き出す回数はn回となる。
 図17Aの制御フローは、フィルタ係数群の更新頻度がiFM群の更新頻度よりも多いことを前提としている。逆に、フィルタ係数群の更新頻度がiFM群の更新頻度よりも少ないことはないとする。なぜなら、iFM群を先に更新してしまうと、フィルタ係数を更新したときにiFM群を再度読み直さなければならなくなるためである。
 以上、本発明の一実施形態について説明したが、本発明の技術範囲は上記実施形態に限定されるものではなく、本発明の趣旨を逸脱しない範囲において構成要素の組み合わせを変えたり、各構成要素に種々の変更を加えたり、削除したりすることができる。
 各構成要素は、それぞれの構成要素に係る機能や処理を説明するためのものである。複数の構成要素に係る機能や処理を、1つの構成(回路)が同時に実現してもよい。
 各構成要素は、それぞれもしくは全体として、1個又は複数のプロセッサ、論理回路、メモリ、入出力インタフェース及びコンピュータ読み取り可能な記録媒体などからなるコンピュータで実現するようにしてもよい。その場合、各構成要素もしくは全体の機能を実現するためのプログラムを記録媒体に記録しておき、記録されたプログラムをコンピュータシステムに読み込ませ、実行することによって、上述した種々の機能や処理を実現してもよい。
 この場合、例えば、プロセッサは、CPU、DSP(Digital Signal Processor)、およびGPU(Graphics Processing Unit)の少なくとも1つである。例えば、論理回路は、ASIC(Application Specific Integrated Circuit)およびFPGA(Field-Programmable Gate Array)の少なくとも1つである。
 また、ここでいう「コンピュータシステム」とは、OSや周辺機器などのハードウェアを含むものであってもよい。また、「コンピュータシステム」は、WWWシステムを利用している場合であれば、ホームページ提供環境(あるいは表示環境)も含むものとする。また、「コンピュータ読み取り可能な記録媒体」とは、フレキシブルディスク、光磁気ディスク、ROM、フラッシュメモリなどの書き込み可能な不揮発性メモリ、CD-ROMなどの可搬媒体、コンピュータシステムに内蔵されるハードディスクなどの記憶装置をいう。
 さらに「コンピュータ読み取り可能な記録媒体」とは、インターネットなどのネットワークや電話回線などの通信回線を介してプログラムが送信された場合のサーバやクライアントとなるコンピュータシステム内部の揮発性メモリ(例えばDRAM(Dynamic Random Access Memory))のように、一定時間プログラムを保持しているものも含むものとする。
 また、上記プログラムは、このプログラムを記憶装置などに格納したコンピュータシステムから、伝送媒体を介して、あるいは、伝送媒体中の伝送波により他のコンピュータシステムに伝送されてもよい。ここで、プログラムを伝送する「伝送媒体」は、インターネットなどのネットワーク(通信網)や電話回線などの通信回線(通信線)のように情報を伝送する機能を有する媒体をいう。また、上記プログラムは、前述した機能の一部を実現するためのものであってもよい。さらに、前述した機能をコンピュータシステムにすでに記録されているプログラムとの組み合わせで実現するもの、いわゆる差分ファイル(差分プログラム)であってもよい。
 本発明は、畳み込みニューラルネットワークを用いたディープラーニングを行う演算処理装置に広く適用できる。
 1、20 演算処理装置
 2 コントローラ
 3 データ入力部
 4 フィルタ係数入力部
 5 IBUF管理部(データ格納メモリ管理部)
 6 WBUF管理部(フィルタ係数格納メモリ管理部)
 7 演算部
 8 データ出力部
 9 DRAM(外部メモリ)
 10 バス
 11、21 SBUF管理部(累積加算結果格納メモリ管理部)
 71 演算制御部
 72 フィルタ演算部
 73 第1加算器
 74 第2加算器
 75 FF(フリップフロップ)
 76 非線形変換部
 77 プーリング処理部
 111 SBUF格納部(累積加算結果格納メモリ格納部)
 112 SBUF(累積加算結果格納メモリ)
 113 SBUF読み出し部(累積加算結果格納メモリ読み出し部)
 210 SBUF制御部(累積加算結果格納メモリ制御部)
 211 第1SBUF格納部(累積加算結果格納メモリ格納部)
 212 第2SBUF格納部(累積加算結果格納メモリ格納部)
 213 第1SBUF読み出し部(累積加算結果格納メモリ読み出し部)
 214 第2SBUF読み出し部(累積加算結果格納メモリ読み出し部)

Claims (4)

  1.  Convolution処理とFullConnect処理を行うディープラーニング用の演算処理装置であって、
     入力特徴量マップデータを格納するデータ格納メモリと、前記データ格納メモリを管理および制御するデータ格納メモリ制御回路とを有するデータ格納メモリ管理部と;
     フィルタ係数を格納するフィルタ係数格納メモリと、前記フィルタ係数格納メモリを管理および制御するフィルタ係数格納メモリ制御回路とを有するフィルタ係数格納メモリ管理部と;
     前記入力特徴量マップデータおよび出力特徴量マップデータを格納する外部メモリと;
     前記外部メモリから、前記入力特徴量マップデータを取得するデータ入力部と;
     前記外部メモリから、前記フィルタ係数を取得するフィルタ係数入力部と;
     入力N並列、出力M並列の構成(N、M≧1の正数)で、前記データ格納メモリから前記入力特徴量マップデータを取得し、前記フィルタ係数格納メモリから前記フィルタ係数を取得して、フィルタ処理、累積加算処理、非線形演算処理およびプーリング処理を行う演算部と;
     前記演算部から出力されるM並列のデータを連結して、出力特徴量マップデータとして前記外部メモリに出力するデータ出力部と;
      入力特徴量マップの各ピクセル単位で累積加算処理の途中結果を一時的に記録しておく累積加算結果格納メモリと、
      有効データを受けてアドレスを生成し前記累積加算結果格納メモリに書き込む累積加算結果格納メモリ格納部と、
      前記累積加算結果格納メモリから指定したデータを読み出す累積加算結果格納メモリ読み出し部と、
     からなる累積加算結果格納メモリ管理部と;
     前記演算処理装置内を制御するコントローラと;
    を有し、
     前記演算部は、
      N並列でフィルタ処理を実行するフィルタ演算部と、
      前記フィルタ演算部の演算結果を全て累積加算する第1加算器と、
      前記第1加算器の累積加算処理の結果を後段で累積加算する第2加算器と、
      前記第2加算器の累積加算処理の結果を保持するフリップフロップと、
      前記演算部内を制御する演算制御部と、
     を有し、
     前記演算制御部は、出力特徴量マップの特定のピクセルを算出するためのフィルタ処理および累積加算処理の途中で、フィルタ処理および累積加算処理に必要な全ての入力特徴量マップデータを前記データ格納メモリに格納することができない場合、または、フィルタ処理および累積加算処理に必要な全てのフィルタ係数を前記フィルタ係数格納メモリに格納することができない場合に、一旦途中結果を前記累積加算結果格納メモリに格納して別のピクセルの処理を行い、すべてのピクセルについて累積加算処理の途中結果を前記累積加算結果格納メモリに格納し終えたら最初のピクセルに戻り、前記累積加算結果格納メモリに格納した値を読み出して累積加算処理の初期値とし、累積加算処理の続きを実行するよう制御することを特徴とする演算処理装置。
  2.  前記演算制御部は、前記フィルタ係数格納メモリに格納されているすべてのフィルタ係数で実行可能なフィルタ処理および累積加算処理を終えた時に、一旦途中結果を前記累積加算結果格納メモリに格納し、前記フィルタ係数格納メモリに格納されているフィルタ係数が更新されたら累積加算処理の続きを実行するように制御する
     請求項1に記載の演算処理装置。
  3.  前記演算制御部は、入力可能なすべての入力特徴量マップデータで実行可能なすべてのフィルタ処理および累積加算処理を終えた時に、一旦途中結果を前記累積加算結果格納メモリに格納し、前記データ格納メモリに格納されている入力特徴量マップデータが更新されたら累積加算処理の続きを実行するように制御する
     請求項1または2に記載の演算処理装置。
  4.  前記累積加算結果格納メモリ管理部は、
      前記累積加算結果格納メモリから累積加算途中結果を読み出して前記外部メモリに書き出す累積加算結果格納メモリ読み出し部と、
      前記外部メモリから累積加算途中結果を読み込んで前記累積加算結果格納メモリに格納する累積加算結果格納メモリ格納部と、
     を有し、
     前記演算制御部は、出力特徴量マップの特定のピクセルを算出するためのフィルタ処理および累積加算処理の途中で、途中結果を前記累積加算結果格納メモリから前記外部メモリに書き出し、前記データ格納メモリに格納されている入力特徴量マップデータまたは前記フィルタ係数格納メモリに格納されているフィルタ係数を更新して累積加算処理を続きから実施する場合は、前記外部メモリに書き出した累積加算途中結果を前記外部メモリから前記累積加算結果格納メモリに読み込んで累積加算処理の続きを実行するように制御する
     請求項1から3のいずれか1項に記載の演算処理装置。
PCT/JP2018/038076 2018-10-12 2018-10-12 演算処理装置 WO2020075287A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201880096920.4A CN112639838A (zh) 2018-10-12 2018-10-12 运算处理装置
JP2020549920A JP7012168B2 (ja) 2018-10-12 2018-10-12 演算処理装置
PCT/JP2018/038076 WO2020075287A1 (ja) 2018-10-12 2018-10-12 演算処理装置
US17/183,720 US20210182656A1 (en) 2018-10-12 2021-02-24 Arithmetic processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2018/038076 WO2020075287A1 (ja) 2018-10-12 2018-10-12 演算処理装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/183,720 Continuation US20210182656A1 (en) 2018-10-12 2021-02-24 Arithmetic processing device

Publications (1)

Publication Number Publication Date
WO2020075287A1 true WO2020075287A1 (ja) 2020-04-16

Family

ID=70164638

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2018/038076 WO2020075287A1 (ja) 2018-10-12 2018-10-12 演算処理装置

Country Status (4)

Country Link
US (1) US20210182656A1 (ja)
JP (1) JP7012168B2 (ja)
CN (1) CN112639838A (ja)
WO (1) WO2020075287A1 (ja)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015197702A (ja) * 2014-03-31 2015-11-09 キヤノン株式会社 情報処理装置、情報処理方法

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004048512A (ja) * 2002-07-12 2004-02-12 Renesas Technology Corp 動画像符号化方法と動画像符号化回路
JP2009194896A (ja) * 2008-01-18 2009-08-27 Sanyo Electric Co Ltd 画像処理装置及び方法並びに撮像装置
CN104905765B (zh) * 2015-06-08 2017-01-18 四川大学华西医院 眼动跟踪中基于CamShift算法的FPGA实现方法
JP2017010255A (ja) * 2015-06-22 2017-01-12 オリンパス株式会社 画像認識装置および画像認識方法
JP6645252B2 (ja) * 2016-02-23 2020-02-14 株式会社デンソー 演算処理装置
GB201607713D0 (en) 2016-05-03 2016-06-15 Imagination Tech Ltd Convolutional neural network
CN108537330B (zh) * 2018-03-09 2020-09-01 中国科学院自动化研究所 应用于神经网络的卷积计算装置及方法

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015197702A (ja) * 2014-03-31 2015-11-09 キヤノン株式会社 情報処理装置、情報処理方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MUSHA, KAZUSA: "Non-official translation: Deep learning acceleration in large scale multi-FPGA system", IEICE TECHNICAL REPORT, vol. 117, no. 278, 31 October 2017 (2017-10-31), pages 1 - 6 *

Also Published As

Publication number Publication date
JPWO2020075287A1 (ja) 2021-06-10
CN112639838A (zh) 2021-04-09
JP7012168B2 (ja) 2022-01-27
US20210182656A1 (en) 2021-06-17

Similar Documents

Publication Publication Date Title
US11449576B2 (en) Convolution operation processing method and related product
CN110506260B (zh) 用于神经网络环境中的增强数据处理的方法、系统和介质
US20240104378A1 (en) Dynamic quantization of neural networks
US20230153593A1 (en) Neural Network Architecture Using Control Logic Determining Convolution Operation Sequence
KR20180080876A (ko) 컨볼루션 회로, 그것을 포함하는 어플리케이션 프로세서 및 그것의 동작 방법
JP7261226B2 (ja) 演算処理装置
CN111583095B (zh) 图像数据存储方法、图像数据处理方法、系统及相关装置
TWI775210B (zh) 用於卷積運算的資料劃分方法及處理器
WO2019041264A1 (zh) 图像处理装置、方法及相关电路
CN113313247A (zh) 基于数据流架构的稀疏神经网络的运算方法
WO2020003345A1 (ja) 演算処理装置
WO2020075287A1 (ja) 演算処理装置
US11275713B2 (en) Bit-serial linear algebra processor
JP2017126203A (ja) 演算処理装置
CN116341630A (zh) 神经网络处理
JPH04288638A (ja) コンピュータシステム
JP7405244B2 (ja) 求解システム、求解方法および求解プログラム
JP6295754B2 (ja) データ処理装置
CN111506522A (zh) 数据处理设备及方法
KR20200024433A (ko) 시간 가변적 예측(anytime prediction)을 위한 얇은 하위 네트워크를 활용하는 방법 및 시스템
US11145356B2 (en) Computation operator in memory and operation method thereof
US20230043584A1 (en) Optimization of memory use for efficient neural network execution
US20210288650A1 (en) Semiconductor device and circuit layout method
CN111506518B (zh) 一种数据存储控制方法及装置
US20230051344A1 (en) Optimization of memory use for efficient neural network execution

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: 18936622

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2020549920

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18936622

Country of ref document: EP

Kind code of ref document: A1