A vector-matrix multiplication operation method and operator with adjustable in-memory precision

By splitting and converting the in-memory vector-matrix operation data and processing it in different non-volatile storage arrays, it solves the problem of limited calculation accuracy in the existing technology, achieves a balance between adjustable accuracy and energy efficiency, and is suitable for a variety of applications. Computational tasks.

CN114168107BActive Publication Date: 2024-10-18HUAZHONG UNIV OF SCI & TECH

Patent Information

Application Number
CN202111331694.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-11
Publication Date
2024-10-18
Estimated Expiration
2041-11-11

AI Technical Summary

Technical Problem

Existing in-memory vector-matrix operations based on non-volatile memory have limited calculation accuracy due to device non-ideal effects, and cannot achieve adjustable accuracy for different applications.

Method used

By splitting and converting the operation data, it is divided into sign bit, high-bit and low-bit data, and the operations are performed in binary and multi-valued non-volatile storage arrays respectively. The number of bits is adjusted according to the required precision to realize vector matrix multiplication.

Benefits of technology

It significantly improves computing accuracy and energy efficiency, balances accuracy and energy efficiency requirements, is suitable for tasks such as scientific computing and machine learning, and has high robustness and computing power advantages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168107B_ABST
    Figure CN114168107B_ABST
Patent Text Reader

Abstract

The invention discloses a vector-matrix multiplication operation method with adjustable in-memory precision and an operator, comprising: splitting a storage matrix into one sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices based on a split conversion rule of operation data, and storing them in corresponding non-volatile storage arrays in high-low order; there are p1+k1 non-volatile storage arrays for operation; splitting an input vector into one sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors based on a split conversion rule of operation data, and sequentially inputting the vectors into p1+k1 non-volatile storage arrays, sequentially implementing multiplication operations of the sign bit vector, the high-bit vector and the low-bit vector with the p1+k1 matrices; shifting and accumulating the obtained multiplication operation results based on a binary operation rule, and obtaining a vector-matrix multiplication operation result of the input vector and the storage matrix; wherein the number of bits of the high-bit data and the low-bit data is adjusted according to the required calculation precision, thereby implementing vector-matrix operation with variable precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of analog circuits, and more specifically, relates to a vector-matrix multiplication operation method and an operator with adjustable in-memory precision. Background Art

[0002] With the explosive growth of data in the era of artificial intelligence, traditional von Neumann computers can no longer meet the urgent needs of the current information age for computer computing power and computer energy efficiency. In-memory computing mode, as a computing method with high computing energy efficiency, low computing latency, and low computing time complexity, is gradually showing its value. Among them, in-memory vector-matrix operations based on non-volatile memory have shown their huge energy efficiency and computing power advantages over traditional digital computers in data-intensive tasks such as manual execution and scientific computing.

[0003] However, as an analog computing mode, the in-memory vector-matrix operation based on non-volatile memory is greatly limited in computational accuracy due to the influence of device non-ideal effects. Vector-matrix operations based on a single memory array can only provide low-precision computing results. When using multiple arrays for precision expansion, the computational energy efficiency is often reduced exponentially. Therefore, in order to make the in-memory computing mode more universal, there is an urgent need for a highly energy-efficient in-memory matrix computing core with adjustable precision. Summary of the invention

[0004] In view of the above defects or improvement needs of the prior art, the present invention provides a vector-matrix multiplication operation method and operator with adjustable in-memory precision, so as to realize variable precision vector-matrix operation, so as to solve the technical problem that the existing memristor vector-matrix operation unit cannot realize adjustable precision calculation for different applications.

[0005] In order to achieve the above object, in a first aspect, the present invention provides a vector-matrix multiplication operation method with adjustable in-memory precision, comprising the following steps:

[0006] S1. Based on the splitting and conversion rules of the operation data, each operation data in the storage matrix is ​​converted into mixed-base data of length p1+k1 to obtain a converted storage matrix; each mixed-base data in the converted storage matrix is ​​integrated bit by bit to obtain a sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices, and they are stored in the corresponding non-volatile storage arrays in the order of high and low bits; one non-volatile storage array stores one matrix, and the number of non-volatile storage arrays used for operation is p1+k1, and p1 and k1 are adjustable according to the required calculation accuracy;

[0007] S2. Based on the splitting and conversion rules of the operation data, each operation data in the input vector is converted into mixed-base data of length p2+k2 to obtain a converted input vector; each mixed-base data in the converted input vector is integrated bit by bit to obtain a sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors;

[0008] S3, inputting the sign bit vector, the high-order vector and the low-order vector into p1+k1 non-volatile storage arrays in sequence, and sequentially performing multiplication operations of the sign bit vector, the high-order vector and the low-order vector with p1+k1 matrices;

[0009] S4, shifting and accumulating the obtained multiplication operation results based on binary operation rules to obtain a vector-matrix multiplication operation result of the input vector and the storage matrix;

[0010] The splitting and conversion rules of the above operation data are as follows: perform a complement operation on the operation data to obtain an m-bit binary complement expression; split the first p bits of data in the complement expression according to the binary bits to obtain 1 sign bit data and p-1 high-bit data; split the last mp bits of data in the complement expression into k bits with lengths of m1, m2, ..., m k After the binary data is converted into the corresponding decimal number, k low-order data are obtained; then 1 sign bit data, p-1 high-order data and k low-order data arranged in sequence from high to low are obtained, which are recorded as mixed-base data with a length of p+k; among them,

[0011] Further preferably, the above non-volatile storage array is a cross structure, and the non-volatile storage device is located at the cross point; the non-volatile storage device is used for binary storage or multi-value storage; the non-volatile storage array based on the non-volatile storage device of binary storage is recorded as a binary non-volatile storage array; the non-volatile storage array based on the non-volatile storage device of multi-value storage is recorded as a multi-value non-volatile storage array;

[0012] The above-mentioned non-volatile memory array includes a binary non-volatile memory array and a multi-value non-volatile memory array;

[0013] The binary non-volatile storage array is used to store the sign bit matrix and the high bit matrix;

[0014] The multi-value non-volatile memory array is used to store the low-order matrix.

[0015] In a second aspect, the present invention provides a vector-matrix multiplication operator with adjustable in-memory precision, comprising: an external input module, an in-memory calculation module and a shift-accumulation module;

[0016] The in-memory computing module includes p1+k1 non-volatile storage arrays, where p1 and k1 are adjustable according to the required computing accuracy;

[0017] The external input module is used to convert each operation data in the storage matrix into mixed-base data of length p1+k1 based on the split conversion rule of the operation data to obtain the converted storage matrix; each mixed-base data in the converted storage matrix is ​​integrated bit by bit to obtain 1 sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices, and store them in the corresponding non-volatile storage arrays in the order of high and low bits; one non-volatile storage array stores one matrix;

[0018] The external input module is further used to convert each operation data in the input vector into mixed-base data of length p2+k2 based on the split conversion rule of the operation data to obtain a converted input vector; integrate each mixed-base data in the converted input vector bit by bit to obtain 1 sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors, and input them into p1+k1 non-volatile storage arrays in sequence;

[0019] The in-memory computing module is used to sequentially implement the multiplication operation of the sign bit vector, the high bit vector and the low bit vector with the p1+k1 matrices based on the non-volatile storage array;

[0020] The shift-and-accumulate module is used to shift and accumulate the obtained multiplication operation results based on binary operation rules to obtain the vector-matrix multiplication operation results of the input vector and the storage matrix;

[0021] The splitting and conversion rules of the above operation data are as follows: perform a complement operation on the operation data to obtain an m-bit binary complement expression; split the first p bits of data in the complement expression according to the binary bits to obtain 1 sign bit data and p-1 high-bit data; split the last mp bits of data in the complement expression into k bits with lengths of m1, m2, ..., m k After the binary data is converted into the corresponding decimal number, k low-order data are obtained; then 1 sign bit data, p-1 high-order data and k low-order data arranged in sequence from high to low are obtained, which are recorded as mixed-base data with a length of p+k; among them,

[0022] Further preferably, the above non-volatile storage array is a cross structure, and the non-volatile storage device is located at the cross point; the non-volatile storage device is used for binary storage or multi-value storage; the non-volatile storage array based on the non-volatile storage device of binary storage is recorded as a binary non-volatile storage array; the non-volatile storage array based on the non-volatile storage device of multi-value storage is recorded as a multi-value non-volatile storage array;

[0023] The above-mentioned non-volatile memory array includes a binary non-volatile memory array and a multi-value non-volatile memory array;

[0024] The binary non-volatile storage array is used to store the sign bit matrix and the high bit matrix;

[0025] The multi-value non-volatile memory array is used to store the low-order matrix.

[0026] Further preferably, the above-mentioned non-volatile memory device includes: resistive memory, phase change memory, NOR-FLASH, spin transfer torque magnetic memory or ferroelectric field effect transistor.

[0027] Further preferably, the in-memory computing module includes a binary operation unit and a multi-value operation unit;

[0028] The binary operation unit includes p1 binary operators; the binary operators include a binary non-volatile storage array and a first peripheral circuit; the first peripheral circuit includes a first digital-to-analog conversion module and a first analog-to-digital conversion module; the output end of the first digital-to-analog conversion module is connected to the input end of the binary non-volatile storage array; the output end of the binary non-volatile storage array is connected to the input end of the first analog-to-digital conversion module; the first digital-to-analog conversion module is used to input a sign bit vector, a high bit vector or a low bit vector into the binary non-volatile storage array in the form of voltage; the first analog-to-digital conversion module is used to perform analog-to-digital conversion on a multiplication result represented as a current output by the binary non-volatile storage array;

[0029] The multi-value operation unit includes k1 multi-value operators; the multi-value operator includes a multi-value non-volatile storage array and a second peripheral circuit; the second peripheral circuit includes a second digital-to-analog conversion module, a differential module and a second analog-to-digital conversion module; the output end of the second digital-to-analog conversion module is connected to the input end of the multi-value non-volatile storage array; the output end of the multi-value non-volatile storage array is connected to the input end of the differential module, and the output end of the differential module is connected to the input end of the second analog-to-digital conversion module; the second digital-to-analog conversion module is used to input a sign bit vector, a high-bit vector or a low-bit vector into the multi-value non-volatile storage array in the form of voltage; the output ends of the multi-value non-volatile storage array are divided into a group of two, and the differential module is used to perform differential operation on each group of outputs of the multi-value non-volatile storage array; the second analog-to-digital conversion module is used to perform analog-to-digital conversion on the differential operation result input by the differential module.

[0030] Further preferably, the first digital-to-analog conversion module includes multiple digital-to-analog converters, whose output ends are connected one-to-one with the input ends of each row participating in the operation in the binary non-volatile storage array; the first analog-to-digital conversion module includes multiple groups of cascaded transimpedance amplifiers and analog-to-digital converters, whose input ends are connected one-to-one with the output ends of each column participating in the operation in the multi-valued non-volatile storage array.

[0031] Further preferably, the second digital-to-analog conversion module includes multiple digital-to-analog converters, whose output ends are connected one-to-one with the input ends of each row participating in the operation in the multi-valued non-volatile storage array; the differential module includes multiple differential units, whose input ends are connected one-to-one with each group of outputs of the multi-valued non-volatile storage array; wherein the differential unit includes two transimpedance amplifiers and a voltage subtractor; each group of outputs of the multi-valued non-volatile storage array is amplified by the transimpedance amplifier and then differentially operated by the voltage subtractor; the first analog-to-digital conversion module includes multiple analog-to-digital converters, which are connected one-to-one with the output ends of each differential unit.

[0032] Further preferably, the shift-and-accumulate module comprises a first shift-and-accumulate unit, a second shift-and-accumulate unit and a third shift-and-accumulate unit;

[0033] The input end of the first shift-accumulate unit is connected to the output end of each binary operator in the binary operation unit; the input end of the second shift-accumulate unit is connected to the output end of each multi-value operator in the multi-value operation unit; the input end of the third shift-accumulate unit is connected to the output end of the first shift-accumulate unit and the output end of the second shift-accumulate unit respectively;

[0034] The first shift-accumulate unit is used for performing shift and accumulation operations on the multiplication results output by each binary operator based on a binary operation rule;

[0035] The second shift-accumulate unit is used for performing shift and accumulation operations on the multiplication results output by each multi-value operator based on a binary operation rule;

[0036] The third shift-accumulate unit is used to perform shift and accumulation operations on the outputs of the first shift-accumulate unit and the second shift-accumulate unit based on binary operation rules to obtain a vector-matrix multiplication result of the input vector and the storage matrix.

[0037] Further preferably, the above-mentioned vector-matrix multiplication operator with adjustable in-memory precision further comprises: a control module;

[0038] The control module is connected to the external input module, the internal memory calculation module and the shift accumulation module respectively, and is used to control the working sequence of the external input module, the internal memory calculation module and the shift accumulation module during the operation process.

[0039] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0040] 1. The present invention provides a vector-matrix multiplication operation method and an operator with adjustable in-memory precision. After the operation data in the input vector and storage matrix involved in the operation are split and converted into sign bit data, high-order data and low-order data based on the splitting and conversion rules of the operation data, vector-matrix multiplication operation is performed based on a non-volatile storage array, wherein the number of bits of the high-order data and the low-order data is adjusted according to the required calculation precision, thereby realizing variable-precision vector-matrix operation, and solving the technical problem that the existing memristor vector-matrix operation unit cannot realize adjustable-precision calculation for different applications.

[0041] 2. The vector matrix multiplication method and operator with adjustable in-memory precision provided by the present invention perform vector matrix multiplication based on binary non-volatile storage array and multi-value non-volatile storage array, use binary non-volatile storage array to store sign bit matrix and high-bit matrix, use multi-value non-volatile storage array to store low-bit matrix, for in-memory calculation based on non-volatile memory, the accuracy of binary calculation is significantly higher than multi-value calculation, and the energy efficiency of multi-value calculation is significantly higher than binary calculation. The present invention makes the data bits significantly affected by the calculation be calculated by binary units to ensure the calculation accuracy, and the data bits with less influence on the calculation structure are calculated by multi-value units, which effectively reduces the influence of the non-ideal effect of the device on the calculation result, and at the same time ensures the energy efficiency of the calculation, so as to realize highly robust and energy-efficient in-memory calculation with adjustable precision.

[0042] 3. The vector-matrix multiplication operation method and operator with adjustable in-memory precision provided by the present invention can enable more high-order data to be operated in a binary non-volatile storage array when the calculation accuracy needs to be guaranteed; when the calculation energy efficiency needs to be guaranteed, more low-order data can be operated in a multi-value non-volatile storage array; and can well balance the calculation accuracy requirements and the calculation energy efficiency requirements.

[0043] 4. The vector-matrix multiplier with adjustable in-memory precision provided by the present invention performs shift and accumulation operations on the multiplication results output by the non-volatile storage array in stages. Since the digital operation unit has very high operation precision and operation robustness, the use of the digital operation unit for shift and accumulation operations can ensure that no additional calculation errors are introduced in the shift and accumulation process, thereby ensuring the accuracy of the shift and accumulation results.

[0044] 5. The operator formed by the in-memory precision adjustable vector-matrix multiplication method provided by the present invention has good versatility. Based on its adjustable precision feature, it can be used to support vector-matrix multiplication processes in scientific computing such as machine learning, and has significant advantages in computing power and power consumption over existing computing systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1A flow chart of a vector-matrix multiplication method with adjustable in-memory precision provided in Embodiment 1 of the present invention;

[0046] Figure 2 A schematic diagram of weight slicing of a storage matrix provided in Embodiment 1 of the present invention;

[0047] Figure 3 A schematic diagram of weight slicing of an input vector provided in Embodiment 1 of the present invention;

[0048] Figure 4 A schematic diagram of performing shift and accumulation operations on multiplication results in stages provided by Embodiment 1 of the present invention;

[0049] Figure 5 A schematic diagram of a non-volatile storage array provided in Embodiment 2 of the present invention;

[0050] Figure 6 A schematic diagram of the structure of an in-memory computing module provided in Embodiment 2 of the present invention;

[0051] Figure 7 A schematic diagram of the structure of a binary operator provided in Embodiment 2 of the present invention;

[0052] Figure 8 A schematic diagram of the structure of a multi-value operator provided in Embodiment 2 of the present invention;

[0053] Fig. 9 A schematic diagram of the structure of a vector-matrix multiplication operator with adjustable in-memory precision provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0055] Embodiment 1,

[0056] A vector-matrix multiplication method with adjustable in-memory precision, such as Figure 1 As shown, the following steps are included:

[0057] S1. Based on the splitting and conversion rules of the operation data, each operation data in the storage matrix is ​​converted into mixed-base data of length p1+k1 to obtain a converted storage matrix; each mixed-base data in the converted storage matrix is ​​integrated bit by bit to obtain 1 sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices, and are stored in the corresponding non-volatile storage arrays in the order of high and low bits; a non-volatile storage array stores a matrix, and the number of non-volatile storage arrays used for calculation is p1+k1, p1 and k1 are both integers, which can be adjusted according to the required calculation accuracy; for example, when executing a machine learning algorithm, the required calculation accuracy is 8-bit, then p1=k1=2 can be taken, and when executing a scientific computing task, the required calculation accuracy is 16-bit, then p1=k1=4 can be taken.

[0058] The splitting and conversion rules of the above operation data are as follows: perform a complement operation on the operation data to obtain an m-bit binary complement expression; split the first p bits of data in the complement expression (the first bit is the sign bit data) according to the binary bit to obtain 1 sign bit data and p-1 high-bit data; split the last mp bits of data in the complement expression into k bits with lengths of m1, m2, ..., m k After the binary data is converted into the corresponding decimal number, k low-order data are obtained; then 1 sign bit data, p-1 high-order data and k low-order data arranged in sequence from high to low are obtained, which are recorded as mixed-base data with a length of p+k; among them, Both p and k are integers and can be adjusted according to the required calculation accuracy. It should be noted that during the splitting process, the sign bit and the second to pth bits that will significantly affect the calculation results are split into binary data; the last mp bits of data are sequentially split into k lengths of m1, m2, ..., m k In general, for the result of splitting the last mp bits of data, the closer to the front, the shorter its length; in this embodiment, m1, m2, ..., m k The size of increases from left to right; the values ​​of p and k can be modulated according to the required calculation accuracy.

[0059] Specifically, Figure 2 As shown, the mixed-base data of the storage matrix includes 1 sign bit data, p1-1 high-bit data and k1 low-bit data arranged in sequence from high to low; the sign bit data and the high-bit data are both binary data, obtained by splitting the first p1 bits of the binary complement expression of the operation data according to the binary bits; the low-bit data are all decimal data, which are sequentially split into k1 bits with lengths of m1, m2, ..., m from the last m-p1 bits of the binary complement expression of the operation data. k1 The binary data is converted into decimal form; m is the length of the two's complement representation.

[0060] S2. Based on the splitting and conversion rules of the operation data, each operation data in the input vector is converted into mixed-base data of length p2+k2 to obtain a converted input vector; each mixed-base data in the converted input vector is integrated bit by bit to obtain 1 sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors; wherein p2 and k2 are both integers and can be adjusted according to the required calculation accuracy; similarly, for example, when executing a machine learning algorithm, the required calculation accuracy is 8-bit, then p2=k2=2 can be taken, and when executing a scientific computing task, the required calculation accuracy is 16-bit, then p2=k2=4 can be taken.

[0061] Specifically, Figure 3 As shown, the operation data in the input vector is converted using the same conversion method as the operation data in the storage matrix to obtain mixed-base data with a length of p2+k2, and then obtain the converted input vector.

[0062] It should be noted that the precision of the above input vector and storage matrix may or may not be consistent.

[0063] S3, inputting the sign bit vector, the high-order vector and the low-order vector into p1+k1 non-volatile storage arrays in sequence, and sequentially performing multiplication operations of the sign bit vector, the high-order vector and the low-order vector with p1+k1 matrices;

[0064] Specifically, in this embodiment, the 1 sign bit vector, p2-1 high-order vectors and k2 low-order vectors corresponding to the input vector are arranged in sequence from high to low according to the original splitting order, and the sign bit vector is simultaneously input into the p1+k1 non-volatile storage arrays for storing 1 sign bit matrix, p1-1 high-order matrix and k1 low-order matrix according to the arrangement order of high and low bits, so as to realize the multiplication operation of the sign bit vector and the p1+k1 matrix; the a (a=1,2,......,p2-1)th The high-order vector is simultaneously input into the p1+k1 non-volatile storage arrays for storing 1 sign bit matrix, p1-1 high-order matrices and k1 low-order matrices to realize the multiplication operation of the high-order vector and the p1+k1 matrices; the b-th (b=1, 2, ..., p2-1) low-order vector is simultaneously input into the p1+k1 non-volatile storage arrays for storing 1 sign bit matrix, p1-1 high-order matrices and k1 low-order matrices to realize the multiplication operation of the high-order vector and the p1+k1 matrices.

[0065] S4, shifting and accumulating the obtained multiplication operation results based on binary operation rules to obtain a vector-matrix multiplication operation result of the input vector and the storage matrix;

[0066] Furthermore, the above non-volatile storage array is a cross structure, and the non-volatile storage device is located at the cross point; the non-volatile storage device is used for binary storage or multi-value storage; the non-volatile storage array based on the non-volatile storage device of binary storage is recorded as a binary non-volatile storage array; the non-volatile storage array based on the non-volatile storage device of multi-value storage is recorded as a multi-value non-volatile storage array;

[0067] In an alternative implementation, the nonvolatile storage array includes a binary nonvolatile storage array and a multi-value nonvolatile storage array; there are p1 binary nonvolatile storage arrays for storing sign bit matrices and high-order matrices; there are k1 multi-value nonvolatile storage arrays for storing low-order matrices.

[0068] Further, in an optional implementation manner, as Figure 4 As shown, the present invention performs shift and accumulation operations on the above-mentioned multiplication results in stages. Specifically, the multiplication results output by the binary non-volatile storage array and the multiplication results output by the multi-valued non-volatile storage array can be shifted and accumulated respectively, and then the results obtained by the shift and accumulation operations are further shifted and accumulated.

[0069] It should be noted that the above-mentioned vector-matrix multiplication method with adjustable in-memory precision has the characteristic of balancing the requirements of computational precision and computational energy efficiency. When the computational precision needs to be guaranteed, more high-order data is calculated in the binary non-volatile storage array; when the computational energy efficiency needs to be guaranteed, more low-order data is calculated in the multi-valued non-volatile storage array. Therefore, according to the user's requirements for precision, during the calculation, all binary non-volatile storage array calculations can be used to ensure the computational precision, or all multi-valued non-volatile storage array calculations can be used to ensure the computational energy efficiency; this can be achieved by adjusting the values ​​of p1 and k1.

[0070] Embodiment 2,

[0071] A vector-matrix multiplication operator with adjustable in-memory precision can be used to implement the vector-matrix multiplication method with adjustable in-memory precision provided in Embodiment 1 of the present invention, comprising: an external input module, an in-memory calculation module and a shift-accumulation module;

[0072] The in-memory computing module includes p1+k1 non-volatile storage arrays, where p1 and k1 are adjustable according to the required computing accuracy;

[0073] The external input module is used to convert each operation data in the storage matrix into mixed-base data of length p1+k1 based on the split conversion rule of the operation data to obtain the converted storage matrix; each mixed-base data in the converted storage matrix is ​​integrated bit by bit to obtain 1 sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices, and store them in the corresponding non-volatile storage arrays in the order of high and low bits; one non-volatile storage array stores one matrix;

[0074] The external input module is also used to convert each operation data in the input vector into mixed-base data of length p2+k2 based on the splitting and conversion rules of the operation data to obtain a converted input vector; integrate each mixed-base data in the converted input vector bit by bit to obtain 1 sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors, and input them into p1+k1 non-volatile storage arrays in sequence; it should be noted that the accuracy of the above-mentioned input vector and storage matrix may be inconsistent or inconsistent.

[0075] The in-memory computing module is used to sequentially implement the multiplication operation of the sign bit vector, the high bit vector and the low bit vector with the p1+k1 matrices based on the non-volatile storage array;

[0076] The shift-and-accumulate module is used to shift and accumulate the obtained multiplication operation results based on binary operation rules to obtain the vector-matrix multiplication operation results of the input vector and the storage matrix;

[0077] The splitting and conversion rules of the above operation data are as follows: the operation data is split based on the operation rules of binary signed numbers. Specifically, the operation data is complemented to obtain an m-bit binary complement expression; the first p bits of data in the complement expression are split according to the binary bits to obtain 1 sign bit data and p-1 high-bit data; the last mp bits of data in the complement expression are sequentially split into k bits with lengths of m1, m2, ..., m k After the binary data is converted into the corresponding decimal number, k low-order data are obtained; then 1 sign bit data, p-1 high-order data and k low-order data arranged in sequence from high to low are obtained, which are recorded as mixed-base data with a length of p+k; among them,

[0078] Specifically, Figure 5As shown, the nonvolatile memory array includes an input port and an output port, wherein the input port is composed of the row lines of the array, and the output port is composed of the column lines of the array. The above nonvolatile memory array is a cross structure, and the nonvolatile memory device is located at the cross point; the selected nonvolatile memory device can be resistive random access memory (RRAM), phase change memory (PCM), NOR-FLASH, spin transfer torque magnetic memory (STT-MRAM), ferroelectric field effect transistor (FeFET), etc. The nonvolatile memory device is used for binary storage or multi-value storage; the nonvolatile memory array based on the nonvolatile memory device of binary storage is recorded as a binary nonvolatile memory array; the nonvolatile memory array based on the nonvolatile memory device of multi-value storage is recorded as a multi-value nonvolatile memory array.

[0079] In an optional implementation, the above-mentioned non-volatile storage array includes a binary non-volatile storage array and a multi-value non-volatile storage array; there are p1 binary non-volatile storage arrays for storing the sign bit matrix and the high-bit matrix input by the external input module; there are k1 multi-value non-volatile storage arrays for storing the low-bit matrix input by the external input module.

[0080] Specifically, Figure 6 As shown, the above-mentioned in-memory computing module includes the above-mentioned binary operation unit and multi-value operation unit;

[0081] Binary operation unit:

[0082] The binary operation unit includes p1 binary operators; Figure 7 As shown, the binary operator includes a binary non-volatile storage array and a first peripheral circuit;

[0083] The first peripheral circuit includes a first digital-to-analog conversion module and a first analog-to-digital conversion module; the output end of the first digital-to-analog conversion module is connected to the input end of the binary non-volatile storage array; the output end of the binary non-volatile storage array is connected to the input end of the first analog-to-digital conversion module;

[0084] The first digital-to-analog conversion module is used to input the sign bit vector, high-order vector or low-order vector input by the storage external input module into the binary non-volatile storage array in the form of voltage; the first analog-to-digital conversion module is used to perform analog-to-digital conversion on the multiplication result represented as current output by the binary non-volatile storage array.

[0085] In an optional implementation, the first digital-to-analog conversion module includes multiple digital-to-analog converters (DACs), whose output ends are connected one-to-one with the input ends of each row participating in the operation in the binary non-volatile storage array; the first analog-to-digital conversion module includes multiple groups of cascaded transimpedance amplifiers and analog-to-digital converters (ADCs), and the input end of each group is connected one-to-one with the output end of each column participating in the operation in the multi-valued non-volatile storage array; wherein the output end of the transimpedance amplifier is connected to the input end of the analog-to-digital converter.

[0086] Furthermore, in an optional implementation, the array size for storing the matrix in the binary non-volatile storage array is M×N; the first digital-to-analog conversion module is composed of M digital-to-analog converters (DACs), and the first analog-to-digital conversion module is composed of N transimpedance amplifiers and N analog-to-digital converters (ADCs).

[0087] Multi-valued arithmetic unit:

[0088] The multi-valued operation unit includes k1 multi-valued operators; Figure 8 As shown, the multi-value operator includes a multi-value non-volatile storage array and a second peripheral circuit;

[0089] The second peripheral circuit includes a second digital-to-analog conversion module, a differential module and a second analog-to-digital conversion module; the output end of the second digital-to-analog conversion module is connected to the input end of the multi-valued non-volatile storage array; the output end of the multi-valued non-volatile storage array is connected to the input end of the differential module, and the output end of the differential module is connected to the input end of the second analog-to-digital conversion module; the second digital-to-analog conversion module is used to input the sign bit vector, the high bit vector or the low bit vector into the multi-valued non-volatile storage array in the form of voltage; the output ends of the multi-valued non-volatile storage array are divided into a group of two, and the differential module is used to perform differential operations on each group of outputs of the multi-valued non-volatile storage array; the second analog-to-digital conversion module is used to perform analog-to-digital conversion on the differential operation results input by the differential module. In an optional implementation, the second digital-to-analog conversion module includes multiple digital-to-analog converters, whose output ends are connected one-to-one with the input ends of each row participating in the operation in the multi-valued non-volatile storage array; the differential module includes multiple differential units, whose input ends are connected one-to-one with each group of outputs of the multi-valued non-volatile storage array; wherein the differential unit includes two transimpedance amplifiers and a voltage subtractor; each group of outputs of the multi-valued non-volatile storage array is amplified by the transimpedance amplifier and then differentially operated by the voltage subtractor; the first analog-to-digital conversion module includes multiple analog-to-digital converters, which are connected one-to-one with the output ends of each differential unit.

[0090] Further, in an optional implementation, the array size for storing the matrix in the multi-valued non-volatile storage array is K×2L; for example, the size of the multi-valued non-volatile storage array is X×Y; wherein X is a positive integer and Y is an even number; when the matrix of size K×L is stored in the first K rows and first 2L columns of the multi-valued non-volatile storage array, the element of the kth row and lth column in the matrix is ​​the difference between the conductance value of the kth row and 2l-1 column and the conductance value of the kth row and 2l column of the multi-valued non-volatile storage array, wherein k=1,2,…,K, l=1,2,…,L, K≤X, 2L≤Y. The second digital-to-analog conversion module is composed of K digital-to-analog converters (DACs), and the second analog-to-digital conversion module is composed of 2L transimpedance amplifiers and L analog-to-digital converters (ADCs). The differential module is composed of 2L electrical transimpedance amplifiers and L voltage subtractors, wherein the transimpedance amplifiers are connected to the output end of the multi-value non-volatile memory array, two adjacent columns of the multi-value non-volatile memory array are organized into a differential pair and connected to the voltage subtractor, and the analog-to-digital conversion module is composed of L analog-to-digital converters (ADCs), whose input ends are connected to the output ends of the voltage subtractors.

[0091] Further, in an optional implementation manner, the shift-accumulate module includes a first shift-accumulate unit, a second shift-accumulate unit, and a third shift-accumulate unit; the shift-accumulate output unit in this embodiment includes an arithmetic logic unit (ALU) and a corresponding cache structure;

[0092] The input end of the first shift-accumulate unit is connected to the output end of each binary operator in the binary operation unit; the input end of the second shift-accumulate unit is connected to the output end of each multi-value operator in the multi-value operation unit; the input end of the third shift-accumulate unit is connected to the output end of the first shift-accumulate unit and the output end of the second shift-accumulate unit respectively;

[0093] The first shift-accumulate unit is used for performing shift and accumulation operations on the multiplication results output by each binary operator based on a binary operation rule;

[0094] The second shift-accumulate unit is used for performing shift and accumulation operations on the multiplication results output by each multi-value operator based on a binary operation rule;

[0095] The third shift-accumulate unit is used to perform shift and accumulation operations on the outputs of the first shift-accumulate unit and the second shift-accumulate unit based on binary operation rules to obtain a vector-matrix multiplication result of the input vector and the storage matrix.

[0096] In an optional implementation manner, the above-mentioned vector-matrix multiplication operator with adjustable in-memory precision further includes: a control module; specifically, the control module includes an arithmetic logic unit (ALU) and a corresponding cache structure;

[0097] The control module is connected to the external input module, the in-memory calculation module and the shift accumulation module respectively, and is used to control the working timing of the external input module, the in-memory calculation module and the shift accumulation module as a whole during the operation process.

[0098] In an optional implementation manner, the structural diagram of the vector-matrix multiplication operator with adjustable in-memory precision is as follows: Fig. 9 As shown, its hardware structure includes: an external input module, an in-memory calculation module and a shift accumulation module. Among them, the in-memory calculation module is composed of a binary operation unit and a multi-value operation unit, and each operation unit contains multiple operators. Each operator is composed of a non-volatile memory array and its corresponding peripheral circuit. During the operation, the matrix to be operated is split according to the binary operation rules and stored in the non-volatile memory array of the operation core. The input vector is also split by the external input unit according to the binary operation rules and input into the in-memory calculation module. After the in-memory calculation module completes the calculation, the result is input into the shift accumulation output module, and the shift accumulation operation is completed according to the binary operation rules and the calculation result is output. The present invention adopts a hybrid operation architecture, and the binary operation unit processes the high-order data and the multi-value operation unit processes the low-order data, which effectively reduces the impact of the non-ideal effect of the device on the calculation result, and at the same time ensures the energy efficiency of the calculation, and can achieve high robustness and high energy efficiency precision adjustable in-memory calculation. The relevant technical features are the same as above, and will not be repeated here.

[0099] It should be noted that, for different computing requirements, the number of non-volatile storage arrays called can be adjusted to perform operations of different precisions, and the storage precision of the devices in the multi-valued computing unit can also be adjusted to fully realize the operation with adjustable precision. Furthermore, when it is necessary to ensure the computing accuracy, more high-order data can be calculated in the binary computing unit. When it is necessary to ensure the computing energy efficiency, more low-order data can be calculated in the multi-valued computing unit. Therefore, during this operation, all binary computing units can be used to ensure the computing accuracy, or all multi-valued computing units can be used to ensure the computing energy efficiency.

[0100] Furthermore, when the usage scenario permits (such as solving equations in a mixed precision architecture or applying neural network inference), a binary operation unit can be used to simultaneously complete binary operation requirements and multi-value operation requirements to reduce circuit area and ensure higher computing energy efficiency.

[0101] The relevant technical features are the same as those in Example 1 and will not be elaborated here.

[0102] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A vector-matrix multiplication method with adjustable in-memory precision, characterized in that: The following steps are involved: S1. Based on the splitting and conversion rules of the operation data, each operation data in the storage matrix is ​​converted into mixed-base data of length p1+k1 to obtain a converted storage matrix; each mixed-base data in the converted storage matrix is ​​integrated bit by bit to obtain a sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices, and they are stored in the corresponding non-volatile storage array in the order of high and low bits; A non-volatile storage array stores a matrix, and the number of non-volatile storage arrays used for calculation is p1+k1, and p1 and k1 are adjustable according to the required calculation accuracy; S2. Based on the splitting and conversion rule of the operation data, each operation data in the input vector is converted into mixed-base data of length p2+k2 to obtain a converted input vector; each mixed-base data in the converted input vector is integrated bit by bit to obtain a sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors; S3, inputting the sign bit vector, the upper bit vector and the lower bit vector into p1+k1 non-volatile storage arrays in sequence, and sequentially performing multiplication operations of the sign bit vector, the upper bit vector and the lower bit vector with p1+k1 matrices; S4, shifting and accumulating the obtained multiplication operation results based on binary operation rules to obtain the vector-matrix multiplication operation result of the input vector and the storage matrix; The splitting and conversion rule of the operation data is as follows: perform a complement operation on the operation data to obtain an m-bit binary complement expression; split the first p bits of data in the complement expression according to the binary bits to obtain 1 sign bit data and p-1 high-bit data; sequentially split the last mp bits of data in the complement expression into k bits with lengths of m1, m2, ..., m k After the binary data is converted into the corresponding decimal number, k low-order data are obtained; then 1 sign bit data, p-1 high-order data and k low-order data are arranged in sequence from high to low, thereby obtaining mixed-base data with a length of p+k; among them, 2. The vector-matrix multiplication method according to claim 1, characterized in that: The non-volatile memory array is a cross structure, and the non-volatile memory devices are located at the cross points; the non-volatile memory devices are used for binary storage or multi-value storage; The non-volatile memory array of the non-volatile memory device based on binary storage is recorded as a binary non-volatile memory array; The nonvolatile storage array based on the nonvolatile storage device of multi-value storage is recorded as a multi-value nonvolatile storage array; The non-volatile memory array includes the binary non-volatile memory array and the multi-value non-volatile memory array; The binary non-volatile storage array is used to store a sign bit matrix and a high bit matrix; The multi-value non-volatile storage array is used to store a low-bit matrix.

3. A vector-matrix multiplication operator with adjustable in-memory precision, characterized in that: include: External input module, in-memory calculation module and shift-accumulation module; The in-memory computing module includes p1+k1 non-volatile storage arrays, wherein p1 and k1 are adjustable according to the required computing accuracy; The external input module is used to convert each operation data in the storage matrix into mixed-base data with a length of p1+k1 based on the split conversion rule of the operation data to obtain a converted storage matrix; each mixed-base data in the converted storage matrix is ​​bit-integrated to obtain a sign bit matrix, p1-1 high-bit matrices and k1 low-bit matrices, and store them in the corresponding non-volatile storage arrays in the order of high and low bits; one non-volatile storage array stores one matrix; The external input module is further used to convert each operation data in the input vector into mixed-base data of length p2+k2 based on the split conversion rule of the operation data to obtain a converted input vector; integrate each mixed-base data in the converted input vector bit by bit to obtain 1 sign bit vector, p2-1 high-bit vectors and k2 low-bit vectors, and input them into p1+k1 non-volatile storage arrays in sequence; The in-memory computing module is used to sequentially implement the multiplication operation of the sign bit vector, the high bit vector and the low bit vector with p1+k1 matrices based on the non-volatile storage array; The shift-and-accumulate module is used to shift and accumulate the obtained multiplication operation result based on the binary operation rule to obtain the vector-matrix multiplication operation result of the input vector and the storage matrix; The splitting and conversion rule of the operation data is as follows: perform a complement operation on the operation data to obtain an m-bit binary complement expression; split the first p bits of data in the complement expression according to the binary bits to obtain 1 sign bit data and p-1 high-bit data; sequentially split the last mp bits of data in the complement expression into k bits with lengths of m1, m2, ..., m k After the binary data is converted into the corresponding decimal number, k low-order data are obtained; then 1 sign bit data, p-1 high-order data and k low-order data arranged in sequence from high to low are obtained, which are recorded as mixed-base data with a length of p+k; among them, 4. The vector-matrix multiplication operator according to claim 3, characterized in that: The non-volatile memory array is a cross structure, and the non-volatile memory devices are located at the cross points; The non-volatile memory device is used for binary storage or multi-value storage; The non-volatile memory array of the non-volatile memory device based on binary storage is recorded as a binary non-volatile memory array; The nonvolatile storage array based on the nonvolatile storage device of multi-value storage is recorded as a multi-value nonvolatile storage array; The non-volatile storage array includes a binary non-volatile storage array and a multi-value non-volatile storage array; The binary non-volatile storage array is used to store a sign bit matrix and a high bit matrix; The multi-value non-volatile storage array is used to store a low-bit matrix.

5. The vector-matrix multiplication operator according to claim 4, characterized in that: The non-volatile memory device includes: resistive memory, phase change memory, NOR-FLASH, spin transfer torque magnetic memory or ferroelectric field effect transistor.

6. The vector-matrix multiplication operator according to claim 4, characterized in that: The in-memory computing module includes a binary operation unit and a multi-value operation unit; The binary operation unit includes p1 binary operators; the binary operators include the binary non-volatile storage array and a first peripheral circuit; the first peripheral circuit includes a first digital-to-analog conversion module and a first analog-to-digital conversion module; the output end of the first digital-to-analog conversion module is connected to the input end of the binary non-volatile storage array; the output end of the binary non-volatile storage array is connected to the input end of the first analog-to-digital conversion module; the first digital-to-analog conversion module is used to input the sign bit vector, the high bit vector or the low bit vector into the binary non-volatile storage array in the form of voltage; The first analog-to-digital conversion module is used to perform analog-to-digital conversion on the multiplication result characterized as current output by the binary non-volatile storage array; The multi-value operation unit includes k1 multi-value operators; the multi-value operator includes the multi-value non-volatile storage array and a second peripheral circuit; the second peripheral circuit includes a second digital-to-analog conversion module, a differential module and a second analog-to-digital conversion module; The output end of the second digital-to-analog conversion module is connected to the input end of the multi-valued non-volatile storage array; the output end of the multi-valued non-volatile storage array is connected to the input end of the differential module, and the output end of the differential module is connected to the input end of the second analog-to-digital conversion module; The second digital-to-analog conversion module is used to input the sign bit vector, the high bit vector or the low bit vector into the multi-value non-volatile storage array in the form of voltage; The output ends of the multi-valued non-volatile storage array are divided into groups of two each, and the differential module is used to perform differential operation on each group of outputs of the multi-valued non-volatile storage array; The second analog-to-digital conversion module is used to perform analog-to-digital conversion on the differential operation result input by the differential module.

7. The vector-matrix multiplication operator according to claim 6, characterized in that: The first digital-to-analog conversion module includes a plurality of digital-to-analog converters, the output ends of which are connected one-to-one with the input ends of each row involved in the operation in the binary non-volatile storage array; The first analog-to-digital conversion module includes a plurality of groups of cascaded transimpedance amplifiers and analog-to-digital converters, and its input end is connected to the output end of each column involved in the operation in the multi-valued non-volatile storage array in a one-to-one correspondence.

8. The vector-matrix multiplication operator according to claim 6, characterized in that: The second digital-to-analog conversion module includes a plurality of digital-to-analog converters, the output ends of which are connected one-to-one with the input ends of each row involved in the operation in the multi-valued non-volatile storage array; The differential module includes a plurality of differential units, whose input ends are connected to each group of outputs of the multi-valued non-volatile memory array in a one-to-one correspondence; wherein the differential unit includes two transimpedance amplifiers and a voltage subtractor; each group of outputs of the multi-valued non-volatile memory array is amplified by the transimpedance amplifier and then subjected to differential operation by the voltage subtractor; The first analog-to-digital conversion module includes a plurality of analog-to-digital converters connected to the output ends of the differential units in a one-to-one correspondence.

9. The vector-matrix multiplication operator according to claim 6, characterized in that: The shift-and-accumulate module comprises a first shift-and-accumulate unit, a second shift-and-accumulate unit and a third shift-and-accumulate unit; The input end of the first shift-accumulate unit is connected to the output end of each binary operator in the binary operation unit; the input end of the second shift-accumulate unit is connected to the output end of each multi-value operator in the multi-value operation unit; the input end of the third shift-accumulate unit is connected to the output end of the first shift-accumulate unit and the output end of the second shift-accumulate unit respectively; The first shift-accumulate unit is used to perform shift and accumulation operations on the multiplication results output by each binary operator based on a binary operation rule; The second shift-accumulate unit is used to perform shift and accumulation operations on the multiplication results output by each multi-value operator based on a binary operation rule; The third shift-and-accumulate unit is used to perform shift and accumulation operations on the outputs of the first shift-and-accumulate unit and the second shift-and-accumulate unit based on binary operation rules to obtain a vector-matrix multiplication result of the input vector and the storage matrix.

10. The vector-matrix multiplication operator according to any one of claims 3 to 9, characterized in that: Also includes: Control module; The control module is connected to the external input module, the in-memory calculation module and the shift-accumulation module respectively, and is used to control the working timing of the external input module, the in-memory calculation module and the shift-accumulation module during the operation process.

Citation Information

Patent Citations

  • In-memory numerical calculation accelerator and in-memory numerical calculation method

    CN111984921A

  • Bit-Ordered Binary-Weighted Multiplier-Accumulator

    US20200356620A1

Cited By

  • Memory device and memory operation method

    US20260237440A1