Computing circuit in memory and method for performing multiplication-accumulation operation

By identifying and separately processing the mantissa products of different exponent differences in the memory calculation circuit, the problem of accuracy impairment of floating-point multiplication-accumulation operations in the prior art is solved, and higher calculation accuracy is achieved.

CN118626049APending Publication Date: 2024-09-10TAIWAN SEMICONDUCTOR MANUFACTURING CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410606610.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-09-19
Filing Date
2024-05-16
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing in-memory computing circuits have the problem of accuracy damage when performing floating-point multiply-accumulate operations, especially when processing digital accumulation with widely different exponential differences, resulting in truncation of the mantissa product and error amplification, which will affect the final sum. Accuracy.

Method used

An in-memory computing circuit is designed to identify and process separately the mantissa products associated with different exponential differences, dynamically configure the difference threshold to separate the distribution percentages of normal and small exponential differences, avoid truncation of the mantissa products, and use multiple Two adder circuits process the mantissa products of different exponent differences in parallel to improve the accuracy of the final sum.

Benefits of technology

By separately processing the mantissa products of different exponent differences, the error amplification is reduced and the accuracy of the multiplication operation of floating point pairs is improved, ensuring the accuracy of the multiplication operation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626049A_ABST
    Figure CN118626049A_ABST
Patent Text Reader

Abstract

An in-memory computing circuit includes an input circuit configured to receive a plurality of N input pairs, each input pair including a first exponent and a second exponent of N exponents, and a first mantissa and a second mantissa of N mantissas; a first adder circuit configured to generate N exponent sums based on first and second exponents in the N input pairs; a subtractor circuit configured to calculate N exponent difference values corresponding to the N input pairs, respectively, each exponent difference value of the N exponent difference values being equal to a difference value between a corresponding one of the N exponent sums and a maximum one of the N exponent sums; and a comparator circuit configured to compare each of the N exponential differences with a threshold to generate N control signals. N mantissa products of the first and second mantissas of the N input pairs are selectively combined based on the N control signals, respectively. The embodiment of the invention further provides a method for executing the multiplication-accumulation operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to in-memory computation circuits and methods for performing multiply-accumulate operations. Background Art

[0002] Computer artificial intelligence (AI) is built on the foundation of machine learning, such as using deep learning techniques. Using machine learning, a computing system organized as a neural network calculates the statistical likelihood that input data matches previously calculated data. A neural network refers to many interconnected processing nodes that enable data analysis to compare inputs to "trained" data. The trained data refers to computational analysis of the properties of known data to develop a model to compare the input data to. An example of an application of artificial intelligence and data training is in object recognition, where the system analyzes the properties of many (e.g., thousands or more) images to determine patterns that can be used to perform statistical analysis to recognize input objects. Summary of the invention

[0003] According to one aspect of an embodiment of the present application, there is provided a computing circuit in a memory, comprising: an input circuit configured to receive: (i) a plurality of first inputs, namely N first inputs; and (ii) N second inputs, wherein the first inputs consist of N first symbols, N first exponents and N first mantissas, and the second inputs consist of N second symbols, N second exponents and N second mantissas; and wherein each of the second inputs and a corresponding one of the first outputs form one of the N input pairs; a first adder circuit configured to combine the first exponent and the second exponent of each of the N input pairs so as to generate N exponential sums; a selector circuit configured to select a maximum exponent from the N exponential sums and; a subtractor circuit configured to respectively calculate N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​being equal to the difference between a corresponding one of the N exponent sums and the maximum exponent sum; a multiplier circuit configured to respectively multiply the first mantissas and the second mantissas of the N input pairs to generate N mantissa products; a second adder circuit configured to combine at least one of: (i) a first subset of the N subsets, based on corresponding exponent difference values ​​of the first subset of the N mantissa products being greater than a threshold, or (ii) a second subset of the N mantissa products, based on corresponding exponent difference values ​​of the second subset of the N mantissa products being equal to or less than a threshold; and a third adder circuit configured to combine all the N mantissa products.

[0004] According to one aspect of an embodiment of the present application, a computing circuit in a memory is provided, comprising: an input circuit configured to receive a plurality of input pairs, namely N input pairs, each of the N input pairs comprising a first exponent and a second exponent among N exponents, and a first mantissa and a second mantissa among N mantissas; a first adder circuit configured to generate N exponential sums based on the first exponent and the second exponent among the N input pairs; a subtractor circuit configured to respectively calculate N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​being equal to a difference between a corresponding exponent sum among the N exponential sums and a maximum exponent sum among the N exponential sums; and a comparator circuit configured to compare each of the N exponent difference values ​​with a threshold value to generate N control signals; wherein the N mantissa products of the first mantissa and the second mantissa of the N input pairs will be selectively combined based on the N control signals, respectively.

[0005] According to another aspect of an embodiment of the present application, a method for performing a multiplication-accumulation operation is provided, comprising the following steps: (i) generating a plurality of exponential sums, i.e., N exponential sums, based on first exponents and second exponents of N input pairs, each of the N input pairs also including a first mantissa and a second mantissa; (ii) respectively calculating N exponent differences corresponding to the N input pairs, each of the N exponent differences being equal to a difference between a corresponding exponential sum in the N exponential sums and a maximum exponential sum in the N exponential sums; (iii) generating N control signals by comparing each of the N exponent differences with a threshold; (iv) respectively calculating N mantissa products of the first mantissa and the second mantissa of the N input pairs; (v) combining a first subset of the N mantissa products based on a first subset of the N control signals being greater than a threshold; and (vi) combining a second subset of the N mantissa products based on a second subset of the N control signals being equal to or less than a threshold. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Various aspects of the present invention will be best understood from the following detailed description when read in conjunction with the accompanying drawings. It should be emphasized that, in accordance with standard practice in the industry, the various components are not drawn to scale and are for illustration purposes only. In fact, the dimensions of the various components may be arbitrarily increased or reduced for clarity of discussion.

[0007] Figure 1 is a block diagram of a data computation circuit for performing MAC operations on floating point numbers according to some embodiments.

[0008] Figure 2 According to some embodiments, Figure 1 An example flow chart of a method of a data calculation circuit.

[0009] Figure 3 According to some embodiments of the present invention Figure 1 Schematic diagram of the data calculation circuit.

[0010] Figure 4 is a block diagram of another data computation circuit for performing MAC operations on floating point numbers according to some embodiments.

[0011] Figure 5 According to some embodiments, Figure 4 An example flow chart of a method of a data calculation circuit.

[0012] Figure 6 and Figure 7 According to some embodiments of the present invention, Figure 4 Schematic diagram of the data calculation circuit.

[0013] Figure 8 According to some embodiments Figure 1 and Figure 4 Schematic diagram of the comparator of the data calculation circuit. DETAILED DESCRIPTION

[0014] The following disclosure provides many different embodiments or examples for realizing different features of the present invention. Specific embodiments or examples of components and arrangements are described below to simplify the present invention. Of course, these are only examples and are not intended to be limiting. For example, in the following description, forming a first component above or on a second component may include an embodiment in which the first component and the second component are directly contacted, and may also include an embodiment in which an additional component may be formed between the first component and the second component so that the first component and the second component may not be in direct contact. In addition, the present invention may repeat reference numbers and / or letters in various examples. This repetition is for the purpose of simplicity and clarity, and does not itself indicate the relationship between the various embodiments and / or configurations discussed.

[0015] Additionally, for ease of description, spacing relation terms such as "below," "beneath," "lower," "above," "upper," etc. may be used herein to describe the relationship of one element or component to another element or component as shown in the figures. The spacing relation terms are intended to encompass different orientations of the device in use or in the process of operation in addition to the orientation shown in the figures. The device may be otherwise oriented (rotated 90 degrees or at other orientations) and the spacing relation descriptors used herein may likewise be interpreted accordingly.

[0016] Neural networks calculate "weights" to perform calculations on new data (input data "words"). Neural networks use multiple layers of computational nodes, where deeper layers perform calculations based on the results of calculations performed by higher layers. Machine learning currently relies on the calculation of dot products and absolute differences of vectors, typically calculated by performing multiply-accumulate (MAC) operations on parameters, input data, and weights. The calculations of large and deep neural networks typically involve so many data elements that it is impractical to store them in the processor cache. Therefore, these data elements are usually stored in memory.

[0017] As a result, machine learning is very intensive in computing and comparing many different data elements. The computation of operations within the processor is orders of magnitude faster than the transfer of data elements between the processor and main memory resources. Due to the size of the memory required to store the data elements, it is prohibitively expensive for the vast majority of practical systems to place all the data elements in cache memory closer to the processor. As a result, the transfer of data elements becomes a major bottleneck for AI computations. As data sets grow, the time and power / energy used by the computing system to move the data elements can end up being a multiple of the time and power used to actually perform the computations.

[0018] In this regard, computing-in-memory (CIM) circuits have been proposed to perform such MAC operations. Similar to the human brain, CIM circuits perform data processing in situ within a suitable memory circuit. CIM circuits suppress the latency of data / program acquisition and output results uploaded to the corresponding memory (e.g., memory array), thereby solving the memory (or von Neumann) bottleneck of traditional computers. Another key advantage of CIM circuits is high computational parallelism, which benefits from the specific architecture of the memory array, where calculations can be performed along multiple current paths simultaneously. CIM circuits also benefit from the high density of multiple memory arrays of computing devices, which typically have excellent scalability and 3D integration capabilities. As a non-limiting example, CIM circuits for various machine learning applications can perform MAC operations locally in memory (i.e., without having to send data elements to the host processor) to achieve higher throughput dot products of neuron activations and weight matrices, while still providing higher performance and lower energy compared to the host processor's calculations.

[0019] The data elements processed by CIM circuits are of various types or forms, such as integers and floating-point numbers. Floating-point numbers are usually represented by a sign part, an exponent part, and a significand (mantissa) part consisting of the significant digits of the number. For example, the Institute of Electrical and Electronics Engineers The specified floating-point format has a size of thirty-two bits, including twenty-three mantissa bits, eight exponent bits, and one sign bit. The other floating-point format has a size of sixteen bits, including ten mantissa bits, five exponent bits, and one sign bit.

[0020] In machine learning applications, CIM circuits are often configured to process dot product multiplications based on performing MAC operations on a large number of data elements (e.g., input word vectors and weight matrices), which may each be in the form of floating-point numbers, and then process the sum (or accumulation) of these dot products. The multiplication of each floating-point number pair typically includes the addition of each exponent part (generating an exponent sum) and the multiplication of each mantissa part (generating a mantissa product). In addition, the exponent sum of each floating-point number pair is compared with the maximum exponent sum among multiple floating-point number pairs to generate an exponent difference. Such an exponent difference is used to align the exponent parts of different floating-point number pairs so as to shift the corresponding mantissa products. The shifted mantissa products are summed and the final sum is obtained together with the exponent of the maximum exponent sum.

[0021] Using this approach, the accuracy of the final sum is often compromised. For example, when numbers with widely varying exponent differences are accumulated together, pairs of numbers with relatively small exponent differences (which correspond to large dot product values) may cause pairs of numbers with relatively normal exponent differences (which correspond to dot products of moderate values) to be truncated. This is because the mantissa products with those normal exponent differences are shifted according to the maximum exponent difference. While the dot products with small exponent differences are not affected, a portion of the dot products with normal exponent differences are truncated. In addition, small exponent differences (large dot products) are often associated with significantly small distribution percentages when compared to the large distribution percentages of normal exponent differences (moderate dot products). As these widely varying exponent differences are processed together, the accumulated errors in the moderate dot products may be amplified, thereby adversely affecting the accuracy of the final sum. Therefore, existing CIM circuits (e.g., configured to perform MAC operations on floating point numbers) are not entirely satisfactory in some respects.

[0022] The present disclosure provides various embodiments of a computation in memory (CIM) circuit that can process the respective mantissa products of a large number of floating point number pairs separately based on the distribution percentage of the pair. In one aspect of the present disclosure, the disclosed CIM circuit may include a dedicated circuit for processing the sum of the mantissa products associated with the exponent difference values ​​equal to or less than the difference threshold, while processing the sum of the mantissa products associated with the exponent difference values ​​greater than the difference threshold. In another aspect of the present disclosure, the disclosed CIM circuit may process the sum of the mantissa products associated with the exponent difference values ​​greater than the difference threshold during a first time period, and process the sum of the mantissa products associated with the exponent difference values ​​equal to or less than the difference threshold during a second time period. Such a difference threshold may be dynamically configured based on the distribution percentage of these "normal" and "small" exponent difference values ​​greater than, equal to, or less than the difference threshold, respectively. For example, the CIM circuit may determine the difference threshold by identifying that some exponent difference values ​​occupy a relatively low percentage of all exponent difference values ​​while being less than or equal to the difference threshold, and that most of the exponent difference values ​​are greater than the difference threshold. By separately processing mantissa products with different exponent differences, mantissa products with normal exponent differences may not be contaminated (e.g., truncated) by mantissa product generation with small exponent differences, which may advantageously improve the accuracy of a final sum of multiplications of pairs of floating-point numbers.

[0023] Figure 1 FIG. 1 is a block diagram of a data calculation circuit 100 according to some embodiments of the present disclosure. Figure 1 In the illustrated embodiment, the data computation circuit 100, also referred to as the circuit 100 or the memory circuit 100, includes various components that are collectively configured to perform in-memory computations (e.g., multiply-accumulate (MAC) operations) on an input word vector and a weight matrix. The input word vector may include a plurality (N) of input data elements InDE, and the weight matrix may include a plurality (N) of weight data elements WtDE. In various embodiments, each of the input data elements InDE and the weight data elements WtDE may include a floating point number.

[0024] As shown, the circuit 100 includes a memory circuit 102, an input circuit 104, a plurality of multiplier circuits 106, a plurality of summing circuits 108, a difference circuit 110, a first shift circuit 112, a first adder circuit (or adder tree) 114, a second adder circuit (or adder tree) 116, a second shift circuit 118, a third adder circuit (or adder tree) 120, a first converter 122, and a second converter 124. In some embodiments, the number of multiplier circuits 106 may correspond to the number of summing circuits 108. For example, the circuit 100 may include N (weight / number of input data elements WtDE / InDE) multiplier circuits 106 and N (weight / number of input data elements WtDE / InDE) summing circuits 108. It should be understood that the simplified Figure 1 1 is a block diagram of the circuit shown in , and thus, circuit 100 may include any of a variety of other components while remaining within the scope of the present disclosure.

[0025] The memory circuit 102 may include one or more memory arrays and one or more corresponding circuits. Each of the memory arrays is a storage device including a plurality of storage elements 103, each storage element 103 including an electrical, electromechanical, electromagnetic or other device configured to store one or more data elements, each data element including one or more data bits represented by a logical state. In some embodiments, the logical state corresponds to a voltage level of a charge stored in a portion or all of the storage element 103. In some embodiments, the logical state corresponds to a physical property of a portion or all of the storage element 103, such as resistance or magnetic orientation.

[0026] In some embodiments, the storage element 103 includes one or more static random access memory (SRAM) cells. In various embodiments, the SRAM cell includes a plurality of transistors, for example, a five-transistor (5T) SRAM cell, a six-transistor (6T) SRAM cell, an eight-transistor (8T) SRAM cell, a nine-transistor (9T) SRAM cell, etc. In some embodiments, the SRAM cell includes a length that is at least twice greater than the width.

[0027] In some embodiments, the storage element 103 includes one or more dynamic random access memory (DRAM) cells, resistive random access memory (RRAM) cells, magnetoresistive random access memory (MRAM) cells, ferroelectric random access memory (FeRAM) cells, NOR flash memory cells, NAND flash memory cells, conductive bridging random access memory (CBRAM), non-volatile memory (NVM) cells, 3D NVM cells, or other memory cell types capable of storing bit data.

[0028] In addition to the memory array, the memory circuit 102 may also include a plurality of circuits for accessing or otherwise controlling the memory array. For example, the memory circuit 102 may include a plurality of (e.g., word line) drivers operably coupled to the memory array. The drivers may apply signals (e.g., voltages) to the corresponding storage elements 103 to allow access (e.g., programming, reading, etc.) to these storage elements 103. For example, the memory circuit 102 may include a plurality of programming circuits and / or reading circuits operably coupled to the memory array.

[0029] Each of the memory arrays of the memory circuit 102 is configured to store a plurality of weight data elements WtDE. In some embodiments, the programming circuit may write the weight data elements WtDE into the corresponding storage elements 103 of the memory array, respectively, and the reading circuit may read the bits written into the storage elements 103 to verify or otherwise test whether the written weight data elements WrDE are correct. The driver of the memory circuit 102 may include or be operably coupled to a plurality of input activation latches, which are configured to receive and temporarily store input data elements InDE. In some other embodiments, such an input activation latch may be part of the input circuit 104, which may also include a plurality of buffers configured to temporarily store weight data elements WtDE retrieved from the memory array of the memory circuit 102. In this way, the input circuit 104 may receive input data elements InDE and weight data elements WtDE.

[0030] In various embodiments of the present disclosure, the circuit 100 is configured such that the input word vector (including, for example, input data elements InDE) and the weight matrix (including, for example, weight data elements WtDE) on which the MAC operation is performed each include a plurality of floating point numbers. Thus, each of the data elements InDE and the weight data elements WtDE includes a sign bit, a plurality of exponent bits, and a plurality of mantissa bits (sometimes referred to as fraction bits).

[0031] For example, each of the data element InDE and the weight data element WtDE has a BF16 format, also referred to as a floating point format or a brain floating point format in some embodiments, wherein the first bit represents the sign of the floating point number, the following eight bits represent the exponent of the floating integer, and the last seven bits represent the mantissa or fraction of the floating point number. Because the mantissa is configured to start with a non-zero value, the last seven bits of each stored data element represent an eight-bit mantissa with the first most significant bit (MSB) equal to 1.

[0032] In some embodiments, each of the data element InDE and the weight data element WtDE has a FP16 format, also referred to as a half-precision format, wherein the first bit represents the sign of a floating-point number, the following five bits represent the exponent of the floating-point number, and the last ten bits represent the mantissa or fraction of the floating-point number. In this case, the last 10 bits of each stored data element represent an 11-bit mantissa with the first MSB equal to 1. In some other embodiments, each of the data element InDE and the weight data element WtDE has a floating-point format other than BF16 or FP16 format, for example, another 16-bit format, 32-bit, 64-bit, 128-bit or 256-bit format or a 40-bit or 80-bit extended precision format. The sign and mantissa of the data element representing a floating-point number are collectively referred to as the signed mantissa of a floating-point number. The MSB of the mantissa is referred to as a hidden bit or hidden MSB.

[0033] Still reference Figure 1 , input circuit 104 is configured to output the integer of each of data elements InDE and WtDE to each of multiplier circuit 106 and summation circuit 108. In some embodiments, input circuit 104 is configured to output the signed mantissa of each data element to multiplier circuit 106 and output the exponent of each data element to summation circuit 108, which will be described below.

[0034] Each of the multiplier circuits 106 is an electronic circuit, such as an integrated circuit (IC), configured to receive, for example, a sign bit InS and a mantissa InM (collectively referred to as a signed mantissa InS / InM) of each of the N data elements InDE and a sign bit WtS and a mantissa WtM (collectively referred to as a signed mantissa WtS / WtM) of each of the N data elements WtDE from the input circuit 104. Each of the summation circuits 108 is an electronic circuit, such as an IC, configured to receive, for example, an exponent InE of each of the N data elements InDE and an exponent WtE of each of the N data elements WtDE from the input circuit 104.

[0035] The multiplier circuits 106 may each include one or more data registers (not shown) configured to receive instances of the signed mantissas InS / InM and WtS / WtM. Figure 1In the illustrated embodiment, multiplier circuit 106 is configured to receive instances of signed mantissas InS / InM and WtS / WtM corresponding to data elements InDE and WtDE. In some other embodiments, multiplier circuit 106 includes one or more data registers configured to receive instances of signed mantissas InS / InM and / or WtS / WtM including a hidden MSB. In some embodiments, multiplier circuit 106 includes one or more data registers configured to add the hidden MSB to the received instances of signed mantissas InS / InM and / or WtS / WtM.

[0036] The multiplier circuit 106 may also include logic circuitry (not shown) configured to reformat each instance of the signed mantissa InS / InM into a two's complement mantissa InTC, also referred to as a reformatted mantissa InTC, and to reformat each instance of the signed mantissa WtS / WtM into a two's complement mantissa WtTC, also referred to as a reformatted mantissa WtTC, in an operation. The reformatted mantissa InTC has the same number of bits as the signed mantissa InS / InM, and the reformatted mantissa WtTC has the same number of bits as the signed mantissa WtS / WtM.

[0037] The multiplier circuit 106 may also include one or more logic gates M1 configured to multiply some or all instances of the reformatted mantissa InTC with some or all instances of the reformatted mantissa WtTC in an operation to generate N products, e.g., P[1] to P[N]. In various embodiments, the one or more logic gates M1 include one or more AND or NOR gates or other circuits suitable for performing some or all of the multiplication operations. The one or more logic gates M1 are configured to generate each of the products P[1] to P[N] as a two's complement data element in an operation, the two's complement data element including a number of bits equal to twice the number of bits of the reformatted mantissas InTC and WtTC minus one.

[0038] The multiplier circuit 106 is configured to generate N products P[1] to P[N] in an operation. For example, the multiplier circuit 106 may generate a number N of products P[1]-P[N] equal to sixteen. In some other embodiments, the multiplier circuit 106 may generate a number N of products P[1]-P[N] less than or greater than sixteen.

[0039] In some embodiments, for example, those embodiments in which the data elements InDE and WtDE have a BF16 format, the multiplier circuit 106 is configured to generate each of the products P[1]-P[N] having a total of 17 bits based on the signed mantissas InS / InM and WtS / WtM having a total of nine bits and each of the reformatted mantissas InTC and WtTC. In some embodiments, for example, those embodiments in which the data elements InDE and WtDE have a FP16 format, the multiplier circuit 106 is configured to generate each of the products P[1]-P[N] having a total of 23 bits based on the signed mantissas InS / InM and WtS / WtM having a total of 12 bits and each of the reformatted mantissas InTC and WtTC. Embodiments in which multiplier circuit 106 is configured to generate each of products P[1]-P[N] having other total numbers of bits based on signed mantissas InS / InM and WtS / WtM having other total numbers of bits and each of reformatted mantissas InTC and WtTC are within the scope of the present disclosure.

[0040] The multiplier circuit 106 is thus configured to perform a multiplication and reformat operation on the sign and mantissa bits of the input data element InDE and the weight data element WtDE in an operation to generate a two's complement product P[1]-P[N]. The multiplier circuit 106 is configured to output the product P[1]-P[N] to the shift circuit 112 on a data bus (not shown).

[0041] Summation circuits 108 each include one or more data registers (not shown) configured to receive instances of exponents InE and WtE corresponding to the number of data elements InDE and WtDE discussed above with respect to multiplier circuit 106 .

[0042] The summing circuits 108 each include one or more logic gates A1 configured to add each instance of the exponent InE to each instance of the exponent WtE in an operation. In various embodiments, the one or more logic gates A1 include one or more full adder gates, half adder gates, ripple carry adder circuits, carry save adder circuits, carry select adder circuits, carry lookahead adder circuits, or other circuits suitable for performing some or all of the addition operations. The respective logic gates A1 of the summing circuits 108 are configured to generate the exponent sum S[1]-S[N] as a data element having a total number of bits equal to the number of bits of each of the exponents InE and WtE plus 1.

[0043] Summation circuit 108 is configured to generate, in operation, exponent sums S[1]-S[N] having a total number N of products P[1]-P[N] and a total number N of data element orderings and an ordering of data elements corresponding to the multiplier circuit 106 discussed above. Thus, for a total of N combinations of data elements InDE and WtDE, each Nth combination corresponds to an Nth exponent sum S[N] of the exponent sums S[1]-S[N] and an nth product P[N] of the products P[1]-P[N].

[0044] In some embodiments, such as those in which the data elements InDE and WtDE have a BF16 format, the summation circuit 108 is configured to generate, based on each of the exponents InE and WtE having a total of eight bits, a corresponding one of the sums S[1]-S[N] having a total of nine bits. In some embodiments, such as those in which the data elements InDE and WtDE have an FP16 format, the summation circuit 108 is configured to generate, based on each of the exponents InE and WtE having a total of five bits, each of the sums S[0]-S[N] having a total of six bits. It is within the scope of the present disclosure that the summation circuit 108 is configured to generate, based on each of the exponents InE and WtE having other total bits, each of the sums S[1]-S[N] having other total bits. The summation circuit 108 is configured to output the sums S[1]-S[N] to the difference circuit 110 on a data bus (not shown).

[0045] The difference circuit 110 is an electronic circuit, such as an IC, including one or more logic gates L1 and one or more logic gates B1, each of which is configured to receive the exponent sum S[1]-S[N] from the summing circuit 108. The one or more logic gates L1 may sometimes be referred to as a selector, and the one or more logic gates B1 may sometimes be referred to as a subtractor. The one or more logic gates L1 are configured to generate a maximum exponent sum MaxExp as a data element in operation, the data element having a value equal to the maximum value of the data elements of the exponent sums S[1]-S[N] and having a number of bits equal to the number of bits of the data elements of the exponent sums S[1]-S[N]. The one or more logic gates L1 are configured to output the maximum exponent sum MaxExp to the one or more logic gates B1 and the converter circuit 124, as described below.

[0046] The one or more logic gates B1 are configured to generate, in operation, a difference value D[1]-D[N] by subtracting each data element of the exponent sum S[1]-S[N] from the maximum exponent sum MaxExp. The difference value D[1]-D[N] thus has a total number N and an ordering of data elements corresponding to the above exponent sum S[1]-S[N] and the product P[1]-P[N]. Figure 1In the illustrated embodiment, one or more logic gates B1 are configured to output the difference values ​​D[1]-D[N] to the shift circuit 112 on a data bus (not shown). In some embodiments, one or more logic gates B1 are not configured to output the difference values ​​D[1]-D[N] to the multiplier circuit 106, and each of the multiplier circuits 106 is configured to generate each instance P[N] of the product P[1]-P[N] by always performing a multiplication operation. In some other embodiments, one or more logic gates B1 are configured to output the difference values ​​D[1]-D[N] to the multiplier circuit 106, respectively, and each of the multiplier circuits 106 is configured to generate each instance P[n] of the product P[1]-P[N] by selectively performing a multiplication operation based on the corresponding instance D[N].

[0047] Shift circuit 112 is an electronic circuit, such as an IC, including one or more registers and / or logic gates, configured to perform a shift operation on each instance P[n] of the product P[1]-P[N] based on the value of the corresponding instance D[n] of the difference D[1]-D[N].

[0048] Each instance P[n] of the product P[1]-P[N] is based on the sign and mantissa of the corresponding combination of data elements InDE and WtDE, and each instance D[n] of the difference value D[1]-D[N] is based on the sum of the exponents of the same combination. In operation, the shift circuit 112 is configured to right shift each instance P[n] of the product P[1]-P[N] by an amount equal to the corresponding difference value D[n], thereby generating shifted products SP[1]-SP[N], wherein the sign and mantissa bits are aligned according to the summed exponents used to generate the difference values ​​D[1]-D[N]. Based on the alignment, the shift circuit 112 is configured to generate each instance SP[n] of the shifted product SP[1]-SP[N] having the same exponent using the maximum exponent and MaxExp as a baseline.

[0049] To compensate for the right shift operation, shift circuit 112 may add an instance of the sign bit (zero or one) of each product P[n] as the leftmost bit of the corresponding shifted product SP[n]. The number of added instances of the sign bit is equal to the right shift amount determined by the corresponding difference value D[n].

[0050] exist Figure 1 In the illustrated embodiment, as described above, the multiplier circuit 106 may generate a corresponding instance P[n] of the product P[1]-P[N] by performing a multiplication operation. The shift circuit 112 may include a plurality of (e.g., N) first shifters 113A and a plurality of (e.g., N) second shifters 113B (refer to Figure 31-D[N]] to the adder circuit 114; and the second shifter circuit 113B may receive the products P[1]-P[N] from the multiplier circuit 106, and selectively output (e.g., shift) one or more first products of the shifted products SP[1]-SP[N] to the adder circuit 114 based on the corresponding difference values ​​D[1]-D[N]; and the second shifter circuit 113B may receive the products P[1]-P[N] from the multiplier circuit 106, and selectively output (e.g., shift) one or more second products of the shifted products SP[1]-SP[N] to the adder circuit 116 based on the corresponding difference values ​​D[1]-D[N]. For example, in Figure 1 , the first shifted product output to adder circuit 114 may include SP[w]-SP[x], and the second shifted product output to adder circuit 116 may include SP[y]-SP[z], where "w", "x", "y", and "z" may each be one of integers from 1 to N. In one aspect of the present disclosure, the sum of the number of SP[w]-SP[x] and the number of SP[y]-SP[z] may be equal to N. In another aspect of the present disclosure, the sum of the number of SP[w]-SP[x] and the number of SP[y]-SP[z] may be less than N.

[0051] The shifters 113A and 113B can be configured to generate a first difference threshold value ( Figure 1 The first difference threshold value may be configured based on the distribution of the difference values ​​D[1]-D[N]. In an example where the difference values ​​D[1]-D[N] are represented as a normal distribution, the first difference threshold value may be determined at one standard deviation below the mean of the normal distribution. In another example where the difference values ​​D[1]-D[N] are still represented as a normal distribution, the first difference threshold value may be determined at two standard deviations below the mean of the normal distribution. In yet another example where the difference values ​​D[1]-D[N] are still represented as a normal distribution, the first difference threshold value may be determined at any standard deviation value below the mean of the normal distribution.

[0052] When any difference value, e.g., D[n], where n is an integer between 1 and N, is equal to or less than a first difference threshold (sometimes referred to as a "small exponent difference"), a corresponding one of the first shifters 113A is deactivated to prevent the corresponding shifted product SP[n] from being received by the adder circuit 114 (e.g., the corresponding product P[n] is not shifted or is decoupled from the adder circuit 114), and a corresponding one of the second shifters is activated to output the corresponding shifted product SP[n] to the adder circuit 116 (i.e., the corresponding product P[n] is shifted and output to the adder circuit 116). Equivalently, when any difference value, e.g., D[n], is greater than a first difference threshold (sometimes referred to as a “normal exponential difference”), a corresponding one of the first shifters 113A is activated to output the corresponding shifted product SP[n] to the adder circuit 114, and a corresponding one of the second shifters is deactivated to prevent the adder circuit 116 from receiving the corresponding shifted product SP[n].

[0053] In other words, the shift circuit 112 may shift all products P[1]-P[N] and selectively output the shifted products SP[1]-SP[N] to the adder circuit 114 or the adder circuit 116 based on comparing the respective difference values ​​D[1]-D[N] with the first difference threshold. In this way, the sum of the number of SP[w]-SP[x] (output by the first shifter 113A) and the number of SP[y]-SP[z] (output by the second shifter 113B) may be equal to N. In various embodiments, the first shifter 113A and the second shifter 113B may output their shifted products to the adder circuit 114 and the adder circuit 116 in parallel, respectively. That is, the adder circuit 114 may receive the shifted products SP[w]-SP[x] in parallel, and the adder circuit 116 may receive the shifted products SP[y]-SP[z] in parallel.

[0054] In addition, to generate SP[w]-SP[x], the first shifter 113A may right shift each instance P[n] of the product P[w]-P[x] by an amount equal to the corresponding difference DA[n], thereby aligning the sign and mantissa bits according to the summed exponent. In some embodiments, the difference DA[n] may be generated (e.g., by the difference circuit 110) based on subtracting each data element of the sum S[w]-S[x] from a "local" maximum exponent and MaxExpA. The local maximum exponent and MaxExpA may correspond to the maximum value of the data elements of the sum S[w]-S[x]. Based on this alignment, the first shifter 113A may use the maximum exponent and MaxExpA as a baseline to generate each instance SP[n] of the shifted product SP[w]-SP[x] with the same exponent. Similarly, the second shifter 113B may right shift each instance P[n] of the product P[y]-P[z] by an amount equal to the corresponding difference DB[n], thereby aligning the sign and mantissa bits according to the summed exponent. In some embodiments, the difference value DB[n] may be generated (e.g., by difference circuit 110) based on subtracting each data element of the sum S[y]-S[z] from a "local" maximum exponent sum MaxExpB. The local maximum exponent sum MaxExpB may correspond to the maximum value of the data elements of the sum S[y]-S[z]. In some embodiments, the local maximum exponent sum MaxExpB may be equal to the "global" maximum exponent sum MaxExp. Based on this alignment, the second shifter 113B may use the maximum exponent sum MaxExpB as a baseline to generate each instance SP[n] of the shifted product SP[y]-SP[z] having the same exponent.

[0055] In addition to the first difference threshold, the shifters 113A and 113B may also be configured based on comparing the corresponding differences in the difference values ​​D[1]-D[N] with the second difference threshold ( Figure 1 In an example where the difference D[1]-D[N] is represented as a normal distribution, the second difference threshold value may be determined at one standard deviation above the mean of the normal distribution. In another example where the difference D[1]-D[N] is still represented as a normal distribution, the second difference threshold value may be determined at two standard deviations above the mean of the normal distribution. In yet another example where the difference D[1]-D[N] is still represented as a normal distribution, the second difference threshold value may be determined at any standard deviation value above the mean of the normal distribution.

[0056] When any difference value (e.g., D[n], where n is an integer between 1 and N) is equal to or less than a first difference threshold (sometimes referred to as a “small exponent difference”), a corresponding one of the first shifters 113A is deactivated to prevent the adder circuit 114 from receiving the corresponding shift product SP[n], and a corresponding one of the second shifters is activated to output the corresponding shift product SP[n] to the adder circuit 116. In addition, when any difference value, such as D[n], is equal to or greater than a second difference value threshold (sometimes referred to as a "large exponent difference value"), a corresponding one of the first shifters 113A is deactivated to prevent the corresponding shifted product SP[n] from being received by the adder circuit 114 (e.g., the corresponding product P[n] is not shifted or is decoupled from the adder circuit 114), and a corresponding one of the second shifters is also deactivated to prevent the corresponding shifted product SP[n] from being received by the adder circuit 116 (e.g., the corresponding product P[n] is not shifted or is decoupled from the adder circuit 116). In some embodiments, products P[n] with such large exponent differences can be ignored.

[0057] In other words, the shift circuit 112 may shift all or some of the products P[1]-P[N] and selectively output corresponding ones of the shifted products SP[1]-SP[N] to the adder circuit 114 or the adder circuit 116 based on comparing the respective differences D[1]-D[N] with the first difference threshold and the second difference threshold. In this way, the sum of the number of SP[w]-SP[x] (output by the first shifter 113A) and the number of SP[y]-SP[z] (output by the second shifter 113B) may be less than or equal to N. The sum is less than N when one or more of the products P[1]-P[N] are ignored (e.g., so that their respective exponential differences D[N] are equal to or greater than the second difference threshold), and the sum is equal to N when none of the products P[1]-P[N] are ignored. In various embodiments, the first shifter 113A and the second shifter 113B may respectively output their shifted products in parallel to the adder circuit 114 and the adder circuit 116. That is, the adder circuit 114 may receive the shifted products SP[w]-SP[x] in parallel, and the adder circuit 116 may receive the shifted products SP[y]-SP[z] in parallel.

[0058] In some other embodiments, multiplier circuit 106 may also receive difference values ​​D[1]-D[N], and if difference value D[n] is equal to or greater than the second difference threshold, multiplier circuit 106 may ignore the product of the corresponding reformatted mantissa InTC and the corresponding reformatted mantissa WtTC. In this way, the number of products received by shift circuit 112 may be less than N, for example, P[1] to P[N] in addition to one or more P[n]. Then, the remaining one of the products P[1]-P[N] may be selectively shifted by shifter 113A or shifter 113B based on comparing their respective difference values ​​D[1]-D[N] with the first difference threshold.

[0059] In some embodiments, such as those in which the data elements InDE and WtDE have a BF16 format, the shift circuit 112 is configured to generate each shift product having a total of 21 bits, such as SP[0]-SP[N], based on each of the products P[0]-P[N] having a total of 17 bits. In some embodiments, such as those in which the data elements InDE and WtDE have an FP16 format, the shift circuit 112 is configured to generate each of the shift products having a total of 27 bits, such as SP[0]-SP[N], based on each of the products P[0]-P[N] having a total of 23 bits. It is within the scope of the present disclosure for the shift circuit 112 to be configured to generate each of the shift products SP[0]-SP[N] having other total numbers of bits, based on each of the products P[0]-P[N] having other total numbers of bits.

[0060] Based on the product P[0]-P[N] having a two's complement format, the shift circuit 112 is configured to generate a shift product having a two's complement format, such as SP[0]-SP[N]. As described above, Figure 1 In the example shown, the first shifter 113A of the shift circuit 112 is configured to output the shifted product SP[w]-SP[x] to the adder circuit (tree) 114 on a data bus (not shown), and the second shifter 113B of the shift circuit 112 is configured to output the shifted product SP[y]-SP[z] to the adder circuit (tree) 116 on another data bus (not shown).

[0061] Each of the adder trees 114 and 116 is an electronic circuit, such as an IC, including multiple layers of one or more logic gates (not shown), such as described above with respect to the one or more logic gates A1 (of the summing circuit 108). For example, the adder tree 114 may include a first layer configured to receive the shifted products SP[w]-SP[x], and a last layer configured to generate a sum 115 as a data element corresponding to the sum of the shifted products SP[w]-SP[x]; the adder tree 116 may include a first layer configured to receive the shifted products SP[y]-SP[z], and a last layer configured to generate a sum 117 as a data element corresponding to the sum of the shifted products SP[y]-SP[z]. In some embodiments, each of the one or more consecutive layers between the first layer and the last layer is configured to receive a first number of sum data elements generated by a previous layer, and to generate a second number of sum data elements based on the first number of sum data elements, the second number being half of the first number. Thus, the total number of layers includes the first layer and the last layer and each consecutive layer (if any).

[0062] In some embodiments, the sum 115 output by the adder tree 114 may be further provided to a shift circuit 118. The shift circuit 118 is an electronic circuit, such as an IC, including one or more registers and / or logic gates, configured to perform a shift operation on the sum 115, thereby generating a shifted sum 115S. As described above, the shift product SP[w]-SP[x] is generated based on the local maximum exponent and MaxExpA, and the shift product SP[y]-SP[z] is generated based on the local maximum exponent and MaxExpB (e.g., equal to the maximum exponent and MaxExp). Therefore, the sum 115 may be associated with an exponent of MaxExpA, and the sum 117 may be associated with an exponent of MaxExpB. The shift circuit 118 may further shift the sum 115 so that the shifted sum 115 is aligned with the sum 117, for example, with an exponent of MaxExp.

[0063] The adder circuit (tree) 120 is an electronic circuit, such as an IC, including multiple layers of one or more logic gates (not shown), such as discussed above with respect to one or more logic gates A1 (of the summing circuit 108). For example, the adder tree 120 may include a first layer configured to receive sums 117 and 115S, and a last layer configured to generate a sum PSTC of data elements corresponding to the sum of the shifted products SP[w]-SP[x] and SP[y]-SP[z]. In some embodiments, each of the one or more consecutive layers between the first layer and the last layer is configured to receive a first number of sum data elements generated by a previous layer, and to generate a second number of sum data elements based on the first number of sum data elements, the second number being half the first number. Thus, the total number of layers includes the first layer and the last layer and each consecutive layer (if present).

[0064] In some embodiments, the sum PSTC, sometimes referred to as the partial sum PSTC or mantissa sum PSTC, has a total number of bits corresponding to the number of bits and the number of data elements of the shift products SP[w]-SP[x] and SP[y]-SP[z]. In some embodiments, the sum PSTC has a number of bits equal to the number of bits of the shift products SP[w]-SP[x] and SP[y]-SP[z] plus the number of bits that can represent the number of data elements of the shift products SP[w]-SP[x] and SP[y]-SP[z]. In some embodiments, the sum PSTC has a number of bits equal to the number of bits of the shift products SP[w]-SP[x] and SP[y]-SP[z] plus four bits that can represent the 16 data elements of the shift products SP[w]-SP[x] and SP[y]-SP[z].

[0065] In some embodiments, for example, embodiments in which the data elements InDE and WtDE have a BF16 format, the adder tree 120 is configured to generate a total of 25 bits of sum PSTC based on each of the shift products SP[w]-SP[x] and SP[y]-SP[z] having a total of 21 bits. In some embodiments, for example, embodiments in which the data elements InDE and WtDE have a FP16 format, the adder tree 120 is configured to generate a total of 31 bits of sum PSTC based on each of the shift products SP[w]-SP[x] and SP[y]-SP[z] having a total of 27 bits. It is within the scope of the present disclosure that the adder tree 120 is configured to generate a sum PSTC based on each of the shift products SP[w]-SP[x] and SP[y]-SP[z] having other total numbers of bits.

[0066] According to various embodiments of the present disclosure, based on the shift products SP[w]-SP[x] and SP[y]-SP[z] having a two's complement format, the adder tree 120 is configured to generate a sum PSTC having a two's complement format. In this way, the adder tree 120 is configured to output the sum PSTC to the converter 122 on a data bus (not shown). In some other embodiments, the adder tree 120 may output the sum PSTC to a circuit (not shown) outside the circuit 100.

[0067] Converter 122 is an electronic circuit, such as an IC, including logic circuits, which is configured to receive the sum PSTC from adder tree 120 in operation and convert the sum PSTC from two's complement to a sum PSSM in signed plus mantissa format. Converter 122 is configured to generate a sum PSSM having the same number of bits as the sum PSTC. Figure 1 In the illustrated embodiment, converter 122 is configured to further output the sum PSSM on a data bus (not shown) to converter 124. In some other embodiments, converter 122 may output the sum PSSM to a circuit external to circuit 100 (not shown).

[0068] Converter 124 is an electronic circuit, such as an IC, including logic circuitry configured to receive the sum PSSM from converter 122 and the maximum exponent sum MaxExp from difference circuit 110 in an operation, and convert the sum PSSM from a sign-plus-mantissa format to a sum PS having an output format based on the sum PSSM and MaxExp and different from the sign-plus-mantissa format, such as a floating-point format as described above. In various embodiments of the present disclosure, converter 124 may generate a sum PS configured to be compatible with a circuit (not shown) external to circuit 100. For example, converter 124 is configured to output the sum PS to a circuit (not shown) external to circuit 100, such as a memory array as part of a CNN or other instance of circuit 100.

[0069] Figure 2 1 is a flow chart showing an example method 200 for generating a sum based on performing a MAC operation on a plurality of input data elements and a plurality of weight data elements, each of the input data elements and the weight data elements comprising a plurality of floating point numbers, according to some embodiments of the present disclosure. The method 200 may be performed to operate the circuit 100 ( Figure 1 ), therefore, in the following discussion of the operation of method 200, the Figure 1 It should be noted that method 200 is merely an example and is not intended to limit the present disclosure. Therefore, it should be understood that the method 200 may be used in Figure 2 Additional operations are provided before, during, and after method 200, and some other operations may be only briefly described herein.

[0070] According to some embodiments of the present disclosure, method 200 starts from operations 202 and 204, in which multiple (N) input data elements (InDE) and multiple (N) weight data elements (WtDE) are received, respectively. Each of the input data elements InDE and the weight data elements WtDE can be implemented as a floating point number. The input data elements InDE can correspond to input word vectors, and the weight data elements WtDE can correspond to weight matrices. Using Figure 1 The circuit 100 shown is used as an example, and the circuit 100 can receive the input data element InDE and the weight data element WtDE through the input circuit 104. In some embodiments, the weight data element WtDE can be stored in the storage element of the memory circuit 102 respectively, and the input data element InDE can be received by the memory circuit 102 and the input circuit 104.

[0071] According to some embodiments of the present disclosure, method 200 proceeds to operation 206, in which the corresponding signed mantissa parts of the input data element InDE and the weight data element WtDE are multiplied with each other to generate products P[1] to P[N]. Figure 1 In the above example, each of the N input data elements InDE includes a signed mantissa portion, such as InS / InM, and each of the N weight data elements WtDE includes a signed mantissa portion, such as WtS / WtM. Each of the multiplier circuits 106 may include a plurality of logic gates operable as a multiplier (e.g., M1) configured to multiply the signed mantissa portion of a corresponding one of the N input data elements InDE with the signed mantissa portion of a corresponding one of the N weight data elements WtDE to generate a corresponding one of the products P[1] to P[N]. Prior to multiplication, each of the multiplier circuits 106 may reformat or otherwise transform the signed mantissa portions of the corresponding input data element InDE and the weight data element WtDE into a two's complement mantissa InTC and a two's complement mantissa WtTC, respectively.

[0072] According to some embodiments of the present disclosure, method 200 proceeds to operation 208, where the respective exponential parts of the input data element InDE and the weight data element WtDE are summed together to generate exponential sums S[1] to S[N]. Figure 1In the above example, each of the N input data elements InDE includes an exponent portion, such as InE, and each of the N weight data elements WtDE includes an exponent portion, such as WtE. Each of the multiplier circuits 106 may include a plurality of logic gates operable as adders (e.g., A1) configured to sum the exponent portion of a corresponding one of the N input data elements InDE and the index portion of a corresponding one of the N weight data elements WtDE to generate a corresponding one of the exponent sums S[1] to S[N].

[0073] According to some embodiments of the present disclosure, method 200 proceeds to operation 210, where the maximum exponent and MaxExp among the exponents S[1] to S[N] are identified. Figure 1 In the above example, the difference circuit 110 can receive the exponent sums S[1] to S[N] and include a plurality of logic gates operable as comparators (e.g., L1) configured to identify the maximum exponent sum MaxExp from the exponent sums S[1]-S[N].

[0074] According to some embodiments of the present disclosure, method 200 proceeds to operation 212, where exponential difference values ​​D[1] to D[N] are generated. Figure 1 In the above example, the difference circuit 110 may include a plurality of logic gates operable as a subtractor (e.g., B1), the subtractor being configured to subtract each of the exponent sums S[1] to S[N] from the maximum exponent sum MaxExp to generate a corresponding one of the exponent difference values ​​D[1] to D[N].

[0075] According to some embodiments of the present disclosure, method 200 proceeds to determination operation 214, where each of the index difference values ​​D[1] to D[N] is compared to a difference threshold value. Figure 1 The above example, the circuit 100 may include a plurality of comparators ( Figure 1216 ); and if any one of the exponent differences, such as D[n], is greater than the difference threshold, the comparator may generate a control signal having an opposite second logic state to deactivate the corresponding one of the second shifters 113B and activate the corresponding one of the first shifters 113A (operation 218).

[0076] In operation 216, upon determining that each of the exponent difference values ​​D[y] to D[z] is less than or equal to the difference threshold (e.g., by receiving the above-mentioned control signal), the first shifter 113A may prevent the products P[y] to P[z] from being shifted or received by the adder tree 114. At the same time, the second shifter 113B may shift the products P[y] to P[z] into shifted products SP[y] to SP[z], respectively, and send the shifted products SP[y] to SP[z] to the adder tree 116. The second shifter 113B may shift the products P[y] to P[z] using the local maximum exponent and MaxExpB as a baseline. In operation 218, upon determining that each of the exponent difference values ​​D[w] to D[x] is greater than the difference threshold (e.g., by receiving the control signal discussed above), the second shifter 113B may prevent the products P[w] to P[x] from being shifted or received by the adder tree 116. At the same time, the first shifter 113A may shift the products P[w] to P[x] into shifted products SP[w] to SP[x], respectively, and send the shifted products SP[w] to SP[x] to the adder tree 114. The first shifter 113A may shift the products P[w] to P[x] using the local maximum exponent and MaxExpA as a baseline.

[0077] According to some embodiments of the present disclosure, after operation 216, method 200 proceeds to operation 220, where the shifted products SP[y] to SP[z] are summed. Figure 1In the above example, the circuit 100 may include an adder tree 116 to sum the shift products SP[y] to SP[z] to generate the sum 117. According to some embodiments of the present disclosure, after operation 218, the method 200 proceeds to operation 222, in which the shift products SP[w] to SP[x] are summed. Figure 1 , circuit 100 may include an adder tree 114 to sum the shifted products SP[w] to SP[x] to generate a sum 115.

[0078] According to some embodiments of the present disclosure, method 200 proceeds to operation 224, where the shifted products SP[y] to SP[z] and the shifted products SP[w] to SP[x] are all added together. Figure 1 In the above example, the circuit 100 may include an adder tree 120 to add the shifted products SP[y] to SP[z] and the shifted products SP[w] to SP[x] as a partial sum PSTC. Alternatively, the adder tree 120 may combine the sum 115 with the sum 117 as a partial sum PSTC. In some embodiments of the present disclosure, before combining with the sum 117 (operation 224), the sum 115 may first be shifted into a shifted sum 115S using a local maximum exponential sum MaxExpB that may be equal to MaxExp as a baseline.

[0079] Figure 3 A circuit 100 ( Figure 1 ) is an example schematic 300 of a portion of ). Figure 3 Schematic diagram 300 presents an example in which circuit 100 receives or retrieves sixteen input data elements InDE and sixteen weight data elements WtDE. However, the number of input data elements InDE and the number of weight data elements WtDE may be less than or greater than sixteen while remaining within the scope of the present disclosure.

[0080] As shown, schematic 300 includes components 302, 304, 306A, 306B, 308, 310, 312, and 314. Component 302 may correspond to logic gate L1 of difference circuit 110; component 304 may correspond to logic gate B1 of difference circuit 110; component 306A may correspond to first shifter 113A of shift circuit 112; component 306B may correspond to second shifter 113B of shift circuit 112; component 308 may correspond to adder tree 114; component 310 may correspond to adder tree 116; component 312 may correspond to shift circuit 118; and component 314 may correspond to adder tree 120.

[0081] In such a configuration, component 302 may receive exponent sums S[1] to S

[16] and output the largest of exponent sums S[1]-S

[16] as the maximum exponent sum MaxExp. Component 304 may also receive exponent sums S[1] to S

[16] and generate exponent difference values ​​D[1] to D

[16] based on subtracting each of the exponent sums S[1]-S

[16] from the maximum exponent sum MaxExp. In other words, each of the exponent difference values ​​D[1] to D

[16] is a difference between a corresponding one of the exponent sums S[1] to S

[16] and the maximum exponent sum MaxExp. Component 306A includes a plurality of shifters, each of which is configured to receive (e.g., be controlled by) a corresponding one of the exponent difference values ​​D[1] to D

[16] ; and component 306B includes a plurality of shifters, each of which is configured to receive (e.g., be controlled by) a corresponding one of the exponent difference values ​​D[1] to D

[16] . The shifter of component 306A is configured to selectively shift the signed mantissa products P[1] to P

[16] to component 308 based on the respective exponent difference values ​​D[1] to D

[16] , and the shifter of component 306B is configured to selectively shift the signed mantissa products P[1] to P

[16] to component 310 based on the respective exponent difference values ​​D[1] to D

[16] .

[0082] In some embodiments, each shifter of component 306A and a corresponding one of the shifters of component 306B may be activated alternately to shift a corresponding one of the signed mantissa products P[1] to P

[16] . Figure 3 In response to the exponent difference value D

[15] being equal to or less than the preset difference threshold, one of the shifters of component 306A controlled based on the exponent difference value D

[15] may be deactivated, and a corresponding one of the shifters of component 306B controlled based on the same exponent difference value D

[15] may be activated. Continuing with the above example, after component 308 sums the shifted signed mantissa products P[1] to P

[16] except P

[15] , component 312 may shift the sum output by component 308 while component 310 sums the shifted signed mantissa products P

[15] . Component 314 may then add the shifted sum output by component 308 to the sum output by component 310 as a partial sum PSTC.

[0083] Figure 4 FIG. 4 is a block diagram of another data calculation circuit 400 according to some embodiments of the present disclosure. Figure 4In the illustrated embodiment, the data computation circuit 400, also referred to as the circuit 400 or the memory circuit 400, includes various components that are collectively configured to perform in-memory computations (e.g., multiply-accumulate (MAC) operations) on an input word vector and a weight matrix. The input word vector may include a plurality (N) of input data elements InDE, and the weight matrix may include a plurality (N) of weight data elements WtDE. In various embodiments, each of the input data elements InDE and the weight data elements WtDE may include a floating point number.

[0084] As shown, the circuit 400 includes a memory circuit 402, an input circuit 404, a plurality of multiplier circuits 406, a plurality of summing circuits 408, a difference circuit 410, a first shift circuit 412, a first adder circuit (or adder tree) 414, a latch circuit 416, a second shift circuit 418, a second adder circuit (or adder tree) 420, a first converter 422, and a second converter 424. In some embodiments, the number of multiplier circuits 406 may correspond to the number of summing circuits 408. For example, the circuit 400 may include N (weight / number of input data elements WtDE / InDE) multiplier circuits 406 and N (weight / number of input data elements WtDE / InDE) summing circuits 408. It should be understood that the simplified Figure 4 4 is a block diagram of the circuit shown in , and thus, circuit 400 may include any of a variety of other components while remaining within the scope of the present disclosure.

[0085] The memory circuit 402 may include one or more memory arrays and one or more corresponding circuits. Each of the memory arrays is a storage device including a plurality of storage elements 403, each storage element 403 including an electrical, electromechanical, electromagnetic or other device configured to store one or more data elements, each data element including one or more data bits represented by a logical state. In some embodiments, the logical state corresponds to a voltage level of a charge stored in a portion or all of the storage element 403. In some embodiments, the logical state corresponds to a physical property of a portion or all of the storage element 403, such as resistance or magnetic orientation.

[0086] In some embodiments, the storage element 403 includes one or more static random access memory (SRAM) cells. In various embodiments, the SRAM cell includes a plurality of transistors, for example, a five-transistor (5T) SRAM cell, a six-transistor (6T) SRAM cell, an eight-transistor (8T) SRAM cell, a nine-transistor (9T) SRAM cell, etc. In some embodiments, the SRAM cell includes a length that is at least twice greater than the width.

[0087] In some embodiments, the storage element 403 includes one or more dynamic random access memory (DRAM) cells, resistive random access memory (RRAM) cells, magnetoresistive random access memory (MRAM) cells, ferroelectric random access memory (FeRAM) cells, NOR flash memory cells, NAND flash memory cells, conductive bridging random access memory, non-volatile memory (NVM) cells, 3D NVM cells, or other memory cell types capable of storing bit data.

[0088] In addition to the memory array, the memory circuit 402 may also include a plurality of circuits to access or otherwise control the memory array. For example, the memory circuit 402 may include a plurality of (e.g., word line) drivers operably coupled to the memory array. The driver may apply a signal (e.g., voltage) to the corresponding storage element 403 to allow access (e.g., programming, reading, etc.) to these storage elements 403. For example, the memory circuit 402 may include a plurality of programming circuits and / or reading circuits operably coupled to the memory array.

[0089] Each of the memory arrays of the memory circuit 402 is configured to store a plurality of weight data elements WtDE. In some embodiments, the programming circuit may write the weight data elements WtDE into the corresponding storage elements 403 of the memory array, respectively, and the read circuit may read the bits written into the storage elements 403 to verify or otherwise test whether the weight data elements WrDE written are correct. The driver of the memory circuit 402 may include or be operably coupled to a plurality of input activation latches, which are configured to receive and temporarily store input data elements InDE. In some other embodiments, such an input activation latch may be a part of the input circuit 404, which may also include a plurality of buffers, which are configured to temporarily store the weight data elements WtDE retrieved from the memory array of the memory circuit 402. In this way, the input circuit 404 may receive the input data elements InDE and the weight data elements WtDE.

[0090] In various embodiments of the present disclosure, the circuit 400 is configured such that the input word vector (including, for example, input data elements InDE) and the weight matrix (including, for example, weight data elements WtDE) on which the MAC operation is performed each include a plurality of floating point numbers. Thus, each of the data elements InDE and the weight data elements WtDE includes a sign bit, a plurality of exponent bits, and a plurality of mantissa bits (sometimes referred to as fraction bits).

[0091] For example, each of the data element InDE and the weight data element WtDE has a BF16 format, also referred to in some embodiments as a bfloat format or a brain floating point format, in which the first bit represents the sign of the floating point number, the following eight bits represent the exponent of the floating point number, and the last seven bits represent the mantissa or fraction of the floating point number. Because the mantissa is configured to start with a non-zero value, the last seven bits of each stored data element represent an eight-bit mantissa with the first most significant bit (MSB) equal to 1.

[0092] In certain embodiments, each of the data element InDE and the weight data element WtDE has a FP16 format, also referred to as a half-precision format, wherein the first bit represents the sign of a floating-point number, the following five bits represent the exponent of a floating-point number, and the last ten bits represent the mantissa or fraction of a floating-point number. In this case, the last 10 bits of each stored data element represent an 11-bit mantissa with the first MSB equal to 1. In some other embodiments, each of the data element InDE and the weight data element WtDE has a floating-point format other than BF16 or FP16 format, for example, another 16-bit format, 32-bit, 64-bit, 128-bit or 256-bit format, or a 40-bit or 80-bit extended precision format. The sign and mantissa of the data element representing a floating-point number are collectively referred to as the signed mantissa of a floating-point number. The MSB of the mantissa is referred to as a hidden bit or hidden MSB.

[0093] Still reference Figure 4 , input circuit 404 is configured to output the entirety of each of data elements InDE and WtDE to each of multiplier circuit 406 and summing circuit 408. In some embodiments, input circuit 404 is configured to output the signed mantissa of each data element to multiplier circuit 406 and the exponent of each data element to summing circuit 408, which will be described below.

[0094] The multiplier circuits 406 are each an electronic circuit, such as an integrated circuit (IC), configured to receive, for example, a sign bit InS and a mantissa InM (collectively referred to as a signed mantissa InS / InM) of each of the N data elements InDE, and a sign bit WtS and a mantissa WtM (collectively referred to as a signed mantissa WtS / WtM) of each of the N data elements WtDE from the input circuit 404. The summation circuits 408 are each an electronic circuit, such as an IC, configured to receive, for example, an exponent InE of each of the N data elements InDE and an exponent WtE of each of the N data elements WtDE from the input circuit 404.

[0095] The multiplier circuits 406 may each include one or more data registers (not shown) configured to receive instances of the signed mantissas InS / InM and WtS / WtM. Figure 4In the illustrated embodiment, multiplier circuit 406 is configured to receive instances of signed mantissas InS / InM and WtS / WtM corresponding to data elements InDE and WtDE. In some other embodiments, multiplier circuit 406 includes one or more data registers configured to receive instances of signed mantissas InS / InM and / or WtS / WtM including a hidden MSB. In some embodiments, multiplier circuit 406 includes one or more data registers configured to add the hidden MSB to the received instances of signed mantissas InS / InM and / or WtS / WtM.

[0096] The multiplier circuit 406 may also include logic circuitry (not shown) configured to reformat each instance of the signed mantissa InS / InM into a two's complement mantissa InTC, also referred to as a reformatted mantissa InTC, and to reformat each instance of the signed mantissa WtS / WtM into a two's complement mantissa WtTC, also referred to as a reformatted mantissa WtTC, in an operation. The reformatted mantissa InTC has the same number of bits as the signed mantissa InS / InM, and the reformatted mantissa WtTC has the same number of bits as the signed mantissa WtS / WtM.

[0097] The multiplier circuit 406 may also include one or more logic gates M1 configured to multiply some or all instances of the reformatted mantissa InTC with some or all instances of the reformatted mantissa WtTC in an operation to generate N products, e.g., P[1] to P[N]. In various embodiments, the one or more logic gates M1 include one or more AND or NOR gates or other circuits suitable for performing some or all of the multiplication operations. The one or more logic gates M1 are configured to generate each of the products P[1] to P[N] in an operation as a two's complement data element, the two's complement data element including a number of bits equal to twice the number of bits of the reformatted mantissas InTC and WtTC minus one.

[0098] The multiplier circuit 406 is configured to generate N products P[1] to P[N] in operation. For example, the multiplier circuit 406 may generate a number N of products P[1]-P[N] equal to sixteen. In some other embodiments, the multiplier circuit 106 may generate a number N of products P[1]-P[N] less than or greater than sixteen.

[0099] In some embodiments, for example, those embodiments in which the data elements InDE and WtDE have a BF16 format, the multiplier circuit 406 is configured to generate each of the products P[1]-P[N] having a total of 17 bits based on the signed mantissas InS / InM and WtS / WtM having a total of 9 bits and each of the reformatted mantissas InTC and WtTC. In some embodiments, for example, those embodiments in which the data elements InDE and WtDE have a FP16 format, the multiplier circuit 406 is configured to generate each of the products P[1]-P[N] having a total of 23 bits based on the signed mantissas InS / InM and WtS / WtM having a total of 12 bits and each of the reformatted mantissas InTC and WtTC. Embodiments in which multiplier circuit 406 is configured to generate each of products P[1]-P[N] having other total numbers of bits based on signed mantissas InS / InM and WtS / WtM having other numbers of bits and each of reformatted mantissas InTC and WtTC are within the scope of the present disclosure.

[0100] The multiplier circuit 406 is thus configured to perform a multiplication and reformatting operation on the sign and mantissa bits of the input data element InDE and the weight data element WtDE in an operation to generate a two's complement product P[1]-P[N]. The multiplier circuit 406 is configured to output the product P[1]-P[N] to the shift circuit 112 on a data bus (not shown).

[0101] The summing circuits 408 each include one or more data registers (not shown) configured to receive instances of exponents InE and WtE corresponding to the number of data elements InDE and WtDE discussed above with respect to the multiplier circuits 406 .

[0102] The summing circuits 408 each include one or more logic gates A1 configured to add each instance of the exponent InE to each instance of the exponent WtE in an operation. In various embodiments, the one or more logic gates A1 include one or more full adder gates, half adder gates, ripple carry adder circuits, carry save adder circuits, carry select adder circuits, carry lookahead adder circuits, or other circuits suitable for performing some or all of the addition operations. The respective logic gates A1 of the summing circuits 408 are configured to generate the exponent sum S[1]-S[N] as a data element having a total number of bits equal to the number of bits in each of the exponents InE and WtE plus 1.

[0103] Summation circuit 408 is configured to generate exponential sums S[1]-S[N] in an operation having a total number N and ordering of data elements corresponding to the total number N and ordering of data elements of products P[1]-P[N] discussed above with respect to multiplier circuit 406. Thus, for a total of N combinations of data elements InDE and WtDE, each nth combination corresponds to an nth exponent sum S[n] in the exponential sums S[1]-S[N] and an nth product P[n] in the products P[1]-P[N].

[0104] In some embodiments, such as those in which the data elements InDE and WtDE have a BF16 format, the summation circuit 408 is configured to generate each corresponding one of the sums S[1]-S[N] having a total of nine bits based on each of the exponents InE and WtE having a total of eight bits. In some embodiments, such as those in which the data elements InDE and WtDE have an FP16 format, the summation circuit 408 is configured to generate each of the sums S[0]-S[N] having a total of six bits based on each of the exponents InE and WtE having a total of five bits. It is within the scope of the present disclosure that the summation circuit 408 is configured to generate each of the sums S[1]-S[N] having other total numbers of bits based on each of the exponents InE and WtE having other total numbers of bits. The summation circuit 408 is configured to output the sums S[1]-S[N] to the difference circuit 410 on a data bus (not shown).

[0105] Difference circuit 410 is an electronic circuit, such as an IC, including one or more logic gates L1 and one or more logic gates B1, each of which is configured to receive the exponent sum S[1]-S[N] from summation circuit 408. The one or more logic gates L1 may sometimes be referred to as a selector, and the one or more logic gates B1 may sometimes be referred to as a subtractor. The one or more logic gates L1 are configured to generate a maximum exponent sum MaxExp as a data element in an operation, the data element having a value equal to the maximum value of the data elements of the exponent sums S[1]-S[N] and having a number of bits equal to the number of bits of the data elements of the exponent sums S[1]-S[N]. The one or more logic gates L1 are configured to output the maximum exponent sum MaxExp to the one or more logic gates B1 and converter circuit 424, as described below.

[0106] The one or more logic gates B1 are configured to generate a difference value D[1]-D[N] by subtracting each data element of the exponent sum S[1]-S[N] from the maximum exponent sum MaxExp in the operation. The difference value D[1]-D[N] thus has a total number N and an ordering of data elements corresponding to the ordering of the exponent sum S[1]-S[N] and the product P[1]-P[N] described above. Figure 4In the illustrated embodiment, one or more logic gates B1 are configured to output the difference values ​​D[1]-D[N] to the shift circuit 412 on a data bus (not shown). In some embodiments, the one or more logic gates B1 are not configured to output the difference values ​​D[1]-D[N] to the multiplier circuit 406, and each of the multiplier circuits 406 is configured to generate each instance P[N] of the product P[1]-P[N] by always performing a multiplication operation. In some other embodiments, the one or more logic gates B1 are configured to output the difference values ​​D[1]-D[N] to the multiplier circuit 406, respectively, and each of the multiplier circuits 406 is configured to generate each instance P[n] of the product P[1]-P[N] by selectively performing a multiplication operation based on the corresponding instance D[n].

[0107] Shift circuit 412 is an electronic circuit, such as an IC, including one or more registers and / or logic gates, which is configured to perform a shift operation on each instance P[n] of the product P[1]-P[N] based on the value of the corresponding instance D[n] of the difference D[1]-D[N].

[0108] Each instance P[n] of the product P[1]-P[N] is based on the sign and mantissa of the corresponding combination of data elements InDE and WtDE, and each instance D[n] of the difference value D[1]-D[N] is based on the sum of the exponents of the same combination. The shift circuit 412 is configured to right shift each instance P[n] of the product P[1]-P[N] by an amount equal to the corresponding difference value D[n] in the operation, thereby generating shifted products SP[1]-SP[N], wherein the sign and mantissa bits are aligned according to the summed exponents used to generate the difference values ​​D[1]-D[N]. Based on the alignment, the shift circuit 412 is configured to use the maximum exponent and MaxExp as a baseline to generate each instance SP[n] of the shifted product SP[1]-SP[N] with the same exponent.

[0109] To compensate for the right shift operation, the shift circuit 412 can add an instance of the sign bit (zero or one) of each product P[n] as the leftmost bit of the corresponding shifted product SP[n]. The number of instances of the sign bit added is equal to the right shift amount determined by the corresponding difference value D[n].

[0110] exist Figure 4 In the illustrated embodiment, the multiplier circuit 406 may generate a corresponding instance P[n] of the product P[1]-P[N] by performing a multiplication operation, as described above. The shift circuit 412 may include a plurality (eg, N) of shifters 413 (refer to Figure 6-Figure 7Shifter 413 may receive products P[1]-P[N] from multiplier circuit 406, selectively output (e.g., shift) one or more first products of shifted products SP[1]-SP[N] to adder circuit 414 based on respective differences D[1]-D[N] during a first time period, and selectively output (e.g., shift) one or more second products of shifted products SP[1]-SP[N] to adder circuit 414 based on respective differences D[1]-D[N] during a second time period. For example, in Figure 4 In one aspect of the present disclosure, the first shifted product output to the adder circuit 414 (during the first time period) may include SP[w]-SP[x], and the second shifted product output to the adder circuit 414 (during the second time period) may include SP[y]-SP[z], where "w", "x", "y", and "z" may each be one of integers from 1 to N. In one aspect of the present disclosure, the sum of the number of SP[w]-SP[x] and the number of SP[y]-SP[z] may be equal to N. In another aspect of the present disclosure, the sum of the number of SP[w]-SP[x] and the number of SP[y]-SP[z] may be less than N.

[0111] The shifter 413 may be configured based on the difference between the corresponding one of the difference values ​​D[1]-D[N] and the first difference threshold value ( Figure 4 The first difference threshold value may be configured based on the distribution of the difference values ​​D[1]-D[N]. In an example where the difference values ​​D[1]-D[N] are represented as a normal distribution, the first difference threshold value may be determined to be one standard deviation below the mean of the normal distribution. In another example where the difference values ​​D[1]-D[N] are still represented as a normal distribution, the first difference threshold value may be determined to be two standard deviations below the mean of the normal distribution. In yet another example where the difference values ​​D[1]-D[N] are still represented as a normal distribution, the first difference threshold value may be determined to be any standard deviation value below the mean of the normal distribution.

[0112] When any difference value, e.g., D[n], where n is an integer between 1 and N, is equal to or less than a first difference threshold value (sometimes referred to as a "small exponent difference value"), during a first time period, a corresponding one of the shifters 413 is deactivated to block the corresponding shifted product SP[n] from being received by the adder circuit 414 (e.g., does not shift the corresponding product P[n] or is decoupled from the adder circuit 114). During a second time period, a corresponding one of the shifters 413 is activated to shift the previously blocked product P[n] and output it to the adder circuit 414. Equivalently, when each difference value D[n] is greater than the first difference threshold value (sometimes referred to as a "normal exponent difference value"), during a first time period, a corresponding one of the shifters 413 is activated to output the corresponding shifted product SP[n] to the adder circuit 414. During a second time period, a corresponding one of the shifters 413 is deactivated to block the previously shifted product SP[n] from being received by the adder circuit 414.

[0113] In other words, the shift circuit 412 can shift all the products P[1]-P[N] and selectively output the shifted products SP[1]-SP[N] to the adder circuit 414 at different timings based on comparing the respective difference values ​​D[1]-D[N] with the first difference threshold value. In this way, the sum of the number of SP[w]-SP[x] (output by the shifter 413 during the first time period) and the number of SP[y]-SP[z] (output during the second time period) can be equal to N.

[0114] In addition, to generate SP[w]-SP[x] during the first time period, the shifter 413 may right shift each instance P[n] of the product P[w]-P[x] by an amount equal to the corresponding difference DA[n], thereby aligning the sign and mantissa bits according to the summed exponent. In some embodiments, the difference DA[n] may be generated (e.g., by the difference circuit 410) based on subtracting each data element of the sum S[w]-S[x] from a "local" maximum exponent and MaxExpA. The local maximum exponent and MaxExpA may correspond to the maximum value of the data elements of the sum S[w]-S[x]. Based on this alignment, the shifter 413 may use the maximum exponent and MaxExpA as a baseline to generate each instance SP[n] of the shifted product SP[w]-SP[x] with the same exponent. Similarly, during the second time period, the shifter 413 may right shift each instance P[n] of the product P[y]-P[z] by an amount equal to the corresponding difference DB[n], thereby aligning the sign and mantissa bits according to the summed exponent. In some embodiments, difference value DB[n] may be generated (e.g., by difference circuit 410) based on subtracting each data element of sum S[y]-S[z] from a "local" maximum exponent sum MaxExpB. The local maximum exponent sum MaxExpB may correspond to the maximum value of the data elements of sum S[y]-S[z]. In some embodiments, the local maximum exponent sum MaxExpB may be equal to the "global" maximum exponent sum MaxExp. Based on this alignment, shifter 413 may use the maximum exponent sum MaxExpB as a baseline to generate each instance SP[n] of shifted product SP[y]-SP[z] having the same exponent.

[0115] In addition to the first difference threshold, the shifter 413 may also be configured based on the difference between the corresponding one of the difference values ​​D[1]-D[N] and the second difference threshold ( Figure 1 In an example where the difference D[1]-D[N] is represented as a normal distribution, the second difference threshold value can be determined to be one standard deviation above the mean of the normal distribution. In another example where the difference D[1]-D[N] is still represented as a normal distribution, the second difference threshold value can be determined to be two standard deviations above the mean of the normal distribution. In yet another example where the difference D[1]-D[N] is still represented as a normal distribution, the second difference threshold value can be determined to be any standard deviation value above the mean of the normal distribution.

[0116] When any difference value (e.g., D[n], where n is an integer between 1 and N) is equal to or less than a first difference threshold value (sometimes referred to as a "small exponent difference value"), a corresponding one of the shifters 413 is deactivated during a first time period to prevent the adder circuit 414 from receiving the corresponding shifted product SP[n], and then a corresponding one of the shifters is activated during a second time period to output the corresponding shifted product SP[n] to the adder circuit 414. In addition, when any of the difference values ​​D[n] is equal to or greater than a second difference threshold value (sometimes referred to as a "large exponent difference value"), a corresponding one of the shifters 413 is deactivated to prevent the corresponding shifted product SP[n] from being received by the adder circuit 414 (e.g., the corresponding product P[n] is not shifted or is decoupled from the adder circuit 414), and the corresponding one of the shifters may not be activated during the second time period or any subsequent timing. In some embodiments, the product P[n] with such a large exponent difference value may be ignored.

[0117] In other words, the shift circuit 412 may shift all or some of the products P[1]-P[N] and selectively output corresponding ones of the shifted products SP[1]-SP[N] to the adder circuit 414 based on comparing the respective difference values ​​D[1]-D[N] with the first difference threshold and the second difference threshold. In this way, the sum of the number of SP[w]-SP[x] (output by the shifter 413 during the first time period) and the number of SP[y]-SP[z] (output by the shifter 413 during the second time period) may be less than or equal to N. The sum is less than N when one or more of the products P[1]-P[N] are ignored (e.g., so that their respective exponential difference values ​​D[n] are equal to or greater than the second difference threshold); and the sum is equal to N when none of the products P[1]-P[N] are ignored.

[0118] In some other embodiments, the multiplier circuit 406 may also receive the difference value D[1]-D[N], and if the difference value D[N] is equal to or greater than the second difference threshold, the multiplier circuit 406 may ignore the product of the corresponding reformatted mantissa InTC and the corresponding reformatted mantissa WtTC. In this way, the number of products received by the shift circuit 412 may be less than N, for example, P[1] to P[N] in addition to one or more P[n]. The remaining products P[1]-P[N] may then be selectively shifted by the shifter 413 based on comparing their respective difference values ​​D[1]-D[N] to the first difference threshold.

[0119] In some embodiments, such as those in which the data elements InDE and WtDE have a BF16 format, the shift circuit 412 is configured to generate each shift product having a total of 21 bits, such as SP[0] to SP[N], based on each of the products P[0] to P[N] having a total of 17 bits. In some embodiments, such as those in which the data elements InDE and WtDE have an FP16 format, the shift circuit 412 is configured to generate each of the shift products having a total of 27 bits, such as SP[0] to SP[N], based on each of the products P[0] to P[N] having a total of 23 bits. It is within the scope of the present disclosure that the shift circuit 412 is configured to generate each of the shift products SP[0] to SP[N] having other total numbers of bits, based on each of the products P[0] to P[N] having other total numbers of bits.

[0120] Based on the product P[0]-P[N] having a two's complement format, the shift circuit 412 is configured to generate a shift product having a two's complement format, such as SP[0]-SP[N]. As described above, Figure 4 In the example shown, the shifter 413 is configured to output the shifted product SP[w]-SP[x] to the adder circuit (tree) 414 on a data bus (not shown) during a first time period, and then output the shifted product SP[y]-SP[z] to the adder circuit (tree) 414 on the same or another data bus (not shown) during a second time period.

[0121] The adder tree 414 is an electronic circuit, such as an IC, including multiple layers of one or more logic gates (not shown), such as discussed above with respect to one or more logic gates A1 (of the summing circuit 408). For example, during a first time period, the adder tree 414 may include a first layer configured to receive the shift products SP[w]-SP[x], and a last layer configured to generate a sum 415_T1 as a data element corresponding to the sum of the shift products SP[w]-SP[x]; and, during a second time period, the same adder tree 414 may utilize the first layer to receive the shift products SP[y]-SP[z], and utilize the last layer to generate a sum 415_T2 as a data element corresponding to the sum of the shift products SP[y]-SP[z]. In some embodiments, each of the one or more consecutive layers between the first layer and the last layer is configured to receive a first number of sum data elements generated by a previous layer, and generate a second number of sum data elements based on the first number of sum data elements, the second number being half the first number. Therefore, the total number of layers includes the first and last layer and each successive layer, if any.

[0122] In some embodiments, the sum 415_T1 output by the adder tree 414 during the first time period may be further provided to a latch circuit 416 and then to a shift circuit 418. The latch circuit 416 is an electronic circuit, such as an IC, including one or more registers and / or logic gates, which is configured to temporarily store the sum 415_T1 and hold the sum 415_T2 until the adder tree 414 provides a new value of the sum 415_T1. The shift circuit 418 is an electronic circuit, such as an IC, including one or more registers and / or logic gates, which is configured to perform a shift operation on the sum 415_T1, thereby generating a shifted sum 415_T1S. As described above, the shift product SP[w]-SP[x] is generated based on the local maximum exponent and MaxExpA during the first time period, and the shift product SP[y]-SP[z] is generated according to the local maximum exponent and MaxExpB (e.g., equal to the maximum exponent and MaxExp) during the second time period. Thus, sum 415_T1 may be associated with an exponent of MaxExpA, while sum 415_T2 may be associated with an exponent of MaxExpB. Shift circuit 418 may further shift sum 415_T1 such that shifted sum 415_T1S is aligned with sum 415_T2, eg, having an exponent of MaxExp.

[0123] The adder circuit (tree) 420 is an electronic circuit, such as an IC, including multiple layers of one or more logic gates (not shown), such as discussed above with respect to one or more logic gates A1 (of the summing circuit 108). For example, the adder tree 420 may include a first layer configured to receive the sums 415_T2 and 415_T1S, and a last layer configured to generate the sum PSTC as a data element corresponding to the sum of the shift products SP[w]-SP[x] and SP[y]-SP[z]. In some embodiments, each of the one or more consecutive layers between the first layer and the last layer is configured to receive a first number of sum data elements generated by a previous layer, and to generate a second number of sum data elements based on the first number of sum data elements, the second number being half the first number. Thus, the total number of layers includes the first layer and the last layer and each consecutive layer (if present).

[0124] In some embodiments, the sum PSTC, sometimes referred to as the partial sum PSTC or mantissa sum PSTC, has a total number of bits corresponding to the number of bits and the number of data elements of the shift products SP[w]-SP[x] and SP[y]-SP[z]. In some embodiments, the number of bits of the sum PSTC is equal to the number of bits of the shift products SP[w]-SP[x] and SP[y]-SP[z] plus the number of bits that can represent the number of data elements of the shift products SP[w]-SP[x] and SP[y]-SP[z]. In some embodiments, the number of bits of the sum PSTC is equal to the number of bits of the shift products SP[w]-SP[x] and SP[y]-SP[z] plus four bits that can represent 16 data elements of the shift products SP[w]-SP[x] and SP[y]-SP[z].

[0125] In some embodiments, for example, embodiments where the data elements InDE and WtDE have a BF16 format, the adder tree 420 is configured to generate a total of 25 bits of sum PSTC based on each of the shift products SP[w]-SP[x] and SP[y]-SP[z] having a total of 21 bits. In some embodiments, for example, embodiments where the data elements InDE and WtDE have a FP16 format, the adder tree 420 is configured to generate a total of 31 bits of sum PSTC based on each of the shift products SP[w]-SP[x] and SP[y]-SP[z] having a total of 27 bits. It is within the scope of the present disclosure that the adder tree 420 is configured to generate a sum PSTC based on each of the shift products SP[w]-SP[x] and SP[y]-SP[z] having other total bits.

[0126] According to various embodiments of the present disclosure, based on the shift products SP[w]-SP[x] and SP[y]-SP[z] having a two's complement format, the adder tree 420 is configured to generate a sum PSTC having a two's complement format. In this way, the adder tree 420 is configured to output the sum PSTC to the converter 422 on a data bus (not shown). In some other embodiments, the adder tree 420 can output the sum PSTC to a circuit (not shown) outside the circuit 400.

[0127] Converter 422 is an electronic circuit, such as an IC, including logic circuits, configured to receive the sum PSTC from adder tree 420 in operation and convert the sum PSTC from two's complement to a sum PSSM having a sign-plus-mantissa format. Converter 422 is configured to generate a sum PSSM having the same number of bits as the sum PSTC. Figure 4In the illustrated embodiment, converter 422 is configured to further output the sum PSSM on a data bus (not shown) to converter 424. In some other embodiments, converter 422 may output the sum PSSM to a circuit (not shown) external to circuit 400.

[0128] Converter 424 is an electronic circuit, such as an IC, including logic circuits configured to receive the sum PSSM from converter 422 and the maximum exponent and MaxExp from difference circuit 410 in an operation, and convert the sum PSSM from a sign-plus-mantissa format to a sum PS having an output format based on the sum PSSM and MaxExp and different from the sign-plus-mantissa format, such as a floating-point format as described above. In various embodiments of the present disclosure, converter 424 can generate a sum PS configured to be compatible with a circuit (not shown) external to circuit 400. For example, converter 424 is configured to output the sum PS to a circuit (not shown) external to circuit 400, such as a memory array as part of a CNN or other instances of circuit 400.

[0129] Figure 5 A flowchart of another example method 500 for generating a sum based on performing a MAC operation on a plurality of input data elements and a plurality of weight data elements according to some embodiments of the present disclosure is shown, each of the input data elements and the weight data elements comprising a plurality of floating point numbers. The method 500 may be performed to operate the circuit 400 ( Figure 4 ), therefore, in the following discussion of the operation of method 500, the Figure 4 It should be noted that method 500 is merely an example and is not intended to limit the present disclosure. Therefore, it should be understood that the method 500 may be used in Figure 5 Additional operations are provided before, during, and after method 500, and some other operations may only be briefly described herein.

[0130] According to some embodiments of the present disclosure, method 500 starts from operations 502 and 504, in which multiple (N) input data elements (InDE) and multiple (N) weight data elements (WtDE) are received, respectively. Each of the input data elements InDE and the weight data elements WtDE can be implemented as a floating point number. The input data elements InDE can correspond to input word vectors, and the weight data elements WtDE can correspond to weight matrices. Using Figure 4The circuit 400 shown is used as an example, and the circuit 400 can receive the input data element InDE and the weight data element WtDE through the input circuit 404. In some embodiments, the weight data element WtDE can be stored in the storage element of the memory circuit 402, and the input data element InDE can be received by the memory circuit 402 and the input circuit 404.

[0131] According to some embodiments of the present disclosure, the method 500 proceeds to operation 506, in which the corresponding signed mantissa parts of the input data element InDE and the weight data element WtDE are multiplied with each other to generate products P[1] to P[N]. Figure 4 In the above example, each of the N input data elements InDE includes a signed mantissa portion, such as InS / InM, and each of the N weight data elements WtDE includes a signed tail portion, such as WtS / WtM. Each of the multiplier circuits 406 may include a plurality of logic gates operable as a multiplier (e.g., M1) configured to multiply the signed mantissa portion of a corresponding one of the N input data elements InDE with the signed mantissa portion of a corresponding one of the N weight data elements WtDE to generate a corresponding one of the products P[1] to P[N]. Before multiplication, each of the multiplier circuits 406 may reformat or otherwise transform the signed mantissa portions of the corresponding input data element InDE and the weight data element WtDE into a two's complement mantissa InTC and a two's complement mantissa WtTC, respectively.

[0132] According to some embodiments of the present disclosure, method 500 proceeds to operation 508, in which the respective exponential parts of the input data element InDE and the weight data element WtDE are added together to generate the exponential sum S[1]-S[N]. Figure 4 In the above example, each of the N input data elements InDE includes an exponent portion, such as InE, and each of the N weight data elements WtDE includes an exponent portion, such as WtE. Each of the multiplier circuits 406 can include a plurality of logic gates that are operable as adders (e.g., A1) configured to sum the exponent portion of a corresponding one of the N input data elements InDE with the exponent portion of a corresponding one of the N weight data elements WtDE to generate a corresponding one of the exponent sums S[1] to S[N].

[0133] According to some embodiments of the present disclosure, method 500 proceeds to operation 510, where the maximum exponent and MaxExp among the exponents S[1] to S[N] are identified. Figure 4In the above example, the difference circuit 410 can receive the exponent sums S[1] to S[N] and include a plurality of logic gates operable as comparators (e.g., L1) configured to identify the maximum exponent and MaxExp from the exponent sums S[1]-S[N].

[0134] According to some embodiments of the present disclosure, method 500 proceeds to operation 512, where exponential difference values ​​D[1] to D[N] are generated. Figure 4 In the above example, the difference circuit 410 may include a plurality of logic gates operable as subtractors (e.g., B1) configured to subtract each of the exponent sums S[1] to S[N] from the maximum exponent sum MaxExp to generate a corresponding one of the exponent difference values ​​D[1] to D[N].

[0135] According to some embodiments of the present disclosure, method 500 proceeds to determination operation 514, where each of the index difference values ​​D[1] to D[N] is compared to a difference threshold value. Figure 4 The above example, the circuit 400 may include a plurality of comparators ( Figure 4 4 , each comparator is configured to compare a corresponding one of the exponential difference values ​​D[1] to D[N] with a difference threshold value and generate a corresponding control signal. In some embodiments, such a comparator may exist between each of the exponential difference values ​​D[1] to D[N] and a corresponding one of the shifters 413. For example, if any exponential difference value (e.g., D[n]) is identified as being less than or equal to the difference threshold value, during a first time period, the comparator may generate a control signal having a first logic state to deactivate a corresponding one of the shifters 413 while activating the remaining shifters 413 (operation 516); and, during a second time period, the comparator may generate a control signal having an opposite second logic state to activate one of the previously deactivated shifters 413 while deactivating the remaining shifters 413 (operation 518).

[0136] Upon determining that each of the exponent difference values ​​D[w] to D[x] is greater than the difference threshold and each of the exponent difference values ​​D[y] to D[z] is equal to or less than the difference threshold (e.g., by receiving the control signal discussed above), during the first time period, the shifter 413 may prevent the products P[y] to P[z] from being shifted or received by the adder tree 414. At the same time, the shifter 413 may shift the products P[w] to P[x] into shifted products SP[w] to SP[x], respectively (operation 516). Next, in operation 520 (still during the first time period), the shifter 413 may send the shifted products SP[w] to SP[x] to the adder tree 414 to sum the shifted products SP[w] to SP[y] into the sum 415_T1. Next, in operation 524 (still during the first time period), adder tree 414 may send sum 415_T1 to latch circuit 416 for (eg, temporary) storage therein. Shifter 413 may shift product P[w] to P[x] using the local maximum exponent and MaxExpA as a baseline.

[0137] Next, during a second time period (e.g., after the first time period), the shifter 413 may prevent the products P[w] to P[x] from being shifted or received by the adder tree 414. Instead, the shifter 413 may shift the products P[y] to P[z] into shifted products SP[y] to SP[z], respectively (operation 518). Next, in operation 522 (still during the second time period), the shifter 413 may send the shifted products SP[y] to SP[z] to the adder tree 414 to add the shifted products SP[y] to SP[z] as the sum 415_T2. During the second time period, the sum 415_T1 may still be stored in the latch circuit 416. The shifter 413 may shift the products P[y] to P[z] using the local maximum exponent and MaxExpB as a baseline.

[0138] According to some embodiments of the present disclosure, method 500 proceeds to operation 526, where the shift products SP[y] to SP[z] and the shift products SP[w] to SP[x] are all added together. Figure 4 In the above example, the circuit 400 may include an adder tree 420 to add the shift products SP[y] to SP[z] to the shift products SP[w] to SP[x] as a partial sum PSTC. Alternatively, the adder tree 420 may combine the sum 415_T2 and the sum 415_T1 as a partial sum PSTC. The adder tree 420 may perform such a combination during a third time period after the second time period. For example, the circuit 400 may first calculate the sum 415_T1 and temporarily store it in the latch circuit, calculate the sum 415_T2 while keeping the sum 415_T2 stored in the latch circuit, and then combine the sum 415_T1.l In some embodiments of the present disclosure, before being combined with the sum 415_T2 (operation 526), ​​the sum 415_T1 may first be shifted into a shifted sum 415_T1S using the local maximum exponential sum MaxExpB, which may be equal to MaxExp, as a baseline.

[0139] Figure 6 and Figure 7 The circuit 400 ( Figure 4 ). Specifically, the schematic diagrams 600 and 700 correspond to the same circuit 400 operating during different time periods (e.g., a first time period and a second time period). Schematic diagrams 600 / 700 present an example in which the circuit 400 receives or retrieves sixteen input data elements InDE and sixteen weight data elements WtDE. However, the number of input data elements InDE and the number of weight data elements WtDE can be less than or greater than sixteen while remaining within the scope of the present disclosure.

[0140] As shown, schematic 600 / 700 includes components 602, 604, 606, 608, 610, 612, and 614. Component 602 may correspond to logic gate L1 of difference circuit 410; component 604 may correspond to logic gate B1 of difference circuit 410; component 606 may correspond to shifter 413 of shift circuit 412; component 608 may correspond to adder tree 414; component 610 may correspond to latch circuit 416; component 612 may correspond to shift circuit 418; and component 614 may correspond to adder tree 420.

[0141] In such a configuration, component 602 may receive exponent sums S[1] to S

[16] and output the largest of the exponent sums S[1] to S

[16] as the maximum exponent sum MaxExp. Component 604 may also receive exponent sums S[1] to S

[16] and generate exponent difference values ​​D[1] to D

[16] based on subtracting each of the exponent sums S[1] to S

[16] from the maximum exponent sum MaxExp. In other words, each of the exponent difference values ​​D[1] to D

[16] is the difference between a corresponding one of the exponent sums S[1] to S

[16] and the maximum exponent sum MaxExp. Component 606 includes a plurality of shifters, each of which is configured to receive (e.g., be controlled by) a corresponding one of the exponent difference values ​​D[1] to D

[16] . The shifters of component 606 are configured to selectively shift the signed mantissa products P[1] to P

[16] to component 608 based on respective exponent difference values ​​D[1] to D

[16] during different time periods. In some embodiments, a first subset of the shifters of component 606 may shift and output a corresponding first one of the signed mantissa products P[1] to P

[16] to component 608 during a first time period in response to identifying that their corresponding exponent difference values ​​are greater than a preset difference threshold, and a second subset of the shifters of component 606 may shift and output a corresponding second one of the signed mantissa products P[1] to P

[16] to component 608 during a second time period in response to identifying that their corresponding exponent difference values ​​are equal to or less than the preset difference threshold.

[0142] For example, in Figure 6 and Figure 7 In response to identifying that the exponential difference value D

[15] is equal to or less than a preset difference threshold and the other exponential differences are greater than the difference threshold, during a first time period, one of the shifters of component 606 controlled based on the exponential difference value D

[15] may be deactivated, while the other shifters controlled based on the exponential differences D[1]-D

[14] and D

[16] may be activated ( Figure 6 ); and, during a second time period, the shifter of component 606 controlled based on the exponential difference value D

[15] may be activated, while the other shifters controlled based on the exponential difference values ​​D[1]-D

[14] and D

[16] may be deactivated ( Figure 7 ). In addition, in the first time period ( Figure 6 ), the signed mantissa products P[1] to P

[14] and P

[16] are shifted by the activated shifters, respectively, and output to component 608 for summation. The sum (415_T1) output by component 608 during the first time period is then latched by latch circuit 610. During the second time period ( Figure 7), the signed mantissa product P

[15] is shifted by the activated shifter and output to component 608 for summation. The sum (415_T2) output by component 608 during the second time period is then combined with the sum (415_T1) by component 614 during a later time period. Figure 6 to Figure 7 In the above example, component 612 can shift the sum output by component 608 during the first time period (415_T1) before combining with sum 415_T2. Component 614 can then add the shifted sum (415_T1S) generated during the first time period to the sum (415_T2) generated during the second time period as a partial sum PSTC.

[0143] As described above, circuits 100 and 400 may each include a plurality of logic gates operable to function as a plurality of comparators. Each of these comparators is configured to compare a corresponding one of the exponential difference values ​​D[1] to D[N] with a difference threshold and generate a control signal to activate or deactivate a corresponding shifter. Figure 3 In the example schematic diagram of , each of the first shifters 306A and a corresponding one of the second shifters 306B can receive opposite logic states of the control signal generated by the corresponding comparator, so that the first shifter and the second shifter are alternately activated based on comparing the corresponding index difference value with the difference threshold value. Figure 6 / Figure 7 In the example diagram of , each shifter 606 may receive a control signal generated by a corresponding comparator such that the shifter is selectively activated based on comparing the corresponding index difference value to a difference threshold value.

[0144] Figure 8 An example schematic diagram of such a comparator (hereinafter referred to as "comparator 800") according to various embodiments of the present disclosure is shown. As shown, the comparator 800 includes two input terminals, which are configured to receive one of the exponential difference values ​​D[1] to D[N] (from the subtractor 304 or 604) and a difference threshold, respectively, where N is equal to 16 in the example. Based on whether the exponential difference is less than, equal to, or greater than the difference threshold, the comparator 800 can output a control signal 801 having a logic state to a corresponding shifter 850, which can be one of the shifters 306A / 306B / 606.

[0145] For example, in Figure 8, when the exponential difference is greater than the difference threshold, the comparator 800 may output a control signal 801 having a first logic state and a second logic state to the corresponding first shifter 306A and the corresponding second shifter 306B, respectively, to activate the first shifter 306A and deactivate the second shifter 306B. Also, when the exponential difference is equal to or greater than the difference threshold, the comparator 800 may output a control signal 801 having a second logic state and a first logic state to the corresponding first shifter 306A and the corresponding second shifter 306B, respectively, to deactivate the first shifter 306A and activate the second shifter 306B. Figure 6 / Figure 7 In another example, when the index difference is greater than the difference threshold, the comparator 800 may output a control signal 801 having a first logic state to the corresponding shifter 606 so as to activate the shifter 606 during a first time period. Also, during a second time period, the comparator 800 may output a control signal 801 having an opposite second logic state to the corresponding shifter 606 so as to deactivate the shifter 606.

[0146] In one aspect of the present disclosure, a computation in memory (CIM) circuit is disclosed. The CIM circuit includes an input circuit configured to receive: (i) a plurality of first inputs, namely N first inputs; and (ii) N second inputs, wherein the first inputs consist of N first symbols, N first exponents, and N first mantissas, and the second inputs consist of N second symbols, N second exponents, and N second mantissas; and wherein each of the second inputs and a corresponding one of the first outputs form one of the N input pairs; a first adder circuit configured to combine the first exponent and the second exponent of each of the N input pairs to generate N exponent sums; a selector circuit configured to select a maximum exponent sum from the N exponent sums; and a subtractor circuit configured to respectively Calculating N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​is equal to the difference between a corresponding one of the N exponent sums and the maximum exponent sum; a multiplier circuit is configured to multiply the first mantissas and the second mantissas of the N input pairs respectively to generate N mantissa products; a second adder circuit is configured to combine at least one of the following: (i) a first subset of the N subsets, based on the corresponding exponent difference values ​​of the first subset of the N mantissa products being greater than a threshold, or (ii) a second subset of the N mantissa products, based on the corresponding exponent difference values ​​of the second subset of the N mantissa products being equal to or less than a threshold; and a third adder circuit is configured to combine all of the N mantissa products.

[0147] In some embodiments, the circuit further comprises: a fourth adder circuit configured to combine the second subset of the N mantissa products.

[0148] In some embodiments, the second adder circuit combines the first subset of the N mantissa products and the fourth adder circuit combines the second subset of the N mantissa products in parallel in the time domain.

[0149] In some embodiments, the circuit further comprises: a shifter circuit coupled between the second adder circuit and the third adder circuit, and the fourth adder circuit is directly coupled to the third adder circuit.

[0150] In some embodiments, the second adder circuit combines the first subset of the N mantissa products during a first time period and combines the second subset of the N mantissa products during a second time period.

[0151] In some embodiments, the circuit further includes: a latch circuit and a shifter circuit coupled between the second adder circuit and the third adder circuit.

[0152] In some embodiments, the second adder circuit is operably coupled to the third adder circuit through the latch circuit and the shifter circuit during the first time period, and is directly operably coupled to the third adder circuit during the second time period.

[0153] In some embodiments, the circuit further includes: a comparator circuit configured to compare each of the N exponent difference values ​​with the threshold to generate N control signals so that the second adder circuit (i) combines only the first subset of the N mantissa products; (ii) combines the first subset of the N mantissa products and the second subset of the N mantissa products; or (iii) combines the first subset of the N mantissa products during a first time period and combines the second subset of the N mantissa products during a second time period.

[0154] In some embodiments, the circuit further comprises: a plurality of shifter circuits, ie, N shifter circuits, operably coupled between the subtractor circuit and the second adder circuit.

[0155] In some embodiments, the N shifter circuits are configured to selectively shift the N mantissa products based on the N control signals, respectively.

[0156] In another aspect of the present disclosure, a computation in memory (CIM) circuit is disclosed. The CIM circuit includes an input circuit configured to receive a plurality of input pairs, namely N input pairs, each of the N input pairs including a first exponent and a second exponent in N exponents, and a first mantissa and a second mantissa in N mantissas; a first adder circuit configured to generate N exponent sums based on the first exponent and the second exponent in the N input pairs; a subtractor circuit configured to respectively calculate N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​being equal to a difference between a corresponding exponent sum in the N exponent sums and a maximum exponent sum in the N exponent sums; and a comparator circuit configured to compare each of the N exponent difference values ​​with a threshold value to generate N control signals. The N mantissa products of the first mantissa and the second mantissa of the N input pairs will be selectively combined based on the N control signals, respectively.

[0157] In some embodiments, the circuit further includes: a second adder circuit configured to combine only a first subset of the N mantissa products based on a first subset of the N control signals being greater than the threshold; and a third adder circuit configured to combine only a second subset of the N mantissa products based on a second subset of the N control signals being equal to or less than the threshold.

[0158] In some embodiments, the second adder circuit combines the first subset of N mantissa products and the third adder circuit combines the second subset of N mantissa products in parallel in the time domain.

[0159] In some embodiments, the circuit further comprises: a fourth adder circuit configured to combine the first subset of the N mantissa products and the second subset of the N mantissa products.

[0160] In some embodiments, the circuit further includes: a second adder circuit configured to: during a first time period, based on a first subset of the N control signals being greater than the threshold, only combine a first subset of the N mantissa products; and during a second time period, based on a second subset of the N control signals being equal to or less than the threshold, only combine a second subset of the N mantissa products.

[0161] In some embodiments, the circuit further comprises: a third adder circuit configured to combine the first subset of the N mantissa products and the second subset of the N mantissa products.

[0162] In some embodiments, the circuit further comprises: a plurality of shifter circuits, ie, N shifter circuits, configured to selectively shift the N mantissa products respectively based on the N control signals before being selectively combined.

[0163] In another aspect of the present disclosure, a method for manufacturing a semiconductor device is disclosed. The method includes: (i) generating a plurality of exponential sums, i.e., N exponential sums, based on first exponents and second exponents of N input pairs, each of the N input pairs further including a first mantissa and a second mantissa; (ii) respectively calculating N exponential difference values ​​corresponding to the N input pairs, each of the N exponential difference values ​​being equal to the difference between a corresponding exponential sum of the N exponential sums and a maximum exponential sum of the N exponential sums; (iii) generating N control signals by comparing each of the N exponential difference values ​​with a threshold; (iv) respectively calculating N mantissa products of the first mantissa and the second mantissa of the N input pairs; (v) combining a first subset of the N mantissa products based on a first subset of the N control signals being greater than the threshold; and (vi) combining a second subset of the N mantissa products based on a second subset of the N control signals being equal to or less than the threshold.

[0164] In some embodiments, the method further comprises performing steps (v) and (vi) simultaneously.

[0165] In some embodiments, the method further comprises performing step (v) during a first time period and performing step (vi) during a second time period.

[0166] As used herein, the terms "about" and "approximately" generally refer to a value of a given quantity that may vary depending on a particular technology node associated with the subject semiconductor device. Based on the particular technology node, the term "about" may refer to a value of a given quantity that varies, for example, within a range of 10-30% of that value (e.g., ±10%, ±20%, or ±30% of that value).

[0167] The features of several embodiments are summarized above so that those skilled in the art can better understand the various aspects of the present disclosure. Those skilled in the art will appreciate that they can easily use the present disclosure as a basis for designing or modifying other processes and structures for realizing the same purpose of the embodiments introduced herein and / or realizing the same advantages thereof. Those skilled in the art will also appreciate that such equivalent structures do not deviate from the spirit and scope of the present invention, and they can make various changes, substitutions and changes in the present invention without deviating from the spirit and scope of the present invention.

Claims

1. A computing circuit in memory, comprising: An input circuit is configured to receive: (i) a plurality of first inputs, namely, N first inputs; and (ii) N second inputs, wherein the first input consists of N first symbols, N first exponents, and N first mantissas, and the second input consists of N second symbols, N second exponents, and N second mantissas; and wherein each of the second inputs and a corresponding one of the first outputs form one of the N input pairs; a first adder circuit configured to combine the first exponent and the second exponent for each of the N input pairs to generate N exponential sums; a selector circuit configured to select a maximum exponential sum from among the N exponential sums; a subtractor circuit configured to respectively calculate N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​being equal to a difference between a corresponding one of the N exponent sums and the maximum exponent sum; a multiplier circuit configured to multiply the first mantissa and the second mantissa of the N input pairs, respectively, to generate N mantissa products; a second adder circuit configured to combine at least one of: (i) a first subset of the N subsets based on corresponding exponent differences of the first subset of the N mantissa products being greater than a threshold, or (ii) a second subset of the N mantissa products based on corresponding exponent differences of the second subset of the N mantissa products being equal to or less than a threshold; and A third adder circuit is configured to combine all of the N mantissa products.

2. The in-memory computing circuit according to claim 1, further comprising: A fourth adder circuit is configured to combine said second subset of the N mantissa products.

3. The computing-in-memory circuit according to claim 2, wherein: The second adder circuit combines the first subset of the N mantissa products and the fourth adder circuit combines the second subset of the N mantissa products in parallel in the time domain.

4. The in-memory computing circuit according to claim 3, further comprising: A shifter circuit is coupled between the second adder circuit and the third adder circuit, and the fourth adder circuit is directly coupled to the third adder circuit.

5. The computing-in-memory circuit of claim 1, wherein: The second adder circuit combines the first subset of the N mantissa products during a first time period and combines the second subset of the N mantissa products during a second time period.

6. The in-memory computing circuit of claim 1 , further comprising: a comparator circuit configured to compare each of the N exponent difference values ​​with the threshold value to generate N control signals to cause the second adder circuit to (i) combine only the first subset of the N mantissa products; (ii) combine the first subset of the N mantissa products and the second subset of the N mantissa products; or (iii) combining the first subset of N mantissa products during a first time period and combining the second subset of N mantissa products during a second time period.

7. A computing circuit in memory, comprising: An input circuit configured to receive a plurality of input pairs, namely N input pairs, each of the N input pairs including a first exponent and a second exponent of the N exponents, and a first mantissa and a second mantissa of the N mantissas; a first adder circuit configured to generate N exponential sums based on the first exponent and the second exponent in the N input pairs; a subtractor circuit configured to respectively calculate N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​being equal to a difference between a corresponding one of the N exponent sums and a maximum exponent sum of the N exponent sums; as well as a comparator circuit configured to compare each of the N exponential difference values ​​with a threshold value to generate N control signals; Wherein, N mantissa products of the first mantissa and the second mantissa of the N input pairs will be selectively combined based on the N control signals respectively.

8. The in-memory computing circuit of claim 7, further comprising: a second adder circuit configured to combine only a first subset of the N mantissa products based on the first subset of the N control signals being greater than the threshold; as well as A third adder circuit is configured to combine only a second subset of the N mantissa products based on the second subset of the N control signals being equal to or less than the threshold.

9. The in-memory computing circuit of claim 7, further comprising: The second adder circuit is configured as: combining only a first subset of the N mantissa products based on a first subset of the N control signals being greater than the threshold during a first time period; and During a second time period, based on a second subset of the N control signals being equal to or less than the threshold, only a second subset of the N mantissa products are combined.

10. A method for performing a multiply-accumulate operation, comprising the steps of: (i) generating a plurality of exponential sums, i.e., N exponential sums, based on first exponents and second exponents of N input pairs, each of the N input pairs further comprising a first mantissa and a second mantissa; (ii) respectively calculating N exponent difference values ​​corresponding to the N input pairs, each of the N exponent difference values ​​being equal to a difference between a corresponding one of the N exponent sums and a maximum exponent sum among the N exponent sums; (iii) generating N control signals by comparing each of the N exponential difference values ​​with a threshold value; (iv) calculating N mantissa products of the first mantissa and the second mantissa of the N input pairs respectively; (v) combining a first subset of the N mantissa products based on the first subset of the N control signals being greater than the threshold; as well as (vi) combining a second subset of the N mantissa products based on the second subset of the N control signals being equal to or less than the threshold.

Citation Information

Cited By

  • Memory device and operating method with data format operation

    EP4742052A1