Deep Neural Network Architecture Using Piecewise Linear Approximation

JP7823296B2Active Publication Date: 2026-03-04INTEL CORP
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2026-03-04

AI Technical Summary

Technical Problem

Existing hardware solutions for deep neural networks (DNNs) face challenges such as high power consumption, large silicon area requirements, and long latency due to the use of floating-point multipliers and lookup tables, which are costly in terms of area and performance.

Method used

Implementing DNNs using logarithmic and antilogarithmic piecewise linear approximation circuits that convert multiplication operations into additions, eliminating the need for multipliers and lookup tables, and performing calculations in a single clock cycle.

Benefits of technology

This approach reduces silicon area, power consumption, and latency while maintaining high accuracy, offering a scalable, portable, and flexible hardware design suitable for various AI applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007823296000055
    Figure 0007823296000055
  • Figure 0007823296000056
    Figure 0007823296000056
  • Figure 0007823296000057
    Figure 0007823296000057
Patent Text Reader

Abstract

To provide a processing architecture for deep neural networks (DNNs).SOLUTION: An apparatus comprises a log circuit to: identify an input associated with a logarithm operation; identify a first range that the input falls within; compute a result of a first equation based on a plurality of operands associated with the first equation; and return an output associated with the logarithm operation. The logarithm operation is to be performed by the log circuit using piecewise linear approximation. The first range is identified from a plurality of ranges associated with a plurality of piecewise linear approximation (PLA) equations for the logarithm operation. The first range corresponds to the first equation of the plurality of PLA equations. The output is generated based at least in part on the result of the first equation.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present disclosure relates generally to the field of computer architecture and design, and more particularly, but not exclusively, to processing architectures for deep neural networks (DNNs). [Background technology]

[0002] The ever-increasing number of deep learning applications being developed for many different use cases is driving demand for specialized hardware designed for deep neural networks (DNNs). For example, DNNs typically require a significant amount of real-time processing, which often involves multiple layers of complex operations on floating-point numbers, such as convolutional layers, pooling layers, fully connected layers, etc. However, existing hardware solutions for DNNs suffer from various limitations, including high power consumption, long latency, large silicon area requirements, etc. [Brief explanation of the drawings]

[0003] The present disclosure is best understood from the following detailed description when read in conjunction with the accompanying drawings. It is emphasized that, according to standard industry practice, various features are not necessarily drawn to scale and are used for illustrative purposes only. Any scale, whether explicit or implied, is provided solely for illustrative purposes. In other embodiments, the dimensions of various features may be arbitrarily increased or decreased for clarity of illustration.

[0004] [Figure 1] 1 illustrates an example embodiment of a deep neural network (DNN) implemented using logarithmic and antilogarithmic piecewise linear approximation circuits.

[0005] [Figure 2A] 1 illustrates an example embodiment of a unified activation function circuit for a deep neural network (DNN). [Figure 2B]1 illustrates an example embodiment of a unified activation function circuit for a deep neural network (DNN).

[0006] [Figure 3A] 1 shows an example of an activation function for a unified activation function circuit. [Figure 3B] 1 shows an example of an activation function for a unified activation function circuit. [Figure 3C] 1 shows an example of an activation function for a unified activation function circuit. [Figure 3D] 1 shows an example of an activation function for a unified activation function circuit. [Figure 3E] 1 shows an example of an activation function for a unified activation function circuit.

[0007] [Figure 4] 1 illustrates an example embodiment of a unified activation function circuit implemented using a modified activation function formula with base 2 exponential terms.

[0008] [Figure 5A] 1 illustrates an example embodiment of a logarithmic circuit implemented using piecewise linear approximation. [Figure 5B] 1 illustrates an example embodiment of a logarithmic circuit implemented using piecewise linear approximation. [Figure 5C] 1 illustrates an example embodiment of a logarithmic circuit implemented using piecewise linear approximation.

[0009] [Figure 6A] 1 illustrates an example embodiment of an anti-logarithm circuit implemented using piecewise linear approximation. [Figure 6B] 1 illustrates an example embodiment of an anti-logarithm circuit implemented using piecewise linear approximation. [Figure 6C] 1 illustrates an example embodiment of an anti-logarithm circuit implemented using piecewise linear approximation.

[0010] [Figure 7] 1 illustrates an example embodiment of an exponential circuit implemented using piecewise linear approximation.

[0011] [Figure 8] 1 shows a flowchart of an example of a processing architecture used to implement an artificial neural network.

[0012] [Figure 9A] 1 illustrates the scalability of an exemplary artificial neural network processing architecture in terms of the number of parallel operations supported. [Figure 9B] 1 illustrates the scalability of an exemplary artificial neural network processing architecture in terms of the number of parallel operations supported.

[0013] [Figure 10A] 1 illustrates one performance aspect of an exemplary artificial neural network processing architecture. [Figure 10B] 1 illustrates one performance aspect of an exemplary artificial neural network processing architecture. [Figure 10C] 1 illustrates one performance aspect of an exemplary artificial neural network processing architecture. [Figure 10D] 1 illustrates one performance aspect of an exemplary artificial neural network processing architecture. [Figure 10E] 1 illustrates one performance aspect of an exemplary artificial neural network processing architecture.

[0014] [Figure 11A] We present examples of DNNs implemented using a traditional activation function and a modified activation function with a base-2 exponential term. [Figure 11B] Here is an example of a DNN implemented using a traditional activation function. [Figure 11C] We present an example of a DNN implemented using a modified activation function with a base-2 exponential term.

[0015] [Figure 12A] We demonstrate the performance of DNNs implemented using conventional activation functions. [Figure 12B]We show the performance aspects of a DNN implemented with a modified activation function. [Figure 13] We present a comparison of the performance aspects of a DNN implemented with a conventional activation function and a DNN implemented with a modified activation function.

[0016] [Figure 14A] 1 illustrates an example implementation of a computer architecture that can be used in accordance with embodiments disclosed herein. [Figure 14B] 1 illustrates an example implementation of a computer architecture that can be used in accordance with embodiments disclosed herein. [Figure 15] 1 illustrates an example implementation of a computer architecture that can be used in accordance with embodiments disclosed herein. [Figure 16] 1 illustrates an example implementation of a computer architecture that can be used in accordance with embodiments disclosed herein. [Figure 17] 1 illustrates an example implementation of a computer architecture that can be used in accordance with embodiments disclosed herein. [Figure 18] 1 illustrates an example implementation of a computer architecture that can be used in accordance with embodiments disclosed herein. DETAILED DESCRIPTION OF THE INVENTION

[0017] The following disclosure provides many different embodiments, or examples, for implementing different features of the present disclosure. Below, specific examples of components and arrangements are described to simplify the disclosure. Of course, these are merely examples and are not intended to be limiting. Furthermore, this disclosure may repeat reference numerals and / or letters in various examples. This repetition is for the purposes of simplicity and clarity and does not, in itself, dictate a relationship between the various embodiments and / or configurations discussed. Different embodiments may have different advantages, and thus a particular advantage is not necessarily required for any embodiment.

[0018] [Deep Neural Network (DNN) Inference Using Logarithmic / Antilogarithmic Piecewise Linear Approximation Circuits] The ever-increasing number of artificial intelligence applications that rely on machine learning (e.g., deep learning) creates a strong demand for specialized hardware designed to implement artificial neural networks (e.g., deep neural networks, convolutional neural networks, feedforward neural networks, recurrent neural networks, etc.) Low-power, small-area, and high-speed hardware are ideal for deep learning applications.

[0019] Specifically, artificial neural networks, such as deep neural networks (DNNs), are implemented using multiple layers of processing nodes or "neurons," such as convolutional layers, pooling layers, fully connected layers, etc. Nodes in each layer perform computations on a collection of inputs and associated weights (typically represented as vectors) to generate outputs, which are then used as inputs to nodes in the next layer. The computations performed by nodes in each layer typically involve transforming the inputs based on the associated weights, as well as an activation function used to determine whether each node should be "activated." Furthermore, these layers are typically iterated in this manner based on the requirements of a particular application to reach a global minimum.

[0020] Furthermore, state-of-the-art DNNs are typically implemented using operations on numbers represented using single-precision (32-bit) floating-point format. DNN inference involves multiple complex computational layers, such as convolutional layers, pooling layers, fully connected layers, and so on, and generally requires a large amount of real-time processing on these floating-point numbers. Furthermore, these complex operations often involve multiplication, and floating-point multipliers are one of the key components in existing DNN solutions. However, floating-point multipliers are extremely costly in terms of power consumption, silicon area, and latency. Furthermore, in some cases, look-up tables (LUTs) are used to simplify DNN operations, but LUTs also require costly silicon area.

[0021] Therefore, in some cases, DNN optimization techniques are utilized to improve the performance and / or reduce the required silicon area of ​​hardware used to implement DNNs and other types of artificial neural networks. However, these DNN optimization techniques typically focus on reducing computational costs by lowering overall precision and / or reducing the number of basic operations (e.g., by limiting the number of convolutional layers, pooling layers, etc.). For example, in some embodiments, hardware used to implement DNNs may be designed to process floating-point representations (e.g., from 8-bit quantized floating-point to 16-bit fixed-point representations) that have fewer bits and thus provide lower precision. However, the use of lower-precision floating-point representations can sometimes result in unacceptable precision loss, especially for larger datasets. Furthermore, DNN optimization techniques that reduce the number of basic operation layers can have adverse effects, such as insufficient convergence time to reach a global minimum during DNN training. Furthermore, these various optimizations still require a floating-point multiplier, which is also limited in power, area and performance by the multiplier circuitry.

[0022] In some cases, to reduce the requirements for multiplier circuits, DNNs may be implemented using circuits that perform logarithmic, antilogarithmic, and / or exponential calculations using lookup tables (LUTs). For example, in some embodiments, a parabolic curve for a logarithmic, antilogarithmic, and / or exponential operation may be divided into multiple segments, and individual coefficient values ​​may be pre-calculated using a curve-fitting algorithm. The pre-calculated coefficients may then be stored in a lookup table implemented using a memory component (e.g., ROM). In this manner, for any point on the curve, ax 2 To calculate +bx+c, the values ​​of the coefficients a, b, and c are first fetched from a lookup table, and then the result is calculated using multipliers and adders. However, this approach requires a large amount of silicon area for the associated LUTs and multipliers, and may consume multiple clock cycles (e.g., 5-8 clock cycles) to calculate the above equation.

[0023] Accordingly, this disclosure describes various embodiments of hardware that can efficiently perform DNN computations without relying on lookup tables and / or multipliers. With more particular reference to the accompanying drawings, example embodiments that can be used to implement the features and functionality of the present disclosure are now described.

[0024] 1 illustrates an example embodiment of a deep neural network (DNN) 100 implemented using log and antilog piecewise linear approximation circuits. In the illustrated example, the DNN 100 is implemented using multiple layers 106a-106e, including a first convolutional layer 106a, a max-pooling layer 106b, a second convolutional layer 106c, a third convolutional layer 106d, and a fully connected layer 106e. Additionally, the DNN 100 is implemented using a multiplier-less neural network microarchitecture, which uses log and antilog circuits 110, 120 rather than multiplier circuits to perform calculations for each of the DNN layers 106a-106e. Specifically, the logarithm and antilogarithm circuits 110, 120 perform base-2 logarithm (log2) and base-2 antilogarithm (antilog2) calculations, which can be leveraged to convert multiplication operations typically required in a given DNN layer 106 to additions. Furthermore, the logarithm and antilogarithm circuits 110, 120 perform the log2 and antilog2 calculations using piecewise linear approximations, allowing each calculation to be performed in a single clock cycle and without the use of lookup tables or multipliers. In this manner, the illustrated embodiment reduces DNN processing latency while also eliminating the need for multiplier circuits and lookup tables, thereby significantly reducing the silicon area required for hardware. Example implementations of the logarithm circuit 110 and the antilogarithm circuit 120 are further shown and described in connection with FIGS. 5A-5C and 6A-6C.

[0025] As an example, for a convolutional layer of a DNN (e.g., layers 106a, 106c, 106d of DNN 100), the convolution can generally be expressed as follows (where f(n) and g(n) are floating-point vectors):

number

number

number

number

[0026] As another example, a fully connected layer (e.g., layer 106e of DNN 100) is the last layer of a DNN and is responsible for performing final inferences and decisions. Generally, a fully connected layer is similar to a convolutional layer, but typically involves one-dimensional vectors. Thus, a fully connected layer can utilize log2 arithmetic in a manner similar to a convolutional layer to convert multiplication operations into additions. However, because a fully connected layer is the last layer of a DNN, the final output must be in the normal domain rather than the log2 domain.

[0027] To illustrate, a fully connected layer can generally be represented using the following equation:

number

number

number

[0028] In the illustrated embodiment, for example, the DNN 100 is implemented using multiple layers 106a-106e, including a first convolutional layer 106a, a max-pooling layer 106b, a second convolutional layer 106c, a third convolutional layer 106d, and a fully connected layer 106e. Each layer 106a-106e performs a computation using an input (X) 101a-101e along with a weight vector (W) 102a-102d for that layer to generate a corresponding output (Y) 103a-103f. Furthermore, an initial input vector (X) 101a is provided to the first convolutional layer 106a of the DNN 100, and each remaining layer 106b-106e receives the output (Y) 103a-103d of the previous layer as its input (X) 101b-101e.

[0029] Furthermore, logarithm and antilogarithm circuits 110, 120 implemented using piecewise linear approximations are utilized to perform calculations in each layer 106 of the DNN 100, thereby eliminating the need for multiplier circuits and lookup tables while simultaneously reducing latency. For example, the logarithm circuit 110 performs a log2 calculation to convert floating-point numbers to fixed-point numbers, thereby allowing complex operations such as floating-point multiplication to be converted to fixed-point addition, and the antilogarithm circuit 120 subsequently performs an antilog2 calculation to convert the fixed-point number back to a floating-point number. Furthermore, the logarithm and antilogarithm circuits 110, 120 perform their respective log2 and antilog2 calculations using piecewise linear approximations, thereby allowing each calculation to be performed in a single clock cycle.

[0030] In the illustrated embodiment, for example, logarithm circuit 110 is used to convert the original input vector (X) 101a and each weight vector (W) 102a-102d to the log2 domain before they are provided to DNN 100, while antilogarithm circuit 120 is used to convert the final output (Y) 103f of fully connected layer 106e from the log2 domain back to the normal domain. Furthermore, additional antilog2 and log2 operations (not shown) are also performed throughout hidden layers (e.g., intermediate layers between the input and output layers) of DNN 100 to convert between the log2 domain and the normal domain as needed. For example, as previously described, convolutional layers require each summation term to be converted back to the normal domain prior to its accumulation, and therefore, an antilog2 operation must be performed before accumulating each summation term. However, the final output of the hidden layer is subsequently converted back to the log2 domain before being provided to the next layer, thereby still avoiding multiplication operations in the next layer.

[0031] For example, the result of each hidden layer node is typically sent to an activation function that determines whether the node should be "activated," and the output of the activation function is then provided as input to the next layer. Thus, to avoid multiplication operations in the next layer, the log2 of the hidden layer node's activation function is provided to the next layer. For example, if a hidden layer node performs an anti-log2 operation to compute a convolutional component, the result is converted back to the log2 domain before being sent to the activation function. In this manner, the output (Y) computed by each hidden layer node is already in the log2 domain when it is provided as input (X) to the next layer.

[0032] Thus, the illustrated embodiment provides many advantages, including low latency, high accuracy, and reduced power consumption, using a highly scalable, portable, flexible, and small-area hardware design. For example, in the illustrated embodiment, the DNN 100 is implemented using logarithm and antilogarithm circuits 110, 120 that perform log2 and antilog2 calculations using piecewise linear approximations, thereby eliminating the need for multiplier circuits and lookup tables in the hardware design. In this manner, the illustrated embodiment significantly reduces the required silicon area, power consumption, and latency of the hardware (e.g., by eliminating multipliers and lookup tables) while still providing high accuracy. Specifically, the proposed microarchitecture performs each log2 and antilog2 calculation in a single clock cycle, thereby reducing delays through the data path and ultimately the overall latency of the hardware.

[0033] The proposed microarchitecture is also highly scalable. Specifically, the flexible implementation of the proposed microarchitecture allows the hardware to be replicated as needed to increase the number of parallel operations supported. For example, the proposed microarchitecture may be implemented with any number of logarithm and antilogarithm circuits 110, 120. In this manner, the proposed microarchitecture can be easily scaled to support the number of parallel operations required by a particular application or use case. The precision of the proposed microarchitecture can also be scaled based on the application's requirements. For example, if an application requires higher precision, the number of segments in the piecewise linear approximation model used by the logarithm and antilogarithm circuits 110, 120 can be increased to address the precision requirement. In this manner, the proposed microarchitecture is also highly portable, as it can be easily ported and / or scaled for any product or form factor, including mobile devices (e.g., handheld or wearable devices), drones, servers, and / or any other artificial intelligence solution requiring DNN operations without dependency or modification.

[0034] [DNN activation function circuit using piecewise linear approximation] As the number of products being designed with artificial intelligence (AI) capabilities continues to increase, there is a strong demand for specialized hardware that can accelerate basic AI operations (e.g., neural network activation functions) while remaining versatile enough to support a variety of different implementations and associated algorithms, especially for resource-constrained form factors (e.g., small, low-power edge devices).

[0035] Specifically, the growing popularity of AI solutions that rely on machine learning (e.g., deep learning) has created a demand for hardware acceleration designed for artificial neural networks (e.g., deep neural networks, convolutional neural networks, feedforward neural networks, recurrent neural networks, etc.). For example, deep neural networks (DNNs) are implemented using multiple layers of "artificial neurons," which are processing nodes that typically use nonlinear activation functions to determine whether or not to "activate" in response to a particular input. For example, an activation function is a function that maps inputs to outputs, typically using a nonlinear transformation, to determine whether a particular processing node or "artificial neuron" should activate. While the use of activation functions is an important aspect of DNNs, it can also be extremely computationally intensive.

[0036] There are many different types of activation functions that can be used to implement DNNs, including sigmoid, hyperbolic tangent (Tanh), rectified linear unit (ReLU), leaky ReLU, and Swish, among others. The choice of activation function significantly affects the training dynamics and task performance of a DNN. Therefore, in some cases, to improve training dynamics and performance, a DNN may be implemented using multiple activation functions within a single neural network. The computational engine of a DNN may also rely on dedicated hardware to implement these activation functions, which typically occupies a significant amount of silicon area. For example, hardware designed for state-of-the-art DNNs typically handles single-precision (32-bit) floating-point numbers and implements activation functions using a look-up table (LUT) approach. However, the use of a look-up table (LUT) approach to activation functions increases silicon area, power consumption, and latency, each of which continues to increase with the number of neurons in a DNN. Furthermore, since each activation function requires its own lookup table, the use of multiple activation functions in a single DNN increases the number of lookup tables required, thus further impacting silicon area, power, and latency.

[0037] As an example, using a lookup table approach, the curve of the activation function is typically bounded by an interval [-m, m] (where "m" is a real number), and the bounded curve may then be divided into multiple segments. A curve-fitting algorithm may then be used to pre-calculate the values ​​of the individual coefficients, which may then be stored in a lookup table implemented using a memory component (e.g., a ROM). In this scheme, for any point on the curve, a 2To calculate +bx+c, the values ​​of the coefficients a, b, and c are first fetched from a lookup table, and then the result is calculated using multipliers and adders. However, this approach requires a large amount of silicon area for the associated lookup tables and multipliers, and may also consume multiple clock cycles (e.g., 5-8 clock cycles) to calculate the above equation.

[0038] To illustrate, a bounded curve spanning the interval [-3, 3], divided into 256 uniform segments with 64-bit coefficient widths (a: 20 bits, b: 20 bits, c: 24 bits), yields 21 bits of mantissa precision for IEEE-754 single-precision floating-point numbers. In certain embodiments, this approach requires a 256x64 ROM and computation block with 41,853 and 5,574 composite gates (e.g., NAND-equivalent gates), respectively. Scaling down this hardware to lower precision (e.g., 12-bit or 10-bit precision) only saves ROM area. For example, in certain embodiments, the estimated silicon area required for a sigmoid activation function with 10-bit precision is 17,120 composite gates. Furthermore, this area must be further replicated or instantiated based on the number of parallel operations the hardware needs to support.

[0039] Thus, existing hardware used to implement activation functions in DNNs (e.g., hardware implemented using lookup tables) has various drawbacks, including costly silicon area requirements, unsatisfactory power consumption, and long processing latency, among other examples. These drawbacks are further exacerbated as hardware is scaled, such as by increasing the number of artificial neurons, parallel operations, and / or activation functions. Furthermore, no integrated hardware solution exists that can implement multiple activation functions without using separate hardware blocks and / or lookup tables for each activation function.

[0040] Accordingly, this disclosure describes various embodiments of an integrated hardware solution that supports multiple DNN activation functions without the use of lookup tables, as described in more detail below.

[0041] 2A and 2B illustrate an example embodiment of an artificial neural network (e.g., a deep neural network (DNN)) unified activation function (AF) circuit 200. Specifically, the AF circuit 200 supports multiple DNN activation functions on a single hardware component without relying on lookup tables.

[0042] For example, in the illustrated embodiment, the AF circuit 200 implements each activation function using a novel algorithm that leverages exponential, base-2 logarithm (log²), and base-2 antilogarithm (antilog²) calculations implemented using piecewise linear approximations to simplify the required calculations for each activation function. For example, many activation functions are nonlinear functions that involve complex exponential, division, and / or multiplication operations that are typically implemented using costly multiplier circuits (e.g., division may be implemented using a multiplier circuit that multiplies the numerator by the reciprocal of the denominator). However, the AF circuit 200 leverages log² and antilog² calculations to eliminate the complex division and / or multiplication operations required for a given activation function, instead converting them to subtraction and / or addition. Furthermore, the AF circuit 200 implements the exponential, log², and antilog² calculations using piecewise linear approximations to further simplify the calculations required for the activation functions. As a result, the log² and antilog² calculations can be performed in a single clock cycle, while the exponential calculations can be performed in two clock cycles. In this manner, one activation function can be calculated in as few as five clock cycles, and the basic calculations can be easily pipelined to increase throughput. Thus, the AF circuit 200 utilizes log2, antilog2, and exponential calculations implemented using piecewise linear approximations to simplify the basic calculation of the activation function, thereby eliminating the need for a lookup table for the activation function, reducing multiplier circuit requirements, and shortening overall latency. This approach directly translates into significant silicon area savings (e.g., due to the elimination of lookup tables and the reduction of multiplier circuitry) because it requires far fewer synthesis gates compared to typical lookup table approaches with similar accuracy.

[0043] In the illustrated embodiment, for example, AF circuit 200 includes log, antilog, and exponent blocks 210, 220, and 230 for performing log2, antilog2, and exponent calculations, respectively, using piecewise linear approximation. For example, in some embodiments, log, antilog, and exponent blocks 210, 220, and 230 may be implemented with 12-bit precision (i.e., 1 sign bit + 8 exponent bits + 12 mantissa bits = 21-bit precision) in the mantissa portion of IEEE-754 single-precision floating-point numbers using a 16-segment piecewise linear approximation. Example implementations of log, antilog, and exponent blocks 210, 220, and 230 are further shown and described in connection with Figures 5A-5C, 6A-6C, and 7.

[0044] The AF circuit 200 is a configurable circuit that supports the following activation functions: sigmoid, hyperbolic tangent (Tanh), rectified linear unit (ReLU), leaky ReLU, and Swish. However, in other embodiments, the AF circuit 200 may be designed to support any type or number of activation functions. The AF circuit 200 can be configured to use any of the supported activation functions using an opcode. For example, in the illustrated embodiment, the AF circuit 200 uses a five-bit opcode to select the type of activation function desired by a particular layer or node in a DNN implementation, and the circuit can be reconfigured for other types of activation functions simply by changing the opcode value. In the illustrated embodiment, five opcode bits 202a-202e are shown as Tanh 202a, Sigmoid 202b, Swish 202c, ReLU 202d, and Leaky ReLU 202e, with the individual bit values ​​set based on the type of activation function desired. Table 1 specifies the hardware configuration of the AF circuit 200 for the various activation functions supported, based on the values ​​of the opcode bits 202a-202e. Table 1: Activation function opcodes [Table 1]

[0045] The operation of AF circuit 200 varies depending on which activation function is selected via opcode bits 202a-202e. Accordingly, the functionality of AF circuit 200 is further described below in conjunction with Figures 3A-3E, which illustrate the various activation functions supported by AF circuit 200.

[0046] Figure 3A shows a graph of the sigmoid activation function, which mathematically can be expressed as

number

[0047] In general, for a given input X represented in single precision floating point format, the sigmoid of X, or Sigmoid(X), can be calculated using the following formula:

number

number

number

[0048] 2A and 2B, AF circuit 200 implements the sigmoid function using the simplified approach described above. For example, if AF circuit 200 is configured for a sigmoid function, the sigmoid opcode bit (reference number 202b) is set to 1, and the remaining opcode bits of the other activation functions (reference numbers 202a, c, d, and e) are set to 0. In this scheme, input X (reference number 201) is provided to AF circuit 200, passes through mux 206a and demux 207, and then to bias block 208, which applies a bias to input X to convert it to a negative number (−X). The result −X is then sent to exponent block 230, where it is multiplied by e. -X is calculated, and then this result is sent to adder 212 to obtain 1+e -X is calculated. -X The result of this is passed through mux 206d to logarithm block 210b, which then converts it to log2(1+e -X ) is calculated.

[0049] Separately, subtractor 211 is provided with the constant 1 as its first operand and the output of mux 206e as its second operand. In this case, sigmoid opcode bit 202b provided to mux 206e is set to 1, causing mux 206e to select the constant value 0 as its output. Thus, subtractor 211 is provided with the constant values ​​1 and 0 as respective operands, and thus subtractor 211 calculates 1 - 0 = 1. The resulting value 1 is then sent through mux 206f to logarithm block 210a, which then calculates log2(1), which becomes 0.

[0050] Therefore, logarithm blocks 210a and 210b are log2(1) and log2(1+e), respectively. -X ), which are then sent as operands to adder / subtractor 213. In this case, adder / subtractor 213 performs a subtraction to obtain log2(1)-log2(1+e -X ), and then the result is sent to the antilogarithm block 220, which calculates antilog2

number

number

[0051] Additionally, as previously mentioned, the exponential, log2, and antilog2 calculations performed by the individual exponential, logarithm, and antilogarithm blocks 210-230 of AF circuit 200 are implemented using piecewise linear approximations to further simplify the calculations required by this alternative formula.

[0052] Figure 3B shows a graph of the hyperbolic tangent (Tanh) activation function, which mathematically can be expressed as

number

[0053] In general, for a given input X represented in single precision floating point format, the hyperbolic tangent of X, or Tanh(X), can be calculated using the following formula:

number

number

number

[0054] 2A and 2B, AF circuit 200 implements the Tanh function using the simplified approach described above. For example, when AF circuit 200 is configured for the Tanh function, the Tanh opcode bit (reference numeral 202a) is set to 1, and the remaining opcode bits (reference numerals 202b, c, d, and e) of the other activation functions are set to 0. In this scheme, when input X (reference numeral 201) is input to AF circuit 200, it first passes through shifter 204, which left-shifts X by one bit to double its value, thus generating output 2X. Furthermore, because AF circuit 200 is configured for the Tanh function, output 2X from shifter 204 is then sent to bias block 208 via mux 206a and demux 207. For example, the select signal for mux 206a is based on Tanh opcode bit 202a, which is set to 1, causing mux 206a to select 2X as the output to send to demux 207. Furthermore, the select signal for demux 207 is based on the output of OR gate 205, which receives as inputs ReLU / Leaky ReLU opcode bits 202d, e, both set to 0, causing demux 207 to route the value 2X to bias block 208.

[0055] Bias block 208 then adds a bias to 2X to convert it to a negative number (-2X), and the resulting value -2X is then sent to exponent block 230, which converts it to the value e -2X The output e from the exponent block 230 -2X is then sent to both subtractor 211 (via mux 206e) and adder 212, which then adds 1-e -2X while adder 212 calculates the value of 1+e -2X The outputs from subtractor 211 and adder 212 are sent to logarithm blocks 210a and 210b, respectively, which calculate the value of log2(1-e -2X ) and log2(1+e -2X ) value.

[0056] The individual outputs from logarithm blocks 210a and 210b are then sent as operands to adder / subtractor 213, which performs the subtraction to obtain log2(1-e -2X )-log2(1+e -2X ), and then the result is sent to the antilogarithm block 220, which calculates the antilog2

number

number

[0057] Additionally, as previously mentioned, the exponential, log2, and antilog2 calculations performed by the individual exponential, logarithm, and antilogarithm blocks 210-230 of AF circuit 200 are implemented using piecewise linear approximations to further simplify the calculations required by this alternative formula.

[0058] FIG. 3C shows a graph of the rectified linear unit (ReLU) activation function, which is mathematically represented as Y=max(0,X). ReLU is a widely used activation function that offers various advantages. Specifically, ReLU is a nonlinear function that avoids the vanishing gradient problem, is less complex than other activation functions and therefore less computationally expensive, and has favorable properties that make DNNs sparser and more efficient (e.g., if its input is negative, the output is zero, and therefore the corresponding neuron is not activated). On the other hand, if the output of ReLU becomes zero, weights cannot be updated during backpropagation; therefore, ReLU can only be used in the hidden layers of neural networks.

[0059] In general, for a given input X represented in single-precision floating-point format, the ReLU of X, or ReLU(X), can be calculated using the following formula:

number

[0060] 2A and 2B, if AF circuit 200 is configured for a ReLU function, the ReLU opcode bit (reference numeral 202d) is set to 1, and the remaining opcode bits (reference numerals 202a, b, c, e) of the other activation functions are set to 0. In this scheme, when input X (reference numeral 201) is provided to AF circuit 200, X first passes through mux 206a to demux 207, which then routes X to mux 206c. Separately, mux 206c is also provided with a constant value of 1 (via mux 206b). Furthermore, because the select signal for mux 206c is based on the sign bit of X, mux 206c selects either X or 0 as its output, depending on whether X is positive or negative. Since the output of mux 206c is the final result of the ReLU function, the remaining logic of the AF circuit 200 is bypassed, and thus the output of mux 206c is ultimately used as the final output Y (reference numeral 203) of the AF circuit 200 for the ReLU function.

[0061] Figure 3D shows a graph of the leaky rectified linear unit (Leaky ReLU) activation function, which mathematically can be expressed as

number

[0062] In general, for a given input X represented in single-precision floating-point format, the leaky ReLU of X, or LeakyReLU(X), can be calculated using the following equation:

number

[0063] 2A and 2B, if AF circuit 200 is configured for a leaky ReLU function, the leaky ReLU opcode bit (reference numeral 202e) is set to 1, and the remaining opcode bits (reference numerals 202a, b, c, d) of the other activation functions are set to 0. In this scheme, when input X (reference numeral 201) is provided to AF circuit 200, X first passes through mux 206a to demux 207, which then routes X to mux 206c. Separately, a constant value of 0.01 is also provided to mux 206c (via mux 206b). Furthermore, because the select signal for mux 206c is based on the sign bit of X, mux 206c selects either X or 0.01 as its output, depending on whether X is positive or negative. Since the output of mux206c is the final result of the leaky ReLU function, the remaining logic of the AF circuit 200 is bypassed, and thus the output of mux206c is ultimately used as the final output Y (reference numeral 203) of the AF circuit 200 for the leaky ReLU function.

[0064] Figure 3E shows a graph of the Swish activation function, which is mathematically represented as Y = X * Sigmoid(X). In many cases, Swish has been proven to provide higher accuracy than other activation functions (e.g., ReLU).

[0065] In general, for a given input X represented in single precision floating point format, the Swish of X, or Swish(X), can be calculated using the following formula:

number

number

number

[0066] 2A and 2B, AF circuit 200 implements the Swish function using the simplified approach described above. For example, when AF circuit 200 is configured for the Swish function, the Swish opcode bit (reference numeral 202c) is set to 1, and the remaining opcode bits of the other activation functions (reference numerals 202a, b, d, and e) are set to 0. In this manner, when input X (reference numeral 201) is provided to AF circuit 200, X proceeds through mux 206a to demux 207, which then routes X to bias block 208. For example, the select signal for mux 206a is based on Tanh opcode bit 202a, which is set to 0, causing mux 206a to select X as the output to send to demux 207. Furthermore, since the select signal of demux 207 is based on the output of OR gate 205, which receives as inputs ReLU / Leaky ReLU opcode bits 202d, e, both set to 0, demux 207 routes value X to bias block 208.

[0067] Bias block 208 then adds a bias to X to convert it to a negative number (-X), and the resulting value -X is then sent to exponent block 230, which converts it to a value e -X The output of the exponent block 230 is e -X is then sent to adder 212 to produce 1+e -X is calculated, and the result is then sent via mux 206d to logarithm block 210b, which then calculates log2(1+e -X ) is calculated.

[0068] Alternatively, the select signal for mux 206f is based on Swish opcode bit 202c, which is set to 1, causing mux 206f to select X as the output to send to logarithm block 210a, which then calculates log2(X).

[0069] The individual outputs from logarithm blocks 210a and 210b are then sent as operands to adder / subtractor 213, which performs the subtraction to obtain log2(X)-log2(1+e -X ), and then the result is sent to the antilogarithm block 220, which calculates the antilog2

number

number

[0070] Additionally, as previously mentioned, the exponential, log2, and antilog2 calculations performed by the individual exponential, logarithm, and antilogarithm blocks 210-230 of AF circuit 200 are implemented using piecewise linear approximations to further simplify the calculations required by this alternative formula.

[0071] 2A and 2B , the illustrated embodiment of the AF circuit 200 supports multiple activation functions and offers many advantages, including low latency, high accuracy, and reduced power consumption, using a flexible, small-area hardware design that is highly scalable and portable. Specifically, the AF circuit 200 is an integrated solution that implements multiple DNN activation functions on a single hardware component (e.g., without using separate hardware components for each activation function) without relying on lookup tables. For example, in the illustrated embodiment, the AF circuit 200 is implemented using log, antilog, and exponential circuits 210, 220, and 230 that perform log2, antilog2, and exponential calculations using piecewise linear approximations, thereby eliminating the need for lookup tables in the hardware design and reducing the required multiplier circuitry.

[0072] In this manner, the illustrated embodiment significantly reduces the required silicon area, power consumption, and latency of the hardware while still providing high accuracy. For example, the elimination of lookup tables and the reduction of multiplier circuitry translates directly into significant silicon area savings, as far fewer synthesis gates are required compared to typical lookup table approaches with similar accuracy. Furthermore, the log2 and antilog2 calculations can be performed in a single clock cycle, while the exponential calculations can be performed in two clock cycles, allowing the activation function to be calculated in just five clock cycles. Furthermore, the basic calculations can be easily pipelined to improve throughput.

[0073] AF circuit 200 also eliminates the dependency on software to load / program lookup tables associated with different activation functions, because AF circuit 200 can be configured for different activation functions simply by programming the appropriate opcode. Programming opcodes on AF circuit 200 is much simpler and requires fewer clock cycles than programming lookup tables for activation functions.

[0074] The AF circuit 200 is also highly scalable. Specifically, the flexible implementation of the AF circuit 200 allows the underlying hardware to be replicated as needed to increase the number of parallel operations supported. In this manner, the AF circuit 200 can be easily scaled to support the number of parallel operations required by a particular application or use case. The precision of the AF circuit 200 can also be scaled based on the requirements of the application. For example, if an application requires higher precision, the number of segments in the piecewise linear approximation model used by the logarithm, antilogarithm, and exponent circuits 210, 220, and 230 can be increased to address the precision requirement. In this manner, the AF circuit 200 is also highly portable, as it can be easily ported and / or scaled for any product or form factor, including mobile devices (e.g., handheld or wearable devices), drones, servers, and / or any other artificial intelligence solution requiring DNN operations without dependency or modification.

[0075] 4 illustrates an alternative embodiment of an integrated activation function (AF) circuit 400 for an artificial neural network (e.g., a deep neural network (DNN)). Specifically, the AF circuit 400 is similar to the AF circuit 200 of FIGS. 2A and 2B, except that the predetermined activation functions are implemented using modified formulas that use powers of 2 rather than powers of the exponential constant e. For illustrative purposes, the original and modified formulas for the sigmoid, Swish, and hyperbolic tangent activation functions are provided in Table 2. [Table 2: Modified activation function formula using powers of 2] [Table 2]

[0076] As shown in Table 2, the base-e exponents in the original formula are replaced with base-2 exponents in the modified formula. In this manner, the modified formula still exhibits important nonlinear properties of the activation function (e.g., curve shape), but the basic activation function hardware can be implemented much more efficiently. Specifically, by replacing the base-e exponents with base-2 exponents, the exponential circuitry is no longer needed in the modified formula, as all of the exponential operations can be performed by the antilogarithm circuitry. For example, the base-2 antilogarithm of a variable x is 2 to the power x, (2 x ), the powers of base 2 appearing in the modified activation function formula can be calculated using an antilogarithm circuit that performs the antilogarithm operation of base 2.

[0077] Furthermore, by performing the exponentiation operation using an inverse logarithm circuit rather than an exponentiation circuit, both the latency and silicon area of ​​the AF circuit 400 are reduced. By comparison, for example, the AF circuit 200 of FIGS. 2A and 2B performs the exponentiation operation using an exponentiation circuit implemented using a piecewise linear approximation (e.g., the exponentiation circuit of FIG. 7), which allows the exponentiation operation to be performed in two clock cycles and requires at least one multiplier. However, the AF circuit 400 performs the exponentiation operation using an inverse logarithm circuit implemented using a piecewise linear approximation (e.g., the inverse logarithm circuit of FIGS. 6A-6C), which allows the base-2 inverse logarithm operation to be performed in a single clock cycle and does not require a multiplier. Therefore, by replacing the exponentiation circuit with the inverse logarithm circuit, the overall latency of the AF circuit 400 is reduced by one clock cycle, thereby allowing the activation function to be calculated in only four clock cycles, compared to five clock cycles for the activation function circuit of FIGS. 2A and 2B. Furthermore, AF circuit 400 no longer requires any multiplier circuitry, and the eliminated exponent circuitry was the only component requiring a multiplier, resulting in significant silicon area savings. For example, AF circuit 200 of Figures 2A and 2B can be implemented using 8,321 gates, while AF circuit 400 can be implemented using only 7,221 gates.

[0078] Additionally, similar to the AF circuit 200 of FIGS. 2A and 2B, the AF circuit 400 utilizes base-2 logarithm (log²) and base-2 inverse logarithm (antilog²) calculations using piecewise linear approximations to simplify the calculations required for a given activation function. For example, log² and antilog² calculations can be used to eliminate complex division and / or multiplication operations required for a given activation function, converting them instead to subtraction and / or addition. Table 3 sets forth the log / antilog equations for the modified sigmoid, Swish, and hyperbolic tangent activation functions (using powers of 2 instead of e) of Table 2. These log / antilog equations for the modified activation functions are derived in a manner similar to that of the original activation functions as described in connection with FIGS. 3A-3E. Table 3: Log / antilog versions of modified activation functions (using powers of 2) [Table 3]

[0079] In the illustrated embodiment, AF circuit 400 is designed to implement sigmoid, Swish, Tanh, ReLU, and leaky ReLU activation functions. The sigmoid, Swish, and Tanh activation functions are implemented using the log / antilog equations in Table 3, while the ReLU and leaky ReLU activation functions are implemented using the original equations in Figures 3C-3D because they do not require complex division, multiplication, or exponential operations. The operation of AF circuit 400 is otherwise similar to AF circuit 200 of Figures 2A and 2B.

[0080] [Logarithmic, antilogarithmic, and exponential circuits implemented using piecewise linear approximation] 5A-5C illustrate an example embodiment of a logarithmic circuit 500 implemented using piecewise linear approximation. Specifically, FIG. 5A illustrates an overall implementation of logarithmic circuit 500, and FIGS. 5B and 5C illustrate implementations of certain components of logarithmic circuit 500.

[0081] Logarithm circuit 500 performs logarithmic calculations using a 16-segment piecewise linear approximation. In this manner, no lookup table or multiplier circuitry is required for logarithm circuit 500, and the logarithm calculations can be performed in a single clock cycle. The equations used by logarithm circuit 500 to perform the piecewise linear approximation for the logarithm calculations are shown in Table 4 below. [Table 4: Piecewise linear approximation equation for log2(1+m)] [Table 4]

[0082] The formulas in Table 4 are designed to calculate or approximate the result of log2(1 + m), where m represents the mantissa portion of the single-precision floating-point input 501. For example, because the mantissa m is always between 0 and 1 and the result of log2(0) is indeterminate, log2(1 + m) is calculated rather than log2(m) to avoid the indeterminate result when m is 0. Furthermore, to calculate log2(1 + m) using a 16-segment piecewise linear approximation, the potential values ​​of m across the interval [0,1] are divided into 16 different ranges or segments, designated as the range 0 to 15, and a separate equation is defined for each range to approximate the result of log2(1 + m). Furthermore, the individual equations are defined using addition and / or subtraction exclusively with one of the following types of operands: m, fractional and / or constant values ​​of m divided by powers of 2. In this scheme, the divisions required by the equations are exclusively by powers of two, and thus all division operations can be implemented using shifters. Furthermore, the loss of precision resulting from restrictive "shift-based" division is compensated for by the use of constant values ​​that are added and / or subtracted in a given equation. Thus, individual equations can be implemented using exclusively addition, subtraction, and / or shift operations, thereby eliminating the need for complex multiplication / division circuitry.

[0083] 5A shows the overall logic of logarithm circuit 500 designed to implement the equations of Table 4. In the illustrated embodiment, a 32-bit single-precision floating-point number is provided as input 501 to logarithm circuit 500 (e.g., provided via an input register), and logarithm circuit 500 calculates a corresponding 32-bit fixed-point number representing the log2 value of input 501 as output 503 (e.g., returned via an output register).

[0084] Input 501 includes a sign bit (input

[31] ), an 8-bit exponent e (input[30:23]), and a 23-bit mantissa m (input[22:0]). Given that the sign of input 501 always matches the sign of output 503, the sign bit (input

[31] ) of input 501 is directly fed to the corresponding bit (output

[31] ) of output 503. Furthermore, the exponent e (input[30:23]) of input 501 is fed to an 8-bit subtractor 502, which subtracts a bias of 0x7F from the exponent e to generate a corresponding 8-bit unbiased exponent. For example, from a mathematical perspective, subtracting the bias from the exponent of a floating-point number always results in a value equal to log2 of the exponent. Therefore, the resulting unbiased exponent serves as the integer part (output[30:23]) of the fixed-point number represented in output 503.

[0085] Additionally, mantissa m of input 501 is used to select the corresponding range and equation from Table 4 that will be used to calculate the fraction field (output[22:0]) of output 503. For example, the four most significant bits of mantissa m (input[22:19]) are provided as inputs to range selection logic 504, which outputs 16 1-bit signals (range[0] through range

[15] ) corresponding to the individual ranges of m in Table 4, such that the signal corresponding to the applicable range is set to 1, while the remaining signals are set to 0.

[0086] Based on the output of range selection logic 504, multiplexers (mux) 508a-508c are then used to select operands corresponding to the selected equation from Table 4, which are then provided as inputs to adder / subtractor logic 520. Specifically, muxes 508a-508c select various fractions of mantissa m (e.g., generated using shift operations) as well as predetermined constant values. For example, mantissa m is provided to a plurality of shifters 506, which each perform a right shift of m by a predetermined number of bits to generate various fractions of m by powers of two (e.g.,

number

number

[0087] Each mux 508a-508c then selects (e.g., based on range selection logic 504) the appropriate output that corresponds to one of the operands of the applicable equations in Table 4, and these outputs are then provided as inputs to adder / subtractor logic 520. In addition, the mantissa m is also provided directly as another input to adder / subtractor logic 520 because it is an operand for all equations in Table 4.

[0088] Adder / subtractor logic 520 then performs the appropriate addition and / or subtraction operations on the various operands provided as inputs, with the result then serving as the 23-bit fractional field (output[22:0]) of output 503. An implementation of adder / subtractor logic 520 is further illustrated and described below in connection with FIG. 5C.

[0089] Figure 5B shows an example implementation of constant generation logic 510 of logarithm circuit 500 of Figure 5A used to generate the constant values ​​required by certain equations in Table 4. In the illustrated embodiment, constant generation logic 510 includes a shifter 512 for generating a set of constant values ​​that appear throughout the equations in Table 4, multiplexers (mux) 514a, 514b for selecting corresponding constant values ​​for selected equations in Table 4, and an adder 516 for adding the selected constant values.

[0090] In the illustrated embodiment, each shifter 512 is provided as an input with a 23-bit constant value that is either +1 or −1 (e.g., depending on whether the fractional constant produced by each shifter 512 is positive or negative). For example, the 23-bit constant value of +1 is provided as an input to all but one shifter that produces a positive result, while the 23-bit signed representation of −1 is provided as an input to the only remaining shifter (e.g., performing a 9-bit right shift) that produces a negative result.

number

number

[0091] Furthermore, because each equation in Table 4 requires either zero, one, or two of these fractional constants, the appropriate combination of fractional constants for the equation selected from Table 4 is selected using two muxes 514a, 514b. Specifically, the output of shifter 512 is provided as an input to two muxes 514a, 514b in the manner shown in FIG. 5B, and a 23-bit constant value of 0 is also provided as an input to each mux 514a, 514b. Each mux 514a, 514b then outputs either a particular fractional constant or the value 0. In this manner, muxes 514a, 514b can collectively output zero, one, or two of the individual fractional constants generated by shifter 512, depending on the particular equation selected from Table 4 (e.g., as determined using range selection logic 504 of logarithm circuit 500 in FIG. 5A).

[0092] The outputs of muxes 514a, 514b are then provided as inputs to adder 516, which calculates their sum. The result from adder 516 then serves as the final constant value 511 output by constant generation logic 510 of FIG. 5B.

[0093] Figure 5C shows an example implementation of the adder / subtractor logic 520 of the logarithm circuit 500 of Figure 5A used to perform addition and / or subtraction on the operands of an equation selected from Table 4. In the illustrated embodiment, the adder / subtractor logic 520 includes two adders / subtractors 522a, 522b and two OR gates 524a, 524b, which are described in more detail below.

[0094] A first adder / subtractor 522a is provided with as its operands the mantissa m and the outputs of muxes 508b and 508c of logarithm circuit 500. Furthermore, the particular combination of additions and / or subtractions performed on these operands by adder / subtractor 522a is dictated by OR gate 524a. For example, OR gate 524a is provided with as inputs signals corresponding to ranges 11 and 15 from Table 4 (e.g., as generated by range select logic 504 of logarithm circuit 500), and the output of OR gate 524a is then provided to adder / subtractor 522a. In this scheme, when the output of OR gate 524a is 0, adder / subtractor 522a sums all operands, but when the output of OR gate 524a is 1 (e.g., when mantissa m is in either range 11 or range 15), adder / subtractor 522a subtracts the operand corresponding to the output of mux 508b and adds the remaining operands. In other words, for any range of m in Table 4 except ranges 11 and 15, adder / subtractor 522a outputs the result m + [output of mux 508b] + [output of mux 508c], but for ranges 11 and 15, adder / subtractor 522a outputs the result m - [output of mux 508b] + [output of mux 508c].

[0095] The second adder / subtractor 522b receives as its operands the output of the first adder / subtractor 522a and the output of mux 508a of logarithm circuit 500. The output of OR gate 524b indicates whether adder / subtractor 522b performs addition or subtraction on these operands. For example, OR gate 524b receives as input a signal corresponding to ranges 7-15 in Table 4 (e.g., as generated by range select logic 504 of logarithm circuit 500), and the output of OR gate 524b is then provided to adder / subtractor 522b. In this scheme, when the output of OR gate 524b is 0, adder / subtractor 522b sums both operands, but when the output of OR gate 524b is 1 (e.g., when mantissa m is in the range 7-15), the output of mux 508a is subtracted from the output of first adder / subtractor 522a. In other words, when m is in the range 0-6 in Table 4, adder / subtractor 522b computes [output of first adder / subtractor 522a] + [output of mux 508a], but when m is in the range 7-15, adder / subtractor 522b computes [output of first adder / subtractor 522a] - [output of mux 508a]. The result of second adder / subtractor 522b serves as final output 521 of adder / subtractor logic 520 of FIG. 5C.

[0096] To illustrate the operation of logarithm circuit 500, the processing flow for example input 501 will be described. Because the sign and exponent fields of input 501 are always processed in the same way regardless of their underlying values, this example focuses on the processing associated with the mantissa m of input 501. In this example, we assume that mantissa m (input[22:0]) of input 501 is within the range 0.125≦m<0.1875, which corresponds to range 2 in Table 4. Therefore, logarithm circuit 500 computes the corresponding equation for range 2 in Table 4, i.e.,

number

[0097] The first operand m, which corresponds to the mantissa field (input [22:0]) of input 501, is provided directly from the associated bit field of input 501 to adder / subtractor logic 520.

[0098] The remaining operands of the previously referenced equations are provided to adder / subtractor logic 520 by muxes 508a-508c. Specifically, a set of operands appearing throughout the various equations in Table 4 are provided as inputs to muxes 508a-508c, which then output the particular operand required for the appropriate equation in Table 4. For example, based on the four most significant bits of mantissa m, range selection logic 504 outputs a signal identifying the particular range in Table 4 that m falls within, and this range signal is used by muxes 508a-508c to select the appropriate operand to be output. In this example, since m is within range 2 in Table 4, range selection logic 504 outputs a range signal, otherwise designated as the range[2] signal, corresponding to range 2. Based on the range[2] signal, mux 508a

number

number

number

number

[0099] In this manner, the following operands are ultimately provided to the adder / subtractor logic 520: m: (supplied directly from input 501),

number

number

number

[0100] 6A-6C illustrate an example embodiment of an inverse logarithm circuit 600 implemented using piecewise linear approximation. Specifically, FIGS. 6A and 6B illustrate an alternative implementation of the entire inverse logarithm circuit 600, and FIG. 6C illustrates the basic adder / subtractor logic 620 of the inverse logarithm circuit 600.

[0101] Inverse logarithm circuit 600 performs the inverse logarithm calculation using a 16-segment piecewise linear approximation. In this manner, no lookup table or multiplier circuitry is required for inverse logarithm circuit 600, and the inverse logarithm calculation can be performed in a single clock cycle. The equations used by inverse logarithm circuit 600 to perform the piecewise linear approximation for the inverse logarithm calculation are shown in Table 5 below. Table 5: antilog2(η) = 2 η Piecewise linear approximation equation of [Table 5]

[0102] The equation in Table 5 is the antilog2 of η, i.e., 2 to the η power, or 2 η , where η represents the fractional portion of the fixed-point input number 601 (input[22:0]). For example, the fixed-point input 601 of the antilogarithm circuit 600 is typically derived from an intermediate DNN calculation on the fixed-point output 503 of the logarithm circuit 500 of FIGS. 5A-5C. Furthermore, as discussed above, the fractional portion of the fixed-point output 503 of the logarithm circuit 500 is calculated as log2(1+m) rather than log2(m) to avoid indeterminate results when m=0. Thus, antilog2(η)=2 η The equations in Table 5 for calculating m are designed to produce a value equal to 1 + m, as reflected by the constant value +1 in each equation.

[0103] antilog2(η)=2 η To calculate, say, a 16-segment piecewise linear approximation, the potential values ​​of η over the interval [0,1] are divided into 16 different ranges or segments, specified as the range 0 to 15, and are expressed as antilog2(η) or 2 ηA separate equation is defined for each range to approximate the result of . Furthermore, each equation is defined using addition and / or subtraction exclusively on any of the following types of operands: η, fractions of η divided by powers of two, and / or constant values. In this manner, the divisions required by the equations are exclusively by powers of two, and thus all division operations can be implemented using shifters. Furthermore, the loss of precision resulting from restrictive "shift-based" division is compensated for by the use of constant values ​​that are added and / or subtracted in a given equation. Therefore, each equation can be implemented exclusively using addition, subtraction, and / or shift operations, thereby eliminating the need for complex multiplication / division circuitry.

[0104] 6A shows the overall logic of an antilogarithm circuit 600 designed to implement the equations of Table 5. In the illustrated embodiment, a 32-bit fixed-point number is provided to the antilogarithm circuit 600 as input 601 (e.g., provided via an input register), and the antilogarithm circuit 600 calculates a corresponding 32-bit floating-point number representing the antilog2 result of input 601 as output 603 (e.g., returned via an output register).

[0105] Input 601 includes a sign bit (input

[31] ), an 8-bit integer part (input[30:23]), and a 23-bit fractional part (input[22:0]). Given that the sign of input 601 and the sign of output 603 always match, the sign bit (input

[31] ) of input 601 is fed directly to the corresponding bit (output

[31] ) of output 603. The integer part (input[30:23]) of input 601 is fed to an 8-bit adder 602, which adds back a bias of 0x7F to generate an 8-bit biased exponent that serves as the exponent field of floating-point output 603.

[0106] Additionally, the fractional portion (input[22:0]) of input 601, which corresponds to the value of η in Table 5, is used to select the corresponding range and formula from Table 5 that will be used to calculate the mantissa (output[22:0]) of floating-point output 603. For example, the four most significant bits (input[22:19]) of the fractional portion of input 601 are provided as inputs to range selection logic 604, which outputs 16 1-bit signals (range[0] through range

[15] ) corresponding to the respective ranges of η in Table 5, such that the signal corresponding to the applicable range is set to 1, while the remaining signals are set to 0. Based on the output of range selection logic 604, multiplexers (mux) 608a through 608d are then used to select predetermined operands, such as the required fraction of η and fractional constant, required by the corresponding formula in Table 5.

[0107] Specifically, muxes 608a and 608b are used to select the fraction of η required by the corresponding equation in Table 5. For example, the value of η (inputs [22:0]) is provided to a first set of shifters 606a, which each perform a right shift of η by a predetermined number of bits to produce the various fractions of η by powers of 2 (e.g.,

number

[0108] Similarly, muxes 608c and 608d are used to select the fractional constants required by the corresponding equations in Table 5. For example, a 23-bit constant having a value of 1 is provided to a second set by shifters 606b, which each perform a right shift by a predetermined number of bits to generate the individual fractional constants (e.g.,

number

[0109] Each operand selected by muxes 608a-608d for the corresponding equation in Table 5 is then provided as an input to adder / subtractor logic 620. The value of η (input[22:0]) and the constant value 1 are also provided as inputs to adder / subtractor logic 620 because these values ​​are operands in all of the equations in Table 5. Adder / subtractor logic 620 then performs the appropriate addition and / or subtraction operations on these operands (e.g., based on the output of range selection logic 604) as required by the corresponding expression in Table 5. The result from adder / subtractor logic 620 then serves as the 23-bit mantissa portion of floating-point output 603 (output[22:0]) of antilogarithm circuit 600. The implementation of adder / subtractor logic 620 is further illustrated and described below in connection with FIG. 6C.

[0110] FIG. 6B shows an alternative implementation 600 of an inverse logarithm circuit implemented using piecewise linear approximation. Specifically, while the inverse logarithm circuit of FIG. 6A is designed to calculate the inverse logarithm of a fixed-point number as input, the inverse logarithm circuit of FIG. 6B can calculate the inverse logarithm of either a fixed-point number or a floating-point number as input. In this manner, the inverse logarithm circuit of FIG. 6B can calculate the antilog2 of either a fixed-point number in the log2 domain (e.g., derived from the output of logarithm circuit 500 of FIGS. 5A-5C) or a floating-point number in its original domain. For example, as described in connection with FIG. 4, activation function (AF) circuit 400 uses the inverse logarithm circuit for two purposes: (1) to convert a fixed-point number in the log2 domain back to a floating-point number in the original domain, and (2) to calculate the power of a base-2 floating-point exponent. Thus, the operands of the antilogarithm circuit of AF circuit 400 include both fixed-point numbers (e.g., for log2 domain transformations) and floating-point numbers (e.g., for powers of base 2). Thus, the antilogarithm circuit of AF circuit 400 can be implemented using the antilogarithm circuit of FIG. 6B, which can process inputs represented as either fixed-point or floating-point numbers.

[0111] The operation of the antilogarithm circuit of FIG. 6B is similar to that of FIG. 6A, except for how it handles the integer or exponent field of input 601 (input [30:23]), as will be explained in more detail below.

[0112] Specifically, if input 601 is a fixed-point number, it includes an integer field (input[30:23]) and is provided as one of the inputs to mux 616. The select signal of mux 616 is a binary signal that indicates whether input 601 is a fixed-point number. Thus, the select signal of mux 616 has a value of 1 if input 601 is a fixed-point number, causing mux 616 to select the integer portion of input 601 (input[30:23]) as its output, which is then provided as an operand to 8-bit adder 602. Adder 602 then adds back a bias of 0x7F to the integer portion of input 601 (input[30:23]) to generate an 8-bit biased exponent, which then serves as the exponent portion of floating-point output 603.

[0113] Alternatively, if input 601 is a floating-point number, it will include an exponent field (input[30:23]). The exponent field (input[30:23]) is provided to an 8-bit subtractor 612, which subtracts a bias of 0x7F to generate a corresponding 8-bit unbiased exponent, which mathematically represents the log2 value of the exponent. The output of subtractor 612 is then provided to shifter 614, which performs a left shift by the unbiased exponent power of 2 to calculate the corresponding antilog2 value, which is then provided as one of the inputs to mux 616. The select signal of mux 616 has a value of 0 when input 601 is a floating-point number, causing mux 616 to select the value from shifter 614 as its output. The output of mux 616 is then provided as an operand to 8-bit adder 602, which adds back a bias of 0x7F to produce an 8-bit biased exponent, which then serves as the exponent portion of floating-point output 603.

[0114] Figure 6C shows an example implementation of adder / subtractor logic 620 of antilogarithm circuit 600 of Figures 6A and 6B used to perform additions and / or subtractions on the operands of the corresponding equations in Table 5. In the illustrated embodiment, adder / subtractor logic 620 includes three adders / subtractors 622a-622c and three OR gates 624a-624c, which are described in more detail below.

[0115] A first adder / subtractor 622a receives as input the following operands: the value of η (inputs [22:0]), a constant value 1, and the output of mux 608a. The particular combination of additions and / or subtractions to be performed on these operands is dictated by an OR gate 624a, which receives as input a signal in the range [0] through [7]. In this manner, if η is within the range 0 through 7 of Table 5, the output of OR gate 624a is 1, causing adder / subtractor 622a to compute η+1 - [output of mux 608a]. Alternatively, if η is within the range 8 through 15 of Table 5, the output of OR gate 624a is 0, causing adder / subtractor 622a to compute η+1 + [output of mux 608a].

[0116] The second adder / subtractor 622b receives as input the following operands: the output of mux 608c and the output of mux 608d. The particular combination of additions and / or subtractions to be performed on these operands is dictated by an OR gate 624b, which receives as input signals in the ranges [4], [8], [9],

[11] , and

[12] . In this manner, if η is within ranges 4, 8, 9, 11, or 12 of Table 5, the output of OR gate 624b is 1, causing adder / subtractor 622b to compute [output of mux 608c] - [output of mux 608d]. Alternatively, if η is within any of the remaining ranges of Table 5, the output of OR gate 624b is 0, causing adder / subtractor 622b to compute [output of mux 608c] + [output of mux 608d].

[0117] The third adder / subtractor 622c receives as input the following operands: the output of adder / subtractor 622a, the output of adder / subtractor 622b, and the output of mux 608b. The particular combination of addition and / or subtraction to be performed on these operands is dictated by OR gate 624c, which receives as input the inverse or NOT values ​​of signals in ranges [2],

[10] ,

[11] ,

[14] , and

[15] . In this manner, if η is within any range other than ranges 2, 10, 11, 14, and 15 in Table 5, the output of OR gate 624c is 1, causing adder / subtractor 622c to compute [output of adder / subtractor 622a] - [output of adder / subtractor 622b] - [output of mux 608b]. Alternatively, if η is within the ranges 2, 10, 11, 14, or 15 in Table 5, the output of OR gate 624c is 0, which causes adder / subtractor 622c to calculate [output of adder / subtractor 622a] - [output of adder / subtractor 622b] + [output of mux 608b].

[0118] The result of the third adder / subtractor 622c serves as the final output 621 of the adder / subtractor logic 620 of FIG. 6C.

[0119] 7 shows an example embodiment of an exponent circuit 700 implemented using piecewise linear approximation. Specifically, exponent circuit 700 performs the exponent calculation using a 16-segment piecewise linear approximation. In this manner, exponent circuit 700 does not require a lookup table, only one multiplier is required, and the exponent calculation can be performed in two clock cycles.

[0120] The formula used by exponent circuit 700 to perform the piecewise linear approximation for the exponent calculation is shown in Table 6 below. [Table 6: Index e x Piecewise linear approximation equation of [Table 6]

[0121] The equations in Table 6 are natural exponential functions e x where e represents a natural exponential constant (e.g., Euler's number) and x represents the 23-bit mantissa (input[22:0]) of a 32-bit floating-point input 701. For example, e x To calculate x using a 16-segment piecewise linear approximation, the potential values ​​of x across the interval [0,1] are divided into 16 different ranges or segments, designated as the range 0 to 15, and e x A separate equation is defined for each range to approximate the result of . Furthermore, each equation is defined using addition and / or subtraction exclusively with the following types of operands: x, 2x, fractions of x divided by powers of 2, and / or constant values. In this manner, the divisions required by the equations are exclusively by powers of 2, and thus all division operations can be implemented using shifters. Furthermore, the loss of precision resulting from restrictive "shift-based" division is compensated for by the use of constant values ​​to be added and / or subtracted in a given equation. Thus, e x The individual equations of can be implemented using exclusively addition, subtraction and / or shift operations.

[0122] To complete the exponentiation operation, we then use the resulting exponentiation function e, which represents the power of the mantissa portion of input 701 (input [22:0]). x must be multiplied by the value of the exponent part of e's input 701 (inputs [30:23]). Therefore, the exponentiation operation requires only one multiplication operation, and therefore only one multiplier circuit is required in exponentiation circuit 700.

[0123] 7 shows the overall logic of exponent circuit 700. In the illustrated embodiment, exponent circuit 700 is provided with a 32-bit floating-point number as input 701, and exponent circuit 700 calculates the natural exponent constant e to be raised to the floating-point number represented by input 701, i.e., e input , and calculates as output 703 the corresponding 32-bit fixed-point number that matches.

[0124] Floating-point input 701 includes a sign bit (input

[31] ), an 8-bit exponent (input[30:23]), and a 23-bit mantissa (input[22:0]). The sign bit (input

[31] ) of input 701 is fed directly to the corresponding bit (output

[31] ) of output 703, given that the sign of input 701 and the sign of output 703 always match.

[0125] The exponent portion of input 701 (input [30:23]) is fed to an 8-bit subtractor 702, which subtracts a bias of 0x7F to produce an 8-bit unbiased exponent. The natural exponent constant e raised to the unbiased exponent, i.e., e unbiased_exponent The value of , is then output by mux710. For example, an 8-bit unbiased exponent is 2 8 = 256 potential values, ranging from -128 to +127. The value of e raised to all 256 potential values ​​of the unbiased exponent (e -128 , e -127 , ..., e 0 , e 1 , ..., e 127 ) is pre-computed and provided as a constant input to mux 710. The 8-bit unbiased exponent output by subtractor 702 serves as a select signal for mux 710, which causes mux 710 to select e unbiased_exponent Then, select the pre-computed constant input corresponding to the output of mux710 (e unbiased_exponent ) is provided to multiplier 712 as one of its operands, as further described below.

[0126] The mantissa portion of input 701 (input[22:0]) is processed according to the equations in Table 6. For example, exponent circuit 700 generates the natural exponent constant e raised to the mantissa (input[22:0]), i.e., e x , where x represents the mantissa (inputs [22:0]). x is calculated using piecewise linear approximation based on the equations in Table 6. Specifically, the mantissa part (input [22:0]) of input 701 (corresponding to the value of x in Table 6) is calculated from Table 6 as follows:x 6. For example, the four most significant bits of the mantissa of input 701 (input[22:19]) are provided as inputs to range selection logic 704, which outputs 16 1-bit signals (range[0] through range

[15] ) corresponding to the respective ranges of x in Table 6, such that the signal corresponding to the applicable range is set to 1 while the remaining signals are set to 0. Based on the output of range selection logic 704, multiplexers (mux) 708a through 708d are then used to select predetermined operands required by the corresponding formula in Table 6, such as the required fraction of x and constant values ​​that appear in the equation.

[0127] For example, muxes 708a and 708b are used to select the fraction of x required by the corresponding equation in Table 6. For example, the value of x (inputs [22:0]) is provided to a first set of shifters 706a, which each perform a right shift of x by a predetermined number of bits to produce the various fractions of x by powers of 2 (e.g.,

number

[0128] Similarly, muxes 708c and 708d are used to select the fractional constants and / or constant values, such as the constant value 1, required by a given equation, as required by the corresponding equation in Table 6. For example, a 23-bit constant having a value of 1 is provided to a second set by shifters 706b, which each perform a right shift by a predetermined number of bits to generate the individual fractional constants (e.g.,

number

[0129] Each operand selected by muxes 708a-708d for the corresponding equation in Table 6 is then provided as an input to adder / subtractor 720. Adder / subtractor 720 also receives the value of x (input [22:0]) via one or two of its inputs, depending on whether the corresponding equation in Table 6 requires an x ​​operand or a 2x operand. For example, the value of x is always provided directly as one of the inputs to adder / subtractor 720, and in some cases may be provided as another input to adder / subtractor 720 via mux 709. Specifically, the value of x and a 23-bit constant 0 are provided as inputs to mux 709, which selects one of these values ​​to provide as an input to adder / subtractor 720. For example, if the corresponding equation in Table 6 requires x rather than 2x as an operand, then mux 709 will select the constant 0 as the output to adder / subtractor 720 because the value of x is already provided directly through another input of adder / subtractor 720. Alternatively, if the corresponding equation in Table 6 requires 2x rather than x as an operand, then mux 709 will select the value of x as the output to adder / subtractor 720 because, as a result, the value of x is provided to adder / subtractor 720 through two inputs.

[0130] Adder / subtractor 720 then performs the appropriate addition and / or subtraction operations on these operands (e.g., based on the output of range selection logic 704) as required by the corresponding equations in Table 6. In this manner, the output of adder / subtractor 720 is e, which is equal to the natural exponent constant e raised to the mantissa of input 701 (input[22:0]). xThis matches the final result.

[0131] The output of mux 710 (e raised to the unbiased exponent of input 701) and the output of adder / subtractor 720 (e raised to the mantissa of input 701) are then provided as operands to multiplier 712, which multiplies these values ​​to produce the integer and fractional parts of the fixed-point output 703 of exponent circuit 700.

[0132] 8 illustrates a flowchart 800 of an example of a processing architecture used to implement an artificial neural network (e.g., a deep neural network (DNN)). Flowchart 800 may be implemented, for example, using embodiments and functionality described throughout this disclosure. For example, in some embodiments, flowchart 800 may be implemented using the activation circuit of FIGS. 2A and 2B or 4, the logarithm circuit of FIGS. 5A-5C, the antilogarithm circuit of FIGS. 6A-6C, and / or the exponential circuit of FIG. 7.

[0133] In this illustrated flowchart, a particular activation function is performed by an activation function circuit designed to accelerate the performance of the activation function. In some embodiments, for example, the activation function circuit may be designed to support multiple types of activation functions commonly used to implement artificial or deep neural networks. Furthermore, the activation function circuit may utilize logarithmic, antilogarithmic, and / or exponential circuits implemented using piecewise linear approximations to accelerate calculations associated with the supported activation functions.

[0134] For example, in some embodiments, the activation function circuit may be implemented on and / or used in connection with a processor, device, and / or system that executes an application using an artificial neural network (e.g., a deep neural network, a convolutional neural network, a feedforward neural network, a recurrent neural network, etc.). In this manner, the application may utilize the activation function circuit to accelerate the activation function used to implement the artificial neural network. For example, an application having an artificial neural network may be stored in memory and executed by a processor on a particular device or system. When the application needs to execute an activation function in connection with a certain operation in the artificial neural network, the application may issue a corresponding instruction or command to the processor and / or the activation function circuit, and the processor may then execute the activation function using the activation function circuit. The results of the activation function may then be provided back to the processor and / or application and subsequently used by the artificial neural network.

[0135] The flowchart begins at block 802, where an instruction or command to execute a particular activation function is received. The instruction or command may be issued by an application and received by a processor and / or activation function circuitry, for example. In some embodiments, the instruction or command may identify the desired activation function and any operands or other parameters associated with the activation function.

[0136] Further, in some cases, the selected activation function may include a combination of exponentiation, multiplication, and / or division operations. Accordingly, the flowchart first proceeds to block 804 to perform any exponentiation operations associated with the activation function. In some embodiments, for example, the exponentiation operations may be performed using piecewise linear approximations to reduce the latency associated with these operations (e.g., using the exponentiation circuit of FIG. 7). However, in some embodiments, if the exponentiation operation involves a base 2, it can be calculated using an inverse logarithm circuit (using a base 2 inverse logarithm operation) instead of the exponentiation circuit to reduce latency.

[0137] The flowchart then proceeds to block 806 to perform any multiplication and / or division operations associated with the activation function. In some embodiments, for example, the multiplication and / or division operations of the activation function may be performed using a combination of logarithm, inverse logarithm, and addition / subtraction operations. For example, by utilizing the properties of the logarithm function, logarithm and inverse logarithm operations can be used to convert expensive multiplication / division operations into addition and / or subtraction operations. Furthermore, the logarithm and inverse logarithm operations can be performed using piecewise linear approximations to reduce the latency associated with these operations.

[0138] In some embodiments, a logarithm circuit (e.g., the logarithm circuit of FIGS. 5A-5C ) may be used to perform a logarithm operation using, for example, a piecewise linear approximation. For example, the logarithm circuit may be designed to calculate the logarithm of an input represented as a floating-point number (e.g., with an exponent and a mantissa), and the logarithm circuit may represent the resulting output as a fixed-point number (e.g., with an integer and a fraction). The logarithm circuit first identifies an input or operand associated with the logarithm operation and then identifies or determines a particular range within which the input falls for the purpose of the piecewise linear approximation. For example, to perform a logarithm operation using a piecewise linear approximation, multiple ranges or segments and associated equations are defined. Thus, a corresponding range within which the input falls is identified, and the operands required by the equation for that range are obtained and / or generated. In some embodiments, for example, a given operand may be extracted, obtained, and / or calculated using an input, such as the mantissa of the input, and a fractional operand with a denominator that is a power of two, which may be generated using a shift circuit (e.g., by shifting bits to perform a division). The appropriate operand is then selected using one or more multiplexers, and the result of the equation is calculated using the selected operand. For example, the result may be calculated by performing addition and / or subtraction on the individual operands using an adder / subtractor circuit. Furthermore, the exponent of the floating-point input may be converted to an unbiased exponent by subtracting the bias using a subtractor circuit. The output of the logarithmic operation is then generated using the result of the corresponding equation and the unbiased exponent. For example, the unbiased exponent serves as the integer part of the resulting fixed-point output, and the result of the equation serves as the fractional part of the fixed-point output.

[0139] Similarly, an antilogarithm circuit (e.g., the antilogarithm circuit of Figures 6A-6C) may be used to perform an antilogarithm operation using a piecewise linear approximation. The antilogarithm operation may be performed in a similar manner, except using different calculations for the integer / exponent portion and different equations for the piecewise linear approximation.

[0140] The flowchart then proceeds to block 808, where the result of the activation function is output based on the result of the exponentiation, multiplication and / or division operation.

[0141] At this point, the flowchart may be complete. However, in some embodiments, the flowchart may resume and / or certain blocks may be repeated. For example, in some embodiments, the flowchart may resume at block 802 to continue executing the activation function.

[0142] [DNN performance] 9A and 9B illustrate the scalability of the described embodiments with respect to the number of parallel operations supported. Specifically, the described embodiments are implemented using a flexible design that allows for replication of the underlying hardware to increase the number of parallel operations supported. In this manner, the described embodiments can be scaled as needed to support the number of parallel operations required by a particular application or use case. For example, as shown in FIGS. 9A and 9B, the proposed solution can be scaled from a single operand to n operands through simple replication. Specifically, FIG. 9A illustrates the proposed solution for a single operand, and FIG. 9B illustrates the proposed solution for n operands. Furthermore, the proposed solution can be pipelined to reduce latency and increase throughput.

[0143] 10A illustrates the scalability of the described embodiments with respect to precision. Specifically, the described embodiments can be scaled to provide various levels of precision simply by adjusting the number of segments in the piecewise linear approximation model implemented by the logarithm, antilogarithm, and / or exponential circuits. In this manner, the described embodiments can be scaled as needed to provide the precision level required for different applications and use cases. For example, if an application requires higher precision, the number of segments included in the piecewise linear approximation model can be increased to accommodate the higher precision requirement.

[0144] The number of segments required in the piecewise linear approximation model for various levels of precision is shown in Figure 10A. For example, if an application requires 23-bit precision from a 23-bit mantissa, as shown in Figure 10A, the piecewise linear approximation model should be implemented using at least 1,556 segments. The number of segments used in the piecewise linear approximation can be adjusted in a similar manner to provide any desired level of precision.

[0145] FIG. 10B compares the silicon area requirements of various implementations of logarithm and antilogarithm hardware. Specifically, FIG. 10B compares the number of composite gates for a solution implemented using a lookup table method (12-bit precision) with logarithm and antilogarithm circuits implemented using piecewise linear approximation (PLA) (either 10-bit or 12-bit precision). As shown in FIG. 10B, the logarithm and antilogarithm circuits implemented using piecewise linear approximation use significantly fewer gates than the solution implemented using the lookup table method. For example, the lookup table solution uses 8,800 gates at 12-bit precision, while the piecewise linear approximation (PLA) logarithm and antilogarithm circuits use 350 and 450 gates at 10-bit precision and 1,048 and 1,348 gates at 12-bit precision, respectively.

[0146] FIG. 10C compares the silicon area requirements of various implementations of activation function hardware (10-bit precision). Specifically, FIG. 10C compares the number of synthesis gates for various individual activation functions (e.g., sigmoid, hyperbolic tangent (Tanh), and Swish) implemented using lookup tables (LUTs) with the number of synthesis gates for a unified activation function circuit (e.g., activation function circuit 200 of FIGS. 2A and 2B) that supports multiple activation functions and is implemented using piecewise linear approximation (PLA). As shown in FIG. 10C, for example, the unified circuit uses significantly fewer gates than either of the LUT-based circuits while still supporting many more activation functions. For example, in the case of the unified circuit, its simplified equations allow the exponential, logarithmic, and antilogarithmic blocks to be implemented using only 4,387, 1,048, and 1,348 synthesis gates, respectively, for a total of 8,321 synthesis gates. In comparison, each LUT-based circuit requires approximately 17,000-18,000 synthesis gates for just one activation function.

[0147] Figure 10D shows the approximation error of log and antilog circuits implemented using piecewise linear approximation (e.g., Figures 5A-5C and 6A-6C), and Figure 10E shows the approximation error of exponent circuits implemented using piecewise linear approximation (e.g., Figure 7). Specifically, these circuits can be implemented with 0.045% absolute error (ABS) for the individual log2, antilog2, and exponent calculations, which translates to 12 bits of mantissa precision for IEEE-754 single-precision floating-point numbers (e.g., 1 sign bit + 8 exponent bits + 12-bit mantissa = 21-bit precision).

[0148] The total precision of an integrated activation function circuit implemented using logarithm, antilogarithm, and exponent circuits (e.g., AF circuit 200 of FIGS. 2A and 2B) is 10 mantissa bits for IEEE-754 single-precision floating-point numbers (e.g., 1 sign bit + 8 exponent bits + 10-bit mantissa = 19-bit precision).

[0149] 11A-11C compare the performance of a deep neural network (DNN) implemented using a conventional activation function formula (using a power of the exponential constant e) with a deep neural network (DNN) implemented using a modified activation function formula (using a power of base 2). For example, as discussed above, the AF circuit 200 of FIGS. 2A and 2B and the AF circuit 400 of FIG. 4 both implement activation functions using piecewise linear approximations. However, while the AF circuit 200 implements a conventional activation function, the AF circuit 400 implements a modified activation function that uses a power of 2 rather than a power of the exponential constant e. The performance of these individual approaches is compared in the examples shown in FIGS. 11A-11C.

[0150] 11A shows an example of a DNN 1100 that includes an input layer with two input neurons, a single hidden layer with three neurons, and a fully connected layer with one output neuron. For simplicity, the DNN 1100 implements the feature mapping shown in Table 7, which has the same behavior as an XOR gate. Table 7: DNN feature set mapping [Table 7]

[0151] The illustrated example focuses on one of these feature sets, A=1 and B=1, that is expected to have an output of 0. In the illustrated example, input neuron X1 corresponds to feature A and input neuron X2 corresponds to feature B.

[0152] Figure 11B shows how the DNN1100 performs with the traditional sigmoid activation function.

number

[0153] For simplicity, the illustrated example adopts a bias of 0. After applying the sigmoid activation function, the updated hidden layer neurons have the following values: H1=0.7310, H2=0.7858, H3=0.6899.

[0154] Next, the fully connected (FC) layer can be calculated as follows: FC=H1*Wh1+H2*Wh2+H3*Wh3=0.7310*0.3+0.7858*0.5+0.6899*0.9=1.235. Applying a sigmoid activation function to the fully connected layer results in FC=0.7746. Then the error is calculated as follows: Error = Expected value - Calculated value = 0 - 0.7746 = -0.7746.

[0155] During the backpropagation and weight update phase, the derivative of the sigmoid activation function

number

[0156] Next, for ΔH1, ΔH2 and ΔH3, the following calculation is performed: New Hidden Layer Value = ΔFC * f' (Hidden Layer Neuron Value without Activation Function) / Hidden Layer Weight: ΔH1=ΔFC*f´(1) / Wh1=-0.13439*0.1966 / 0.3=-0.088, ΔH2=ΔFC*f´(1.3) / Wh2=-0.13439*0.1683=-0.0452, ΔH1=ΔFC*f´(0.8) / Wh3=-0.13439*0.2139=-0.0319.

[0157] After backpropagation, the new hidden layer weights have the following values: Wh1=Wh1+ΔWh1=0.3-0.1838=0.1162, Wh2=Wh2+ΔWh2=0.5-0.1710=0.392, Wh3=Wh3+ΔWh3=0.9-0.1920=0.708.

[0158] Next, the weight updates between the input and hidden layers are calculated as follows: Weight delta = Hidden delta / Input: ΔW11=ΔH1 / X1=-0.088 / 1=-0.088, ΔW12=ΔH2 / X1=-0.0452 / 1=-0.0452, ΔW13=ΔH3 / X1=-0.0319 / 1=-0.0319, ΔW21=ΔH1 / X2=-0.088 / 1=-0.088, ΔW22=ΔH2 / X2=-0.0452 / 1=-0.0452, ΔW23=ΔH3 / X2=-0.0319 / 1=-0.0319, New weights: W11=W11+ΔW11=0.8-0.088=0.712, W12=W12+ΔW12=0.4-0.0452=0.3548, W13=W13+ΔW13=0.3-0.0319=0.2681, W21=W21+ΔW21=0.2-0.088=0.112, W22=W22+ΔW22=0.9-0.0452=0.8548, W23=W23+ΔW23=0.5-0.0319=0.4681.

[0159] Figure 11B shows the state of the DNN 1100 after the weights have been updated based on the calculations above. The output of the DNN after this iteration is 0.69, an improvement over the output of 0.77 after the first iteration. This iteration continues until the loss function gradient reaches an acceptable level.

[0160] FIG. 11C shows that the DNN 1100 is

number

[0161] During the forward propagation stage, the weights are randomly selected as follows: W11 = 0.8, W12 = 0.4, W13 = 0.3, W21 = 0.2, W22 = 0.9, W23 = 0.5, Wh1 = 0.3, Wh2 = 0.5 and Wh3 = 0.9. The outputs of the hidden layer nodes (H) are then calculated as follows: H1=X1*W11+X2*W21=0.8+0.2=1, H2=X1*W12+X2*W22=0.4+0.9=1.3, H3=X1*W13+X2*W23=0.3+0.5=0.8.

[0162] For simplicity, the illustrated example adopts a bias of 0. After applying the modified sigmoid activation function, the updated hidden layer neurons have the following values: H1=0.6667, H2=0.7117, H3=0.6351.

[0163] Next, the fully connected (FC) layer can be calculated as follows: FC=H1*Wh1+H2*Wh2+H3*Wh3=0.6667*0.3+0.7117*0.5+0.6351*0.9=1.1272. Applying the modified sigmoid activation function to the fully connected layer results in FC=0.6859. The error is then calculated as follows: Error = Expected value - Calculated value = 0 - 0.6859 = -0.6859.

[0164] During the backpropagation and weight update phases, the derivative of the modified sigmoid activation function

number

[0165] Next, for ΔH1, ΔH2, and ΔH3, the following calculation is performed: New Hidden Layer Value = ΔFC * f` (Hidden Layer Neuron Value without Activation Function) / Hidden Layer Weight: ΔH1=ΔFC*f´(1) / Wh1=-0.13439*0.1966 / 0.3=-0.05259, ΔH2=ΔFC*f´(1.3) / Wh2=-0.13439*0.1683=-0.02917, ΔH1=ΔFC*f´(0.8) / Wh3=-0.13439*0.2139=-0.01828.

[0166] After backpropagation, the new hidden layer weights have the following values: Wh1=Wh1+ΔWh1=0.3-0.15364=0.1463, Wh2=Wh2+ΔWh2=0.5-0.14402=0.3559, Wh3=Wh3+ΔWh3=0.9-0.16125=0.7387.

[0167] Next, the weight updates between the input and hidden layers are calculated as follows: Weight delta = Hidden delta / Input: ΔW11=ΔH1 / X1=-0.05259 / 1=-0.05259, ΔW12=ΔH2 / X1=-0.02917 / 1=-0.02917, ΔW13=ΔH3 / X1=-0.01828 / 1=-0.01828, ΔW21=ΔH1 / X2=-0.02917 / 1=-0.05259, ΔW22=ΔH2 / X2=-0.0452 / 1=-0.02917, ΔW23=ΔH3 / X2=-0.01828 / 1=-0.01828, New weights: W11=W11+ΔW11=0.8-0.05259=0.7474, W12=W12+ΔW12=0.4-0.02917=0.3708, W13=W13+ΔW13=0.3-0.01828=0.2817, W21=W21+ΔW21=0.2-0.05259=0.1474, W22=W22+ΔW22=0.9-0.02917=0.8708, W23=W23+ΔW23=0.5-0.01828=0.4817.

[0168] Figure 11C shows the state of the DNN 1100 after the weights have been updated based on the calculations above (e.g., using a modified sigmoid activation function). The output of the DNN in Figure 11C after this iteration is 0.70, comparable to the output of the DNN in Figure 11B, 0.69. Iterations in this manner continue until the loss function gradient reaches an acceptable level.

[0169] Figures 12A and 12B compare the training convergence for the individual DNNs of Figures 11B and 11C. Specifically, Figure 12A shows the convergence rate for the original sigmoid activation function used by the DNN of Figure 11B, and Figure 12B shows the convergence rate for the modified sigmoid activation function (e.g., using a power of base 2 instead of e) used by the DNN of Figure 11C. Figure 13 shows the error rate or accuracy of these approaches.

[0170] [Example of computing architecture] 14A-18 illustrate example implementations of computing environments and architectures that can be used in accordance with embodiments disclosed herein. In various embodiments, for example, these example computer architectures may be used in conjunction with and / or to implement deep neural network (DNN) processing functionality described throughout this disclosure.

[0171] Also suitable are other system designs and configurations known in the art for laptops, desktops, handheld PCs, personal digital assistants, engineering workstations, servers, network devices, network hubs, switches, embedded processors, digital signal processors (DSPs), graphics devices, video game devices, set-top boxes, microcontrollers, mobile phones, portable media players, handheld devices, and a variety of other electronic devices. Generally, a wide variety of systems or electronic devices capable of incorporating a processor and / or other execution logic as disclosed herein are generally suitable.

[0172] Figure 14A is a block diagram illustrating both an exemplary in-order pipeline and an exemplary register renaming, out-of-order issue / execution pipeline, according to an embodiment of the present invention. Figure 14B is a block diagram illustrating both an exemplary embodiment of an in-order architecture core and an exemplary register renaming, out-of-order issue / execution architecture core to be included in a processor, according to an embodiment of the present invention. Solid lined boxes in Figures 14A and 14B indicate the in-order pipeline and in-order core, and optionally added dashed lined boxes indicate the register renaming, out-of-order issue / execution pipeline and core. Given that the in-order aspect is a subset of the out-of-order aspect, the out-of-order aspect will be described.

[0173] In FIG. 14A , a processor pipeline 1400 includes a fetch stage 1402, a length decode stage 1404, a decode stage 1406, an allocation stage 1408, a renaming stage 1410, a scheduling (also known as dispatch or issue) stage 1412, a register read / memory read stage 1414, an execution stage 1416, a writeback / memory write stage 1418, an exception handling stage 1422, and a commit stage 1424.

[0174] 14B shows a processor core 1490 including a front end unit 1430 coupled to an execution engine unit 1450, both of which are coupled to a memory unit 1470. Core 1490 may be a reduced instruction set computing (RISC) core, a complex instruction set computing (CISC) core, a very long instruction word (VLIW) core, a hybrid or alternative core type. As a further alternative, core 1490 may be a specialized core such as a network or communications core, a compression engine, a coprocessor core, a general purpose computing graphics processing unit (GPGPU) core, a graphics core, or the like.

[0175] The front-end unit 1430 includes a branch prediction unit 1432 coupled to an instruction cache unit 1434, which is coupled to an instruction translation lookaside buffer (TLB) 1436, which is coupled to an instruction fetch unit 1438, which is coupled to a decode unit 1440. The decode unit 1440 (or decoder) decodes instructions and may generate as output one or more micro-operations, microcode entry points, microinstructions, other instructions, or other control signals that are decoded from or otherwise reflect or are derived from the original instruction. The decode unit 1440 may be implemented using a variety of different mechanisms. Examples of suitable mechanisms include, but are not limited to, lookup tables, hardware implementations, programmable logic arrays (PLAs), microcode read-only memory (ROM), and others. In one embodiment, core 1490 includes a microcode ROM or other medium (e.g., within decode unit 1440 or elsewhere in front end unit 1430) that stores microcode for a given macroinstruction. Decode unit 1440 is coupled to rename / allocator unit 1452 within execution engine unit 1450.

[0176] The execution engine unit 1450 includes a rename / allocator unit 1452 coupled to a retirement unit 1454 and a set of one or more scheduler units 1456. The scheduler units 1456 represent any number of different schedulers, including reservation stations, central instruction windows, and others. The scheduler units 1456 are coupled to physical register file units 1458. The physical register file units 1458 each represent one or more physical register files, different ones of which store one or more different data types, such as scalar integer, scalar floating point, packed integer, packed floating point, vector integer, vector floating point, status (e.g., an instruction pointer, which is the address of the next instruction to be executed), etc. In one embodiment, the physical register file units 1458 comprise a vector register unit, a write mask register unit, and a scalar register unit. These register units may provide architectural vector registers, vector mask registers, and general-purpose registers. The physical register file unit 1458 is overlapped by the retirement unit 1454 to illustrate various ways in which register renaming and out-of-order execution can be implemented (e.g., by using a reorder buffer and a retirement register file, a future file, a history buffer and a retirement register file, a register map and a register pool, etc.). The retirement unit 1454 and the physical register file unit 1458 are coupled to an execution cluster 1460. The execution cluster 1460 includes a set of one or more execution units 1462 and a set of one or more memory access units 1464. The multiple execution units 1462 may perform various operations (e.g., shift, add, subtract, multiply) on various types of data (e.g., scalar floating point, packed integer, packed floating point, vector integer, vector floating point).Some embodiments may include several execution units dedicated to particular functions or sets of functions, while other embodiments may include only one execution unit or multiple execution units that all execute all functions. Scheduler unit 1456, physical register file unit 1458, and execution cluster 1460 are shown as possibly multiple because certain embodiments generate separate pipelines for certain types of data / operations (e.g., a scalar integer pipeline, a scalar floating-point / packed integer / packed floating-point / vector integer / vector floating-point pipeline, and / or a memory access pipeline, each with its own scheduler unit, physical register file unit, and / or execution cluster, and in the case of a separate memory access pipeline, certain embodiments are implemented in which only the execution cluster of this pipeline has a memory access unit 1464). It should also be understood that if separate pipelines are used, one or more of these pipelines may be out-of-order issue / execution, and the rest in-order.

[0177] The set of memory access units 1464 is coupled to a memory unit 1470, which includes a data TLB unit 1472 coupled to a data cache unit 1474, which is coupled to a level 2 (L2) cache unit 1476. In one example embodiment, the plurality of memory access units 1464 may include a load unit, a store address unit, and a store data unit, each of which is coupled to the data TLB unit 1472 in the memory unit 1470. The instruction cache unit 1434 is further coupled to a level 2 (L2) cache unit 1476 in the memory unit 1470. The L2 cache unit 1476 is coupled to one or more other levels of cache and ultimately to main memory.

[0178] By way of example, an exemplary register renaming, out-of-order issue / execution core architecture may implement pipeline 1400 as follows: 1) the instruction fetch unit 1438 performs the fetch stage 1402 and the length decode stage 1404; 2) the decode unit 1440 performs the decode stage 1406; 3) the rename / allocator unit 1452 performs the allocation stage 1408 and the renaming stage 1410; 4) the scheduler unit 1456 performs the schedule stage 1412; 5) the physical register file unit 1458 and the memory unit 1470 perform the register read / memory read stage 1414; the execution cluster 1460 performs the execution stage 1416; 6) the memory unit 1470 and the physical register file unit 1458 perform the writeback / memory write stage 1418; 7) various units may be involved in the exception handling stage 1422; and 8) the retirement unit 1454 and the physical register file unit 1458 perform the commit stage 1424.

[0179] Core 1490 may support one or more instruction sets (e.g., the x86 instruction set (with some extensions added in newer versions), the MIPS instruction set from MIPS Technologies of Sunnyvale, California, or the ARM instruction set from ARM Holdings of Sunnyvale, California (with optional extensions such as NEON)), including the instructions described herein. In one embodiment, core 1490 includes logic to support packed data instruction set extensions (e.g., AVX1, AVX2), which enables it to perform operations used by many multimedia applications using packed data.

[0180] It should be understood that a core may support multithreading (executing two or more parallel sets of operations or threads) and may do so in a variety of ways, including time-sliced ​​multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that the physical core is simultaneously multithreading), or a combination thereof (e.g., time-sliced ​​fetch and decode followed by simultaneous multithreading, such as in Intel® Hyper-Threading Technology).

[0181] Although register renaming is described in the context of out-of-order execution, it should be understood that register renaming can be used in in-order architectures. Also, while the illustrated processor embodiment includes separate instruction and data cache units 1434 / 1474 and a shared L2 cache unit 1476, alternative embodiments may have a single internal cache for both instructions and data, such as a level 1 (L1) internal cache, or multiple levels of internal cache. In some embodiments, the system may include a combination of internal cache and external cache external to the core and / or processor. Alternatively, all of the cache may be external to the core and / or processor.

[0182] 15 is a block diagram of a processor 1500 that may have two or more cores, an integrated memory controller, and integrated graphics, according to an embodiment of the present invention. The solid-lined box in FIG. 15 illustrates a processor 1500 with a single core 1502A, a system agent 1510, and a set of one or more bus controller units 1516, while an optional dashed-lined box illustrates an alternative processor 1500 with multiple cores 1502A-1502N, a set of one or more integrated memory controller units 1514 within the system agent unit 1510, and dedicated logic 1508.

[0183] Thus, different implementations of processor 1500 may include: 1) a CPU having special-purpose logic 1508 that is integrated graphics and / or scientific (throughput) logic (which may include one or more cores) and one or more general-purpose cores 1502A-1502N (e.g., general-purpose in-order cores, general-purpose out-of-order cores, or a combination of both); 2) a coprocessor having multiple special-purpose cores 1502A-1502N intended primarily for graphics and / or scientific (throughput); or 3) a coprocessor having multiple general-purpose in-order cores 1502A-1502N. Thus, processor 1500 may be a general-purpose processor, coprocessor, or special-purpose processor, such as, for example, a network or communications processor, a compression engine, a graphics processor, a GPGPU (general-purpose graphics processing unit), a high-throughput multiple integrated core (MIC) coprocessor (including 30 or more cores), an embedded processor, or the like. The processor may be implemented on one or more chips. The processor 1500 may be part of one or more substrates and / or may be implemented on one or more substrates using any of several process technologies, such as, for example, BiCMOS, CMOS, or NMOS.

[0184] The memory hierarchy includes one or more levels of cache within the cores, one or more shared cache units 1506 or sets of shared cache units 1506, and external memory (not shown) coupled to a set of integrated memory controller units 1514. The set of shared cache units 1506 may include one or more intermediate level caches, such as level 2 (L2), level 3 (L3), level 4 (L4), or other level caches, last level caches (LLCs), and / or combinations thereof. In one embodiment, a ring-based interconnect unit 1512 interconnects the integrated graphics logic 1508, the set of shared cache units 1506, and the system agent unit 1510 / integrated memory controller unit 1514, although alternative embodiments may use any number of well-known techniques for interconnecting such units. In one embodiment, coherence is maintained between one or more cache units 1506 and the cores 1502A-1502N.

[0185] In some embodiments, one or more of the cores 1502A-1502N are capable of multithreading. The system agent 1510 includes components that coordinate the operation of the cores 1502A-1502N. The system agent unit 1510 may include, for example, a power control unit (PCU) and a display unit. The PCU may be or include the logic and components necessary to stabilize the power states of the cores 1502A-1502N and the integrated graphics logic 1508. The display unit is for driving one or more externally connected displays.

[0186] Cores 1502A-1502N may be homogeneous or heterogeneous with respect to architectural instruction sets, i.e., two or more of cores 1502A-1502N may be capable of executing the same instruction set, while others may be capable of executing only a subset of that instruction set or a different instruction set.

[0187] 16, a block diagram of a system 1600 according to one embodiment of the present invention is shown. The system 1600 may include one or more processors 1610, 1615, which are coupled to a controller hub 1620. In one embodiment, the controller hub 1620 includes a graphics and memory controller hub (GMCH) 1690 and an input / output hub (IOH) 1650 (which may be on separate chips), where the GMCH 1690 includes a memory controller and a graphics controller to which memory 1640 and coprocessor 1645 are coupled, and the IOH 1650 couples input / output (I / O) devices 1660 to the GMCH 1690. Alternatively, one or both of the memory controller and the graphics controller may be integrated within the processor (as described herein), where the memory 1640 and coprocessor 1645 are directly coupled to the processor 1610, and the controller hub 1620 resides on a single chip with the IOH 1650.

[0188] An additional, and inherently optional, processor 1615 is shown in dashed lines in Figure 16. Processors 1610, 1615 may each include one or more of the processing cores described herein and may be some version of processor 1500.

[0189] The memory 1640 may be, for example, dynamic random access memory (DRAM), phase change memory (PCM), or a combination thereof. In at least one embodiment, the controller hub 1620 communicates with the processors 1610, 1615 via a multi-drop bus such as a front side bus (FSB), a point-to-point interface such as a quick path interconnect (QPI), or similar connection 1695.

[0190] In one embodiment, coprocessor 1645 is a special-purpose processor such as, for example, a high-throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU, an embedded processor, or the like. In one embodiment, controller hub 1620 may include an integrated graphics accelerator.

[0191] There may be a variety of differences between the physical resources 1610, 1615 in terms of a range of metrics of merit, including architecture, microarchitecture, thermal, power consumption characteristics, and the like.

[0192] In one embodiment, processor 1610 executes instructions that control general-purpose data processing operations. The instructions may have coprocessor instructions embedded within them. Processor 1610 recognizes these coprocessor instructions as being of a type that should be executed by a connected coprocessor 1645. Accordingly, processor 1610 issues these coprocessor instructions (or control signals representing the coprocessor instructions) over a coprocessor bus or other interconnection to coprocessor 1645. Coprocessor 1645 accepts and executes the received coprocessor instructions.

[0193] Referring now to Figure 17, a block diagram of a more specific first exemplary system 1700 is shown, in accordance with one embodiment of the present invention. As shown in Figure 17, multiprocessor system 1700 is a point-to-point interconnect system including a first processor 1770 and a second processor 1780 coupled via a point-to-point interconnect 1750. Processors 1770 and 1780 may each be some version of processor 1500. In one embodiment of the present invention, processors 1770 and 1780 are processors 1610 and 1615, respectively, and coprocessor 1738 is coprocessor 1645. In another embodiment, processors 1770 and 1780 are processor 1610 and coprocessor 1645, respectively.

[0194] Processors 1770 and 1780 are shown including integrated memory controller (IMC) units 1772 and 1782, respectively. Processor 1770 also includes point-to-point (PP) interfaces 1776 and 1778 as part of its bus controller unit; similarly, second processor 1780 includes PP interfaces 1786 and 1788. Processors 1770, 1780 may use PP interface circuits 1778, 1788 to exchange information via point-to-point (PP) interface 1750. As shown in FIG. 17 , IMCs 1772 and 1782 couple these processors to respective memories, i.e., memories 1732 and 1734, which may be part of main memory connected locally to the respective processors.

[0195] Processors 1770, 1780 may each exchange information with chipset 1790 via respective PP interfaces 1752, 1754 using point-to-point interface circuits 1776, 1794, 1786, 1798. Chipset 1790 may optionally exchange information with coprocessor 1738 via high-performance interface 1739. In one embodiment, coprocessor 1738 is a special-purpose processor such as, for example, a high-throughput MIC processor, a network or communications processor, a compression engine, a graphics processor, a GPGPU, an embedded processor, or the like.

[0196] A shared cache (not shown) may be included external to either or both processors and connected to these processors via the PP interconnect so that when either processor is placed in a low power mode, local cache information of either or both processors can be stored in the shared cache.

[0197] Chipset 1790 may be coupled to a first bus 1716 via an interface 1796. In one embodiment, first bus 1716 may be a Peripheral Component Interconnect (PCI) bus, a PCI Express bus, or another third generation I / O interconnect bus, although the scope of the invention is not limited in this way.

[0198] As shown in FIG. 17 , various I / O devices 1714 may be coupled to a first bus 1716, along with a bus bridge 1718 coupling the first bus 1716 and a second bus 1720. In some embodiments, one or more additional processors 1715, such as a coprocessor, a high-throughput MIC processor, a GPGPU, an accelerator (e.g., a graphics accelerator or digital signal processing (DSP) unit), a field programmable gate array, or any other processor, are coupled to the first bus 1716. In some embodiments, the second bus 1720 may be a low pin count (LPC) bus. Various devices may be coupled to the second bus 1720, including, for example, a keyboard and / or mouse 1722, a communication device 1727, and a storage unit 1728, such as a disk drive or other mass storage device, which in some embodiments may contain instructions / code and data 1730. Additionally, audio I / O 1724 may be coupled to the second bus 1720. However, it should be noted that other architectures are possible. For example, instead of the point-to-point architecture of Figure 17, the system may implement a multi-drop bus or other similar architecture.

[0199] Referring now to FIG. 18, a block diagram of an SoC 1800 according to one embodiment of the present invention is shown. Similar elements to FIG. 15 are designated with similar reference numerals. Again, dashed boxes represent optional features on more advanced SoCs. In FIG. 18, an interconnect unit 1802 is coupled to an application processor 1810 including a set of one or more cores 1802A-1802N and a shared cache unit 1806, a system agent unit 1810, a bus controller unit 1816, an integrated memory controller unit 1814, a set of one or more coprocessors 1820, which may include integrated graphics logic, an image processor, an audio processor, and a video processor, a static random access memory (SRAM) unit 1830, a direct memory access (DMA) unit 1832, and a display unit 1840 for coupling to one or more external displays. In one embodiment, the coprocessor 1820 includes a special-purpose processor, such as, for example, a network or communication processor, a compression engine, a GPGPU, a high-throughput MIC processor, an embedded processor, or the like.

[0200] Embodiments of the mechanisms disclosed herein may be implemented in hardware, software, firmware, or a combination of these implementation techniques. Embodiments of the invention may be implemented as a computer program or program code running on a programmable system comprising at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0201] Program code, such as code 1730 shown in Figure 17, may be applied to input instructions to perform the functions described herein and generate output information. The output information may be applied to one or more output devices, in known fashion. For purposes of this application, a processing system includes any system having a processor, such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0202] The program code may be implemented in a high-level procedural or object-oriented programming language to communicate with a processing system. The program code may also be implemented in assembly or machine language, if desired. Indeed, the mechanisms described herein are not limited in scope to any particular programming language. In any case, the language may be a compiled or interpreted language.

[0203] One or more aspects of at least one embodiment may be implemented by descriptive instructions stored on a machine-readable medium that represent various logic within a processor, which, when read by a machine, causes the machine to create logic for performing the techniques described herein. These representations, known as "IP cores," may be stored on tangible, machine-readable media and supplied to various customers or manufacturing facilities for loading into manufacturing machines that actually create the logic or processor.

[0204] Such machine-readable storage media may include, but are not limited to, non-transitory tangible apparatus of articles manufactured or formed by a machine or device, including storage media such as hard disks, other disks of any type, including floppy disks, optical disks, compact disk read-only memory (CD-ROM), compact disk re-writable (CD-RW), and magneto-optical disks, read-only memory (ROM), random access memory (RAM) such as dynamic random access memory (DRAM), static random access memory (SRAM), semiconductor devices such as erasable programmable read-only memory (EPROM), flash memory, electrically erasable programmable read-only memory (EEPROM), phase change memory (PCM), magnetic or optical cards, or any other type of medium suitable for storing electronic instructions.

[0205] Accordingly, embodiments of the present invention also include non-transitory tangible machine-readable media, such as hardware description languages ​​(HDLs), that include instructions or include design data that define the structures, circuits, devices, processors, and / or system features described herein. Such embodiments may also be referred to as program products.

[0206] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various aspects of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, comprising one or more executable instructions for implementing particular logical functions. It should also be noted that, in alternative implementations, the functions noted in the blocks may occur out of the order shown in the figures. For example, depending on the functionality involved, two blocks shown in succession may in fact be executed substantially concurrently, or these blocks may sometimes be executed in the reverse order or in an alternate order. It should also be noted that each block of the block diagrams and / or flowchart diagrams, and combinations of blocks in the block diagrams and / or flowchart diagrams, may be implemented by a dedicated hardware-based system that performs particular functions or activities, or by a combination of dedicated hardware and computer instructions.

[0207] The foregoing disclosure outlines features of some embodiments so that those skilled in the art may better understand various aspects of the present disclosure. Those skilled in the art should readily recognize that this disclosure may be used as a basis for designing or modifying other processes and structures to carry out the same purposes and / or achieve the same advantages as the embodiments presented herein. Those skilled in the art should also recognize that such equivalent constructions do not depart from the spirit and scope of the present disclosure, and that those skilled in the art may make various changes, substitutions, and alterations to the description herein without departing from the spirit and scope of the present disclosure.

[0208] All or a portion of any hardware element disclosed herein may be readily provided in a system-on-chip (SoC), including a central processing unit (CPU) package. SoC refers to an integrated circuit (IC) that integrates components of a computer or other electronic system onto a single chip. An SoC may include digital, analog, mixed-signal, and radio frequency functions, all of which may be provided on a single chip substrate. Other embodiments may include multi-chip modules (MCMs), in which multiple chips are positioned within a single electronic package and configured to tightly interact with each other through this electronic package. In various other embodiments, the computing functionality disclosed herein may be implemented in one or more silicon cores in application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), and other semiconductor chips.

[0209] The terms "processor" or "microprocessor" as used herein should be understood to encompass not only conventional microprocessors (such as Intel®'s industry-leading x86 and x64 architectures), but also graphics processors, matrix processors, and any ASIC, FPGA, microcontroller, digital signal processor (DSP), programmable logic device, programmable logic array (PLA), microcode, instruction set, emulated, or virtual machine processor, or similar "Turing-complete" device, combination of devices, or logic element (hardware or software) that permits the execution of instructions.

[0210] It should also be noted that in certain embodiments, some components may be omitted or integrated. In a general sense, the illustrated arrangements should be understood as logical divisions, although the physical architecture may include various permutations, combinations, and / or hybridizations of these elements. It is essential to note that a myriad of possible design configurations may be used to achieve the operational objectives outlined herein. Thus, the associated infrastructure is subject to a myriad of alternative arrangements, design choices, device possibilities, hardware configurations, software implementations, and equipment options.

[0211] In a general sense, any suitably configured processor can execute instructions associated with data or microcode to perform the operations detailed herein. Any processor disclosed herein can also transform an element or item (e.g., data) from one state or thing to another. In another example, some of the activities outlined herein may be implemented by fixed logic or programmable logic (e.g., software and / or computer instructions executed by a processor), and the elements identified herein may be any type of programmable processor, programmable digital logic (e.g., field programmable gate array (FPGA), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM)), digital logic, software, code, electronic instructions, flash memory, optical disk, CD-ROM, DVD-ROM, magnetic or optical card, ASIC including other types of machine-readable media suitable for storing electronic instructions, or any suitable combination thereof.

[0212] In operation, a storage device may store information in any suitable type of tangible, non-transitory storage medium (e.g., random access memory (RAM), read-only memory (ROM), field programmable gate array (FPGA), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or microcode), software, hardware (e.g., processor instructions or microcode), or any other suitable component, device, element, or object, as appropriate and based on particular needs. Furthermore, information tracked, transmitted, received, or stored in a processor may also be provided in any database, register, table, cache, queue, control list, or memory structure, as appropriate and based on particular needs and implementation, all of which information may be referenced in any suitable time frame. Any memory or storage element disclosed herein should be construed as encompassed by the broad terms "memory" and "storage," as appropriate. A non-transitory storage medium herein is expressly intended to encompass any non-transitory dedicated or programmable hardware configured to provide the disclosed operations or to cause a processor to perform the disclosed operations. A non-transitory storage medium also expressly includes a processor having stored thereon hardware-coded instructions, and optionally microcode instructions or sequences encoded in hardware, firmware, or software.

[0213] Computer program logic implementing all or a portion of the functionality described herein may be embodied in various forms, including, but by no means limited to, hardware description languages, source code form, computer-executable form, machine instructions or microcode, programmable hardware, and various intermediate forms (e.g., forms generated by an HDL processor, assembler, compiler, linker, or locator). In one example, source code includes a series of computer program instructions implemented in various programming languages, such as object code, assembly language, or high-level languages ​​for use with various operating systems or operating environments, such as OpenCL, FORTRAN, C, C++, JAVA, or HTML, or implemented in hardware description languages, such as Spice, Verilog, and VHDL. The source code may define and use various data structures and communication messages. The source code may be in a computer-executable form (e.g., via an interpreter), or the source code may be converted (e.g., via a translator, assembler, or compiler) into a computer-executable form or into an intermediate form such as bytecode. Where appropriate, any of the above may be used to construct or describe suitable discrete or integrated circuits, whether sequential, combinatorial, state machine, or otherwise.

[0214] In one example, any number of the electrical circuits in the diagrams may be implemented on a board of the associated electronic device. The board may be a general circuit board that holds various components of the electronic device's internal electronic system and may also provide connectors for other peripheral devices. More specifically, the board may provide electrical connections that enable electrical communication with other components of the system. Any appropriate processor and memory may be appropriately coupled to the board based on particular configuration needs, processing requirements, and computing design. Other components, such as external storage devices, additional sensors, audio / video display controllers, and peripherals, may be attached to the board as plug-in cards via cables or may be integrated into the board itself. In another example, the electrical circuits in the diagrams may be implemented as stand-alone modules (e.g., devices with associated components and circuits configured to perform a particular application or function) or as plug-in modules in application-specific hardware of the electronic device.

[0215] It should be noted that in many of the examples provided herein, interactions may be described in terms of two, three, four, or more electrical components. However, this is done solely for purposes of clarity and illustration. It should be recognized that systems may be integrated or reconfigured in any suitable manner. In addition to similar alternative designs, any of the illustrated components, modules, and elements in the figures may be combined in a variety of possible configurations, all of which are within the broad scope of this specification. In some cases, it may be easier to describe one or more of the functions of a given flow set with reference to only a limited number of electrical elements. It should be recognized that the illustrated electrical circuits and their teachings are easily scalable to accommodate larger numbers of components and more complex / advanced arrangements and configurations. Thus, the provided examples are not intended to limit the scope or constrain the broad teachings of the electrical circuits, which are potentially applied to countless other architectures.

[0216] Many other changes, substitutions, variations, modifications and alterations may be ascertained by those skilled in the art, and it is intended that the present disclosure encompass all such changes, substitutions, variations, modifications and alterations as fall within the scope of the appended claims.

[0217] [Implementation example] The following examples relate to embodiments described throughout this disclosure.

[0218] One or more embodiments may include an apparatus comprising a logarithmic circuit comprising circuitry for identifying an input associated with a logarithmic operation via an input register, identifying a first range within which the input falls using a range selection circuit, obtaining a plurality of operands associated with a first equation, calculating a result of the first equation based on the plurality of operands using an adder / subtractor circuit, and returning an output associated with the logarithmic operation via an output register, wherein the logarithmic operation is to be performed by the logarithmic circuit using piecewise linear approximation, the first range being identified from a plurality of ranges associated with a plurality of piecewise linear approximation (PLA) equations of the logarithmic operation, and the first range corresponds to a first equation of a plurality of PLA equations, and the output is generated based at least in part on a result of the first equation.

[0219] In one example embodiment of the device, a logarithmic operation is associated with an artificial neural network operation.

[0220] In one example embodiment of the apparatus, the input comprises a floating-point number, the floating-point number comprising an exponent portion and a mantissa portion, and the output comprises a fixed-point number, the fixed-point number comprising an integer portion and a fractional portion.

[0221] In one example embodiment of the apparatus, the plurality of operands includes a mantissa operand and one or more fraction operands, each of the one or more fraction operands including a denominator that includes a power of two.

[0222] In one example embodiment of the apparatus, the logarithm circuit further comprises one or more shift circuits for generating one or more fractional operands.

[0223] In an example embodiment of the apparatus, the logarithm circuit further comprises a subtractor circuit for subtracting the bias from the exponent of the floating-point number to produce an unbiased exponent.

[0224] In an example embodiment of the apparatus, the circuitry for returning an output associated with the logarithmic operation via an output register further generates an integer portion of the fixed-point number based on the unbiased exponent, and generates a fractional portion of the fixed-point number based on a result of the first equation.

[0225] In one example embodiment of the apparatus, the logarithm circuit further comprises one or more multiplexers for selecting a plurality of operands associated with the first equation.

[0226] In one example embodiment of the apparatus, the adder / subtractor circuit performs one or more addition or subtraction operations on multiple operands.

[0227] In an example embodiment of the apparatus, the apparatus further includes an inverse logarithm circuit comprising circuitry for identifying a second input associated with an inverse logarithm operation, identifying a second range within which the second input falls, calculating a second result of a second equation based on a second plurality of operands associated with the second equation, and generating a second output associated with the inverse logarithm operation, wherein the inverse logarithm operation is to be performed by the inverse logarithm circuit using piecewise linear approximation, the second range being identified from a second plurality of ranges associated with a second plurality of piecewise linear approximation (PLA) equations of the inverse logarithm operation, and the second range corresponds to a second equation of the second plurality of PLA equations, and the second output is generated based at least in part on a second result of the second equation.

[0228] In an example embodiment of the apparatus, the apparatus further comprises an activation function circuit, the activation function circuit comprising a logarithm circuit and an inverse logarithm circuit, the activation function circuit receiving instructions to perform an activation function selected from a plurality of available activation functions, and further comprising circuitry for performing one or more multiplication or division operations using one or more logarithm operations and one or more inverse logarithm operations, and generating an activation output associated with the activation function, the activation function comprising one or more multiplication or division operations, the one or more logarithm operations being performed using the logarithm circuit, and the one or more inverse logarithm operations being performed using the inverse logarithm circuit, and the activation output being generated based at least in part on one or more results of the one or more multiplication or division operations.

[0229] In an example embodiment of the apparatus, the activation function further includes one or more exponential operations, and the activation function circuit further comprises an exponential circuit for performing the one or more exponential operations using piecewise linear approximation.

[0230] One or more embodiments may include a system comprising: a memory for storing information associated with an application; a processor for executing one or more instructions associated with the application; and an activation function circuit for executing a plurality of activation functions, the activation function circuit comprising circuitry for receiving instructions to execute an activation function associated with the application, performing one or more multiplication or division operations using one or more logarithmic operations and one or more inverse logarithmic operations, and generating an output associated with the activation function, the activation function being selected from a plurality of activation functions and comprising one or more multiplication or division operations, the one or more logarithmic operations being performed using a piecewise linear approximation by a logarithm circuit, and the one or more inverse logarithm operations being performed using a piecewise linear approximation by an inverse logarithm circuit, and the output being generated based at least in part on one or more results of the one or more multiplication or division operations.

[0231] In one example embodiment of the system, the application includes an artificial neural network, and the activation function is associated with the operation of the artificial neural network.

[0232] In an example embodiment of the system, the circuit for performing one or more multiplication or division operations using one or more logarithmic operations and one or more inverse logarithmic operations further performs one or more base 2 logarithmic operations on one or more operands associated with the one or more multiplication or division operations, performs one or more addition or subtraction operations on one or more results of the one or more base 2 logarithmic operations, and performs one or more base 2 inverse logarithmic operations on one or more results of the one or more addition or subtraction operations, wherein the one or more base 2 logarithmic operations are performed using piecewise linear approximation, and wherein the one or more base 2 inverse logarithmic operations are performed using piecewise linear approximation.

[0233] In an example embodiment of the system, the activation function further includes one or more exponential operations, and the activation function circuitry further comprises circuitry for performing the one or more exponential operations using piecewise linear approximation.

[0234] In one example embodiment of the system, the one or more exponentiation operations each include a base 2, and the circuitry for performing the one or more exponentiation operations using a piecewise linear approximation further performs the one or more exponentiation operations using one or more base 2 inverse logarithm operations, and the one or more base 2 inverse logarithm operations are performed using a piecewise linear approximation.

[0235] In one example embodiment of the system, the activation functions include a sigmoid function, a hyperbolic tangent function, a swish function, and a normalized linear unit function.

[0236] In an example embodiment of the system, at least one of the sigmoid function, hyperbolic tangent function, or swish function is defined using one or more exponential operations involving exclusively base 2, and the activation function circuitry further includes circuitry for performing the one or more exponential operations using one or more base 2 inverse logarithm operations, where the one or more base 2 inverse logarithm operations are performed using piecewise linear approximations.

[0237] One or more embodiments may include at least one machine-accessible storage medium storing instructions that, when executed on a machine, cause the machine to receive, with an activation function circuit, instructions to perform an activation function selected from a plurality of available activation functions, perform one or more multiplication or division operations using one or more logarithmic operations and one or more inverse logarithmic operations, and generate an output associated with the activation function, wherein the activation function includes one or more multiplication or division operations, wherein the one or more logarithmic operations and the one or more inverse logarithmic operations are performed using piecewise linear approximation, and wherein the output is generated based, at least in part, on one or more results of the one or more multiplication or division operations.

[0238] In an example embodiment of the storage medium, the instructions for causing a machine to perform one or more multiplication or division operations using one or more logarithmic operations and one or more inverse logarithmic operations further cause the machine to perform one or more base 2 logarithmic operations on one or more operands associated with the one or more multiplication or division operations, perform one or more addition or subtraction operations on one or more results of the one or more base 2 logarithmic operations, and perform one or more base 2 inverse logarithmic operations on one or more results of the one or more addition or subtraction operations, wherein the one or more base 2 logarithmic operations are performed using piecewise linear approximation, and the one or more base 2 inverse logarithmic operations are performed using piecewise linear approximation.

[0239] In an example embodiment of the storage medium, the activation function further includes one or more exponential operations, and the instructions further cause the machine to perform the one or more exponential operations using piecewise linear approximation.

[0240] In one example embodiment of the storage medium, at least one activation function of the plurality of available activation functions is defined using one or more exponentiation operations involving exclusively base 2, and the instructions further cause the machine to perform the one or more exponentiation operations using one or more base 2 inverse logarithm operations, wherein the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation.

[0241] One or more embodiments may include a method comprising receiving, by an activation function circuit, instructions to execute an activation function selected from a plurality of available activation functions, the activation function including one or more multiplication or division operations; performing the one or more multiplication or division operations using one or more logarithmic operations and one or more antilogarithmic operations, wherein the one or more logarithmic operations and the one or more antilogarithmic operations are performed using piecewise linear approximation; and generating an output associated with the activation function, the output being generated based at least in part on one or more results of the one or more multiplication or division operations.

[0242] In an example embodiment of the method, the method further includes performing one or more base 2 logarithm operations on one or more operands associated with the one or more multiplication or division operations, wherein the one or more base 2 logarithm operations are performed using piecewise linear approximation; performing one or more addition or subtraction operations on one or more results of the one or more base 2 logarithm operations; and performing one or more base 2 inverse logarithm operations on one or more results of the one or more addition or subtraction operations, wherein the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation. [Other possible claims] (Item 1) 1. An apparatus comprising a logarithmic circuit, the logarithmic circuit comprising: Identifying, via an input register, an input associated with the logarithmic operation; identifying a first range within which the input falls using a range selection circuit; calculating a result of a first equation based on a plurality of operands using an adder / subtractor circuit; and circuitry for returning an output associated with said logarithmic operation via an output register; the logarithmic operation is to be performed by the logarithmic circuit using piecewise linear approximation; the first range is identified from a plurality of ranges associated with a plurality of piecewise linear approximation (PLA) equations of the logarithmic operation, and the first range corresponds to a first equation of the plurality of PLA equations; The output is generated based at least in part on the result of the first equation. (Item 2) Item 10. The apparatus of item 1, wherein the logarithmic operation is associated with an artificial neural network operation. (Item 3) the input comprises a floating-point number, the floating-point number comprising an exponent and a mantissa; and Item 10. The apparatus of item 1, wherein the output comprises a fixed-point number, the fixed-point number comprising an integer portion and a fractional portion. (Item 4) 4. The apparatus of claim 3, wherein the plurality of operands include the mantissa operand and one or more fraction operands, each of the one or more fraction operands including a denominator that includes a power of two. (Item 5) Item 5. The apparatus of item 4, wherein the logarithm circuit further comprises one or more shift circuits for generating the one or more fractional operands. (Item 6) Item 4. The apparatus of item 3, wherein the logarithm circuit further comprises a subtractor circuit for subtracting a bias from the exponent portion of the floating-point number to produce an unbiased exponent. (Item 7) The circuit for returning the output associated with the logarithmic operation via the output register further comprises: generating an integer part of the fixed-point number based on the unbiased exponent; and Item 7. The apparatus of item 6, wherein the fractional part of the fixed-point number is generated based on the result of the first equation. (Item 8) Item 10. The apparatus of item 1, wherein the logarithm circuit further comprises one or more multiplexers for selecting the plurality of operands associated with the first equation. (Item 9) Item 1. The apparatus of item 1, wherein the adder / subtractor circuit performs one or more addition or subtraction operations on the plurality of operands. (Item 10) The antilogarithm circuit further comprises: Identifying a second input associated with the antilogarithm operation; identifying a second range within which the second input falls; calculating a second result of a second equation based on a second plurality of operands associated with the second equation; and a circuit for generating a second output associated with the antilogarithm operation; the antilogarithm operation is to be performed by the antilogarithm circuit using piecewise linear approximation; the second range is identified from a second plurality of ranges associated with a second plurality of piecewise linear approximation (PLA) equations of the antilogarithm operation, and the second range corresponds to a second equation of the second plurality of PLA equations; Item 10. The apparatus of item 1, wherein the second output is generated based at least in part on the second result of the second equation. (Item 11) The method further includes an activation function circuit, the activation function circuit including the logarithm circuit and the antilogarithm circuit, and the activation function circuit including: receiving instructions to execute an activation function selected from a plurality of available activation functions; performing one or more multiplication or division operations with one or more logarithmic operations and one or more antilogarithmic operations; and further comprising a circuit for generating an activation output associated with the activation function; the activation function includes one or more of the multiplication or division operations; the one or more logarithmic operations are performed using the logarithm circuit, and the one or more antilogarithm operations are performed using the antilogarithm circuit; Item 11. The apparatus of item 10, wherein the activation output is generated based at least in part on one or more results of the one or more multiplication or division operations. (Item 12) The activation function further includes one or more exponential operations; and Item 12. The apparatus of item 11, wherein the activation function circuit further comprises an exponential circuit for performing the one or more exponential operations using piecewise linear approximation. (Item 13) 1. A system comprising: a memory for storing information associated with the application; a processor for executing one or more instructions associated with said application; an activation function circuit for implementing a plurality of activation functions, the activation function circuit comprising: receiving instructions to execute an activation function associated with the application; performing one or more multiplication or division operations with one or more logarithmic operations and one or more antilogarithmic operations; and a circuit for generating an output associated with the activation function; the activation function is selected from the plurality of activation functions, and the activation function includes the one or more multiplication or division operations; the one or more logarithmic operations are performed by a logarithmic circuit using piecewise linear approximation, and the one or more antilogarithmic operations are performed by an antilogarithmic circuit using piecewise linear approximation; The system, wherein the output is generated based at least in part on one or more results of the one or more multiplication or division operations. (Item 14) Item 14. The system of item 13, wherein the application includes an artificial neural network, and the activation function is associated with the operation of the artificial neural network. (Item 15) The circuit for performing the one or more multiplication or division operations using the one or more logarithmic operations and the one or more antilogarithmic operations further comprises: performing one or more base 2 logarithm operations on one or more operands associated with said one or more multiplication or division operations; performing one or more addition or subtraction operations on one or more results of said one or more base 2 logarithm operations; and performing one or more base 2 antilogarithm operations on one or more results of said one or more addition or subtraction operations; wherein the one or more base 2 logarithm operations are performed using piecewise linear approximation; Item 14. The system of item 13, wherein the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation. (Item 16) The activation function further includes one or more exponential operations; and Item 14. The system of item 13, wherein the activation function circuitry further comprises circuitry for performing the one or more exponential operations using piecewise linear approximation. (Item 17) wherein the one or more exponentiation operations each include base 2, and Item 17. The system of item 16, wherein the circuit for performing the one or more exponential operations using piecewise linear approximation further performs the one or more exponential operations using one or more base 2 inverse logarithm operations, and the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation. (Item 18) The above multiple activation functions include: The sigmoid function, The hyperbolic tangent function, The swish function and Item 14. The system of item 13, comprising: a normalized linear unit function. (Item 19) At least one of the sigmoid function, the hyperbolic tangent function, or the swish function is defined using one or more exponential operations involving exclusively base 2; and Item 19. The system of item 18, wherein the activation function circuit further comprises circuitry for performing the one or more exponential operations using one or more base 2 inverse logarithm operations, wherein the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation. (Item 20) At least one machine-accessible storage medium storing instructions that, when executed on a machine, cause the machine to: receiving, by an activation function circuit, instructions to perform an activation function selected from a plurality of available activation functions; performing one or more multiplication or division operations using one or more logarithmic operations and one or more antilogarithmic operations; and generating an output associated with said activation function; the activation function includes one or more of the multiplication or division operations; the one or more logarithmic operations and the one or more antilogarithmic operations are performed using piecewise linear approximations; and At least one machine-accessible storage medium, wherein said output is generated based, at least in part, on one or more results of said one or more multiplication or division operations. (Item 21) The instructions for causing the machine to perform the one or more multiplication or division operations using the one or more logarithmic operations and the one or more antilogarithmic operations may further cause the machine to: performing one or more base 2 logarithm operations on one or more operands associated with said one or more multiplication or division operations; performing one or more addition or subtraction operations on one or more results of said one or more base 2 logarithm operations; and performing one or more base 2 antilogarithm operations on one or more results of said one or more addition or subtraction operations; wherein the one or more base 2 logarithm operations are performed using piecewise linear approximation; Item 21. The storage medium of item 20, wherein the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation. (Item 22) The activation function further includes one or more exponential operations; and The storage medium of claim 20, wherein the instructions further cause the machine to perform the one or more exponential operations using piecewise linear approximation. (Item 23) At least one activation function among the plurality of available activation functions is defined using one or more exponential operations that exclusively include base 2, and Item 21. The storage medium of item 20, wherein the instructions further cause the machine to perform the one or more exponential operations using one or more base 2 inverse logarithm operations, wherein the one or more base 2 inverse logarithm operations are performed using piecewise linear approximation.

Claims

1. a first circuit configured to process a floating point arithmetic input to calculate the base 2 logarithm of said input; a second circuit configured to calculate an intermediate result using the base 2 logarithm of the input together with an input having a different floating-point format than the input; a third circuit configured to apply a base 2 power function to the intermediate result to generate an output of the floating-point operation; Equipped with the floating-point operation is an operation within a machine learning model, The apparatus, wherein the operation in the machine learning model is an activation function.

2. 2. The apparatus of claim 1, wherein the input has a floating-point format, and the first circuit is configured to calculate the base 2 logarithm of the input by performing a calculation on a mantissa of the input.

3. The apparatus of claim 2 , wherein performing the calculation on the mantissa of the input comprises applying piecewise approximation to the mantissa of the input.

4. The apparatus of claim 3 , wherein applying the piecewise approximation comprises using one or more coefficients stored in a piecewise approximation table.

5. The apparatus of claim 4 , wherein applying the piecewise approximation further comprises obtaining the one or more coefficients from the piecewise approximation table based on a range that includes the mantissa portion of the input.

6. The apparatus of claim 2 , wherein the first circuit is further configured to subtract a bias from the exponent portion of the input to calculate an unbiased exponent.

7. 1. A method for executing a machine learning model, the method comprising: calculating, by a first circuit, a base 2 logarithm of a floating-point arithmetic input in the machine learning model; calculating, by a second circuit, an intermediate result using the base 2 logarithm of the input together with an input having a floating-point format different from the input; and applying, by a third circuit, a base-2 power function to the intermediate result to generate an output of the floating-point operation in the machine learning model; A method comprising:

8. 8. The method of claim 7, wherein the input has a floating-point format, and wherein calculating the base 2 logarithm of the input comprises performing a calculation on a mantissa of the input.

9. The method of claim 8 , wherein performing the calculation on the mantissa of the input comprises applying piecewise approximation to the mantissa of the input.

10. Applying the piecewise approximation using one or more coefficients stored in a piecewise approximation table; and obtaining the one or more coefficients from the piecewise approximation table based on a range that includes the mantissa portion of the input; 10. The method of claim 9, comprising:

11. 9. The method of claim 8, wherein calculating the base 2 logarithm of the input further comprises subtracting a bias from the exponent portion of the input to calculate an unbiased exponent.

12. One or more non-transitory computer-readable media storing executable instructions for performing operations for executing a machine learning model, the operations comprising: calculating, by a first circuit, a base 2 logarithm of a floating-point arithmetic input in the machine learning model; calculating, by a second circuit, an intermediate result using the base 2 logarithm of the input together with an input having a floating-point format different from the input; and applying, by a third circuit, a base-2 power function to the intermediate result to generate an output of the floating-point operation in the machine learning model; 1. One or more non-transitory computer-readable media comprising:

13. 13. The one or more non-transitory computer-readable media of claim 12, wherein the input has a floating-point format, and wherein calculating the base-2 logarithm of the input comprises performing a calculation on a mantissa of the input.

14. 14. The one or more non-transitory computer-readable media of claim 13, wherein performing the calculation on the mantissa of the input comprises applying piecewise approximation to the mantissa of the input.

Citation Information

Patent Citations

  • Methods for non-linearly quantizing and dequantizing an information signal

    EP1176743A2

  • Apparatus for converting floating-point binary numbers to logarithms in binary form and vice versa

    JP1996504046A

  • Suppression of Interaction between Combined Particles

    JP2018502366A

  • Decimal elementary functions computation

    US20130117341A1

  • Data processing apparatus and method for performing data processing operation with a conditional processing step

    US20150261542A1