Multiplication and accumulation operation device, multiplication and accumulation operation method and system
By using multiple memory blocks and input data generators in the deep neural network to generate multi-valued bit input data, and optimizing the multiply-accumulate operation through the decoder and control unit, the problems of recognition accuracy and power efficiency in the multiply-accumulate operation are solved. problem, realizing efficient and reliable multiplication and accumulation operations.
Patent Information
- Application Number
- CN201910706737.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-09-07
- Filing Date
- 2019-08-01
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2039-08-01
AI Technical Summary
In the existing technology, in deep neural networks, there are problems such as reduced recognition accuracy and increased power efficiency and area overhead in the multiply-accumulate operation. Especially when using analog inputs, the arithmetic operation results are susceptible to changes, and it is difficult to improve the application efficiency. Recognition accuracy.
Using multiple memory blocks and input data generators, by storing the same digit data of multiple multiplied elements, and using decoders and control units to generate multi-valued bit input data, the multiplication-accumulation operation is implemented and the access to memory is reduced. times, and optimizes the accumulation of multiplication results through shift operations.
Effectively perform multiply-accumulate operations, improve recognition accuracy, reduce power consumption and area overhead, enhance the reliability of arithmetic operations, and simplify the input data generation process without the need for additional DAC circuits.
Smart Images

Figure CN110889080B_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] The disclosure of Japanese Patent Application No. 2018-167802 filed on September 7, 2018 including the specification, drawings and abstract is incorporated herein by reference in its entirety. Background Art
[0003] In a deep neural network (DNN), it is known that the multiplication-addition operation of multiple elements is the dominant factor in the processing time. In non-patent document 1 "In-Memory Computation of a Machine-Learning Classifier in aStandard 6T SRAM Array", a technology for performing multiplication-addition operations within a memory array is disclosed. In non-patent document 1, a memory cell array configuration is used, and multiple memory cells connected to corresponding bit lines are driven simultaneously for charging and discharging. In this way, multiple multiplication results are added simultaneously.
[0004] Typically, the input of the word line for accessing the memory cell array is a digital value 0 / 1, and the multiplication-addition operation using a 1-bit input may result in a reduction in recognition accuracy in applications such as general object recognition. Therefore, by performing the multiplication-addition operation using a multi-value bit input, the recognition accuracy can be improved. However, in a common memory cell array, the memory size must be increased in order to perform the operation using the multi-value bit input. For example, in order to perform the operation using a 4-bit unsigned multi-value bit input, for 16 (=2^4) cells, the multiplied elements are stored in the same bit line direction. In non-patent document 1, a DAC (digital-to-analog converter) is provided at the input portion in order to use the multi-value bit input. The voltage applied to the word line is controlled to an analog value to correspond to the multi-value bit, thereby performing a multiplication process in the multi-value bit input.
[0005] Japanese Unexamined Patent Application Publication No. 2017-79017 (Patent Document 1) discloses a digital architecture level technology for DNN. In Patent Document 1, a shift register is provided in an input data portion. Summary of the invention
[0006] One feature of the DNN algorithm is that the same data is accessed repeatedly multiple times. Therefore, in Patent Document 1, data is reused in a local register by using the above-mentioned shift register. As a result, the number of accesses to the main memory can be reduced, and redundant memory accesses, power overhead associated therewith, etc. can be suppressed. In addition, Patent Document 1 adopts an accumulation-addition method while shifting the timing of multiplication of elements to be accumulated and added in a multiplication-addition operation.
[0007] In Patent Document 1, the timing for performing multiplication of elements added as cumulative addition is shifted. However, it is difficult to apply the multiply-accumulate operation disclosed in Patent Document 1 to Non-Patent Document 1 in which multiply-accumulate operations are performed simultaneously.
[0008] In non-patent document 1, when performing multi-value bit input operations, the input part of the memory requires circuits such as DAC. Although the power efficiency in the multiplication and addition operations within the memory array is increased, there is a problem of energy consumption when generating input data to the memory array. In addition, when performing multiplication and addition operations in the memory cell array, a large number of word lines need to be driven simultaneously. Therefore, a DAC circuit is required for each column of the array, and energy consumption and area overhead increase. In addition, in arithmetic operations using analog inputs, the arithmetic operation results are susceptible to changes, and the problem of reduced reliability of the arithmetic operation results occurs. In other words, even when a DAC circuit is provided to use multi-value bit inputs, it is possible that the recognition accuracy in the application cannot be improved.
[0009] Other objects and novel features will become clear from the description of this specification and the accompanying drawings.
[0010] According to one embodiment, a multiplication-addition operation device includes a plurality of memory blocks and an input data generator, wherein the plurality of memory blocks store a plurality of multiplied elements and perform multiplication-addition operations on the input data, wherein one of the memory blocks stores a single-bit value of the same digit of the plurality of multiplied elements as a first bit value, and the input data generator is used to extract a second-bit value of the same digit from the plurality of multiplied elements to generate input data.
[0011] According to the above-described embodiments, the multiply-add operation can be efficiently performed. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a block diagram showing the configuration of a multiply-and-add operation device according to a first embodiment;
[0013] Figure 2 is a block diagram illustrating a configuration of a control unit;
[0014] Figure 3 is a block diagram illustrating a configuration of a decoder;
[0015] Figure 4 is a diagram for explaining a method of storing data between memory blocks;
[0016] Figure 5 It is the flow of arithmetic operations on the memory block;
[0017] Figure 6 is a table showing the digits of the multiplication elements and the block address for each step in the arithmetic operation flow of the memory block;
[0018] Figure 7 is an arithmetic operation in a memory block;
[0019] Figure 8 is a diagram for explaining processing in an input data generating unit;
[0020] Fig. 9 is an input data generating unit according to the comparative example;
[0021] Fig.10 is an input data generating unit according to the second embodiment;
[0022] Fig.11 is a diagram showing the flow of arithmetic operations of a memory block when K=2 bits;
[0023] Fig.12 is a table showing the digits of the multiplication elements and the block addresses when K=2 bits;
[0024] Fig.13 is a diagram showing the flow of arithmetic operations of a memory block when K=1 bit;
[0025] Fig.14 is a table showing the digits of the multiplication elements and the block addresses when K=1 bit;
[0026] Fig.15 is a block diagram showing a system of a third embodiment;
[0027] Fig.16 is a diagram used to illustrate the process of shifting addresses to obtain the best address;
[0028] Fig.17 is a flow chart illustrating a process for determining an optimal address;
[0029] Fig.18 is a block diagram illustrating a decoder in the third embodiment; and
[0030] Fig.19 is a block diagram showing a multiply-and-add operation device according to another embodiment. DETAILED DESCRIPTION
[0031] For the purpose of clear explanation, the following description and drawings are appropriately omitted and simplified. In addition, the various elements described in the drawings as function blocks for performing various processes can be configured by a CPU (central processing unit), a memory and other circuits in hardware, and can be implemented by a program loaded in the memory in software. Therefore, it will be appreciated by those skilled in the art that these function blocks can be implemented in various forms by only hardware, only software or a combination thereof, and the present invention is not limited to any of them. In the drawings, the same elements are represented by the same reference numerals, and their repeated descriptions are omitted as required.
[0032] In the following description, a multiplication-accumulation operation device for performing a multiplication-accumulation operation on a multiplied element and a multiplication element, and a multiplication-accumulation operation process will be described. For example, the multiplication-accumulation operation device uses a weight parameter for a CNN (convolutional neural network) as a multiplied element, and uses input data as a multiplication element. The multiplied element is a value obtained by machine learning such as deep learning. The multiplication element is, for example, a feature quantity obtained based on detection data detected by a sensor such as a camera.
[0033] The multiplication element and the multiplied element are multi-bit or 1-bit data, respectively. The multiplication-accumulation operation device performs a multiplication-accumulation operation of a plurality of multiplication elements and a plurality of multiplied elements. The value obtained by the multiplication-accumulation operation becomes a multiplication element for the multiplication-accumulation operation operation of the next layer of the CNN.
[0034] For example, the multiplication-addition operation device performs a multiplication-addition operation on m multiplication elements (m is an integer equal to or greater than 2) and m multiplied elements in one multiplication-addition operation. That is, the multiplication-addition operation device multiplies the m multiplication elements by the data of the corresponding m multiplied elements to obtain m products. Then, the multiplication-addition operation device obtains the sum of the m products as a multiplication-addition operation value. The multiplication-addition operation value becomes the multiplication element of the next multiplication-addition operation. For example, the multiplication-addition operation value is used for the multiplication-addition operation of the next layer of CNN. In this way, the multiplication-addition operation device repeatedly performs the multiplication-addition operation. Therefore, in the present embodiment, the multiplication-addition operation device includes a plurality of memory blocks for performing multiplication-addition operations.
[0035] First embodiment
[0036] Figure 1 1 is a block diagram showing the configuration of the multiply-and-add operation device 100 according to the first embodiment. The multiply-and-add operation device 100 includes a memory unit 101, a memory block 102, a block array 103, a data memory 104, a decoder 105, a control unit 106, and an instruction memory 107.
[0037] The memory cells 101 store bit data of the multiplied elements, respectively. Specifically, one memory cell 101 stores one bit of data. As the memory cell, for example, a memory cell such as SRAM (static random access memory), flash memory, MRAM (magnetoresistive random access memory), ReRAM (resistive random access memory), or FeRAM (ferroelectric random access memory) can be used.
[0038] The memory block 102 includes a plurality of memory cells 101. In the memory block 102, the memory cells 101 are arranged in an array. The memory block 102 includes a plurality of word lines and a plurality of bit lines. In addition, the memory block 102 has a multiplication-addition operation function. Specifically, the memory block 102 has a function of simultaneously accessing the data of the memory cells, and has a function of reading the data stored in the plurality of memory cells 101. Each memory block 102 also includes an A / D (Analog-to-Digital) converter for converting an output value corresponding to a bit line potential into a digital value.
[0039] Each memory block 102 stores data of the same digits of the multiplied elements in common. Therefore, one memory block 102 stores data of the same digits of the multiplied elements for a multiply-add operation.
[0040] The block array 103 includes a plurality of memory blocks 102. Figure 1 In FIG. 1 , the block array 103 includes 3×3 (ie, 9) memory blocks 102 , but the number of memory blocks 102 included in the block array 103 is not particularly limited.
[0041] The data memory 104 is a main memory for storing product elements. The data memory 104 has a data read function and a data write function. The data memory 104 stores the stored product-addition operation value based on the operation result of the memory block 102 as a product element for the next product-addition operation.
[0042] The decoder 105 receives a plurality of multiplication elements from the data memory 104. Then, the decoder 105 selects the values of the same digits of the plurality of multiplication elements to obtain input data. The decoder 105 outputs the input data to the memory block 102 corresponding to the specified address. The input data is composed of data of the same digits included in the plurality of multiplication elements. For example, the input data is composed of data of the number of digits corresponding to the number of multiplication elements used for one multiplication-accumulation operation.
[0043] The control unit 106 controls the multiplication-accumulation computing device 100. Specifically, the data of the multiplication element is read out from the data memory 104. The control unit 106 provides the data read from the data memory 104 to the decoder 105. The control unit 106 controls the digits of the multiplication element selected by the decoder 105. In addition, the control unit 106 controls the selection of the block address and the input data. The control unit 106 outputs information for specifying the block address of the memory block 102 to the decoder 105, and the input data is provided to the block address. In addition, the control unit 106 receives an operation value from the memory block 102, which is a multiplication-accumulation operation result. Figure 21 is a block diagram showing the configuration of the control unit 106. The control unit 106 includes a controller 1061, a write data generating unit 1064, an accumulative adder 1063 and a bit shifter 1062. The controller 1061 controls the multiplication-accumulation operation device 100. The bit shifter 1062 performs a shift operation on the operation value received from the memory block 102 according to the digits of the multiplication element and the multiplied element, and provides the result to the accumulative adder 1063. The accumulative adder 1063 adds the value of the bit shifter 1062 to the accumulative addition value until the previous step, and stores it. When the multiplication-accumulation operation of all digits is completed, the control unit 106 generates write data in the write data generating unit 1064 based on the digits and operation values of the specified multiplication data. The control unit 106 writes the write data to the specified address of the data memory 104. The write data written in the data memory 104 becomes the multiplication element of the next multiplication-accumulation operation.
[0044] The instruction memory 107 stores the number of bits of the multiplication element and the number of bits of the multiplied element. The instruction memory 107 stores the write address and the read address of the data memory 104. The instruction memory 107 stores the address information of the memory block 102. The control unit 106 sequentially reads out the data such as the number of bits and the address stored in the instruction memory 107. Then, the control unit 106 performs control related to the multiplication and accumulation operation based on the data such as the number of bits and the address. As a result, the control unit 106 can provide appropriate input data to the memory block 102 corresponding to the appropriate block address.
[0045] Next, we will refer to Figure 3 The decoder 105 is described. Figure 3 20 is a block diagram showing the configuration of the decoder 105. The decoder 105 includes a second bit counter 202, a first bit counter 203, an address holding unit 204, a block address generating unit 205, a selector 206, and an input data generating unit 207.
[0046] The first bit counter 203 is a first holding unit that holds first bit information corresponding to the bit of the multiplied element. The second bit counter 202 is a second holding unit that holds second bit information corresponding to the bit of the multiplied element. The address holding unit 204 holds the memory address of the multiplied element read from the data memory 104. The block address generating unit 205 refers to the memory address and the first bit information, and generates a block address of a designated memory block. The block address generating unit 205 outputs the block address to the selector 206.
[0047] The input data generating unit 207 temporarily holds the multiplication element from the data memory 104. The input data generating unit 207 divides the multiplication element into digits based on the number of digits of the multiplication element and the memory address. Then, the input data generating unit 207 selects the digits of the multiplication element and generates input data to the specified memory block. The input data is a collection of data of the same digits of a plurality of multiplication elements. That is, the input data generating unit 207 extracts data of the same digits from a plurality of multiplication elements and outputs the extracted data as input data to the selector 206.
[0048] The selector 206 outputs the input data from the input data generating unit 207 to the corresponding memory block 102. That is, the selector 206 outputs the input data to the memory block 102 corresponding to the block address generated by the block address generating unit 205.
[0049] Figure 4 The data storage method of the multiplied elements in the memory block 102 is shown. Figure 4 An example is shown in which each multiplied element is 4-bit data. Here, a i is one of the multiplication elements, and w ji is one of the multiplied elements. Note that i is an arbitrary integer from 1 to m, and j is an arbitrary integer from 1 to n. In one multiplication-accumulation operation, a multiplication-accumulation operation of m (m is an integer equal to or greater than 2) multiplied elements and m multiplication elements is performed. That is, m multiplication elements are multiplied by the corresponding multiplied elements to obtain m products. The sum of the m products becomes the sum of the m products obtained by w. j,i and a i The multiplication and accumulation operation value o obtained by the multiplication and accumulation operation j .
[0050] w n,i It is 4-bit data and consists of 0 to 3 bit digits (also simply referred to as digits). n,i The data of the 0th digit is defined as w 0 n,i , the first digit of data is defined as w 1 n,i , the second digit is defined as w 2 n,i , and the data of the third digit is defined as w 3 n,i .w j,i Can also be used with w n,i The same way is expressed.
[0051] Each digit of data is 1 bit of data, w k n,i represents 0 or 1. Note that k is a value indicating a digit and is an arbitrary integer from 0 to 3. n,iGiven by:
[0052] w n,i =2 3 ·w 3 n,i +2 2 ·w 2 n,i +2 1 ·w 1 n,i +2 0 ·w 0 n,i
[0053] w j,i The data bits are stored in different memory blocks 102 according to the number of digits. For example, one memory block 102 stores the data bits of the third digit. 3 1,1 to w 3 n,m , that is, m×n 1-bit data. 3 1,1 to w 3 n,m is summarized and denoted as w 3 i,j The following memory block 102 stores the second digit of data w 2 i,j , that is, data w 2 1,1 To data w 2 n,m The other two memory blocks 102 store the first digital data w 1 i,j (i.e., w 1 1,1 to w 1 n,m ) and the zeroth digit data w 0 i,j (i.e., w 0 1,1 to w 0 n,m ). Each memory block 102 stores (n×m) one-bit data, that is, (n×m)-bit data.
[0054] Therefore, each memory block 102 includes m×n memory cells 101, and each memory cell 101 stores one bit of data. The memory block 102 includes n bit lines 102b and m word lines 102w. In the m cells corresponding to one bit line 102b, data of the same digit of m multiplied elements are stored. For example, Figure 4 A memory block 102 is shown, which stores the multiplied element w 3 1,1to w 3 n,m .like Figure 4 As shown, in the memory cell 101 corresponding to the first bit line 102b, w is stored. 3 1,1 to w 3 1,m In this configuration, since the memory block 102 performs a multiply-add operation with n rows of multiplied elements with respect to input of m multiplication elements, m×n multiply-add operations are performed at the same time.
[0055] The data of the same digits of the m multiplier elements are commonly provided from the m word lines 102w to the memory cell 101. At this time, the word line of the row in which "1" is stored as the value of the multiplier element is driven, and the bit line is charged and discharged according to the value of the memory cell in which the multiplier element is stored. The word line of the row in which "0" is stored as the value of the multiplier element is not driven, and the bit line is not charged / discharged regardless of the value of the memory cell in which the multiplier element is stored. In this way, the data of the same digits of the m multiplier elements can be simultaneously provided to the data of the same digits of the m multiplied elements for one multiplication-addition operation. 3 1,1 to w 3 1,m A reading circuit (not shown) reads the bit line potential and performs A / D conversion. Then, the digital value is output to the control unit 106.
[0056] Therefore, for each digit, a multiplied element is stored in a different memory block 102. When a multiplied element is 4-bit data, a multiplied element is stored in four memory blocks 102 in a distributed manner. In the case of a general memory storage format, data is stored in the same memory block in a data unit (an element unit of multiplication in a multiplication-addition operation). This is because, when a multiplied element data is stored in different blocks in a distributed manner for each digit, multiple accesses and redundant readings of data occur in the method of using the digital arithmetic unit. Therefore, usually, data stored in a 4-bit format is stored in the same memory block.
[0057] Will refer to Figures 5 to 8 Describes the operation processing in the memory block. Figure 5 is a diagram showing the flow of a multiply-add operation in a memory block. Figure 6 is a table showing the block address and digits for each step. Figure 7 is a diagram showing operations in one memory block 102 . Figure 8 is a diagram showing input data generated by a decoder.
[0058] In the following description, it is assumed that a multiplication element a iis 4-bit data. Assume a i It consists of 0 to 3 digits. i In the example, the data at the 0th digit is defined as a 0 i , the first digit of data is defined as a 1 i , the second digit is defined as a 2 i , the data of the third digit is defined as a 3 i .a k i Represents 0 or 1. Note that i is an integer from 1 to m, and k is an integer from 0 to 3. i It is expressed by the following formula:
[0059] a i =2 3 ·a 3 i +2 2 ·a 2 i +2 1 ·a 1 i +2 0 ·a 0 i
[0060] Here, if Figure 5 As shown, it is assumed that the block array 103 includes 9 memory blocks 102, and the block addresses thereof are 0 to 8. The memory block 102 at block address 3 stores the multiplied element w j,i The data of the 0th digit w 0 j,i The memory block 102 at block address 4 stores the multiplied element w j,i The first digit of data w 1 j,i Similarly, the memory blocks 102 at block addresses 5 and 6 store the multiplied elements w respectively. j,i The second digit of data w 2 j,i and the third digit w 3 j,i .
[0061] Let c be the digit of the multiplication element, and d be the digit of the multiplied element. Each of c and d is an integer equal to or greater than 0. Here, since the multiplication element and the multiplied element are 4 bits, c and d are 0, 1, 2, or 3, respectively. Since the multiplied element and the multiplication element are 4-bit data, the multiplication-addition operation device 100 repeats the steps (hereinafter, steps 1 to 16) 16 (=4×4) times. That is, one multiplication-addition operation is time-divided into 16 steps and performed.
[0062] First, in step 1, Figure 8 As shown, decoder 105 generates a generalized multiplication element a i The data of bit 0 a 0 0 to a 0 m Input data. m data a 0 0 to a 0 m collectively referred to as input data a 0 i The decoder 105 converts the input data a 0 i Output to the memory block 102 at block address 3. The memory block 102 at block address 3 will a 0 i and w 0 j,i The result of the multiplication and accumulation operation (i.e., the operation value O in the first step) 0_0 1) is output to the control unit 106. In the shifter 1062, the control unit 106 converts the first step operation value O 0_0 1 is multiplied by the value corresponding to the digit of the multiplication element (c=0) (1=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d ) to obtain a multiplication value. The multiplication value is added to the cumulative adder 1063. The control unit 106 stores the multiplication value as a cumulative addition value in the cumulative adder 1063. The cumulative addition value at step 1 is 0 0_0 1.
[0063] In step 2, similar to step 1, input data a 0 0 to a 0 m The decoder 105 converts the input data a 0 i Output to the memory block 102 at block address 4. The memory block 102 at block address 4 outputs a to the control unit 106. 0 i and w 1 j,i The result of the multiplication and accumulation operation (i.e., the second step operation value O 0_1 1). In the bit shifter 1062, the control unit 106 converts the second step operation value O 0_1 1 is multiplied by the value corresponding to the digit c (c=0) of the multiplication element (1=2 c ) and the value corresponding to the digit d (d=1) of the multiplied element (2=2 d ) to obtain the multiplication value cdO 0_11. Then, the control unit 106 adds the multiplication value cd0 to the accumulator adder 1063. 0_1 1 is added to the accumulated value of step 1, and the accumulated value is updated. The accumulated value of step 2 is 2×0 0 _1 1+O 0_0 1.
[0064] In step 3, data a 0 0 to a 0 m is the input data, similar to steps 1 and 2. Decoder 105 converts the input data a 0 i Output to storage w 2 j,i The memory block 102 at block address 5 will be a 0 i and w 2 j,i The result of the multiplication and accumulation operation (i.e., the operation value O in the third step) 0_2 1) is output to the control unit 106. In the bit shifter 1062, the control unit 106 converts the third step operation value O 0_2 1 is multiplied by the value corresponding to the digit c (c=0) of the multiplication element (1=2 c ) and the value corresponding to the digit d (d = 2) of the multiplied element (4 = 2 d ) to obtain the multiplication value cdO 0_2 1. Then, the control unit 106 adds the multiplication value cd0 to the accumulator adder 1063. 0_2 1 is added to the accumulated value of step 2, and the accumulated value is updated. The accumulated value of step 3 is 4×0 0_2 1+2×O 0_1 1+O 0_0 1.
[0065] In step 4, data a 0 0 to a 0 m is the input data, similar to steps 1 and 2. Decoder 105 converts the input data a 0 i Output to storage w 3 j,i The memory block 102 at block address 6 will be a 0 i and w 3 j,i The result of the multiplication and accumulation operation (as the fourth step operation value O 0_31) is output to the control unit 106. In the bit shifter 1062, the control unit 106 multiplies the fourth step operation value by a value corresponding to the digit c of the multiplication element (1=2 c ) and the value corresponding to the digit d (d=3) of the multiplied element (8=2 d ) to obtain the multiplication value cdO 0_3 1. Then, the control unit 106 adds the multiplication value cd0 to the accumulator adder 1063. 0_3 1 is added to the accumulated value of step 3, and the accumulated value is updated. The accumulated value of step 4 is 8×0 0_3 1+4×O 0_2 1+2×O 0_1 1+O 0_0 1.
[0066] In step 5, the decoder 105 generates input data, which summarizes the multiplication element a i The data of bit 0 a 1 0 to a 0 m . m data a 1 0 to a 1 m collectively referred to as input data a 1 i The decoder 105 converts the input data a 1 i Output to storage w 0 j,i The memory block 102 at block address 3 will be a 1 i and w 0 j,i The result of the multiplication and accumulation operation (i.e., the operation value O in the fifth step) 1_0 1) Output to the control unit 106.
[0067] In the bit shifter 1062, the control unit 106 converts the fifth step operation value O 1_0 1 is multiplied by the value corresponding to the digit c (c=1) of the multiplication element (2=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d ) to obtain the multiplication value cdO 1_0 1. Then, the control unit 106 adds the multiplication value cd0 to the accumulator adder 1063. 1_0 1 is added to the accumulated sum at step 4 to update the accumulated sum. The accumulated sum at step 5 is 2×O 1_0 1+8×O 0_3 1+4×O 0_2 1+2×O 0_1 1+O0_0 1.
[0068] Thereafter, the product-addition operation device 100 repeats the above process until step 16 . Figure 6 The digits and block addresses of the multiplied elements in steps 1 to 16 are shown. Steps 6 to 16 are based on Figure 6 The control unit 106 accumulates the multiplication and addition operation results in each step in the bit shifter 1062. c_d j Multiply by the value corresponding to the digit c of the multiplication element (2 c ) and the value corresponding to the digit d of the multiplied element (2 d ) to obtain a multiplication value. Then, the control unit 106 accumulates and adds the cumulative addition value in the cumulative adder 1063, and overwrites and stores the cumulative addition value. After the process to step 16 is completed, the control unit 106 converts the cumulative addition result into data of the maximum digit of the multiplication element in the write data generation unit 1064, and stores the data in the data memory 104. The multiplication and accumulation operation device 100 repeats the multiplication and accumulation operation and the cumulative addition operation, thereby realizing the multiplication and accumulation operation using the multi-valued bit using the memory block 102.
[0069] To perform the above process, the decoder 105 extracts m 1-bit data (the data is the same digit of m multiplication elements) for use as input data. The input data (which is m-bit data) is arranged along the column direction of the memory block 102 and is provided to the memory block 102.
[0070] In the column direction of the memory block 102, data of the same digit of the multiplied element is stored. Then, data of the same digit of a plurality of multiplication elements are input in the column direction of the memory block 102. The memory block 102 performs a multiplication-addition operation on the data of a certain digit of the multiplication element and a certain digit of the multiplied element. Then, the memory block 102 repeatedly obtains a multiplication-addition operation value by changing the digit combination in sequence. In addition, the sum of the multiplication values obtained by multiplying the multiplication-addition operation value by the value corresponding to the digit becomes the multiplication element of the multiplication-addition operation of the next layer. By doing so, the multiplication-addition operation for the convolution operation can be efficiently performed. The multiplication-addition operation device 100 similarly performs the multiplication-addition operation using the following multiplication elements.
[0071] In the present embodiment, the multiplied element is divided for each digit, and each bit is stored in a different memory block. In addition, the multiplication element used as the input data is divided for each digit, and the data of each digit is provided to the memory block 102 by time division. As a result, the multiplication and accumulation operation of multi-valued bits can be realized using the memory block.
[0072] By using this configuration, with respect to a processor including a multiply-accumulate operation circuit array using a memory element, multi-value input data can be generated because it is digitally represented. Therefore, a multi-bit multiply-accumulate operation can be performed without the additional cost of a DAC or the like. For example, a DAC for inputting input data to a memory block does not need to be provided in the input stage.
[0073] In the above description, an example has been described in which the data of each digit of the multiplied element and the data of each digit of the multiplied element are processed in ascending order, but the order of processing the data is not particularly limited. For example, the decoder 105 can provide data to the block array 103 so that the data of each digit of the multiplied element and the multiplied element are processed in descending order. More specifically, when the digits of the multiplied element are processed in descending order, the input data can be provided to the memory block 102 storing the data of the third digit of the multiplied element, and then provided to the memory block 102 storing the data of the second digit of the multiplied element. When the digits of the multiplied element are processed in descending order, the decoder can generate the data of the third digits of the plurality of multiplied elements as input data, and then generate the data of the second digit of the multiplied element as input data.
[0074] In the present embodiment, the data of the multiplication element and the multiplied element are described as 4-bit data, but these data are not limited to 4 bits. By increasing the block memory for storing the multiplied element, the number of digits of the multiplied element can be arbitrarily expanded. In addition, the number of digits of the multiplication element to be input can be arbitrarily expanded by increasing the time fraction (number of steps), and while using the same hardware configuration, the number of optimal digits can be set for each application according to the recognition accuracy and processing speed.
[0075] Second embodiment
[0076] In the present embodiment, the data storage format of the data memory 104 and the configuration of the input data generating unit 207 are different from those in the first embodiment. The basic configuration other than the data storage format of the data memory 104 and the input data generating unit 207 is the same as that of the first embodiment. For example, the data storage format of the memory block 102 is the same as that of the first embodiment. The description of the same contents as those of the first embodiment will be appropriately omitted.
[0077] In this embodiment, the data storage format of the data memory 104 is improved to achieve bit scalability. In addition, the circuit configuration of the decoder 105 can be simplified to improve area and speed. Fig. 9 is a block diagram showing the configuration of the input data generating unit 207 a according to the comparative example. Fig.10 is a block diagram showing the configuration of the input data generating unit 207 of the second embodiment.
[0078] The input data generating unit 207 includes an input buffer 301, a selection circuit 302, and an output buffer 303. Here, the size of the input buffer 301 is 16 bits, and the size of the output buffer 303 is 4 bits. Hereinafter, a case where the bit length K of the multiplication element is changed to 1, 2, or 4 bits will be described.
[0079] The data of the multiplication element from the data memory 104 is input to the input buffer 301. The input buffer 301 stores the data of each digit of the multiplication element. The input buffer 301 stores the data in a sequence corresponding to the data storage format of the data memory. Fig. 9 and Fig.10 The storage order of 16-bit data in the data memory 104 when K=1, 2, and 4 is shown.
[0080] The selection circuit 302 selects data input to the input buffer 301 and outputs the data to the output buffer 303. The selection circuit 302 selects 4-bit data from the 16-bit data stored in the input buffer 301. The output buffer 303 stores the data selected by the selection circuit 302. The output buffer 303 outputs the stored data collectively to the memory block 102. The data output from the output buffer 303 is supplied to one memory block 102. Then, the memory block 102 performs a multiplication-addition operation in the same manner as in the first embodiment.
[0081] In the following description, the data length of input data is represented by N, the word length of data memory 104 is represented by W, and the data length of multiplication element is represented by K. The data length N of input data corresponds to the size of output buffer 303 and is Fig. 9 and 10 In the data memory 104, data is written and read in units of word length W. The word length W of the data memory 104 corresponds to the size of the input buffer 301, and Fig. 9 and 10 In the word length W = 16 (= 2 4 ). The data length K of the multiplication element corresponds to the number of digits of the multiplication element. The length K of the multiplication element is a power of 2, i.e., n An integer represented by , where n is an integer greater than or equal to 0.
[0082] exist Fig. 9 In the input data generating unit 207 shown in FIG. 1 , the input buffer 301 stores the same multiplier element in adjacent bits. In addition, the data memory 104 stores data in the order of the multiplier element in the same manner as the general data storage format. For example, when the multiplier element is 4-bit data (K=4), the data a of a multiplier element a1 is 0 1.a 1 1.a 2 1 and a3 1 is stored in 4 consecutive bits. Next to the product element a1, the data a of the subsequent product element a2 0 2.a 1 2.a 2 2 and a 3 2 is stored in four consecutive bits. Similarly, when the multiplier element is 2-bit data (K=2), the data a of one multiplier element is 0 1 and a 1 1 is stored in two adjacent bits. Next to the product element a1, the data a of the subsequent product element a2 0 2 and a 1 2 is stored in two consecutive bits. When the multiplier element is 1-bit data (K=1), the multiplier elements a1 to a 16 a 0 1 to a 0 16 Store in this order.
[0083] The input buffer 301 of the input data generating unit 207 has 16 bits. The selection circuit 302 selects data from the 16-bit data and outputs the data to the output buffer 303. At this time, the selection circuit 302 needs to change the order of the data so that the data of the same digit is continuous. That is, the selection circuit 302 selects the data of the same digit of four consecutive multiplication elements. Therefore, when the input data generating unit 207 is made to correspond to different data lengths K, the selection circuit 302 becomes complicated, such as Fig. 9 As a result, an increase in area or a decrease in speed may occur.
[0084] Therefore, in this embodiment, the data storage 104 is based on Fig.10 The data is stored in the order shown. The case where the data length K of the multiplication element is 4 bits is the same as Fig. 9 That is, in the data memory 104, the data of one multiplication element is stored continuously, and the data is stored in the order of the multiplication elements. The digits of the multiplication elements are arranged in ascending order, such as 0, 1, 2, and 3, but may be arranged in descending order.
[0085] When the data length K of the multiplication element is 2 bits, the data is a 0 1.a 1 1.a 0 5.a 1 5.a 0 2.a 1 2.a 0 6.a 1 6, ... are stored in the data memory 104, such as Fig.10As shown. That is, in the data memory 104, the data of one multiplication element is stored continuously, but the data is stored in an order different from the order of the multiplication elements. For example, next to the multiplication element a1, the data of the multiplication element a5 which is not the next multiplication element a2 is stored. The digits of the multiplication elements are arranged in ascending order, such as 0 and 1, but may be arranged in descending order.
[0086] When the data length K of the multiplication element is 1 bit, the data is a 0 1.a 0 5.a 0 9.a 0 13 、a 0 2.a 0 6...... is stored in the data memory 104, such as Fig.10 That is, in the data memory 104, data is stored in an order different from the order of the multiplication elements. For example, next to the multiplication element a1, data of the multiplication element a5 which is not the next multiplication element a2 is stored.
[0087] When the word length W of the data memory 104, the data length K of the multiplier element, and the maximum data length K_max of the multiplier element are used, the i-th (integer greater than or equal to 0 and less than W) data a of a word k index It can be generalized by the following formula (1).
[0088] [Equation 1]
[0089]
[0090] Note that Y mod X is the remainder obtained by dividing Y by X, and the quotient values in equation (1) (i.e., i / K_max, W / K_max, and (i mod K_max) / K) are integer values obtained by rounding off the decimal point. n , a decoder 105 having (n+1) bit scalability modes can be implemented. The data memory 104 stores multiplication elements so that the single word data a k index The storage order satisfies equation (1). That is, the control unit 106 writes the data of each bit of the plurality of multiplication elements into the data memory 104 in the writing order satisfying equation (1). In equation (1), k is arranged in ascending order, but may be arranged in descending order.
[0091] Hereinafter, the process in the second embodiment will be described. Fig.11 is a diagram showing the operation flow of the memory block 102 . Fig.12 is a table showing the digits and block addresses of the multiplied elements in each step. Fig.11 and Fig.12 In the example, the data length K of the multiplication element is set to 2, and the multiplication element is set to 2-bit data. The multiplication and accumulation operation device 100 repeats 8 steps (hereinafter referred to as steps 1 to 8). Let M be the number of multiplication elements included in the word length W. Fig.10 In the example of K=2 bits in , since the multiplication elements of a1 to a8 are stored in the input buffer 301 , M=8. In general, M=W / K.
[0092] Four memory blocks 102 with block addresses 3 to 6 store data w of the multiplication elements. j,i In the memory block 102 at block address 3, w1 of the 0th digit of the multiplied element is stored. 0 j,i The data w1 of the first digit of the multiplied element 1 j,i is stored in the memory block 102 at block address 4. In the memory block 102 at block address 5, w2 of the 0th digit of the multiplied element is stored. 0 j,i The data w2 of the first digit of the multiplied element 1 j,i Stored in memory block 102 at block address 6.
[0093] The data of the same digit of the multiplied element for one multiplication-accumulation operation is divided into two memory blocks 102 and stored. More specifically, the memory blocks 102 corresponding to block addresses 3 and 5 store the 0th digit data of the multiplied element for one multiplication-accumulation operation. The memory blocks 102 corresponding to block addresses 4 and 6 store the first digit data of the multiplied element for one multiplication-accumulation operation. The memory blocks 102 corresponding to block addresses 3 and 4 store the data of different digits of a plurality of multiplied elements. The memory blocks 102 corresponding to block addresses 5 and 6 store the data of different digits of a plurality of multiplied elements.
[0094] In step 1, the decoder 105 collects data of the 0th digit of a plurality of multiplication elements as the 1st to M / 2th multiplication elements to obtain input data. Here, as described above, the input data generation unit 207 selects a part of the data of the input buffer 301 as input data. Then, the selector 206 provides the input data to the memory block 102 of the block address 3. The memory block 102 of the block address 3 outputs the product-addition operation result of the input data and the data stored in the memory block 102 (i.e., the first step operation value) to the control unit 106. In the bit shifter 1062, the control unit 106 multiplies the first step operation value by a value (c=0) corresponding to the digit of the multiplication element (1=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d) to obtain a multiplication value. The control unit 106 stores the multiplication value in the cumulative adder 1063 as a cumulative addition value.
[0095] In step 2, similarly to step 1, data of the 0th digit of a plurality of multiplication elements from the 1st to the M / 2th digits are input data. The selector 206 provides the input data to the memory block 102 of the block address 4. The memory block 102 of the block address 4 outputs the product-addition operation result of the input data and the data stored in the memory block 102 of the block address 4 to the control unit 106, and the result is the second step operation value. In the bit shifter 1062, the control unit 106 multiplies the second step operation value by a value (c=0) corresponding to the digit (1=2) of the multiplication element. c ) and the value corresponding to the digit d (d=1) of the multiplied element (2=2 d The control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0096] In step 3, the decoder 105 collects data of the first digits of a plurality of multiplication elements from 1 to M / 2 as input data. The selector 206 provides the input data to the memory block 102 of the block address 3. The memory block 102 of the block address 3 outputs the product-addition operation result of the input data and the data stored in the memory block 102 of the block address 3 to the control unit 106, and the result is the third step operation value. In the bit shifter 1062, the control unit 106 multiplies the third step operation value by the value corresponding to the digit (c=1) of the multiplication element (2=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d The control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0097] In step 4, as in step 3, the data of the first digits of the plurality of multiplication elements from the 1st to the M / 2th are input data. The selector 206 provides the input data to the memory block 102 of the block address 4. The memory block 102 of the block address 4 outputs the product-addition operation result of the input data and the data stored in the memory block 102 of the block address 4 to the control unit 106, and the result is the fourth step operation value. In the bit shifter 1062, the control unit 106 multiplies the fourth step operation value by the value corresponding to the digit (c=1) of the multiplication element (2=2 c ) and the value corresponding to the digit d (d=1) of the multiplied element (2=2 dThe control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0098] In step 5, the decoder 105 collects data of the 0th digit of a plurality of multiplication elements from the M / 2+1th to the Mth multiplication element, and sets the data as input data. The selector 206 provides the input data to the memory block 102 of the block address 5. The memory block 102 of the block address 5 outputs the product-addition operation result (i.e., the fifth step operation value) of the input data and the data stored in the memory block 102 of the block address 5 to the control unit 106. In the block shifter 1062, the control unit 106 multiplies the fifth step operation value by a value (c=0) corresponding to the digit of the multiplication element (1=2 c ) and the value corresponding to the dth position (d=0) of the multiplied element (1=2 d The control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0099] In step 6, as in step 5, data of the 0th digit of the plurality of multiplication elements from the (M / 2+1)th to the Mth is input data. The selector 206 provides the input data to the memory block 102 of the block address 6. The memory block 102 of the block address 6 outputs the product-addition operation result (i.e., the sixth step operation value) of the input data and the data stored in the memory block 102 of the block address 6 to the control unit 106. In the bit shifter 1062, the control unit 106 multiplies the sixth step operation value by a value (c=0) corresponding to the digit (c=2) of the multiplication element. c ) and the value corresponding to the digit d (d=1) of the multiplied element (2=2 d The control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0100] In step 7, the decoder 105 collects the data of the first digits of the M / 2+1th to Mth multiplication elements as input data. The selector 206 provides the input data to the memory block 102 of the block address 5. The memory block 102 of the block address 5 outputs the product-addition operation result of the input data and the data stored in the memory block 102 to the control unit 106, and the result is the seventh step operation value. In the bit shifter 1062, the control unit 106 multiplies the seventh step operation value by the value corresponding to the digit (c=1) of the multiplication element (2=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 dThe control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0101] In step 8, as in step 7, the data of the first digits of the plurality of multiplication elements from the M / 2+1th to the Mth are input data. The selector 206 provides the input data to the memory block 102 of the block address 6. The memory block 102 of the block address 6 outputs the product-addition operation result of the input data and the data stored in the memory block 102 to the control unit 106, and the result is the eighth step operation value. In the bit shifter 1062, the control unit 106 multiplies the eighth step operation value by the value of the digit (c=1) corresponding to the multiplication element (2=2 c ) and the value corresponding to the digit d (d=1) of the multiplied element (2=2 d ) to obtain a multiplication value. The control unit 106 updates the cumulative addition value by adding the multiplication value to the cumulative addition value obtained in the previous step in the cumulative adder 1063. After the processing up to step 8 is completed, the control unit 106 converts the cumulative addition result into data of the maximum digit of the multiplication element in the write data generation unit 1064, and stores the data in the data memory 104.
[0102] Next, we will refer to Fig.13 and Fig.14 A case where the data length K of the multiplication element is 1 is described. Fig.13 is a diagram showing the operation flow of the memory block. Fig.14 is a table showing the digits and block addresses of the multiplied elements in each step. Fig.13 and Fig.14 In the above description, the data length K of the multiplication element is set to 1, and the multiplication element is set to 1-bit data. The multiplication and accumulation operation device 100 repeats 4 steps (hereinafter referred to as steps 1 to 4). In the following description, M is the number of multiplication elements included in the word length W. Fig.10 In the case of K = 1, since a1 to a 16 The multiplied elements of are stored in the input buffer 301, so M=16.
[0103] The four memory blocks 102 corresponding to the block addresses 3 to 6 store the data w of the multiplied elements. j,i In the memory block 102 at block address 3, w1 of the 0th digit of the multiplied element is stored. 0 j,i In the memory block 102 at block address 4, the data w2 of the 0th digit of the multiplied element is stored. 0 j,i In the memory block 102 at block address 5, the 0th digit w3 of the multiplied element is stored. 0j,i The data w4 of the 0th digit of the multiplied element 1 j,i Stored in memory block 102 at block address 6.
[0104] Data of the same digit of the multiplied element for one multiply-accumulate operation is divided and stored in four memory blocks 102. More specifically, the memory blocks 102 corresponding to block addresses 3 to 6 all store data of the 0th digit of the multiplied element for one multiply-accumulate operation.
[0105] In step 1, the decoder 105 collects data of the 0th digit of a plurality of multiplication elements from the 1st to the M / 4th multiplication elements to obtain input data. Here, as described above, the input data generation unit 207 selects a portion of the data of the input buffer 301 as input data. Then, the selector 206 provides the input data to the memory block 102 of the block address 3. The memory block 102 of the block address 3 outputs the product-addition operation result (i.e., the first step operation value) of the input data and the data stored in the memory block 102 of the block address 3 to the control unit 106. In the block shifter 1062, the control unit 106 multiplies the first step operation value by a value (c=0) corresponding to the digit of the multiplication element (1=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d ) to obtain a multiplication value. The control unit 106 stores the multiplication value in the cumulative adder 1063 as a cumulative addition value.
[0106] In step 2, the decoder 105 collects data of the 0th digit of a plurality of multiplication elements from the M / 4+1th to the M / 2th multiplication element as input data. The selector 206 provides the input data to the memory block 102 of the block address 4. The memory block 102 of the block address 4 outputs the product-addition operation result of the input data and the data stored in the memory block 102 of the block address 4 to the control unit 106, and the result is the second step operation value. In the bit shifter 1062, the control unit 106 multiplies the second step operation value by a value (c=0) corresponding to the digit of the multiplication element (1=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d The control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0107] In step 3, the decoder 105 collects the data of the 0th digit of the plurality of multiplication elements from the (M / 2+1)th to the (3M / 4th)th as input data. The selector 206 provides the input data to the memory block 102 of the block address 5. The memory block 102 of the block address 5 outputs the product-addition operation result of the input data and the data stored in the memory block 102 of the block address 5 to the control unit 106, and the result is the third step operation value. In the bit shifter 1062, the control unit 106 multiplies the third step operation value by the value (c=0) corresponding to the digit (1=2 c ) and the value corresponding to the digit d (d=0) of the multiplied element (1=2 d The control unit 106 updates the cumulative added value by adding the multiplication value to the cumulative added value obtained in the previous step in the cumulative adder 1063.
[0108] In step 4, the decoder 105 collects data of the 0th digit of the plurality of multiplication elements from the 3M / 4+1th to the Mth, and sets the data as input data. The selector 206 provides the input data to the memory block 102 of the block address 6. The memory block 102 of the block address 6 outputs the product-addition operation result of the input data and the data stored in the memory block 102 of the block address 6 to the control unit 106, and the result is the fourth step operation value. In the bit shifter 1062, the control unit 106 multiplies the fourth step operation value by the value (1=2) corresponding to the digit (c=0) of the multiplication element. c ) and the value corresponding to the dth position (d=0) of the multiplied element (1=2 d ) to obtain a multiplication value. The control unit 106 updates the cumulative addition value by adding the multiplication value to the cumulative addition value obtained in the previous step in the cumulative adder 1063. After the processing up to step 4 is completed, the control unit 106 converts the cumulative addition result into data of the maximum digit of the multiplication element in the write data generation unit 1064, and stores the data in the data memory 104.
[0109] In this embodiment, when k (k is any integer from 0 to K, and K is an integer starting from 2) is used as the digit of the multiplication element, the i-th data a of a word stored in the data memory 104 is k index (i is an integer from 0 to less than W) is stored to satisfy the above equation (1).
[0110] This makes it possible to achieve bit scalability while suppressing the scale and speed delay of the circuit for generating input data to the memory block. The selection circuit 302 of the input data generation unit 207 can easily select appropriate data. For example, when K=1, 2, and 4 are used as scalability, in Fig.10In the embodiment, the selection circuit 302 can select one bit from the four bits of the input buffer 301. On the other hand, in Fig. 9 In the configuration of , the number of bits of the input buffer 301 selected by the selection circuit 302 is large. Therefore, the configuration of this embodiment can suppress the size and speed delay of the circuit.
[0111] Third embodiment
[0112] Generally, in the multiplication-addition operation technique using a memory cell array, there is a possibility that errors may occur in the operation results due to the influence of changes in device characteristics. Such errors may cause performance degradation of applications. As a method for dealing with random changes in elements between different chips, a method of performing machine learning again using input / output results of actual devices is used.
[0113] In the case of performing machine learning, the following processes (a) to (c) need to be repeated hundreds of times using tens of thousands of data depending on the application. (a) Perform calculations using temporary parameters. (b) Calculate errors based on expected values. (c) Adjust parameters. Therefore, the larger the scale of the neural network, the longer the learning time. In addition, the cost of relearning each chip is very high.
[0114] In the third embodiment, a technique of preventing a reduction in recognition accuracy due to a change without performing relearning is shown. Fig.15 is a system configuration diagram of the multiplication and addition operation device 100 according to the third embodiment. Fig.15 In the multiplication and accumulation operation device 100 shown in FIG. 1 , a CPU 111, a write control unit 112, a chip 110, and an evaluation device 120 are added to the Figure 1 Specifically, the chip 110 includes the multiply-add operation device 100 of the first embodiment and a write control unit 112. The evaluation device 120 is connected to the chip 110. The evaluation device 120 evaluates the operation result of the multiply-add operation device 100.
[0115] In the multiplication-addition operation technique using a memory element array, parameters obtained in advance by machine learning are written into a storage area as multiplied elements. In the present embodiment, the write control unit 112 only changes the address of the write destination of the multiplied element. That is, the write control unit 112 shifts the address of the write destination. The multiplication-addition operation device 100 performs a multiplication-addition operation on each address. Then, the evaluation device 120 evaluates the recognition accuracy of each shifted address by using the multiplication-addition operation result.
[0116] The evaluation device 120 may be, for example, a processing device such as a personal computer provided separately from the chip 110. Alternatively, the CPU 111 mounted on the chip 110 may perform part or all of the evaluation. For example, when the multiplication-accumulation operation device 100 performs a multiplication-accumulation operation of a neural network for image recognition, the offset address is changed so that the accuracy of the recognized image is the highest.
[0117] Fig.16 The address shift of the write data and its evaluation image are shown. The multiplied element is a 0 / 1 combination. In addition, when data 1 is stored in a memory element with a large characteristic variation, the error of the operation result relative to the multiplied element becomes large. On the other hand, the method of distributing the parameters of the neural network near 0 is widely used, and a lot of data tends to be 0. Therefore, the address of the multiplied element is shifted in units of rows or blocks. For example, in Fig.16 In the example, the write address 401 is shifted by one row. By doing so, 0 is written to the element with a large characteristic variation, which has a fatal adverse effect on the calculation accuracy. That is, by shifting the write address 401, the result of the multiplication-addition operation differs, and therefore, the recognition accuracy differs. For example, the evaluation device 120 obtains an offset address so that a memory element with a large characteristic variation is written with 0. This offset address is the optimal address with the highest recognition accuracy.
[0118] Fig.17 The flow of calculation accuracy adjustment is shown. First, in step S11, the write control unit 112 sets the address. Here, the address with an offset of 0 is designated as the initial value. In step S12, the multiplication and accumulation operation device 100 performs an operation. Here, the multiplication and accumulation operation shown in the first embodiment is performed. Then, the multiplication and accumulation operation device 100 performs repeated multiplication and accumulation operations, and outputs the final operation result to the evaluation device 120.
[0119] Next, in step S13, the evaluation device 120 evaluates the operation result. That is, the evaluation device 120 evaluates the recognition accuracy based on the operation result of the multiplication-addition operation. For example, when the multiplication-addition operation device 100 performs a multiplication-addition operation on the image recognition neural network, a plurality of image samples are prepared. Then, the multiplication-addition operation device 100 stores data based on one picture sample in a data memory. In S12, the multiplication-addition operation device 100 performs a multiplication-addition operation on each picture sample. A multiplication-addition operation is performed on each image using an offset address. The evaluation device 120 evaluates whether each image is correctly recognized. Then, the evaluation device 120 evaluates the recognition results of each image and stores a numerical value indicating the recognition accuracy.
[0120] Next, in step S14, the write control unit 112 determines whether the address shift search is completed. When the search is not completed ("No" in S14), the write control unit 112 shifts the address (S15). Then, the processing of S12 and S13 is performed using the shifted address. As a result, the evaluation device 120 can evaluate the recognition accuracy at the shifted address. The address to be shifted may be a block address or a row address of a block address. Alternatively, the write control unit 112 may shift the block address and the row address in sequence.
[0121] When the search is completed ("Yes" in S14), the evaluation device 120 stores the setting of the optimal address (S16). That is, the write control unit 112 shifts the address in sequence, and the evaluation device 120 evaluates the recognition accuracy of all the shifted addresses. Then, the evaluation device 120 records the address with the highest recognition accuracy among all the shifted addresses as the offset address. In this way, the preliminary test is completed.
[0122] Fig.18 1 is a block diagram showing the configuration of the decoder 105 according to the present embodiment. In the decoder 105, the address shift unit 220 is added Figure 3 The address shift unit 220 has a function of shifting the write address. The evaluation device 120 outputs the optimal offset address information obtained through the preliminary test to the multiplication and addition operation device 100.
[0123] For example, the address shift unit 208 receives information of the optimal offset address obtained in the preliminary test from the control unit 106. Then, the address shift unit 208 shifts the write destination of the multiplication element according to the offset address information. By doing so, the influence of the characteristic change of the memory element can be suppressed while using the parameters that have been learned once. In this embodiment, the deterioration of the recognition accuracy can be suppressed without relearning. Therefore, the development time of the reasoning program implemented by the DNN for each memory device can be shortened.
[0124] The multiplication-addition computing device 100 according to the first to third embodiments is suitable for multiplication-addition computing of DNN processing at the end point in automatic computing, surveillance cameras, etc. Power efficiency is enhanced by the device and method of multiplication-addition computing according to this embodiment. In addition, by using the multiplication-addition computing device 100, the entire application such as image recognition can be efficiently operated. In particular, the multiplication-addition computing device 100 is suitable for applications such as automatic control of robots, surveillance cameras, drones, etc.
[0125] Part or all of the above-mentioned multiplication-addition operation device 100 may be implemented by hardware including semiconductor circuits such as semiconductor memories, etc. In addition, some functions of the multiplication-addition operation device 100 may be implemented by software programs.
[0126] Fig.19 1 is a block diagram showing the configuration of a multiplication-accumulation operation device 100 according to another embodiment. The multiplication-accumulation operation device 100 includes a plurality of memory blocks 102, an input data generating unit 207, a control unit 106, and a data memory 104. The plurality of memory blocks 102 store a plurality of multiplied elements and perform a multiplication-accumulation operation on the input data. One memory block 102 stores the first bit value of the same digit of a plurality of multiplication elements as a single bit value. The input data generating unit 207 generates input data by extracting the second bit value of the same digit from a plurality of multiplication elements. The data memory 104 accumulatively adds the values corresponding to the multiplication-accumulation operation of the memory blocks 102. The data memory 104 stores the accumulative addition value obtained by the accumulative addition as the multiplication element of the next multiplication-accumulation operation. As a result, the multiplication-accumulation operation can be efficiently performed.
[0127] The multiplication-accumulation operation method includes the following steps (A) to (G). (A) Reading a plurality of multiplication elements from a data memory. (B) Selecting a memory block from a plurality of memory blocks storing the first bit values of the same digits of a plurality of multiplied elements as a single-bit value. (C) Generating input data by extracting the second bit values of the same digits from a plurality of multiplication elements. (D) Inputting the input data into the selected one of the memory blocks. (E) The memory block performs a multiplication-accumulation operation using the first bit value and the second bit value. (F) Cumulatively adding values corresponding to the multiplication-accumulation operation of the memory block. (G) The cumulative addition value obtained by the cumulative addition is stored in the data memory as a multiplication element of the next multiplication-accumulation operation. As a result, the multiplication-accumulation operation can be efficiently performed.
[0128] Moreover, various types of non-transitory computer-readable media can be used to store the above-mentioned program and provide it to the computer. Non-transitory computer-readable media include various types of tangible storage media. Examples of non-transitory computer-readable media include magnetic recording media (e.g., floppy disks, magnetic tapes, hard disk drives), magneto-optical recording media (e.g., magneto-optical disks), CD-ROMs (read-only memories), CD-Rs, CD-R / Ws, solid-state memories (e.g., mask ROMs, PROMs (programmable ROMs), EPROMs (erasable PROMs), flash ROMs, RAMs (random access memories)). The program can also be provided to the computer via various types of transient computer-readable media. Examples of transient computer-readable media include electrical signals, optical signals, and electromagnetic waves. Transient computer-readable media can provide programs to the computer via wired or wireless communication paths (such as wires and optical fibers).
[0129] Although the present invention made by the inventors has been specifically described based on the embodiments, the present invention is not limited to the embodiments that have been described, and it goes without saying that various modifications can be made without departing from the gist thereof.
Claims
1. A multiply-accumulate operation device for performing a multiply-accumulate operation of m multiplication elements and m multiplied elements in one multiply-accumulate operation to obtain m products, and then obtaining the sum of the products as a multiply-accumulate operation value, m being an integer of 2 or greater, each multiplied element consisting of p bits, each multiplication element consisting of s bits, p and s being integers of 2 or greater, The multiplication and accumulation operation device comprises: A data memory for storing multiplication elements; an input data generating unit for extracting one-bit data of each identical digit from each of the m multiplication elements from the data storage, and outputting m extracted one-bit data as input data of each digit; p memory blocks are provided corresponding to the p bits of the multiplied element, each memory block having: i) m×n memory cells, each memory cell for storing one bit of data, ii) n bit lines, and iii) m word lines, n being an integer of 2 or greater, wherein in a k-th memory block, data of the m×n multiplied elements of the k-th digit are stored, k being an integer between 1 and p, the k-th memory block being configured to perform a multiplication-accumulation operation of m extracted one-bit data of the j-th digit and the stored data of the m×n multiplied elements of the k-th digit as input data supplied through the corresponding m word lines, and output a multiplication-accumulation result, j being an integer between 1 and s, supplying the m extracted one-bit data to the memory block is repeated for each memory block and each digit, thereby outputting p×s multiplication-accumulation results; A first holding unit, used for holding first digit information corresponding to the k-th digit of the m×n multiplied elements; A second holding unit, used for holding second digit information corresponding to the j-th digit of the m multiplication elements; as well as A control unit configured to: generating p×s multiplication values by multiplying a corresponding one of the p×s product-accumulation results by a value corresponding to the first digit information corresponding to the product-accumulation result and a value corresponding to the second digit information corresponding to the product-accumulation result, and accumulatively adding the generated multiplication values, thereby obtaining an accumulative addition value, and The data memory is configured to store the accumulated addition value as a next multiplication element.
2. The multiply-add operation device according to claim 1, Wherein the input data generating unit comprises: An input buffer, used to store data from the data storage device with a word length of W, where W is an integer equal to or greater than 1; a selector for selecting data of a data length of N from the data of a word length of W stored in the input buffer, wherein N is an integer from 1 to W, and an output buffer, configured to output data having a data length N selected by the selector to the memory block, It is assumed that the data length of the multiplication element is K, the maximum data length of the multiplication element is K_max, the number of digits of the multiplication element is k, k is an arbitrary integer from 2 to K, and K is a power of 2, Data a as the i-th data in a word of the data memory k index The control unit is stored in a writing order satisfying the following formula (1), wherein in the formula (1), k is arranged in ascending order or in descending order, wherein i / K_max, W / K_max and (i mod K_max) / K are integer values with the decimal point omitted, and i is an integer greater than or equal to 0 and less than W: 3 . The multiply-add operation device according to claim 1 , further comprising an address shift unit configured to shift a write address for the product element based on an offset address. 4 .
4. A multiplication and accumulation operation system, comprising: The multiply-add operation device according to claim 3, and evaluation means configured to evaluate the product-accumulate result from the product-accumulate operation means while changing the write address for the product element, The offset address is set based on the evaluation result.
