Optimizing Neural Networks Using Hardware Computational Efficiency and Tuning Factors
By using logarithmic digital representation and exponential adjustment computing modules in computing devices, combined with Kulisch accumulators, the problem of low computing efficiency in the existing technology is solved, efficient multiplication operations in neural networks are realized, and computing performance is improved.
Patent Information
- Application Number
- CN201980068960.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-08-01
- Filing Date
- 2019-10-18
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2039-10-18
AI Technical Summary
Existing computing systems suffer from low computational efficiency when executing machine learning algorithms in neural networks. Especially when performing multiplication operations, traditional hardware multiplier methods are inefficient and difficult to meet high-performance computing needs.
By using mathematical transformations in the computing device to convert binary number representations to logarithmic number representations and performing logarithmic number operations in hardware, using exponentiation and summation calculation modules to perform accurate logarithmic linear multiplication and addition operations, combined with Kulisch The accumulator performs accumulation operations for faster calculations.
It improves the efficiency of the computing system when performing neural network-related operations, reduces computing costs, and achieves more efficient hardware computing performance.
Smart Images

Figure CN112889024B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to using hardware computational efficiency to optimize neural networks in computing systems.
[0002] background
[0003] Machine learning explores the design of algorithms that learn from data. Machine learning algorithms adapt to inputs to build models that can then be used to make predictions on new data. Machine learning has close ties to statistics, artificial intelligence, and optimization, and is often used for tasks where it is difficult to formulate explicit rule-based algorithms. Artificial neural networks are computational tools that enable machine learning. In artificial neural networks, hereinafter referred to as neural networks, interconnected computational units called "neurons" are allowed to adapt to training data and then work together to produce predictions in a model that is somewhat similar to the processing in biological neural networks. A neural network can include a set of layers, the first layer being an input layer configured to receive input. The input layer includes neurons connected to neurons included in a second layer, which can be referred to as a hidden layer. The neurons of the hidden layer can be connected to another hidden layer or an output layer. In some neural networks, each neuron in one layer is connected to each neuron in the next layer. Such neural networks are referred to as fully connected networks. The training data is used to give each connection a weight that characterizes the strength of the connection. Some neural networks include fully connected layers and incompletely connected layers. The fully connected layers in a convolutional neural network can be referred to as densely connected layers. In some neural networks, signals travel strictly in one path from the input layer to the output layer, which means that there are no connections that propagate backwards to the input layer. Such neural networks are called feed-forward neural networks. If there are indeed connections that propagate backwards to the input layer, the neural network in question can be called a recurrent neural network.
[0004] Overview of Certain Embodiments
[0005] The present disclosure discusses a computing device that can facilitate the execution of computational operations, including exact logarithmic linear multiply-add (ELMA) computational operations. At a high level, the execution of ELMA computational operations by a computing device can use mathematical transformations to perform faster hardware computations without using hardware multipliers. For example, consider the execution of a computational function c+ab by a computing device. In some examples, the computing device can convert binary digital representations a and b into logarithmic digital representations (in binary representation) instead of performing multiplication operations by the computing device using binary digital representations. In some examples, the computing device can receive logarithmic digital representations a and b. The computing device can then perform additional calculations on the logarithmic digital representations (e.g., exponentiation of a fixed base of values in the linear domain of the logarithmic digital representation) to generate a logarithmic digital representation product, which is computationally inexpensive to implement in the hardware of the computing device. The computing device can approximate the logarithmic digital representation product as a linear domain representation product. The computing device can then perform additional operations to add the linear digital representation c to the linear domain representation product ab. The computing device may perform the additional computation by adding the linear digital representation c to the linear representation product ab using an accumulator (eg, a Kulisch accumulator).
[0006] Innovative aspects of the subject matter described in this specification can be embodied in a system comprising a processor configured to receive a request for an operation to be performed, determine that the operation is associated with a machine learning algorithm, and in response, route the operation to a computational circuit configured to perform the operation, wherein the computational circuit comprises: an exponential adjustment computation module configured to apply an adjustment factor to a first linear-domain number to generate an adjusted first linear-domain number; and a sum computation module configured to determine a sum of the first adjusted linear-domain number and a second linear-domain number as a third linear-domain number, wherein the exponential adjustment computation module is further configured to apply an additional adjustment factor to the third linear-domain number to generate an adjusted third linear-domain number.
[0007] Other embodiments of these aspects include corresponding methods, apparatus, and computer programs configured to perform the actions of the methods encoded on computer storage devices.
[0008] These and other embodiments may each optionally include one or more of the following features. For example, the first linear domain number is a floating point number. The adjustment factor and / or the additional adjustment have negative or positive values. The summation calculation module is a Kulisch accumulator. Before summing, the adjusted first linear domain number is converted into a fixed point number. The summation calculation module is a floating point accumulator. The second linear domain number is associated with the operation.
[0009] Innovative aspects of the subject matter described in this specification can be embodied in a method comprising receiving a request for an operation to be performed; determining that the operation is associated with a machine learning algorithm and, in response, routing the operation to a computational circuit; and performing computer-implemented operations at the computational circuit by the following steps: applying an adjustment factor to a first linear domain number to generate an adjusted first linear domain number; determining a sum of the adjusted first linear domain number and a second linear domain number as a third linear domain number; applying an additional adjustment factor to the third linear domain number to generate an adjusted third linear domain number; and outputting the adjusted third linear domain number.
[0010] Other embodiments of these aspects include corresponding systems, apparatus, and computer programs configured to perform the actions of the method encoded on a computer storage device. These and other embodiments may each optionally include one or more of the following features. For example, the first linear domain number is a floating point number. The adjustment factor and / or additional adjustment have negative or positive values. The sum of the first adjusted linear domain number and the second linear domain number is determined using a Kulisch accumulator. Before summing, the adjusted first linear domain number is converted to a fixed point number. A floating point accumulator is used to determine the sum of the first adjusted linear domain number and the second linear domain number. The second linear domain number is associated with the operation.
[0011] The embodiments disclosed herein are merely examples, and the scope of the present disclosure is not limited to them. Specific embodiments may include all, some, or none of the components, elements, features, functions, operations, or steps of the embodiments disclosed herein. Embodiments according to the present invention are specifically disclosed in the attached claims, and relate to methods, storage media, systems, and computer program products, wherein any feature mentioned in one claim category (e.g., method) may also be claimed in another claim category (e.g., system). The dependencies or back references in the attached claims are selected only for formal reasons. However, any subject matter generated by intentional back references to any previous claim (especially multiple dependencies) may also be claimed, so that any combination of claims and their features is disclosed and may be claimed, regardless of the dependencies selected in the attached claims. The subject matter that may be claimed includes not only the combination of features as set forth in the attached claims, but also any other combination of features in the claims, wherein each feature mentioned in the claims may be combined with any other feature or combination of other features in the claims. Furthermore, any of the embodiments and features described or depicted herein may be claimed in a separate claim and / or in any combination with any embodiment or feature described or depicted herein or in any combination with any features of the appended claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 An example computing environment for performing machine learning operations on a neural network is shown.
[0014] Figure 2 An example flow chart for performing machine learning operations on a neural network is shown.
[0015] Figure 3 An example flow chart for adjusting values within a machine learning operation for a neural network is shown.
[0016] Figure 4 An example computer system is shown.
[0017] Description of Example Embodiments
[0018] Figure 1 A computing system 100 for performing machine learning operations for a neural network is shown. The computing system 100 may include a processor module 102 and a computing circuit 104. The computing circuit 104 may include a logarithmic multiplication computing module 106, a conversion computing module 108, a sum computing module 110, and an exponential adjustment computing module 180. In short, the computing system 100 may facilitate the execution of computing operations, including an exact logarithmic linear multiply-add (ELMA) computing operation.
[0019] In some implementations, processor module 102 may receive request 120 for an operation 122 to be performed by computing system 100. Processor module 102 may evaluate operation 122 and determine that operation 122 is associated with machine learning algorithm 124 of neural network architecture 126.
[0020] In response to determining that operation 122 is associated with machine learning algorithm 124, processor module 102 routes operation 122 to computation circuit 104. Computation circuit 104 is configured to perform operation 122. Specifically, operation 122 may be associated with first logarithmic domain number 130a and second logarithmic domain number 130b (collectively referred to as logarithmic domain numbers 130). In some examples, logarithmic domain numbers 130 may be represented herein as binary radix fixed point numbers prefixed with b and the radix point indicated by a period, if any. For example, b011 encodes the number 3, which represents the linear domain value 2 in the logarithmic domain. 3 (or 8); and represents the b01.11 coded number 1.75, which in the logarithmic domain represents the linear domain value 2 1.75 (or approximately 3.363585...) In some examples, the fixed-point representation of the logarithm can be one of several encodings of a signed fixed-point binary number, including sign / magnitude, two's complement, or an unsigned value with an implicit bias offset.
[0021] The log domain number 130 may be an uncompressed log domain number. The uncompressed (X, Y) n-bit log domain number 130 may include i) an n-bit two's complement signed fixed-point value V having X non-fractional bits and Y fractional bits; ii) a sign flag S indicating the sign of the log domain number 130; iii) a zero flag Z indicating whether the log domain number 130 is zero; and iv) an infinity flag I indicating whether the log domain number 130 represents positive or negative infinity (or a not-a-number signed value if the number represents the result of an undefined operation such as division by zero). In addition, the n-bit value V may be represented as bX.Y with an indicated binary radix separator (between the non-fractional portion and the fractional portion). When the infinity flag I is marked as true, the uncompressed number represents positive or negative infinity, or a not-a-number signed value. When the infinity flag I is marked as false, the represented number is neither positive infinity nor negative infinity, nor a non-numeric marked value, and the zero flag Z is checked to determine the value (i.e., the infinity flag I, if marked as true, takes precedence over the zero flag Z). When the infinity flag I is marked as false and the zero flag Z is marked as true, the represented number has a zero value; and when the infinity flag I is marked as false and the zero flag Z is marked as false, the represented number is a normal value (not any of positive / negative infinity, non-numeric marked value or zero). When the sign flag S is marked as true, the number has a value of +2^V (e.g., 2 raised to the power of a signed fixed-point value V), and when the sign flag S is marked as false, the number has a value of -2^V. For example, the 4-bit logarithmic domain number {V:b01.10, S:b1, Z:b0, I:b0} represents the real number -2^(1+1 / 2), or the value -(2×sqrt(2)). For example, the 4-bit logarithm {V:b11.10,S:b1,Z:b0,I:b0} represents the real number -2^(-1+1 / 2) or -sqrt(2).
[0022] In some embodiments, the logarithmic multiplication calculation module 106 receives the logarithmic domain number 130 (e.g., data representing the logarithmic domain number 130). The logarithmic multiplication calculation module 106 is configured to determine the product (in the linear domain) of the logarithmic domain number 130 based on the sum of the first logarithmic domain number 130a and the second logarithmic domain number 130b (i.e., the value V of the uncompressed logarithm, which represents the exponent of the number in the linear domain). The logarithmic multiplication calculation module 106 can output a third logarithmic domain number 132 representing the product (in the linear domain) of the logarithmic domain number 130. Specifically, the sum of the logarithmic domain numbers 130 (representing their product in the linear domain) (e.g., n-bit uncompressed logarithmic domain numbers) is the third logarithmic domain number 132 (e.g., uncompressed n+1-bit logarithmic domain number). The n+1 signed fixed-point value V of the third logarithmic domain number 132 is the sum of the fixed-point values V of the logarithmic domain numbers 130. This value V has X+1 non-fractional digits and Y fractional digits. The +1 represents the preservation of the additional dynamic range implied by the multiplication of two large numbers or two small numbers (e.g., the logarithmic domain number 130) by the logarithmic multiplication calculation module 106. If the logarithmic multiplication calculation module 106 determines that the logical OR of the Z flag of the logarithmic domain number 130 is true (i.e., any one of the Z flags is zero), then the n+1 signed fixed-point values of the third logarithmic domain number 132 are ignored because the product is zero. The sign flag S of the third logarithmic domain number 132 is the exclusive OR of the sign flag S of the logarithmic domain number 130; the zero flag Z is the logical OR of the zero flag Z of the logarithmic domain number 130; and the infinity flag I is the logical OR of the infinity flag I of the logarithmic domain number 130.
[0023] For example, the first logarithmic domain number 130a can be represented by a 4-bit logarithmic number as {V:b01.10, S:b1, Z:b0, I:b0}, and the second logarithmic domain number 130 can be represented by a 4-bit logarithmic number {V:b10.00, S:b0, Z:b0, I:b0}. The product of the logarithmic domain numbers 130 (e.g., {V:b01.10, S:b1, Z:b0, I:b0} and {V:b10.00, S:b0, Z:b0, I:b0}) is a third logarithmic domain number 132, which is represented by a 5-bit logarithm as {V:b111.10, S:b1, Z:b0, I:b0}. This 5-bit logarithmic number as the third logarithmic domain number 132 can represent the real number 2^-0.5, or -1 / sqrt(2).
[0024] In some implementations, the conversion calculation module 108 may receive a third logarithmic domain number 132 (e.g., data representing the third logarithmic domain number 132). The conversion calculation module 108 is configured to convert the third logarithmic domain number 132 into a first linear domain number 134 as an approximation of the third logarithmic domain number 132. The conversion calculation module 108 may output the first linear domain number 134. Specifically, the third logarithmic domain number 132 may be an n-bit uncompressed logarithm {XY, S, Z, I}, which the conversion calculation module 108 converts into the first linear domain number 134 as a linear domain floating point number (X, alpha), where X represents the integer portion of the base-2 linear domain exponent retained from the third logarithmic domain number 132, and alpha represents the number of floating point significand digits that approximate the fractional portion of the linear domain exponent represented by the logarithmic domain value (or, in other words, X is the floating point exponent and alpha is the significand digits). The parameter alpha may have any value greater than zero, and in some examples is set to a value of Y+1. This allows every logarithmic decimal 0.Y to have a unique linear decimal representation.
[0025] In some examples, the conversion calculation module 108 converts 2^Y possible logarithmic fractions (e.g., b0.000...0 to b0.111...1) to linear fractions using the function p(t)=(2^f)-1, where f is a logarithmic fraction represented by Y logarithmic fraction bits. In some examples, the conversion calculation module 108 communicates with a lookup table (LUT) 140 (e.g., having a table size of (2^y×alpha) bits). The conversion calculation module 108 can access the LUT 140 via an explicitly listed mapping to perform the function p(y). In some examples, the conversion calculation module 108 can perform a piecewise linear approximation to perform the function p(y). In some examples, the conversion calculation module 108 can execute a computer-implemented algorithm that generates one or more bits of p(f) at a time.
[0026] The first linear domain number 134 can be an (A, B)n-bit linear floating point number, which includes i) an unsigned number with an implicit bias or a signed two's complement number representing an exponent, for example, an A-bit signed integer E representing the exponent; ii) a B-bit unsigned integer F, which represents an unsigned fixed-point significand fraction (i.e., the unsigned integer is a fractional value in the range of [0, 1-1 / (2^b)]); iii) where n is A+B (and the linear floating point value can be encoded in n bits); iv) a sign flag S indicates the sign of the floating point number; v) a zero flag Z indicates whether the floating point number is zero; and vi) an infinity flag I indicates whether the floating point number represents positive or negative infinity or a non-number mark flag.
[0027] Thus, the floating point A exponent is the X portion of the third logarithmic domain number 132. The floating point B fraction may be generated by the conversion calculation module 108 using the function p(y), with the size of the floating point B fraction being alpha bits. This represents the unsigned floating point significand with a leading 1 (in normalized form) of the first linear domain number 134. The values of the flags S, Z, and I of the first linear domain number 134 are the same as for the third logarithmic domain number 132.
[0028] For example, the third logarithmic domain number 132 can be represented as {V: b111.10, S: b1, Z: b0, I: b0} (i.e., -1 / sqrt(2), which is approximately -0.707...) with alpha equal to 3. The conversion calculation module 108 can convert this example of the third logarithmic domain number 132 into the first linear domain number 134 represented as {A: b111, B: b011, S: b1, Z: b0, I: b0}. This is a linear domain approximation of the logarithmic domain fraction b0.10 as (2^(b0.10)-1). The conversion calculation module 108 can round this to 3 digits (by rounding to the nearest even integer), resulting in b0.011, i.e., the significand b1.011. This example of the first linear domain number 134 is approximated to the third logarithmic domain number 132, for example, 2^-1×-(b1.011)=1 / 2×-1.375=-0.6875.
[0029] In some examples, the conversion calculation module 108 is configured to identify the LUT 140 that stores the correspondence between the logarithmic domain number and the approximate linear domain number. For example, the conversion calculation module 108 can store the correspondence between the third logarithmic domain number 132 and the third logarithmic domain number 132 as an approximation of the first linear domain number 134. The conversion calculation module 108 can then identify the first linear domain number 134 corresponding to the third logarithmic domain number 132 based on the LUT 140.
[0030] In some implementations, the summation calculation module 110 may receive the first linear domain number 134 from the transformation calculation module 108. The summation calculation module 110 may also receive a second linear domain number 136 associated with the operation 122 (e.g., data representing the second linear domain number 136). In some examples, the second linear domain number 136 is a running summation of the accumulation of linear domain numbers by the summation calculation module 110, e.g., a previous summation. The summation calculation module 110 may be configured to sum the first linear domain number 134 (e.g., addend) and the second linear domain number 136 (e.g., accumulator). The summation calculation module 110 may output a third linear domain number 138 as a summation result of the first linear domain number 134 and the second linear domain number 136.
[0031] In some examples, the sum calculation module 110 can be a linear accumulator that can store the sum of many linear domain numbers (e.g., the sum of the products of many logarithmic domain numbers). In some examples, the sum calculation module 110 can be a fixed-point accumulator, such as a Kulisch accumulator for exact logarithmic linear multiply-add (ELMA) accumulation, or a linear floating-point accumulator for floating-point logarithmic linear multiply-add (FLMA) accumulation.
[0032] Specifically, for ELMA accumulation, the third linear domain number 138 (e.g., Kulisch accumulation) may include i) a signed two's complement fixed-point value V having M non-fractional bits and N fractional bits (M+N total bits), denoted as bM.N, and ii) an infinity flag I indicating positive or negative infinity of the Kulisch accumulator. For bM.N and the infinity flag I, the initial value of the Kulisch accumulator is zero.
[0033] For example, for a 6-bit M value and a 5-bit N value, the initial value of the Kulisch accumulator is {V: b000000.00000, I: b0}. The first linear domain number 134 may have a value of {A: b111, B: b011, S: b1, Z: b0, I: b0}. The sum calculation module 110 may form a fixed-point extension of the first linear domain floating point number 134 into a signed fixed-point number of MN bits, the same size as the Kulisch accumulator.
[0034] The summation calculation module 110 represents the significand as a signed fixed-point number (adding an additional bit). Therefore, the summation calculation module 110 converts b1.011 to b01.011, and then, since the value is negative (Z: b1), the summation calculation module 110 takes the two's complement of b01.011, resulting in b10.101.
[0035] The sum calculation module 110 extends the value with zeros on the least significant bit to form a 6.5-bit number, resulting in b101010.00000 (e.g., the number -22). This is a fixed-point representation of the original floating-point significand, with an exponent value of +4. For example, the sum calculation module 110 may adjust the significand by a factor of 2^(M-2). Continuing with the above example, when M-2 is added to the original exponent, the sum calculation module 110 determines that the exponent has a value of +4, or (6-2)+0=4.
[0036] The sum computation module 110 shifts the addend fixed-point number (e.g., the first linear domain number 134) to the right toward the least significant bit (e.g., (+4-(-1))=5 digits) to adjust the fixed-point representation to match the original exponent indicated above, e.g., -1. When the fixed-point value is signed, the sum computation module 110 shifts the summed fixed-point number (e.g., the first linear domain number 134) via sign extension (e.g., copying the value of the most significant bit), resulting in a value of b111111.01010 (which is a value of -0.6875). If the sum computation module 110 determines that the zero flag Z of the floating-point addend (e.g., the first linear domain number 134) is marked as true, the sum computation module 110 ignores the value and the extended fixed-point representation is zero - continuing with this example, the extended fixed-point representation is b000000.00000.
[0037] In some examples, the sum calculation module 110 stores a previous sum (eg, the third linear domain number 138 ) and, after each accumulation, adds the previous sum to an additional linear domain number (eg, an accumulator).
[0038] In some examples, the infinity flag I of the third linear domain number 138 is a logical OR of the infinity flag I of the previous accumulated value (if any) and the infinity flag I of the first linear domain number 134 .
[0039] In addition, for FLMA accumulation, the sum calculation module 110 may include a floating point adder, and the linear domain sum of the approximate logarithmic values is maintained in a floating point representation. The floating point accumulator of the sum calculation module 110 may include an exponent bit E and a fractional significand bit F.
[0040] In some examples, for subsequent accumulations, third linear domain number 138 may become second linear domain number 136 , such that conversion calculation module 108 may be configured to sum first linear domain number 134 and second linear domain number 136 , as described above.
[0041] Figure 2An example method 200 for performing machine learning operations for a neural network is shown. The method may begin at step 202, where the processor module 102 receives a request 120 for an operation 122 to be performed. At step 204, the processor module 102 determines that the operation 122 is associated with the machine learning algorithm 124. At step 206, in response to determining that the operation 122 is associated with the machine learning algorithm 124, the processor module 102 routes the operation 122 to the computation circuit 104. At step 208, the computation circuit 104 performs the operation 122. At step 210, the logarithmic multiplication computation module 106 determines the (linear domain) product of the first logarithmic domain number 130a and the second logarithmic domain number 130b associated with the operation 122 as the sum of the first logarithmic domain number 130a and the second logarithmic domain number 130b, which is output as the third logarithmic domain number 132. At step 212, the conversion calculation module 108 converts the third logarithmic domain number 132 into the first linear domain number 134 as an approximation of the third logarithmic domain number 132. At step 214, the summation calculation module 110 sums the first linear domain number 134 and the second linear domain number 136 associated with the operation 122. At step 216, the summation calculation module 110 outputs the third linear domain number 138 as the summation result.
[0042] Where appropriate, specific examples may be repeated Figure 2 Although the present disclosure will Figure 2 Certain steps of the method are described and illustrated as occurring in a particular order, but the present disclosure contemplates occurring in any suitable order. Figure 2 In addition, although this disclosure describes and illustrates example methods for performing machine learning operations on a neural network (including Figure 2 ), but the present disclosure contemplates any suitable method for performing machine learning operations on a neural network, including any suitable steps, and where appropriate, the method may include Figure 2 In addition, although the present disclosure describes and illustrates the implementation of Figure 2 specific components, devices or systems for specific steps of the method, but the present disclosure contemplates performing Figure 2 Any suitable combination of any suitable components, devices, or systems of any suitable steps of the method.
[0043] Return to reference Figure 1, the exponent adjustment calculation module 180 can be used to apply an adjustment factor to the first linear domain number 134 and / or the third linear domain number 138 to ensure that they can be encoded in a limited number of bits in the memory. Specifically, the exponent adjustment calculation module 180 can apply the adjustment factor to the number to scale the number into a "workable unit" that the computing system 100 can properly process. The exponent adjustment calculation module 180 can apply the adjustment factor to the first linear domain number 134 and the third linear domain number 138 (for example, depending on the processing requirements of further processing of the output number). In some examples, the exponent adjustment calculation module 180 can apply an exponent bias factor as an adjustment factor to adjust the input exponent by summing m, or to adjust the output exponent by summing n (checking for underflow or overflow as needed). The accumulator can be a Kulisch accumulator, or a floating point accumulator.
[0044] In some implementations, the exponent adjustment module 180 may receive the first linear domain number 134 (e.g., data representing the first linear domain number 134). The exponent adjustment module 180 is configured to apply the adjustment factor 182 to the exponent of the first linear domain number 134 to generate an adjusted first linear domain number. In some examples, the first linear domain number 134 is a floating point number.
[0045] In some examples, when the adjustment factor has been previously applied, exponent adjustment module 180 may apply adjustment factor 182 to first linear domain number 134, such as an output of a linear algebra operation (e.g., matrix multiplication or convolution) performed by computing system 100. In some cases, the exponent of first linear domain number 134 is distributed within a threshold (e.g., a bound) and provided as a configuration parameter to exponent adjustment module 180, and in response, any previous application of the adjustment factor is reversed by applying adjustment factor 182.
[0046] In some cases, exponent adjustment module 180 applies adjustment factor 182 to ensure that the n-bit encoding of first linear domain number 134 is preserved and does not suffer from saturation (as in traditional floating point encoding) or loss of precision (as in posit-type encoding).
[0047] In some implementations, the exponent adjustment module 180 may receive the third linear domain number 138 (e.g., data representing the third linear domain number 138). The exponent adjustment module 180 is configured to apply the adjustment factor 184 to the exponent of the third linear domain number 138 to generate an adjusted third linear domain number. In some examples, the third linear domain number 138 is a floating point number.
[0048] In some examples, when the adjustment factor has been previously applied, exponent adjustment module 180 may apply adjustment factor 184 to third linear domain number 138, e.g., an output of a linear algebra operation (such as a matrix multiplication or convolution) performed by computing system 100. In some cases, the exponent of third linear domain number 138 is distributed within a threshold (e.g., a bound) and provided as a configuration parameter to exponent adjustment module 180, and in response, any previous application of the adjustment factor is reversed by applying adjustment factor 184.
[0049] In some cases, exponent adjustment module 180 applies adjustment factor 184 to ensure that the n-bit encoding of third linear domain number 138 is preserved and is not affected by saturation (as in traditional floating point encoding) or loss of precision (as in posit-type encoding).
[0050] In some examples, the exponent adjustment module 180 is further configured to apply an adjustment factor 184 to the exponent of the third linear domain number 138 to control the center of the dynamic range used by the third linear domain number 138. The adjustment factor 184 may be a fixed value maintained across multiple summations. The exponent adjustment module 180 may use the adjustment factor 184 when the third linear domain number 138 is to be re-encoded into an n-bit logarithmic or linear floating point representation, or when the third linear domain number 138 exceeds the range of the desired n-bit encoding, or in the case of posit-type encoding, exceeds the range of maximum precision. In some examples, the adjustment factors 182, 184 may have substantially the same absolute value. In some examples, the adjustment factor 182 is negative and the adjustment factor 184 is positive (e.g., the adjustment factor 184 is the negative of the adjustment factor 182 (multiplied by -1). In some examples, the value of the adjustment factor 182 is different from the adjustment factor 184 (e.g., there is no direct relationship).
[0051] For example, the third linear domain number 138 may have a floating point value {A: 8, B: b1.00001111, S: 1, Z: 0, I: 0}, which represents a value of -2^8*(b1.00001111)=-2^8×(1.05859375)=-271.0. The exponent adjustment module 180 may apply the adjustment factor 184 to the third linear domain number 138 of -5, which is summed with the exponent A to generate a linear floating point number {A: 3, b1.00001111, S: 1, Z: 0, I: 0} representing a value of -8.4687. In some examples, the exponent adjustment module 180 may round the value and encode it in a desired n-bit linear floating point or logarithmic fixed point representation.
[0052] In some examples, exponent adjustment module 180 may apply adjustment factor 182 and adjustment factor 184 independently for each operation 122. By doing so, exponent adjustment module 306 may be able to re-center the distribution of values to approximately 1.0 for calculations used in neural network 126. Computation circuitry 104 may determine the adjustment factor for each layer of neural network 126 in order to maximize processing of in-memory representations of neural network activations between layers.
[0053] Figure 3 An example method 300 for adjusting a value in a machine learning operation for a neural network is shown. The method may begin at step 302, where the processor module 102 receives a request 120 for an operation 122 to be performed. At step 304, the processor module 102 determines that the operation 122 is associated with the machine learning algorithm 124. At step 306, in response to determining that the operation 122 is associated with the machine learning algorithm 124, the processor module 102 routes the operation 122 to the computation circuit 104. At step 308, the computation circuit 104 performs the operation 122. At step 310, the exponent adjustment module 180 applies the adjustment factor 182 to the first linear domain number 134 to generate an adjusted first linear domain number. At step 312, the sum computation module 110 sums the adjusted first linear domain number and the second linear domain number 136 associated with the operation as a third linear domain number 138. At step 314, the exponent adjustment module 180 applies the adjustment factor 184 to the third linear domain number 138. In step 316 , the exponent adjustment module 306 outputs the adjusted third linear domain number.
[0054] Where appropriate, specific examples may be repeated Figure 3 Although the present disclosure will Figure 3 Certain steps of the method are described and illustrated as occurring in a particular order, but the present disclosure contemplates occurring in any suitable order. Figure 3 Furthermore, although the present disclosure describes and illustrates example methods for adjusting values within a machine learning operation for a neural network, including Figure 3 However, the present disclosure contemplates any suitable method for adjusting a value within a machine learning operation for a neural network, including any suitable steps, and where appropriate, the method may include Figure 3 In addition, although the present disclosure describes and illustrates the implementation of Figure 3 specific components, devices or systems for specific steps of the method, but the present disclosure contemplates performing Figure 3 Any suitable combination of any suitable components, devices, or systems of any suitable steps of the method.
[0055] Figure 4 An example computer system 400 is shown. In a particular embodiment, one or more computer systems 400 perform one or more steps of one or more methods described or shown herein. In a particular embodiment, one or more computer systems 400 provide functionality described or shown herein. In a particular embodiment, software running on one or more computer systems 400 performs one or more steps of one or more methods described or shown herein, or provides functionality described or shown herein. A particular embodiment includes one or more portions of one or more computer systems 400. Herein, references to computer systems may include computing devices, and vice versa, where appropriate. In addition, references to computer systems may include one or more computer systems, where appropriate.
[0056] The present disclosure contemplates any suitable number of computer systems 400. The present disclosure contemplates that computer system 400 takes any suitable physical form. By way of example and not limitation, computer system 400 may be an embedded computer system, a system on a chip (SOC), a single board computer system (SBC) (e.g., a computer on a module (COM) or a system on a module (SOM)), a desktop computer system, a laptop or notebook computer system, an interactive kiosk, a mainframe, a mesh of computer systems, a mobile phone, a personal digital assistant (PDA), a server, a tablet computer system, an augmented / virtual reality device, or a combination of two or more of these systems. Where appropriate, computer system 400 may include one or more computer systems 400; be monolithic or distributed; span multiple locations; span multiple machines; span multiple data centers; or reside in a cloud, which may include one or more cloud components in one or more networks. Where appropriate, one or more computer systems 400 may perform one or more steps of one or more methods described or illustrated herein without substantial spatial or temporal limitations. As an example and not as a limitation, one or more computer systems 400 may perform one or more steps of one or more methods described or shown herein in real time or in batch mode. Where appropriate, one or more computer systems 400 may perform one or more steps of one or more methods described or shown herein at different times or at different locations.
[0057] In a particular embodiment, computer system 400 includes processor 402, memory 404, storage 406, input / output (I / O) interface 408, communication interface 410, and bus 412. Although this disclosure describes and illustrates a particular computer system having particular numbers of particular components in a particular arrangement, this disclosure contemplates any suitable computer system having any suitable numbers of any suitable components in any suitable arrangement.
[0058] In a particular embodiment, the processor 402 includes hardware for executing instructions (e.g., those that constitute a computer program). As an example and not by way of limitation, to execute instructions, the processor 402 may retrieve (or fetch) instructions from an internal register, an internal cache, a memory 404, or a storage device 406; decode them and execute them; and then write one or more results to an internal register, an internal cache, a memory 404, or a storage device 406. In a particular embodiment, the processor 402 may include one or more internal caches for data, instructions, or addresses. Where appropriate, the present disclosure contemplates that the processor 402 includes any suitable number of any suitable internal caches. As an example and not by way of limitation, the processor 402 may include one or more instruction caches, one or more data caches, and one or more translation lookaside buffers (TLBs). The instructions in the instruction cache may be copies of the instructions in the memory 404 or the storage device 406, and the instruction cache may speed up the retrieval of those instructions by the processor 402. The data in the data cache may be: a copy of data in the memory 404 or storage device 406 for operating the instructions executed at the processor 402; the result of a previous instruction executed at the processor 402 for access by a subsequent instruction executed at the processor 402 or for writing to the memory 404 or storage device 406; or other suitable data. The data cache may speed up read or write operations performed by the processor 402. The TLB may speed up virtual address translations for the processor 402. In a particular embodiment, the processor 402 may include one or more internal registers for data, instructions, or addresses. Where appropriate, the present disclosure contemplates that the processor 402 includes any suitable number of any suitable internal registers. Where appropriate, the processor 402 may include one or more arithmetic logic units (ALUs); be a multi-core processor; or include one or more processors 402. Although the present disclosure describes and illustrates a particular processor, the present disclosure contemplates any suitable processor.
[0059] In a particular embodiment, the memory 404 includes a main memory for storing instructions for the processor 402 to execute or data for the processor 402 to operate. As an example and not by way of limitation, the computer system 400 may load instructions from the storage device 406 or another source (e.g., another computer system 400) to the memory 404. The processor 402 may then load the instructions from the memory 404 to an internal register or an internal cache. In order to execute the instructions, the processor 402 may retrieve the instructions from the internal register or the internal cache and decode them. During or after the execution of the instructions, the processor 402 may write one or more results (which may be intermediate results or final results) to the internal register or the internal cache. The processor 402 may then write one or more of these results to the memory 404. In a particular embodiment, the processor 402 only executes instructions in one or more internal registers or internal caches or in the memory 404 (rather than the storage device 406 or elsewhere), and only operates on data in one or more internal registers or internal caches or in the memory 404 (rather than the storage device 406 or elsewhere). One or more memory buses (which may each include an address bus and a data bus) may couple the processor 402 to the memory 404. As described below, the bus 412 may include one or more memory buses. In a particular embodiment, one or more memory management units (MMUs) reside between the processor 402 and the memory 404 and facilitate access to the memory 404 requested by the processor 402. In a particular embodiment, the memory 404 includes a random access memory (RAM). Where appropriate, the RAM may be a volatile memory. Where appropriate, the RAM may be a dynamic RAM (DRAM) or a static RAM (SRAM). In addition, where appropriate, the RAM may be a single-port RAM or a multi-port RAM. The present disclosure contemplates any suitable RAM. Where appropriate, the memory 404 may include one or more memories 404. Although the present disclosure describes and illustrates specific memories, the present disclosure contemplates any suitable memory.
[0060] In a particular embodiment, the storage device 406 includes a large-capacity storage device for data or instructions. As an example and not as a limitation, the storage device 406 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the storage device 406 may include a removable or non-removable (or fixed) medium. Where appropriate, the storage device 406 may be inside or outside the computer system 400. In a particular embodiment, the storage device 406 is a non-volatile solid-state memory. In a particular embodiment, the storage device 406 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically variable ROM (EAROM), or a flash memory, or a combination of two or more of these. The present disclosure contemplates a large-capacity storage device 406 in any suitable physical form. Where appropriate, the storage device 406 may include one or more storage device control units that facilitate communication between the processor 402 and the storage device 406. Where appropriate, storage 406 may include one or more storage 406. Although this disclosure describes and illustrates particular storage, this disclosure contemplates any suitable storage.
[0061] In a particular embodiment, the I / O interface 408 includes hardware, software, or both that provide one or more interfaces for communication between the computer system 400 and one or more I / O devices. Where appropriate, the computer system 400 may include one or more of these I / O devices. One or more of these I / O devices can implement communication between a person and the computer system 400. As an example and not as a limitation, the I / O device may include a keyboard, a keypad, a microphone, a monitor, a mouse, a printer, a scanner, a speaker, a static camera, a stylus, a tablet computer, a touch screen, a tracking ball, a video camera, another suitable I / O device, or a combination of two or more of these. The I / O device may include one or more sensors. The present disclosure contemplates any suitable I / O device and any suitable I / O interface 408 for them. Where appropriate, the I / O interface 408 may include one or more devices or software drivers that enable the processor 402 to drive one or more of these I / O devices. Where appropriate, the I / O interface 408 may include one or more I / O interfaces 408. Although this disclosure describes and illustrates a particular I / O interface, this disclosure contemplates any suitable I / O interface.
[0062] In a particular embodiment, the communication interface 410 includes hardware, software, or both, providing one or more interfaces for communication (e.g., packet-based communication) between the computer system 400 and one or more other computer systems 400 or one or more networks. As an example and not as a limitation, the communication interface 410 may include a network interface controller (NIC) or a network adapter for communicating with an Ethernet or other wired-based network, or a wireless NIC (WNIC) or a wireless adapter for communicating with a wireless network (e.g., a Wi-Fi network). The present disclosure contemplates any suitable network and any suitable communication interface 410 for it. As an example and not as a limitation, the computer system 400 may communicate with one or more parts of an ad hoc network, a personal area network (PAN), a local area network (LAN), a wide area network (WAN), a metropolitan area network (MAN), or the Internet, or a combination of two or more of these. One or more parts of one or more of these networks may be wired or wireless. As examples, computer system 400 may communicate with a wireless PAN (WPAN) (e.g., a Bluetooth WPAN), a WI-FI network, a WI-MAX network, a cellular telephone network (e.g., a Global System for Mobile Communications (GSM) network), or other suitable wireless networks, or a combination of two or more of these. Computer system 400 may include any suitable communication interface 410 for any of these networks, where appropriate. Communication interface 410 may include one or more communication interfaces 410, where appropriate. Although this disclosure describes and illustrates particular communication interfaces, this disclosure contemplates any suitable communication interface.
[0063] In a particular embodiment, bus 412 includes hardware, software, or both that couples components of computer system 400 to each other. By way of example and not limitation, bus 412 may include an accelerated graphics port (AGP) or other graphics bus, an extended industry standard architecture (EISA) bus, a front side bus (FSB), a HYPERTRANSPORT (HT) interconnect, an industry standard architecture (ISA) bus, an INFINIBAND interconnect, a low pin count (LPC) bus, a memory bus, a micro channel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCIe) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus, or any other suitable bus, or a combination of two or more of these. Where appropriate, bus 412 may include one or more buses 412. Although the present disclosure describes and illustrates a particular bus, the present disclosure contemplates any suitable bus or interconnect.
[0064] Herein, where appropriate, one or more computer-readable non-transitory storage media may include one or more semiconductor-based or other integrated circuits (ICs) (e.g., field programmable gate arrays (FPGAs) or application-specific ICs (ASICs)), hard disk drives (HDDs), hybrid hard disk drives (HHDs), optical disks, optical disk drives (ODDs), magneto-optical disks, magneto-optical disk drives, floppy disks, floppy disk drives (FDDs), magnetic tapes, solid-state drives (SSDs), RAM drives, secure digital (SECURE DIGITAL) cards or drives, any other suitable computer-readable non-transitory storage media, or any suitable combination of two or more of these. Where appropriate, the computer-readable non-transitory storage media may be volatile, non-volatile, or a combination of volatile and non-volatile.
[0065] As used herein, "or" is inclusive and not exclusive, unless expressly indicated otherwise or indicated by context. Thus, as used herein, "A or B" means "A, B, or both," unless expressly indicated otherwise or indicated by context. Furthermore, "and" is both conjunctive and several, unless expressly indicated otherwise or indicated by context. Thus, as used herein, "A and B" means "A and B, jointly or severally," unless expressly indicated otherwise or indicated by context.
[0066] The scope of the present disclosure includes all changes, substitutions, variations, alterations and modifications to the example embodiments described or shown herein that will be understood by those of ordinary skill in the art. The scope of the present disclosure is not limited to the example embodiments described or shown herein. In addition, although the present disclosure describes and illustrates the corresponding embodiments herein as including specific components, elements, features, functions, operations or steps, any of these embodiments may include any combination or replacement of any components, elements, features, functions, operations or steps described or shown anywhere herein that will be understood by those of ordinary skill in the art. In addition, references to devices or systems or components of devices or systems that are suitable for, arranged to, capable of, configured to, implemented to, operable to, or operated to perform specific functions in the appended claims include the device, system, component, whether it or that specific function is activated, turned on or unlocked, as long as the device, system or component is adjusted, arranged, enabled, configured, implemented, operable, or operated in this way. In addition, although the present disclosure describes or illustrates specific embodiments as providing specific advantages, specific embodiments may provide some, all or none of these advantages.
Claims
1. A system comprising: A processor configured to receive a request for an operation to be performed, determine that the operation is associated with a machine learning algorithm, and in response, route the operation to a computational circuit configured to perform the operation, wherein the computational circuit comprises: a conversion calculation module configured to receive a logarithmic domain number and convert the logarithmic domain number into the first linear domain number by identifying a corresponding relationship between the logarithmic domain number and the first linear domain number indicated by a lookup table (LUT); an exponent adjustment calculation module configured to determine a first adjustment factor to apply to the first linear domain number to generate an adjusted first linear domain number such that the adjusted first linear domain number can be encoded in a number of bits in a memory storing the linear domain number, and a summation calculation module, wherein the summation calculation module is configured to determine the sum of the adjusted first linear domain number and the second linear domain number as the third linear domain number, The exponent adjustment calculation module is further configured to determine a third adjustment factor to apply to the third linear domain number to generate an adjusted third linear domain number such that the adjusted third linear domain number can be encoded in the number of bits in the memory.
2. The system of claim 1, wherein the first linear domain number is a floating point number. 3 . The system according to claim 1 , wherein the first adjustment factor and / or the third adjustment factor has a negative value or a positive value.
4. The system of claim 1, wherein the summation calculation module is a Kulisch accumulator. 5 . The system of claim 2 , wherein the conversion calculation module is further configured to convert the adjusted first linear domain number into a fixed point number before summing. The system of claim 1 , wherein the sum calculation module is a floating point accumulator.
7. The system of claim 1, wherein the second linear domain number is associated with the operation.
8. A computer-implemented method comprising: receiving a request for an operation to be performed; determining that the operation is associated with a machine learning algorithm, and in response, routing the operation to a computational circuit; and The operation is performed at the computing circuit by: receiving a logarithmic domain number, and converting the logarithmic domain number into the first linear domain number by identifying a corresponding relationship between the logarithmic domain number and the first linear domain number indicated by a lookup table (LUT); determining a first adjustment factor to apply to the first linear domain number to generate an adjusted first linear domain number such that the adjusted first linear domain number can be encoded in a number of bits in a memory storing the linear domain number; Determine the sum of the adjusted first linear domain number and the second linear domain number as the third linear domain number; determining a third adjustment factor to apply to the third linear domain number to generate an adjusted third linear domain number such that the adjusted third linear domain number can be encoded in the number of bits in the memory; and The adjusted third linear domain number is output.
9. The computer-implemented method of claim 8, wherein the first linear domain number is a floating point number. 10 . The computer-implemented method of claim 8 , wherein the first adjustment factor and / or the third adjustment factor has a negative value or a positive value.
11. The computer-implemented method of claim 8, wherein: The adjusted sum of the first linear domain number and the second linear domain number is determined using a Kulisch accumulator.
12. The computer-implemented method of claim 9, further comprising converting the adjusted first linear domain number to a fixed point number prior to summing.
13. The computer implemented method of claim 8, wherein the second linear domain number is associated with the operation.
14. The computer implemented method of claim 8, wherein a floating point accumulator is used to determine the sum of the adjusted first linear domain number and the second linear domain number.
15. A non-transitory computer-readable medium storing software, the software comprising instructions executable by one or more computers, the instructions when executed causing the one or more computers to perform operations comprising: receiving a logarithmic domain number, and converting the logarithmic domain number into the first linear domain number by identifying a corresponding relationship between the logarithmic domain number and the first linear domain number indicated by a lookup table (LUT); determining a first adjustment factor to apply to the first linear domain number to generate an adjusted first linear domain number such that the adjusted first linear domain number can be encoded in a number of bits in a memory storing the linear domain number; Determine the adjusted sum of the first linear domain number and the second linear domain number as the third linear domain number; determining a third adjustment factor to apply to the third linear domain number to generate an adjusted third linear domain number such that the adjusted third linear domain number can be encoded in the number of bits in the memory; and The adjusted third linear domain number is output.
16. The computer-readable medium of claim 15, wherein the first linear domain number is a floating point number.
17. The computer-readable medium of claim 15, wherein the first adjustment factor and / or the third adjustment factor has a negative value or a positive value.
18. The computer-readable medium of claim 15, wherein the adjusted sum of the first linear-domain number and the second linear-domain number is determined using a Kulisch accumulator.
19. The computer readable medium of claim 16, the operating further comprising converting the adjusted first linear domain number to a fixed point number prior to summing.
20. The computer-readable medium of claim 15, wherein: A floating point accumulator is used to determine a sum of the adjusted first linear domain number and the second linear domain number.
