CIM data processing method and device based on DDFP data structure, and electronic equipment

Through the DDFP data structure processing method, the compatibility and energy consumption problems of CIM devices when processing floating point data are solved, convenient data conversion and energy efficiency reduction are achieved, and standardized processing flow is provided.

CN119201034APending Publication Date: 2024-12-27INTERNATIONAL INNOVATION CENTER OF TSINGHUA UNIVERSITY SHANGHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411310099.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Existing CIM devices have data compatibility limitations when processing floating point data, the conversion process is cumbersome and the energy consumption is high, and there is a lack of standardized data structures and processing processes.

Method used

Using CIM data processing method based on DDFP data structure, by obtaining floating point data and quantizing it into a DDFP structure including scaling coefficients and integer data, CIM calculations are performed and the target scaling coefficients are determined, and the floating point data is finally converted, which is compatible. Digital and analog circuits reduce multiplier hardware calls.

Benefits of technology

It realizes convenient integer and floating-point data conversion, reduces energy efficiency and delay, and provides standardized processing flow and data structures, suitable for CIM equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201034A_ABST
    Figure CN119201034A_ABST
Patent Text Reader

Abstract

The invention discloses a CIM data processing method and device based on a DDFP data structure and electronic equipment. The method comprises the following steps: acquiring first floating point data; quantizing the first floating point data into a DDFP data structure corresponding to a first floating point number, the DDFP data structure comprising a first scaling coefficient and first integer data; performing CIM calculation on the first integer data to obtain second integer data; determining a target scaling coefficient according to the first scaling coefficient, the second integer data and a calculation parameter of the CIM; and determining target floating point data according to the product of the second integer data and the target scaling coefficient. According to the processing method, a standardized DDFP data structure and a processing flow are provided, a digital circuit and an analog circuit can be well compatible, convenient conversion between integer data and floating point data is achieved, multiplying unit calculation hardware does not need to be called, energy efficiency is reduced, and time delay is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a CIM data processing method based on a DDFP data structure, a CIM data processing device based on a DDFP data structure, a computer-readable storage medium and an electronic device. Background Art

[0002] When using CIM (Compute In Memory) devices for calculations, since CIM devices use DAC (Digital-to-Analog Converter) and ADC (Analog-to-Digital Converter) for data acquisition and quantization, they can only represent the calculated data linearly, so they are not compatible with floating-point data. Instead, they usually use integer data for calculations, and data scaling will occur. This is a great limitation for most regression neural network tasks, because these networks usually need to use floating-point data structures as their intermediate data streams and final outputs.

[0003] The related technology usually directly transfers the INT (Integer) data calculated by CIM to the CPU (Central Processing Unit) or other peripheral circuits, and then converts the INT data to FP (Floating Point) data. This process is very cumbersome, lacks standardized data structure and processing flow, and has high energy consumption and latency. Summary of the invention

[0004] The present invention aims to solve one of the technical problems in the related art to at least a certain extent. To this end, the first purpose of the present invention is to propose a CIM data processing method based on the DDFP data structure, obtain first floating-point data; quantize the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure includes a first scaling factor and a first integer data; perform CIM calculation on the first integer data to obtain second integer data; determine the target scaling factor according to the first scaling factor, the second integer data and the calculation parameters of CIM; determine the target floating-point data according to the product of the second integer data and the target scaling factor. The processing method of the present invention provides a standardized DDFP (Dual-Domain FloatingPoint, dual-domain floating point) data structure and processing flow, which can be better compatible with digital circuits and analog circuits, realize convenient conversion between integer data and floating-point data, and does not need to call multiplier computing hardware, which reduces energy efficiency and shortens delay.

[0005] The second objective of the present invention is to provide a CIM data processing device based on the DDFP data structure.

[0006] A third object of the present invention is to provide a computer-readable storage medium.

[0007] A fourth objective of the present invention is to provide an electronic device.

[0008] To achieve the above-mentioned purpose, a first aspect of the present invention proposes a CIM data processing method based on a DDFP data structure, the processing method comprising: acquiring first floating-point data; quantizing the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure comprises a first scaling factor and a first integer data; performing CIM calculation on the first integer data to obtain second integer data; determining a target scaling factor according to the first scaling factor, the second integer data and calculation parameters of the CIM; and determining the target floating-point data according to the product of the second integer data and the target scaling factor.

[0009] According to one embodiment of the present invention, the CIM includes an ADC and a DAC, and the calculation parameters of the CIM include: ADC gain and DAC gain. The target scaling factor is determined according to the first scaling factor, the second integer data and the calculation parameters of the CIM, including: obtaining the product of the ADC gain and the DAC gain during the read verification and the CIM calculation, respectively, recorded as the first gain product and the second gain product; determining the first scaling factor according to the ratio of the second gain product to the first gain product; when the second integer data needs to be rescaled, determining the second scaling factor according to the numerical range of the second integer data; and determining the target scaling factor according to the product of the first scaling factor, the second scaling factor and the first scaling factor.

[0010] According to an embodiment of the present invention, the processing method further includes: performing quantization processing on the first floating-point data to obtain first integer data.

[0011] According to an embodiment of the present invention, the processing method further includes: determining a first scaling factor according to the first integer data and the first floating-point data.

[0012] According to one embodiment of the present invention, the first scaling factor includes a first sign, a first exponent and a first mantissa; the first integer data includes a second sign and a value; and the first floating point data includes a third sign, a second exponent and a second mantissa.

[0013] According to one embodiment of the present invention, the first index is the same as the second index.

[0014] According to one embodiment of the present invention, the second mantissa is compressed to obtain the first mantissa, and the resolution of the first mantissa is the same as the resolution of the first integer data.

[0015] To achieve the above-mentioned purpose, the second aspect of the present invention proposes a CIM data processing device based on a DDFP data structure, the device comprising: an acquisition module, acquiring first floating-point data; a quantization module, used to quantize the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure comprises a first scaling factor and a first integer data; a calculation module, used to perform CIM calculation on the first integer data to obtain second integer data; a first determination module, determining a target scaling factor according to the first scaling factor, the second integer data and the calculation parameters of the CIM; and a second determination module, determining the target floating-point data according to the product of the second integer data and the target scaling factor.

[0016] To achieve the above-mentioned purpose, the third aspect of the present invention proposes a computer-readable storage medium, on which a CIM data processing program based on the DDFP data structure is stored. When the CIM data processing program based on the DDFP data structure is executed by a processor, the aforementioned CIM data processing method based on the DDFP data structure is implemented.

[0017] To achieve the above-mentioned purpose, an embodiment of the fourth aspect of the present invention proposes an electronic device, including a memory, a processor, and a CIM data processing program based on a DDFP data structure stored in the memory and executable on the processor. When the processor executes the CIM data processing program based on the DDFP data structure, the aforementioned CIM data processing method based on the DDFP data structure is implemented.

[0018] According to the CIM data processing method, device, and electronic device based on the DDFP data structure of the embodiment of the present invention, first floating-point data is obtained; the first floating-point data is quantized into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure includes a first scaling factor and a first integer data; the first integer data is subjected to CIM calculation to obtain second integer data; the target scaling factor is determined according to the first scaling factor, the second integer data, and the calculation parameters of the CIM; the target floating-point data is determined according to the product of the second integer data and the target scaling factor. The processing method of the present invention provides a standardized DDFP data structure and processing flow, which can be better compatible with digital circuits and analog circuits, realize convenient conversion between integer data and floating-point data, and does not need to call multiplier computing hardware, thereby reducing energy efficiency and shortening latency. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a schematic diagram of the structure of a CIM according to some embodiments of the present invention;

[0020] Figure 2 A schematic diagram of the operation principle of a single row device of a CIM according to some embodiments of the present invention;

[0021] Figure 3 is a flowchart of a CIM data processing method based on a DDFP data structure according to some embodiments of the present invention;

[0022] Figure 4 A schematic diagram of a DDFP data structure according to some embodiments of the present invention;

[0023] Figure 5 A schematic diagram of a DDFP data processing architecture according to some embodiments of the present invention;

[0024] Figure 6 is a block diagram of a CIM data processing device based on a DDFP data structure according to some embodiments of the present invention;

[0025] Figure 7 is a block diagram of an electronic device according to some embodiments of the present invention. DETAILED DESCRIPTION

[0026] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0027] The following describes in detail a CIM data processing method, device, and electronic device based on a DDFP data structure according to an embodiment of the present invention with reference to the accompanying drawings.

[0028] In some embodiments, CIM (Compute In Memory) is an efficient analog computing device that can be used to implement large-scale matrix-vector multiplication and addition operations, and is generally widely used in artificial intelligence and neural network calculations. The basic computing unit of its circuit is usually a conductance or charge modulated circuit device, such as RRAM (Resistance RAM), PCM (Phase-Change Memory), MRAM (Magnetoresistive Random Access Memory), Flash (floating gate transistor), DRAM (Dynamic Random Access Memory), SRAM (Static Random-Access Memory), etc. By selecting the row and column switches, the current is accumulated and sampled in the analog domain to achieve efficient matrix multiplication operations.

[0029] For example, refer to Figure 1, taking the RRAM storage-computation integrated array for neural network reasoning (matrix multiplication) as an example for explanation, but not as a limitation of the present invention. Generally speaking, the weight information is stored in the storage-computation integrated device in the form of conductance G, and the row and column switches are selected by using WL (Word Line) and DAC (Digital-to-Analog Converter) to apply different levels of voltage on BL (Bit Line) to obtain the current I tot After collecting the current at the SL (Source Line) end and sampling it through the ADC (Analog-to-Digital Converter), multiple sets of matrix multiplication and addition operation results can be obtained in parallel.

[0030] The specific calculation process is as follows Figure 2 As shown, Figure 2 The weight values ​​of the neural network are quantized into integers and stored in the RRAM unit. For example, the weight information is stored in the form of conductance G1, G2, ..., G n The WL controls all transistor switches in the row circuit. BL is used as the input voltage of each RRAM. The voltage value V is adjusted to correspond to different input signals. For example, the input signal can be V1, V2, ..., V n The input signal is a neuron or feature map quantized to an integer. According to Kirchhoff's current law, the current through each RRAM is V×G. All currents flowing through the RRAM will converge on the SL and be sampled as digital signals by the back-end ADC, completing a multiplication and addition operation in the analog domain. The current formula in the analog domain is as follows:

[0031] I tot =V1×G1+V2×G2+…+V n ×G n

[0032] Among them, I tot [A] represents the total current, V i(i=1,2,…,n) [V] represents the voltage applied to each memristor, G i(i=1,2,…,n) [S] represents the conductance value of each memristor, and the corresponding dimension is in square brackets.

[0033] Since CIM equipment uses DAC and ADC for data acquisition and quantization, it can only represent calculated data linearly, so it is not compatible with data in floating-point format, which has great limitations for most regression neural network tasks. The relevant technology is to transfer the INT data calculated by CIM to the CPU or other peripheral circuits for conversion from INT data to FP data. The INT data calculated by CIM is directly transferred to the CPU or other peripheral circuits, and then the INT data is converted to FP data. This process usually uses FP16 or FP32 multipliers, which will occupy a lot of hardware resources and energy consumption. At the same time, the conversion process also involves data fitting. Since the scaling coefficient of the data is generated during CIM calculation, each time the INT data obtained by CIM calculation is converted into FP data, the scaling coefficient of the data needs to be calculated by fitting, and the corresponding FP true value is obtained by using the coefficient. This process is very cumbersome and lacks standardized data structure and processing flow.

[0034] Based on this, the present invention provides a standardized DDFP data structure and processing flow, which can be better compatible with digital circuits and analog circuits, realize convenient conversion between integer data and floating-point data, and do not need to call multiplier computing hardware, thereby reducing energy efficiency and shortening delay.

[0035] Figure 3 FIG. 1 is a flow chart of a CIM data processing method based on a DDFP data structure according to some embodiments of the present invention. Figure 3 The CIM data processing method based on the DDFP data structure of the embodiment of the present application may include the following steps:

[0036] S110, obtaining first floating point data.

[0037] Specifically, the first floating-point data can be generated by a digital computing core (such as a floating-point operation unit), and the type of the first floating-point data can be determined according to actual conditions. For example, the first floating-point data can be FP16, FP32, FP64, etc., and no specific restrictions are made here.

[0038] S120: quantize the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure includes a first scaling factor and first integer data.

[0039] Specifically, the DDFP data structure includes a first scaling factor and first integer data, and the first integer data is determined according to the first floating-point data. After the first integer data is determined, the first scaling factor is determined according to the first integer data and the first floating-point data. The type of the first integer data can be determined according to actual conditions, for example, the first integer data can be INT8, INT16, INT32, etc., which is not specifically limited here.

[0040] It should be noted that the DDFP data structure adopts a storage structure in which the first integer data and the first scaling factor are stored separately, which facilitates flexible access and use of the CIM and the digital circuit.

[0041] S130, performing CIM calculation on the first integer data to obtain second integer data.

[0042] Specifically, without considering the first scaling factor, the first integer data is deployed on the CIM array to perform calculations to obtain the second integer data.

[0043] S140: Determine a target scaling factor according to the first scaling factor, the second integer data and a calculation parameter of the CIM.

[0044] Specifically, since CIM devices can only represent data linearly and are not compatible with floating-point data, integer data is usually used for calculation, and data scaling occurs during the calculation process. Therefore, when performing CIM calculation on first floating-point data, the first integer data is input into CIM for calculation to obtain second integer data, and the first scaling factor is updated according to the second integer data and the calculation parameters of CIM to determine the target scaling factor.

[0045] S150, determining target floating-point data according to the product of the second integer data and the target scaling factor.

[0046] Specifically, after obtaining the second integer data and the target scaling factor, the second integer data is multiplied by the target scaling factor to restore the second integer data to the target floating-point data.

[0047] The processing method of the present invention provides a standardized DDFP data structure and processing flow, can be well compatible with digital circuits and analog circuits, realizes convenient conversion between integer data and floating-point data, and does not need to call multiplier computing hardware, thus reducing energy efficiency and shortening delay.

[0048] In some embodiments, the CIM includes an ADC and a DAC, and the calculation parameters of the CIM include: ADC gain and DAC gain. The target scaling factor is determined according to the first scaling factor, the second integer data and the calculation parameters of the CIM, including: obtaining the product of the ADC gain and the DAC gain during the read verification and the CIM calculation, respectively, recorded as the first gain product and the second gain product; determining the first scaling factor according to the ratio of the second gain product to the first gain product; when the second integer data needs to be rescaled, determining the second scaling factor according to the numerical range of the second integer data; determining the target scaling factor according to the product of the first scaling factor, the second scaling factor and the first scaling factor.

[0049] Specifically, after the first scaling factor is determined based on the first integer data and the first floating-point data, a scaling effect will occur in subsequent calculations due to the influence of the calculation parameters of CIM (such as ADC gain and DAC gain). Therefore, it is necessary to determine the first scaling factor based on the ADC gain and DAC gain during the read verification and CIM calculation, and use the first scaling factor to update the first scaling factor. In addition, the type of the integer data obtained after the first integer data is calculated by CIM may not be the target type. For example, assuming that the target type of the second integer data is INT8, but the type of the integer data obtained after the first integer data is calculated by CIM is INT16, then it is necessary to determine the second scaling factor based on the numerical range of the second integer data, for example, the second scaling factor is 1 / 2 8 and update the first zoom factor using the second zoom factor.

[0050] Exemplarily, the calculation formula of the first zoom factor is as follows:

[0051]

[0052] The first gain product is the product of the ADC gain and the DAC gain during the reading verification, and the second gain product is the product of the ADC gain and the DAC gain during the CIM calculation.

[0053] In the case where the second integer data needs to be rescaled, the target scaling factor is calculated as follows:

[0054] Target zoom factor = first zoom factor × second zoom factor × first zoom factor

[0055] When the second integer data does not need to be rescaled, the target scaling factor is calculated as follows:

[0056] Target zoom factor = first zoom factor × first zoom factor

[0057] In some embodiments, the first scaling factor may also be determined in combination with other calculation parameters of the CIM.

[0058] In the embodiment of the present invention, the type of the first floating-point data is FP32 and the type of the first integer data is INT8. However, this is not intended to limit the present invention.

[0059] In some embodiments, the above processing method further includes: performing quantization processing on the first floating-point data to obtain first integer data.

[0060] Exemplarily, first determine the FP32 range and the INT8 range, calculate the scaling factor based on the INT8 range and the FP32 range, and determine the offset based on the minimum value of FP32, then convert the FP32 to INT8 based on the scaling factor and the offset, and finally perform clipping to limit the converted INT8 to a valid range.

[0061] In some embodiments, the processing method further includes: determining a first scaling factor according to the first integer data and the first floating-point data.

[0062] In some embodiments, the first scaling factor includes a first sign, a first exponent, and a first mantissa; the first integer data includes a second sign and a value; and the first floating point data includes a third sign, a second exponent, and a second mantissa.

[0063] Exemplarily, when the type of the first floating point data is FP32 and the type of the first integer data is INT8, the DDFP data structure is as follows: Figure 4 See Figure 4 The first scaling factor includes a first sign, a first exponent and a first mantissa, wherein the first exponent is determined according to the second exponent of the first floating-point data, and the first mantissa is determined according to the second mantissa of the first floating-point data and the value of the first integer data.

[0064] In some embodiments, the first index is the same as the second index.

[0065] For example, continue to refer to Figure 4 , the first index is the same as the second index, so that the data range that can be expressed by the first scaling factor is the same as the first floating-point data.

[0066] In some embodiments, the second mantissa is compressed to obtain the first mantissa, and a resolution of the first mantissa is the same as a resolution of the first integer data.

[0067] For example, continue to refer to Figure 4 , compress the second mantissa to obtain the first mantissa, for example, compress the second mantissa from 23 bits of FP32 to 6 bits, so when performing multiplication calculations, the cost of the multiplier can be greatly reduced, that is, from a 24-bit multiplier to a 7-bit multiplier. And the data precision of the first scaling factor is consistent with the data precision of the first integer, for example, both have a resolution of 7 bits.

[0068] In this way, the DDFP data format is well compatible with the resolution accuracy of CIM calculations, and is also compatible with the data range of the first floating-point data, thereby compressing the data without losing calculation accuracy, and also simplifying the delay and energy consumption of the corresponding computing devices.

[0069] As a specific example, the CIM architecture using the DDFP data structure is as follows Figure 5 As shown, the architecture includes a digital computing core, a CIM computing array, a quantization circuit, a shared cache, a restoration circuit, a controller, and a CPU.

[0070] Exemplarily, the digital computing core vectorization circuit first sends the first floating-point data, such as FP32 data. After the FP32 data passes through the quantization circuit, it is converted into a DDFP data structure, which includes a first integer data (such as INT8 data) and a first scaling factor. The quantized DDFP is saved in the shared cache. The CIM calculation array in the analog domain extracts the INT8 data in the DDFP from the shared cache without paying attention to the first scaling factor. The CIM calculation array uses the INT8 feature map data to interact with the shared cache and perform calculations. After the CIM calculation array is calculated, the obtained second integer data (such as INT8 data) and the corresponding updated target scaling factor are saved back to the shared cache, where the target scaling factor can be updated by the compiler (not shown) and then statically saved in the shared cache. When the second integer data needs to be restored to the target floating-point data and passed into the digital computing core, the restoration circuit extracts the DDFP from the cache and multiplies the corresponding second integer data (INT8 data) and the target scaling factor to obtain the restored target floating-point data (FP32 data). The target floating-point data (FP32 data) is sent to the digital computing core for subsequent processing.

[0071] In summary, the processing method of the present invention provides a standardized DDFP data structure and processing flow, which can be well compatible with digital circuits and analog circuits, realize convenient conversion between integer data and floating-point data, and do not need to call multiplier computing hardware, thereby reducing energy efficiency and shortening delay; the compatibility of the DDFP data structure is higher than that of the traditional floating-point data structure, and adopts a storage structure in which data and scaling factors are separated, which is convenient for flexible access and use of CIM computing arrays and digital circuits; the DDFP data structure also has the computing resolution accuracy of the integer data type widely used by the CIM computing array, and is also compatible with the data range of floating-point data; the use of the DDFP data structure also realizes data compression without losing computing accuracy, thereby simplifying the delay and energy consumption overhead of the corresponding computing device.

[0072] Corresponding to the above embodiment, the present application also proposes a CIM data processing device based on the DDFP data structure.

[0073] Reference Figure 6The CIM data processing device 200 based on the DDFP data structure includes: an acquisition module 210, a quantification module 220, a calculation module 230, a first determination module 240 and a second determination module 250.

[0074] The acquisition module 210 acquires the first floating-point data. The quantization module 220 is used to quantize the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure includes a first scaling factor and a first integer data. The calculation module 230 is used to perform CIM calculation on the first integer data to obtain second integer data. The first determination module 240 determines the target scaling factor according to the first scaling factor, the second integer data and the calculation parameters of CIM. The second determination module 250 determines the target floating-point data according to the product of the second integer data and the target scaling factor.

[0075] According to one embodiment of the present invention, the CIM includes an ADC and a DAC, and the calculation parameters of the CIM include: ADC gain and DAC gain. The first determination module 240 is specifically used to obtain the product of the ADC gain and the DAC gain during the reading verification and the CIM calculation, respectively, recorded as the first gain product and the second gain product; determine the first scaling factor according to the ratio of the second gain product to the first gain product; when the second integer data needs to be rescaled, determine the second scaling factor according to the numerical range of the second integer data; determine the target scaling factor according to the product of the first scaling factor, the second scaling factor and the first scaling factor.

[0076] According to an embodiment of the present invention, the quantization module 220 is specifically configured to perform quantization processing on the first floating-point data to obtain first integer data.

[0077] According to an embodiment of the present invention, the quantization module 220 is specifically configured to determine a first scaling factor according to the first integer data and the first floating-point data.

[0078] According to one embodiment of the present invention, the first scaling factor includes a first sign, a first exponent and a first mantissa; the first integer data includes a second sign and a value; and the first floating point data includes a third sign, a second exponent and a second mantissa.

[0079] According to one embodiment of the present invention, the first index is the same as the second index.

[0080] According to one embodiment of the present invention, the second mantissa is compressed to obtain the first mantissa, and the resolution of the first mantissa is the same as the resolution of the first integer data.

[0081] Corresponding to the above embodiments, the present application also proposes a computer-readable storage medium.

[0082] The computer-readable storage medium of the present application stores a CIM data processing program based on a DDFP data structure, and when the CIM data processing program based on a DDFP data structure is executed by a processor, the aforementioned CIM data processing method based on a DDFP data structure is implemented.

[0083] It should be noted that the above explanation of the embodiment and beneficial effects of the CIM data processing method based on the DDFP data structure is also applicable to the computer-readable storage medium of the embodiment of the present invention, and will not be elaborated here in detail to avoid redundancy.

[0084] Corresponding to the above embodiment, the present application also proposes an electronic device.

[0085] See also Figure 7 As shown, the electronic device 300 of the present application includes a memory 310, a processor 320, and a CIM data processing program based on the DDFP data structure stored in the memory 310 and executable on the processor 320. When the processor executes the CIM data processing program based on the DDFP data structure, the aforementioned CIM data processing method based on the DDFP data structure is implemented.

[0086] It should be pointed out that the above explanation of the embodiment and beneficial effects of the CIM data processing method based on the DDFP data structure is also applicable to the electronic device of the embodiment of the present invention, and will not be elaborated here in detail to avoid redundancy.

[0087] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0088] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0089] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0090] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0091] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0092] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A CIM data processing method based on DDFP data structure, characterized in that: The processing method comprises: Get the first floating point data; quantizing the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure includes a first scaling factor and first integer data; Perform CIM calculation on the first integer data to obtain second integer data; determining a target scaling factor according to the first scaling factor, the second integer data and a calculation parameter of the CIM; The target floating point data is determined according to the product of the second integer data and the target scaling factor.

2. The CIM data processing method based on the DDFP data structure according to claim 1, characterized in that: The CIM includes an ADC and a DAC, and the calculation parameters of the CIM include: an ADC gain and a DAC gain. Determining a target scaling factor according to the first scaling factor, the second integer data and the calculation parameters of the CIM includes: Respectively obtaining the product of the ADC gain and the DAC gain during reading verification and CIM calculation, and recording them as a first gain product and a second gain product; determining a first scaling factor according to a ratio of the second gain product to the first gain product; In the case where the second integer data needs to be rescaled, determining a second scaling factor according to a value range of the second integer data; The target zoom factor is determined according to the product of the first zoom factor, the second zoom factor and the first zoom factor.

3. The CIM data processing method based on the DDFP data structure according to claim 1, characterized in that: The method further comprises: The first floating-point data is quantized to obtain the first integer data.

4. The method according to claim 3, characterized in that The method further comprises: The first scaling factor is determined according to the first integer data and the first floating point data.

5. The CIM data processing method based on the DDFP data structure according to claim 3, characterized in that: in, The first scaling factor includes a first sign, a first exponent, and a first mantissa; The first integer data includes a second symbol and a value; The first floating point data includes a third sign, a second exponent, and a second mantissa.

6. The method according to claim 5, characterized in that The first index is the same as the second index.

7. The CIM data processing method based on the DDFP data structure according to claim 5, characterized in that: The second mantissa is compressed to obtain the first mantissa, and a resolution of the first mantissa is the same as a resolution of the first integer data.

8. A CIM data processing device based on DDFP data structure, characterized in that: The device comprises: An acquisition module is used to acquire first floating point data; A quantization module, configured to quantize the first floating-point data into a DDFP data structure corresponding to the first floating-point number, wherein the DDFP data structure includes a first scaling factor and first integer data; A calculation module, used for performing CIM calculation on the first integer data to obtain second integer data; A first determination module, which determines a target scaling factor according to the first scaling factor, the second integer data and a calculation parameter of the CIM; The second determination module determines the target floating point data according to the product of the second integer data and the target scaling factor.

9. A computer-readable storage medium, characterized in that: A CIM data processing program based on the DDFP data structure is stored thereon, and when the CIM data processing program based on the DDFP data structure is executed by a processor, a CIM data processing method based on the DDFP data structure according to any one of claims 1-7 is implemented.

10. An electronic device, characterized in that: The invention comprises a memory, a processor and a CIM data processing program based on a DDFP data structure which is stored in the memory and can be run on the processor. When the processor executes the CIM data processing program based on the DDFP data structure, the CIM data processing method based on the DDFP data structure according to any one of claims 1 to 7 is implemented.