Floating-point number in-memory computing system and method based on double-edge time domain computing and floating-point number in-memory computing chip

By adopting dual-edge time domain calculations in the floating-point in-memory computing system and integrating exponent summation and mantissa multiplication-accumulation, the problem of time-consuming and large-area floating-point multiplication-accumulation operations in the existing technology is solved, and more efficient calculations are achieved. .

CN118550501APending Publication Date: 2024-08-27PEKING UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410523553.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-28
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

In the prior art, the floating-point multiply-accumulate operation in the time domain requires the two operations of exponential addition and mantissa multiplication-accumulate to be separated, resulting in a large consumption of time and area.

Method used

A floating-point in-memory computing system based on dual-edge time domain calculation is used to calculate the exponent sum through multiple dual-mode in-memory computing modules, and complete the exponent summation and mantissa multiplication and accumulation in the same clock cycle, reducing area, time and power. Consumption.

Benefits of technology

It realizes the multiplication and accumulation of floating-point numbers in the same clock cycle, reduces the circuit area and power consumption, and improves the calculation speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550501A
    Figure CN118550501A
Patent Text Reader

Abstract

The invention provides a floating-point number in-memory calculation system and method based on double-edge time domain calculation and a floating-point number in-memory calculation chip, and the system comprises a plurality of dual-mode in-memory calculation modules, each dual-mode in-memory calculation module is used for calculating the index sum of each input floating-point number and each weight floating-point number in a preset time domain period; the maximum value searching module is used for determining the output time of each index sum and determining the maximum index sum and the difference value between each index sum and the maximum index sum according to the output time of each index sum; the mantissa shifting module is used for shifting the mantissa of each input floating-point number and the mantissa of each weight floating-point number according to the difference value between each index sum and the maximum index sum, and outputting the shifted mantissa of each input floating-point number and the mantissa of each weight floating-point number; and the dual-mode in-memory calculation module is also used for carrying out multiply-accumulate operation on mantissas of the shifted input floating-point numbers and the shifted weight floating-point numbers. According to the invention, the structure area, the calculation time and the power consumption overhead of the in-memory calculation system can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of neural network technology, and in particular to a floating point number in-memory computing system and method based on double-edge time-domain computing, and a floating point number in-memory computing chip. Background Art

[0002] In the field of neural networks, the accuracy of the network model often determines the final recognition accuracy. However, most in-memory computing chips currently only support integer multiplication and accumulation calculations, so the accuracy of the weights and activation values ​​in the model needs to be converted from floating point numbers to integers, which to a certain extent reduces the recognition accuracy of the overall neural network model.

[0003] In order to improve the recognition accuracy of neural network models, some in-memory computing architectures that can calculate floating-point multiplication and accumulation have emerged. Among them, the in-memory computing of floating-point numbers in the time domain is a type of computing architecture with higher energy efficiency.

[0004] However, the floating-point multiplication and accumulation operations in the time domain in the above scheme require that the two operations of floating-point exponent addition and mantissa multiplication and accumulation be completely separated in time and space, and these two processes are completed respectively by two independent modules, so the time and area consumption are relatively large. Therefore, the above architecture requires a large circuit cost to perform multi-bit weighted number multiplication and accumulation in the time domain. Summary of the invention

[0005] The present invention provides a floating-point in-memory computing system and method based on double-edge time-domain computing and a floating-point in-memory computing chip, which are used to solve the defect in the prior art that floating-point multiplication and accumulation operations in the time domain need to separate the two operation processes of floating-point exponent addition and mantissa multiplication and accumulation in time and space, and complete the two processes respectively through two independent modules, resulting in relatively large consumption of time and area. The system realizes the completion of the entire floating-point multiplication and accumulation process within the same clock cycle, reducing the overhead of area, time and power consumption.

[0006] The present invention provides a floating point number in-memory computing system based on double-edge time domain computing, the system comprising:

[0007] A plurality of dual-mode in-memory computing modules, each of which is used to calculate the exponential sum of each input floating-point number and weighted floating-point number within a preset time domain period;

[0008] A maximum value search module, the maximum value search module is connected to each of the dual-mode in-memory calculation modules, the maximum value search module is used to determine the output time of each of the exponential sums, and determine the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums;

[0009] A mantissa shifting module, the mantissa shifting module is connected to the maximum value searching module, and the mantissa shifting module is used to shift the mantissa of each of the input floating-point numbers and the weighted floating-point numbers according to the difference between each of the exponent sums and the maximum exponent sum, and output the mantissa of each of the input floating-point numbers and the weighted floating-point numbers after the shifting;

[0010] The dual-mode in-memory computing module is also used to perform multiplication and accumulation operations on the mantissas of the shifted input floating-point numbers and weighted floating-point numbers.

[0011] According to the floating point number in-memory computing system based on double-edge time domain computing provided by the present invention, the system also includes:

[0012] A plurality of memory modules are arranged between each of the dual-mode in-memory computing modules and the mantissa shifting modules, each of the memory modules corresponds one-to-one to each of the dual-mode in-memory computing modules, and are used to store the mantissas of each of the shifted input floating-point numbers and weighted floating-point numbers.

[0013] According to the floating point number in-memory computing system based on double-edge time domain computing provided by the present invention, the system also includes:

[0014] A plurality of memory modules are used to store the exponents of each of the input floating point numbers and weight floating point numbers, each of the memory modules corresponds one-to-one to each of the dual-mode in-memory computing modules, and is used to store the exponents of each of the input floating point numbers and weight floating point numbers.

[0015] According to the floating point number in-memory computing system based on double-edge time domain computing provided by the present invention, the maximum exponent sum and the difference between each exponent sum and the maximum exponent sum are determined according to the output time of each exponent sum, including:

[0016] Setting the structure and calculation logic of the dual-mode in-memory calculation module, setting the delay between the time domain input pulse and the time domain output pulse to be smaller as the index and the time domain input pulse are larger;

[0017] Obtaining the exponential sum with the minimum delay, and determining the exponential sum corresponding to the minimum delay as the maximum exponential sum;

[0018] The delay difference between each of the delays and the minimum delay is calculated, and the difference between each of the exponential sums and the maximum exponential sum is determined according to each of the delay differences.

[0019] According to the floating point number in-memory computing system based on double-edge time domain computing provided by the present invention, the maximum exponent sum and the difference between each exponent sum and the maximum exponent sum are determined according to the output time of each exponent sum, and further includes:

[0020] Setting the structure and calculation logic of the dual-mode in-memory calculation module, setting the delay between the time domain input pulse and the time domain output pulse to be larger as the index and the delay between the time domain input pulse and the time domain output pulse are larger;

[0021] Obtaining the maximum exponential sum of the delay, and determining the exponential sum corresponding to the maximum delay as the maximum exponential sum;

[0022] The delay difference between each of the delays and the maximum delay is calculated, and the difference between each of the exponential sums and the maximum exponential sum is determined according to each of the delay differences.

[0023] According to the floating-point number in-memory computing system based on double-edge time-domain calculation provided by the present invention, each of the dual-mode in-memory computing modules includes a plurality of dual-mode in-memory computing units connected in series, and each of the dual-mode in-memory computing units is used to store each bit thermometer code obtained by exponential conversion of multi-bit input floating-point numbers and weighted floating-point numbers, and the exponential sum of each input floating-point number and the weighted floating-point number is obtained by calculating the thermometer code stored in each of the dual-mode in-memory computing units.

[0024] According to the floating-point in-memory computing system based on double-edge time-domain computing provided by the present invention, the dual-mode in-memory computing unit is a four-stage series-connected inverter; the ground terminals of the first-stage inverter and the third-stage inverter are respectively provided with a first computing structure, and the first computing structure is used to calculate the exponential sum of each input floating-point number and the weighted floating-point number; the power supply terminals of the first-stage inverter and the third-stage inverter are respectively provided with a second computing structure, and the second computing structure is used to calculate the multiplication and accumulation of the mantissas of each input floating-point number and the weighted floating-point number.

[0025] According to the floating-point in-memory computing system based on double-edge time-domain computing provided by the present invention, the dual-mode in-memory computing unit is a four-stage series-connected inverter; the power supply end of the second-stage inverter and the fourth-stage inverter are respectively provided with a third computing structure, and the third computing structure is used to calculate the exponential sum of each input floating-point number and the weighted floating-point number; the ground end of the second-stage inverter and the fourth-stage inverter are respectively provided with a fourth computing structure, and the fourth computing structure is used to calculate the multiplication and accumulation of the mantissa of each input floating-point number and the weighted floating-point number.

[0026] The present invention also provides a floating-point number in-memory calculation method based on double-edge time-domain calculation, the method is implemented by the floating-point number in-memory calculation system based on double-edge time-domain calculation as described in any one of the above items, and the method comprises:

[0027] Calculate the exponential sum of the input floating point number and the weighted floating point number within a preset time domain period through the dual-mode in-memory calculation module;

[0028] Determine the output time of each of the exponential sums by a maximum value search module, and determine the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums;

[0029] According to the difference between each exponent sum and the maximum exponent sum, the mantissa of each input floating-point number and the weight floating-point number is shifted by a mantissa shift module, and the mantissa of each input floating-point number and the weight floating-point number after the shift is output;

[0030] The shifted mantissas of each of the input floating-point numbers and the weighted floating-point numbers are input into the dual-mode memory computing module for multiplication and accumulation operations.

[0031] The present invention also provides a floating-point in-memory computing chip, comprising the floating-point in-memory computing system based on double-edge time-domain computing as described in any of the above items.

[0032] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the floating-point in-memory calculation method based on double-edge time domain calculation as described above is implemented.

[0033] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the floating-point number in-memory calculation method based on double-edge time domain calculation as described in any one of the above is implemented.

[0034] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the floating-point number in-memory calculation method based on double-edge time domain calculation as described above is implemented.

[0035] The present invention provides a floating-point number in-memory computing system and method based on double-edge time-domain computing and a floating-point number in-memory computing chip. The system calculates the exponential sum of each input floating-point number and weighted floating-point number within a preset time-domain period through a plurality of dual-mode in-memory computing modules, determines the output time of each exponential sum through a maximum value search module, and determines the maximum exponential sum and the difference between each exponential sum and the maximum exponential sum according to the output time of each exponential sum; shifts the mantissa of each input floating-point number and weighted floating-point number according to the difference between each exponential sum and the maximum exponential sum through a mantissa shift module, and outputs the mantissa of each shifted input floating-point number and weighted floating-point number; and performs multiplication and accumulation operations on the mantissa of each shifted input floating-point number and weighted floating-point number through the dual-mode in-memory computing module. The present invention integrates the exponential summation and mantissa multiplication and accumulation in the in-memory calculation of floating-point numbers into the same in-memory calculation module in the time domain, thereby avoiding the extra area, time and power consumption overhead caused by the need to transmit and process the exponential summation result over a long distance and then input the additional mantissa multiplication and accumulation module after the result is output; the function of simultaneously searching for the maximum value and generating the difference in the process of performing the floating-point exponential summation is realized, the extra time required for the two modules to run independently is reduced, and the speed of the overall calculation is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 An implementation scheme for floating-point time-domain in-memory calculation provided by the prior art;

[0038] Figure 2 A floating point number time domain in-memory computing implementation scheme provided in an embodiment of the present invention;

[0039] Figure 3 A schematic diagram of the structure of a floating-point in-memory computing system based on double-edge time-domain computing provided by an embodiment of the present invention;

[0040] Figure 4 A floating-point time-domain calculation circuit structure based on double-edge provided in an embodiment of the present invention;

[0041] Figure 5 Input and output waveform diagrams under different calculation results provided by the embodiments of the present invention;

[0042] Figure 6A working timing diagram of a floating-point in-memory computing system based on double-edge time-domain computing provided by an embodiment of the present invention;

[0043] Figure 7 A schematic flow chart of a floating point number in-memory calculation method based on double-edge time domain calculation provided by an embodiment of the present invention;

[0044] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] For a floating-point multiplication and accumulation, the traditional calculation process is as follows Figure 1 As shown, Figure 1 In the implementation of floating-point time-domain in-memory calculation provided by the prior art, the multiplication of the e exponent is expressed as the addition of the floating-point exponent bits in the actual calculation process, so the first step of floating-point multiplication and accumulation is to perform the exponential sum of the single weight and input ExponentialAdd. After the exponential sum is completed, since the e exponent of each product of the weight and input is a different value, the mantissa value cannot be directly multiplied and accumulated. It is necessary to find the largest exponential sum among the different exponent sums, that is, Figure 1 The maximum value is found in the Max Finder, and then the mantissa is shifted and aligned according to the difference between each exponent sum and the maximum exponent sum, so as to obtain the mantissa that can be multiplied and accumulated. In the existing floating-point in-memory computing architecture, finding the difference between each exponent sum and the maximum exponent sum is an independent module, the Difference Generator, and shifting and aligning the mantissa according to the difference is also an independent module, the Mantissa Shift module. After the maximum value is found and the mantissa is shifted, the multiplication and accumulation of the mantissa can be calculated according to the shifted and aligned mantissa, and finally the output result of the entire floating-point multiplication and accumulation is obtained.

[0047] The above scheme has certain defects, because the calculation of floating-point numbers needs to be completed by calculating the exponential addition first and adjusting the order of the decimal point position of the mantissa according to the addition result. Therefore, the current mainstream floating-point time domain calculation method is mainly to perform exponential addition and mantissa multiplication and accumulation operations respectively through two independent modules, thereby realizing the overall floating-point multiplication and accumulation. The most commonly used scheme in existing work is to realize the addition of floating-point exponents by accumulating delay time, converting multi-bit floating-point exponents into thermometer codes and storing them in an array, and then controlling the delay time of the time domain delay chain through the thermometer code exponent bits stored in the array, and obtaining the result of exponential addition through TDC quantization. The result of exponential addition needs to be input into an independent maximum value search module to generate the maximum value mark and the difference between other addition results and the maximum value. After finding the maximum value and the difference between other addition results and the maximum value, it is also necessary to adjust the value of the mantissa according to the result and input it into the next module for the mantissa multiplication and accumulation process. In the existing solutions, in order to realize multi-bit mantissa multiplication and accumulation, the mantissa multiplication and accumulation module does not adopt the structure of full time domain in-memory calculation, but combines the overall multi-bit multiplication and accumulation realized by the charge domain calculation structure, thus limiting the combination between the two modules.

[0048] To solve the above problems, the present invention provides a new implementation scheme for floating-point number time-domain in-memory calculation. Figure 2 An implementation scheme for floating-point number time-domain in-memory calculation provided by an embodiment of the present invention is as follows: Figure 2As shown, from the perspective of time, compared with the existing architecture, the present invention adopts a solution that simultaneously completes the maximum value search and exponential difference generation in the process of calculating the exponential sum. Since the delay of the pulse edge in the process of time domain accumulation represents the result of the accumulation, the present invention compares the size according to the early or late arrival of the pulse edge, and quantizes it into the difference of different exponential sums according to the time between the pulse edges. In this way, no additional time is required between the mantissa shift module Mantissa Shift and the exponential sum module ExponentialAdd to perform the maximum value search and exponential difference generation, saving the time required for these two modules. From the perspective of the overall area, this design uses the two ends of the same calculation unit to perform the calculation of exponential addition and mantissa multiplication and accumulation respectively, so these two parts are integrated into the same module Dual-Mode CIM. According to the structure of the actual circuit, the integrated dual-mode in-memory calculation Dual-Mode CIM array is reduced by at least 30% compared to the two separate arrays before, because the calculation array occupies the vast majority of the area in the actual in-memory calculation chip, so the optimization effect in this regard is very important. At the same time, all the exponents and data obtained can be transmitted back to the nearest module after passing through the maximum value search and exponent difference generation module Max Finder & Difference Generator and the mantissa shift module Mantissa Shift to continue the multiplication and accumulation operation of the mantissa, and finally obtain the output result of the entire floating-point multiplication and accumulation. In this way, the overall circuit is not a serial structure that requires long-distance transmission. Not only does the integration between modules reduce the area of ​​the overall circuit, but also reduces the extra time and power consumption of long-distance data transmission.

[0049] Based on the above embodiments, the embodiments of the present invention provide a floating point number in-memory computing system based on double-edge time domain computing. Figure 3 A schematic diagram of the structure of a floating-point in-memory computing system based on double-edge time-domain computing provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the system comprises:

[0050] A plurality of dual-mode in-memory computing modules, each of which is used to calculate the exponential sum of each input floating-point number and weighted floating-point number within a preset time domain period;

[0051] A maximum value search module, the maximum value search module is connected to each of the dual-mode in-memory calculation modules, the maximum value search module is used to determine the output time of each of the exponential sums, and determine the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums;

[0052] A mantissa shifting module, the mantissa shifting module is connected to the maximum value searching module, and the mantissa shifting module is used to shift the mantissa of each of the input floating-point numbers and the weighted floating-point numbers according to the difference between each of the exponent sums and the maximum exponent sum, and output the mantissa of each of the input floating-point numbers and the weighted floating-point numbers after the shifting;

[0053] The dual-mode in-memory computing module is also used to perform multiplication and accumulation operations on the mantissas of the shifted input floating-point numbers and weighted floating-point numbers.

[0054] Optionally, the floating-point in-memory computing system based on double-edge time-domain calculation in the above embodiment also includes: multiple memory modules arranged between each of the dual-mode in-memory computing modules and the mantissa shifting module, each of the memory modules corresponding one-to-one to each of the dual-mode in-memory computing modules, and used to store the mantissa of each of the shifted input floating-point numbers and weighted floating-point numbers.

[0055] Optionally, the floating-point in-memory computing system based on double-edge time-domain calculation in the above embodiment also includes: multiple memory modules for storing the exponents of each of the input floating-point numbers and weighted floating-point numbers, each of the memory modules corresponding one-to-one to each of the dual-mode in-memory computing modules, and used to store the exponents of each of the input floating-point numbers and weighted floating-point numbers.

[0056] Optionally, in the floating-point in-memory computing system based on double-edge time-domain calculation in the above embodiment, the memory module is SRAM, DRAM or other types of memory.

[0057] Optionally, in the above embodiment, determining the maximum exponential sum and the difference between each exponential sum and the maximum exponential sum according to the output time of each exponential sum specifically includes:

[0058] Setting the structure and calculation logic of the dual-mode in-memory calculation module, setting the delay between the time domain input pulse and the time domain output pulse to be smaller as the index and the time domain input pulse are larger;

[0059] Obtaining the exponential sum with the minimum delay, and determining the exponential sum corresponding to the minimum delay as the maximum exponential sum;

[0060] The delay difference between each of the delays and the minimum delay is calculated, and the difference between each of the exponential sums and the maximum exponential sum is determined according to each of the delay differences.

[0061] As another implementation manner, in the above embodiment, determining the maximum exponential sum and the difference between each exponential sum and the maximum exponential sum according to the output time of each exponential sum may further specifically include:

[0062] Setting the structure and calculation logic of the dual-mode in-memory calculation module, setting the delay between the time domain input pulse and the time domain output pulse to be larger as the index and the delay between the time domain input pulse and the time domain output pulse are larger;

[0063] Obtaining the maximum exponential sum of the delay, and determining the exponential sum corresponding to the maximum delay as the maximum exponential sum;

[0064] The delay difference between each of the delays and the maximum delay is calculated, and the difference between each of the exponential sums and the maximum exponential sum is determined according to each of the delay differences.

[0065] Optionally, each of the dual-mode in-memory computing modules includes a plurality of dual-mode in-memory computing units connected in series, and each of the dual-mode in-memory computing units is used to store each bit thermometer code obtained by exponential conversion of multi-bit input floating-point numbers and weighted floating-point numbers, and the exponential sum of each input floating-point number and weighted floating-point number is obtained by operating on the thermometer codes stored in each of the dual-mode in-memory computing units.

[0066] As a specific implementation, the dual-mode in-memory computing unit is a four-stage series-connected inverter; the ground terminals of the first-stage inverter and the third-stage inverter are respectively provided with a first computing structure, and the first computing structure is used to calculate the exponential sum of each input floating-point number and the weighted floating-point number; the power supply terminals of the first-stage inverter and the third-stage inverter are respectively provided with a second computing structure, and the second computing structure is used to calculate the multiplication and accumulation of the mantissas of each input floating-point number and the weighted floating-point number.

[0067] As another implementation, the dual-mode in-memory computing unit is a four-stage series-connected inverter; the power supply terminals of the second-stage inverter and the fourth-stage inverter are respectively provided with a third computing structure, and the third computing structure is used to calculate the exponential sum of each input floating-point number and the weighted floating-point number; the ground terminals of the second-stage inverter and the fourth-stage inverter are respectively provided with a fourth computing structure, and the fourth computing structure is used to calculate the multiplication and accumulation of the mantissas of each input floating-point number and the weighted floating-point number.

[0068] For example, Figure 4 A floating point time domain calculation circuit structure based on double edges is provided in an embodiment of the present invention, such as Figure 4As shown, in this circuit, the input pulse PULSE_IN and the output pulse PULSE_OUT are connected by four stages of inverters in series: PM2 and NM0, PM3 and NM1, PM4 and NM2, PM5 and NM3. At the ground terminals of the first and third stage inverters, additional calculation structures are added to calculate the exponential sum of the floating-point input and the weight. In the first stage, two transistors NM8 and NM9 are connected in parallel between the ground and the source terminal of NM0, the gate terminal of NM8 is connected to the fixed bias voltage VBIAS_E for exponential calculation, and the gate terminal of NM9 is connected to the exponent bit E_IN of the input floating-point value corresponding to the unit. In the third stage, two transistors NM10 and NM11 are connected in parallel between the ground and the source terminal of NM2, the gate terminal of NM10 is connected to the fixed bias voltage VBIAS_E for exponential calculation, and the gate terminal of NM11 is connected to the exponent bit E_W of the weight floating-point value corresponding to the unit. At the power supply end of the first and third stage inverters, additional calculation structures are added to calculate the multiplication and accumulation results of the floating-point input and the mantissa of the weight. In the first stage of calculating the first mantissa product, the source and drain of PM0 are connected between the power supply and the source end of PM2, and the drain ends of NM4 and NM5 are connected to the gate end of PM0 at the same time. The source end of NM4 is connected to the voltage M_IN1 controlled by the mantissa bit of the input floating-point number, and the gate end is connected to the mantissa bit M_W1 of the weight floating-point number. The source end of NM5 is connected to the ground, and the gate end is connected to the mantissa bit inversion M_W1_B of the weight floating-point number. In the third stage of calculating the second mantissa product, the source and drain of PM1 are connected between the power supply and the source end of PM4, and the drain ends of NM6 and NM7 are connected to the gate end of PM1 at the same time. The source end of NM6 is connected to the voltage M_IN2 controlled by the mantissa bit of the input floating-point number, and the gate end is connected to the mantissa bit M_W2 of the weight floating-point number. The source terminal of NM7 is connected to the ground, and the gate terminal is connected to the inverted mantissa bit M_W2_B of the weighted floating point number.

[0069] correspond Figure 4 The circuit structure of Figure 5 The input and output waveform diagrams under different calculation results provided by the embodiments of the present invention are as follows: Figure 5As shown, when the rising edge of the input pulse signal arrives, NM0 in the first-stage inverter and NM2 in the third-stage inverter are turned on and discharged downward, and the exponential sum of the input floating-point number and the weighted floating-point number begins to be calculated. In the first stage, there is an inherent current path turned on by NM8, and another parallel path controlled by the input floating-point number exponent value E_IN. In the third stage, there is an inherent current path turned on by NM10, and another parallel path controlled by the weighted floating-point number exponent value E_W. When E_IN and E_W are both 0, NM9 and NM11 are both in the off state, so only the inherent current path is turned on to generate a pull-down current, and the actual input pulse rising edge delay will be greater. When one of E_IN and E_W is 1 and the other is 0, one of the first-stage inverter and the third-stage inverter is pulled down by two transistors at the same time, while the other is still pulled down by an inherent current path, so the actual input pulse rising edge delay is smaller than when both values ​​are 0. When E_IN and E_W are both 1, the first-stage inverter and the third-stage inverter are pulled down by two series transistors at the same time, so the actual input pulse rising edge delay is even smaller. Therefore, Figure 5 As shown in the figure, when the rising edge is used to calculate the exponential sum, as the value of E_IN+E_W increases, the delay of the rising edge of the input pulse will decrease accordingly.

[0070] When the falling edge of the input pulse arrives, PM2 in the first-stage inverter and PM4 in the third-stage inverter are turned on and pulled up through PM0 and PM1. In this circuit structure, the first and third stages can calculate two multiplication results respectively and add them in series through the delay unit. In the first stage, if the weight mantissa bit M_W1 is 0, its negated value M_W1_B is 1, NM4 is turned off, NM5 is turned on, and the gate terminal of PM0 is grounded. The pull-up current at this time is the largest, so the delay time of the falling edge of the input pulse is also the smallest. In the first stage, if the weight mantissa bit M_W1 is 1, its negated value M_W1_B is 0, NM5 is turned off, NM4 is turned on, and the gate terminal of PM0 is connected to the voltage M_IN1 controlled by the mantissa bit of the input floating point number. When the mantissa of the input floating-point number is 0, M_IN1 is ground, and the gate terminal of PM0 is equivalent to being connected to the ground, so the delay time of the falling edge of the input pulse is as small as when M_W1 is 0. When the mantissa of the input floating-point number is 1, M_IN1 is a voltage higher than the ground, and the on-current of PM0 is smaller than the previous case, so the pull-up time will be longer, and the delay of the falling edge of the input pulse will also be longer. Therefore, when at least one of M_IN1 and M_W1 is 0, the delay of the falling edge of the input pulse will be a relatively small value, and when both M_IN1 and M_W1 are 1, the delay of the falling edge of the input pulse will be a larger value. The above process of the third level is the same as that of the first level.

[0071] Will Figure 4 The circuit structure in is applied to Figure 3 In the floating point in-memory computing system based on double-edge time domain calculation, the working sequence is as follows Figure 6 As shown, Figure 6 The working timing diagram of the floating-point in-memory computing system based on double-edge time-domain computing provided in the embodiment of the present invention is mainly divided into four stages within a certain time-domain computing cycle: exponential summation and maximum value search, mantissa shifting, mantissa multiplication and accumulation, and output.

[0072] The following is a detailed introduction Figure 6 The above four stages.

[0073] Exponential summation and maximum value finding phase:

[0074] In this stage, it is necessary to obtain the maximum value of multiple exponents and results while performing exponential summation.

[0075] According to the actual value, we can calculate the longest delay time under the maximum range. The corresponding pulse is the last output pulse, and all output pulse edges will not exceed this pulse signal. Between the rising edge of the input pulse and the last output pulse, the enable signal maximum value finder that controls the maximum value search is turned on. Since in the calculation circuit, the larger the accumulated result, the smaller the rising edge delay, the rising edge of the output pulse corresponding to the maximum value will appear first in this time period among all the output pulse rising edges, which also marks the beginning of quantization. Finally, the delay time between the rising edge of the output pulse corresponding to the maximum value and the rising edge of the output pulse corresponding to each index is sampled by the counter, so as to obtain the difference between each index sum and the maximum index sum. These processes are completed within the pulse width of the maximum value finder.

[0076] In this stage, the present invention realizes the functions of simultaneously performing exponential summation and maximum value search, integrating these two modules at the same time, and greatly reducing the extra time for data waiting and transmission.

[0077] Mantissa shift stage:

[0078] In this stage, the corresponding mantissa is shifted according to the exponent and maximum value found in the previous stage and the difference between other exponents and maximum values.

[0079] Specifically, all exponents and data can only be obtained after the latest output pulse signal's last output pulse rising edge arrives, and the arrival of the falling edge of the input pulse signal PULSE_IN represents the beginning of the multiplication and accumulation of the mantissa, so there needs to be enough time for the mantissa shifting in the middle, and its enable signal is the mantissa shifter. This period of time cannot be omitted or replaced in all work. In the present invention, the mantissa shifting module has two different inputs, one is the mantissa value of the floating-point input and weight before shifting: M_IN and M_W, and the other is the difference between each calculated exponent sum and the maximum exponent sum output by the maximum value finder of the maximum value finding module. The module will shift the mantissa part of its floating-point input and weight according to the difference between the exponent sum and the maximum exponent sum, and input the new mantissa value generated after the shift into the corresponding memory unit. The shifted memory unit will be directly connected to the in-memory computing unit to perform the mantissa multiplication and accumulation operation of the next stage.

[0080] Mantissa multiplication and accumulation stage:

[0081] In this stage, the shifted floating-point input and the mantissa of the weight are multiplied and added by the designed double-edge-based floating-point time-domain calculation unit.

[0082] According to the actual value, first calculate the longest delay time under the maximum range. The corresponding pulse is the last output pulse, and all output pulse edges will not exceed this pulse signal. Between the falling edge of the input pulse and the last output pulse, the enable signal of the quantization process of the mantissa multiplication and accumulation is turned on and sampled by the counter. The counter starts sampling from the falling edge of the input pulse PULSE_IN, stops sampling at the falling edge of the input pulse PULSE_OUT, and keeps the current count result. Since the falling edges of the output pulses of all mantissa multiplication and accumulation results stay within this period of time, all results will complete the counting and keep the results before the falling edge of the last output pulse arrives.

[0083] In this stage, the operations of mantissa multiplication and accumulation and counter quantization are performed simultaneously, so before the next stage arrives, the final results of all floating-point multiplication and accumulation calculations can be directly obtained without the need for additional time to quantize the results.

[0084] Output stage:

[0085] In this stage, the final output result has been determined, all calculations and sampling have been completed, and the data remains unchanged. At this time, after the quantization enable signal multiplication and accumulation of the mantissa arrives at the normalized falling edge, the final digital result can be digitized and output, and the final digital result output is completed before the rising edge of the next input pulse signal PULSE_IN arrives.

[0086] It is understandable that in the common floating-point time-domain memory computing architecture, the exponential summation module, the maximum value search module, the mantissa shift module, and the mantissa multiplication and accumulation module are often completely separated and completely separated in different chip modules. This is often because the circuit structure of the floating-point exponential summation and the circuit structure of the mantissa multiplication and accumulation in the existing work are not compatible, so they cannot be integrated into the same circuit module. This not only causes the area of ​​the actual circuit to increase a lot, but also generates a lot of extra data transmission time and power consumption. In the present invention, the exponential summation circuit and the mantissa multiplication and accumulation circuit of the floating-point number can be perfectly integrated into the same time-domain memory computing unit, so the area of ​​the overall circuit is greatly reduced, and the long-distance transmission of data is also avoided. At the same time, because this time-domain memory computing unit can use the rising edge and falling edge of the clock at the same time, the time utilization rate in actual work is also greatly improved, thereby improving the speed of actual circuit calculation.

[0087] Based on the above embodiments, the floating-point in-memory calculation system based on double-edge time domain calculation provided by the present invention can integrate the floating-point exponent summation and mantissa multiplication and accumulation in the same module in a double-edge floating-point time domain calculation delay unit; a scheme for calculating the exponent summation and mantissa multiplication and accumulation in the floating-point in-memory calculation using the rising edge and falling edge of the pulse respectively in the same clock cycle; a floating-point in-memory calculation scheme for performing maximum value search and difference generation while performing floating-point exponent summation.

[0088] Furthermore, the present invention integrates the exponential summation and mantissa multiplication and accumulation in the floating-point in-memory calculation into the same time-domain in-memory calculation delay unit, thereby avoiding the extra area, time and power consumption overhead caused by the need to transmit and process the exponential summation result over a long distance and then input the additional mantissa multiplication and accumulation module after the exponential summation result is output. The present invention uses the rising edge and the falling edge of the clock to respectively calculate the exponential summation and mantissa multiplication and accumulation in the floating-point in-memory calculation, thereby completing the entire floating-point multiplication and accumulation process within the same clock cycle, reducing the extra time consumption. The present invention realizes the function of simultaneously searching for the maximum value and generating the difference in the process of performing the floating-point exponential summation, reducing the extra time required for the two modules to run independently, and improving the speed of the overall calculation.

[0089] In the specific implementation process, the specific structure and logic of the calculation unit can be adjusted, for example, changing the delay when the calculation result is larger to the delay when the calculation result is smaller, which can still meet the needs of the top-level architecture. The memory type used to store the input and weight values ​​can be adjusted, for example, SRAM can be adjusted to other memory types such as DRAM. The principle and structure of the maximum value finder can be adjusted, for example, it can be adjusted from getting the maximum value first and starting to sample other results to starting sampling after each result is output until the last maximum value is calculated. The principle and structure of the mantissa shift can be adjusted, for example, the mantissa bits of the input and weight can be written into the module at the same time as the output of the maximum value finder and shifted to first write the mantissa bits of the input and weight and then shift the mantissa value in the memory according to its output after the maximum value finder completes its work. The embodiment of the present invention does not specifically limit the above content.

[0090] The floating-point number in-memory computing system based on double-edge time-domain computing provided by the present invention calculates the exponential sum of each input floating-point number and weighted floating-point number within a preset time-domain period through multiple dual-mode in-memory computing modules, determines the output time of each exponential sum through a maximum value search module, and determines the maximum exponential sum and the difference between each exponential sum and the maximum exponential sum according to the output time of each exponential sum; shifts the mantissa of each input floating-point number and weighted floating-point number according to the difference between each exponential sum and the maximum exponential sum through a mantissa shift module, and outputs the mantissa of each shifted input floating-point number and weighted floating-point number; and performs multiplication and accumulation operations on the mantissa of each shifted input floating-point number and weighted floating-point number through the dual-mode in-memory computing module. The present invention integrates the exponential summation and mantissa multiplication and accumulation in the in-memory calculation of floating-point numbers into the same time-domain in-memory calculation delay unit, thereby avoiding the extra area, time and power consumption overhead caused by the need to transmit and process the exponential summation result over a long distance and then input an extra mantissa multiplication and accumulation module after the exponential summation result is output; the exponential summation and mantissa multiplication and accumulation in the in-memory calculation of floating-point numbers are calculated respectively by using the rising edge and the falling edge of the clock, so that the whole floating-point multiplication and accumulation process is completed within the same clock cycle, reducing the extra time consumption; the function of simultaneously searching for the maximum value and generating the difference in the process of performing the floating-point exponential summation is realized, so that the extra time required for the two modules to run independently is reduced, and the overall calculation speed is improved.

[0091] The floating-point number in-memory calculation method based on double-edge time-domain calculation provided by the present invention is described below. The floating-point number in-memory calculation method based on double-edge time-domain calculation described below and the floating-point number in-memory calculation system based on double-edge time-domain calculation described above can correspond to each other.

[0092] Figure 7 A schematic diagram of a flow chart of a floating point number in-memory calculation method based on double-edge time domain calculation provided by an embodiment of the present invention, such as Figure 7 As shown, the method includes:

[0093] Step 710, calculating the exponential sum of the input floating point number and the weighted floating point number within a preset time domain period through the dual-mode in-memory calculation module;

[0094] Step 720, determining the output time of each of the exponential sums through a maximum value search module, and determining the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums;

[0095] Step 730, shifting the mantissa of each of the input floating-point numbers and the weighted floating-point number through a mantissa shifting module according to the difference between each of the exponent sums and the maximum exponent sum, and outputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point number;

[0096] Step 740, input the shifted mantissas of each of the input floating-point numbers and the weighted floating-point numbers into the dual-mode in-memory computing module for multiplication and accumulation operations.

[0097] The implementation principle and beneficial effects of the floating-point in-memory calculation method based on double-edge time-domain calculation provided in an embodiment of the present invention are similar to the implementation principle and beneficial effects of the floating-point in-memory calculation system based on double-edge time-domain calculation shown in the above embodiment. Please refer to the implementation principle and beneficial effects of the floating-point in-memory calculation system based on double-edge time-domain calculation shown in the above embodiment, and no further details will be given here.

[0098] The present invention also provides a floating-point in-memory computing chip, comprising the floating-point in-memory computing system based on double-edge time-domain computing as described in any of the above items.

[0099] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8 As shown, the electronic device may include: a processor (processor) 810, a communication interface (Communications Interface) 820, a memory (memory) 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call the logic instructions in the memory 830 to execute the floating-point in-memory calculation method based on double-edge time domain calculation, which method includes: calculating the exponential sum of the input floating-point number and the weighted floating-point number within a preset time domain period through a dual-mode in-memory calculation module; determining the output time of each of the exponential sums through a maximum value search module, and determining the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums; shifting the mantissa of each of the input floating-point numbers and the weighted floating-point number through a mantissa shift module according to the difference between each of the exponential sums and the maximum exponential sum, and outputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point number; inputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point number into the dual-mode in-memory calculation module for multiplication and accumulation operations.

[0100] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0101] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the floating-point in-memory calculation method based on double-edge time domain calculation provided by the above-mentioned methods, the method including: calculating the exponential sum of input floating-point numbers and weighted floating-point numbers within a preset time domain period through a dual-mode in-memory calculation module; determining the output time of each of the exponential sums through a maximum value search module, and determining the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum based on the output time of each of the exponential sums; shifting the mantissa of each of the input floating-point numbers and the weighted floating-point numbers through a mantissa shifting module based on the difference between each of the exponential sums and the maximum exponential sum, and outputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point numbers; inputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point numbers into the dual-mode in-memory calculation module for multiplication and accumulation operations.

[0102] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the floating-point in-memory calculation method based on double-edge time domain calculation provided by the above-mentioned methods, the method comprising: calculating the exponential sum of input floating-point numbers and weighted floating-point numbers within a preset time domain period through a dual-mode in-memory calculation module; determining the output time of each of the exponential sums through a maximum value search module, and determining the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum based on the output time of each of the exponential sums; shifting the mantissa of each of the input floating-point numbers and the weighted floating-point numbers through a mantissa shifting module based on the difference between each of the exponential sums and the maximum exponential sum, and outputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point numbers; inputting the mantissa of each of the shifted input floating-point numbers and the weighted floating-point numbers into the dual-mode in-memory calculation module for multiplication and accumulation operations.

[0103] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A floating point number in-memory computing system based on double-edge time domain computing, characterized in that: The system comprises: A plurality of dual-mode in-memory computing modules, each of which is used to calculate the exponential sum of each input floating-point number and weighted floating-point number within a preset time domain period; A maximum value search module, the maximum value search module is connected to each of the dual-mode in-memory calculation modules, the maximum value search module is used to determine the output time of each of the exponential sums, and determine the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums; A mantissa shifting module, the mantissa shifting module is connected to the maximum value searching module, and the mantissa shifting module is used to shift the mantissa of each of the input floating-point numbers and the weighted floating-point numbers according to the difference between each of the exponent sums and the maximum exponent sum, and output the mantissa of each of the input floating-point numbers and the weighted floating-point numbers after the shifting; The dual-mode in-memory computing module is also used to perform multiplication and accumulation operations on the mantissas of the shifted input floating-point numbers and weighted floating-point numbers.

2. The floating point number in-memory computing system based on double-edge time domain computing according to claim 1, characterized in that: The system further comprises: A plurality of memory modules are arranged between each of the dual-mode in-memory computing modules and the mantissa shifting modules, each of the memory modules corresponds one-to-one to each of the dual-mode in-memory computing modules, and are used to store the mantissas of each of the shifted input floating-point numbers and weighted floating-point numbers.

3. The floating point number in-memory computing system based on double-edge time domain computing according to claim 1, characterized in that: The system further comprises: A plurality of memory modules are used to store the exponents of each of the input floating point numbers and weight floating point numbers, each of the memory modules corresponds one-to-one to each of the dual-mode in-memory computing modules, and is used to store the exponents of each of the input floating point numbers and weight floating point numbers.

4. The floating point number in-memory computing system based on double-edge time domain computing according to claim 1, characterized in that: The determining, according to the output time of each of the exponential sums, the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum comprises: Setting the structure and calculation logic of the dual-mode in-memory calculation module, setting the delay between the time domain input pulse and the time domain output pulse to be smaller as the index and the time domain input pulse are larger; Obtaining the exponential sum with the minimum delay, and determining the exponential sum corresponding to the minimum delay as the maximum exponential sum; The delay difference between each of the delays and the minimum delay is calculated, and the difference between each of the exponential sums and the maximum exponential sum is determined according to each of the delay differences.

5. The floating point number in-memory computing system based on double-edge time domain computing according to claim 1, characterized in that: The step of determining the maximum exponential sum and the difference between each exponential sum and the maximum exponential sum according to the output time of each exponential sum further includes: Setting the structure and calculation logic of the dual-mode in-memory calculation module, setting the delay between the time domain input pulse and the time domain output pulse to be larger as the index and the delay between the time domain input pulse and the time domain output pulse are larger; Obtaining the maximum exponential sum of the delay, and determining the exponential sum corresponding to the maximum delay as the maximum exponential sum; The delay difference between each of the delays and the maximum delay is calculated, and the difference between each of the exponential sums and the maximum exponential sum is determined according to each of the delay differences.

6. The floating point number in-memory computing system based on double-edge time domain computing according to claim 1, characterized in that: Each of the dual-mode in-memory computing modules includes a plurality of dual-mode in-memory computing units connected in series, and each of the dual-mode in-memory computing units is used to store each bit thermometer code obtained by exponential conversion of multi-bit input floating-point numbers and weighted floating-point numbers, and obtain the exponential sum of each input floating-point number and weighted floating-point number by operating on the thermometer code stored in each of the dual-mode in-memory computing units.

7. The floating point number in-memory computing system based on double-edge time domain computing according to claim 6, characterized in that: The dual-mode in-memory computing unit is a four-stage series-connected inverter; the ground terminals of the first-stage inverter and the third-stage inverter are respectively provided with a first computing structure, and the first computing structure is used to calculate the exponential sum of each input floating-point number and the weighted floating-point number; the power supply terminals of the first-stage inverter and the third-stage inverter are respectively provided with a second computing structure, and the second computing structure is used to calculate the multiplication and accumulation of the mantissas of each input floating-point number and the weighted floating-point number.

8. The floating point number in-memory computing system based on double-edge time domain computing according to claim 6, characterized in that: The dual-mode in-memory computing unit is a four-stage series-connected inverter; the power supply end of the second-stage inverter and the fourth-stage inverter are respectively provided with a third computing structure, and the third computing structure is used to calculate the exponential sum of each input floating-point number and the weighted floating-point number; the ground end of the second-stage inverter and the fourth-stage inverter are respectively provided with a fourth computing structure, and the fourth computing structure is used to calculate the multiplication and accumulation of the mantissa of each input floating-point number and the weighted floating-point number.

9. A floating point number in-memory calculation method based on double-edge time domain calculation, characterized in that: The method is implemented by the floating-point in-memory computing system based on double-edge time-domain computing according to any one of claims 1 to 8, and the method comprises: Calculate the exponential sum of the input floating point number and the weighted floating point number within a preset time domain period through the dual-mode in-memory calculation module; Determine the output time of each of the exponential sums by a maximum value search module, and determine the maximum exponential sum and the difference between each of the exponential sums and the maximum exponential sum according to the output time of each of the exponential sums; According to the difference between each exponent sum and the maximum exponent sum, the mantissa of each input floating-point number and the weight floating-point number is shifted by a mantissa shift module, and the mantissa of each input floating-point number and the weight floating-point number after the shift is output; The shifted mantissas of each of the input floating-point numbers and the weighted floating-point numbers are input into the dual-mode memory computing module for multiplication and accumulation operations.

10. A floating point in-memory computing chip, characterized in that: A floating point in-memory computing system based on double-edge time domain computing comprising any one of claims 1-8.

Citation Information

Cited By

  • In-memory computing method, in-memory computing architecture and in-memory computing chip of floating-point number

    CN119248712A

  • In-memory calculation method, in-memory calculation architecture and in-memory calculation chip for floating point numbers

    CN119248712B

  • Inference apparatus, inference system, and inference task execution method

    WO2026170698A1