Energy consumption calculation method and related equipment for deep spiking neural network training architecture
Through the energy consumption calculation method of the deep pulse neural network training architecture, the problem of low energy efficiency of deep SNN training is solved. By accurately calculating the energy consumption of tasks and reducing repetitive operations, efficient deep SNN training is achieved.
Patent Information
- Application Number
- CN202411827416.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-12-11
AI Technical Summary
Existing deep spiking neural network training hardware suffers from low energy efficiency in global optimization methods, especially in deep SNN training tasks based on error backpropagation, resulting in higher memory consumption and training time due to reliance on GPUs.
A method for calculating the energy consumption of a deep spiking neural network training architecture is proposed. By obtaining the number of operations and memory reuse factors in the training task, the task energy consumption is accurately calculated, including the number of logical discrimination, floating-point addition, and floating-point multiplication operations. The read and write characteristics of the memory are used to reduce repeated operations, and the task energy consumption is calculated in combination with the unit energy consumption.
It achieves accurate calculation of energy consumption for deep pulse neural network training tasks, reduces task energy consumption, and supports efficient deep SNN training.
Smart Images

Figure CN119940458B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to an energy consumption calculation method and related equipment for a deep pulse neural network training architecture. Background Art
[0002] Against the backdrop of growing demand for intelligent computing, traditional intelligent computing architectures (GPUs, TPUs) are increasingly struggling to meet energy efficiency challenges. Neuromorphic computing, a paradigm designed to mimic the structure and function of the human brain, offers an important path to realizing new, energy-efficient intelligent computing systems. As the foundation of neuromorphic computing, spiking neural networks (SNNs) have attracted significant attention due to their unique potential for high energy efficiency and simulation of biological neural processes. As the classification accuracy of deep SNN models approaches that of traditional deep neural networks (DNNs), SNNs have demonstrated their enormous potential for achieving efficient intelligent computing.
[0003] However, the development of hardware supporting efficient SNN training is currently lagging significantly. Existing near-memory computing chips, such as TrueNorth, Loihi, and Tianjic, are primarily designed for feedforward computation and local learning methods, such as synaptic timing-dependent plasticity. However, they are insufficient for deep SNN training, which relies on global optimization methods based on error backpropagation (BP). This has led to the current reliance of GPUs on SNN training. Due to the lack of targeted optimization for key SNN features such as multi-step computation and spiking convolution, GPUs consume more memory and take longer to train than DNN training on GPUs, resulting in lower training and inference energy efficiency. Therefore, the research and development of energy-efficient hardware architectures tailored to the data representation and computational characteristics of deep SNN global optimization training tasks has become a hot topic in the field of energy-efficient intelligent computing. Systematic energy consumption assessment methods serve as the foundation for rapid iteration of intelligent computing architecture development towards high energy efficiency. A number of mature methods and software tools, such as TimesLoop and ZigZag, have been developed for DNN inference accelerators. However, training energy consumption methods suitable for deep spiking neural network training are currently lacking. Summary of the Invention
[0004] The embodiments of the present application provide an energy consumption calculation method and related equipment for a deep pulse neural network training architecture, which can accurately obtain the energy consumption of the deep pulse neural network model during the training process.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application proposes a method for calculating energy consumption of a deep spiking neural network training architecture, the method comprising:
[0006] Obtain the number of logical discrimination, floating-point addition, and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep spiking neural network training task, where the number of operations includes the number of logical discrimination operations corresponding to the logical discrimination, the number of accumulation operations corresponding to the floating-point addition, and the number of accumulation operations corresponding to the floating-point multiplication;
[0007] Obtaining reuse factors of a plurality of variables for read and write operations in a memory of the deep spiking neural network training architecture, respectively, wherein the memory includes DRAM, SRAM, and registers;
[0008] Calculating task read and write energy consumption based on the number of logical judgments, the reuse factor, and the unit read and write energy consumption of the memory;
[0009] Calculating the task computing energy consumption based on the number of accumulation operations, the number of multiplication operations, the number of logical determinations, and the corresponding unit computing energy consumption;
[0010] The task energy consumption of the deep pulse neural network training task is obtained by accumulating the task reading and writing energy consumption and the task computing energy consumption.
[0011] In some embodiments, the calculating the task read / write energy consumption based on the number of logical determinations, the reuse factor, and the unit read / write energy consumption of the memory includes:
[0012] Obtaining, from the logical discrimination quantity, a forward pass discrimination quantity corresponding to the forward pass and a weight gradient discrimination quantity corresponding to the weight gradient update;
[0013] Obtaining from the reuse factors a forward pass reuse factor corresponding to the forward pass, a back propagation reuse factor corresponding to error back propagation, and a weight gradient reuse factor corresponding to the weight gradient update;
[0014] Calculating forward transfer read and write energy consumption based on the forward transfer judgment quantity, the forward transfer reuse factor, and the unit read and write energy consumption;
[0015] Calculating the back propagation read and write energy consumption based on the number of back propagation cumulative multiplication operations, the back propagation reuse factor, and the unit read and write energy consumption, wherein the number of back propagation cumulative multiplication operations corresponds to error back propagation;
[0016] Based on the weight gradient judgment quantity, the weight gradient reuse factor and the unit read and write energy consumption, the weight gradient read and write energy consumption is calculated, and the forward pass read and write energy consumption, the back propagation read and write energy consumption and the weight gradient read and write energy consumption are accumulated to obtain the task read and write energy consumption.
[0017] In some embodiments, the deep spiking neural network training task includes multiple layers of neurons, and the forward pass read and write energy consumption is calculated based on the forward pass discriminant number, the forward pass reuse factor, and the unit read and write energy consumption, including:
[0018] For each of the variables, obtaining the variable read / write energy consumption based on the ratio of the corresponding unit read / write energy consumption to the forward transfer reuse factor, and accumulating all the variable read / write energy consumptions to obtain the forward variable read / write energy consumption;
[0019] Accumulating the forward propagation discrimination quantities of all the neurons to obtain the model forward discrimination quantity;
[0020] The forward transfer read-write energy consumption is obtained by multiplying the model forward discrimination quantity and the forward variable read-write energy consumption.
[0021] In some embodiments, the unit computing energy consumption includes determination unit computing energy consumption, accumulation unit computing energy consumption, and multiplication unit computing energy consumption. The task computing energy consumption is calculated based on the number of accumulation operations, the number of multiplication operations, the number of logical determinations, and the corresponding unit computing energy consumption, including:
[0022] Obtaining, from the number of accumulation operations, the number of forward transfer accumulation operations corresponding to the forward transfer, the number of back propagation accumulation operations corresponding to the error back propagation, and the number of weight gradient accumulation operations corresponding to the weight gradient update, and obtaining, from the number of multiplication operations, the number of back propagation accumulation operations corresponding to the error back propagation;
[0023] Accumulating all the forward transfer determination numbers and multiplying the result by the determination unit calculation energy consumption, and adding the result to the product of the forward transfer accumulation operation number and the accumulation unit calculation energy consumption to obtain the forward transfer calculation energy consumption;
[0024] Accumulating all the back-propagation accumulation operation numbers and multiplying the result by the accumulation unit calculation energy consumption, and then adding the product of the back-propagation accumulation multiplication operation number and the multiplication unit calculation energy consumption to obtain the back-propagation calculation energy consumption;
[0025] Accumulating all the weight gradient discrimination quantities and multiplying the result by the discrimination unit calculation energy consumption, and then adding the product of the weight gradient accumulation operation quantity and the accumulation unit calculation energy consumption to obtain the weight gradient calculation energy consumption;
[0026] The forward pass computing energy consumption, the back propagation computing energy consumption, and the weight gradient computing energy consumption are accumulated to obtain the task computing energy consumption.
[0027] In some embodiments, respectively obtaining reuse factors of the plurality of variables for read and write operations in a memory of the deep spiking neural network training architecture includes:
[0028] Taking each of the variables as the target variable one by one;
[0029] The reuse factor corresponding to the target variable is generated based on the read and write operations of the target variable in the first data transmission process or the second data transmission process, where the first data transmission process is a process of transmitting data between the register and the SRAM, and the second data transmission process is a process of transmitting data between the SRAM and the DRAM.
[0030] In some embodiments, the number of logical judgments includes the number of forward pass judgments and the number of weight gradient judgments, the number of logical judgments includes the number of forward pass judgments and the number of weight gradient judgments, the number of accumulation operations includes the number of forward pass accumulation operations, the number of back propagation accumulation operations, and the number of weight gradient accumulation operations, and the obtaining of the number of logical judgments corresponding to the logical judgment operations and the number of accumulation operations corresponding to the accumulation operations for multiple variables in the deep spiking neural network training task includes:
[0031] Generating the forward pass discrimination quantity and the forward pass accumulation operation quantity according to the convolution operation in the forward pass update function in the deep spiking neural network training task;
[0032] Generate the number of backpropagation accumulation operations and the number of backpropagation accumulation operations according to the convolution operation and the multiplication operation in the backpropagation update function in the deep spiking neural network training task;
[0033] The weight gradient discrimination quantity and the weight gradient accumulation operation quantity are generated according to the convolution operation in the weight gradient update function in the deep pulse neural network training task.
[0034] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a deep spiking neural network training architecture, wherein the system includes a forward transmission component, a back-propagation component, a unified buffer area, and a computing processor;
[0035] The forward transfer component includes a forward transfer engine and a first direct memory access module connected to each other, and the first direct memory access module is connected to the unified cache area;
[0036] The back propagation component includes a back propagation engine, a weight gradient engine, and a second direct memory access module, wherein the back propagation engine and the weight gradient engine are both connected to the second direct memory access module, and the second direct memory access module is connected to the unified cache area;
[0037] The computing processor is used to execute the energy consumption calculation method of the deep pulse neural network training architecture as described in the first aspect.
[0038] In some embodiments, the forward pass component is used to perform forward pass processing in a deep spiking neural network training task;
[0039] The back propagation component is used to perform error back propagation processing and weight gradient update processing in deep pulse neural network training tasks.
[0040] To achieve the above objectives, a third aspect of the embodiments of the present application provides an energy consumption calculation device for a deep pulse neural network training architecture, the device comprising:
[0041] A calculation quantity acquisition module is used to obtain the number of logical discrimination, floating-point addition, and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep pulse neural network training task. The operation quantity includes the number of logical discrimination operations corresponding to the logical discrimination, the number of accumulation operations corresponding to the floating-point addition, and the number of accumulation operations corresponding to the floating-point multiplication;
[0042] A reuse factor acquisition module, configured to respectively acquire reuse factors of a plurality of the variables for read and write operations in a memory of the deep spiking neural network training architecture, the memory comprising DRAM, SRAM, and registers;
[0043] a read / write energy consumption calculation module, configured to calculate the task read / write energy consumption based on the number of logical determinations, the reuse factor, and the unit read / write energy consumption of the memory;
[0044] A calculation energy consumption calculation module, configured to calculate the task calculation energy consumption based on the number of accumulation operations, the number of multiplication operations, the number of logic judgments and the corresponding unit calculation energy consumption;
[0045] The task energy consumption calculation module is used to accumulate the task reading and writing energy consumption and the task computing energy consumption to obtain the task energy consumption of the deep pulse neural network training task.
[0046] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the energy consumption calculation method of the deep pulse neural network training architecture as described in the first aspect.
[0047] To achieve the above-mentioned purpose, the fifth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, it implements the energy consumption calculation method of the deep pulse neural network training architecture described in the first aspect above.
[0048] The energy consumption calculation method and related equipment of the deep pulse neural network training architecture proposed in the embodiment of the present application include: first, obtaining the number of logical discrimination, floating-point addition and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution and weight gradient of the deep pulse neural network training task, and the operation number includes the number of logical discrimination corresponding to the logical discrimination, the number of accumulation operations corresponding to the floating-point addition and the number of accumulation operations corresponding to the floating-point multiplication; secondly, respectively obtaining the reuse factors of the read and write operations of multiple variables in the memory of the deep pulse neural network training architecture, and the memory includes DRAM, SRAM and registers; next, based on the number of logical discrimination, the reuse factor and the unit read and write energy consumption of the memory, the task read and write energy consumption is calculated; then, based on the number of accumulation operations, the number of accumulation operations, the number of logical discrimination and the corresponding unit calculation energy consumption, the task calculation energy consumption is calculated; finally, the task read and write energy consumption and the task calculation energy consumption are accumulated to obtain the task energy consumption of the deep pulse neural network training task. The embodiments of the present application focus on the number of logical discrimination operations corresponding to the logical discrimination operations on multiple variables in the deep pulse neural network training task and the number of accumulation operations corresponding to the accumulation operations. The reuse factor generated by the read and write characteristics of the memory of the deep pulse neural network training architecture is used to reduce the number of read and write operations on the same data. The unit read and write energy consumption and the unit computing energy consumption are further combined to reduce the task energy consumption corresponding to the deep pulse neural network training task while accurately calculating the task energy consumption corresponding to the neural network computing task.
[0049] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be achieved and obtained through the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a structural diagram of a deep pulse neural network training architecture provided in one embodiment of the present application.
[0051] Figure 2 This is a flowchart of a method for calculating energy consumption of a deep pulse neural network training architecture provided by another embodiment of the present application.
[0052] Figure 3 yes Figure 2 Flowchart of step 201 in FIG.
[0053] Figure 4 This is a schematic diagram of changes in convolution calculation during a forward transfer process provided by another embodiment of the present application.
[0054] Figure 5 This is a schematic diagram of changes in convolution calculation during a back-propagation process provided by another embodiment of the present application.
[0055] Figure 6 This is a schematic diagram of changes in convolution kernel gradient convolution calculation provided by another embodiment of the present application.
[0056] Figure 7 This is a schematic diagram of the read and write actions of a memory provided in another embodiment of the present application.
[0057] Figure 8 yes Figure 2 Flowchart of step 202 in FIG.
[0058] Figure 9 This is a schematic diagram of the reuse factors of various variables at various levels of storage provided by another embodiment of the present application.
[0059] Figure 10 This is a schematic diagram of the unit read and write energy consumption of each level of storage provided by another embodiment of the present application.
[0060] Figure 11 This is a schematic diagram of the unit read and write energy consumption of various variables at various levels of storage provided by another embodiment of the present application.
[0061] Figure 12 This is a schematic diagram of power consumption of an operator provided in another embodiment of the present application.
[0062] Figure 13 yes Figure 2 Flowchart of step 203 in FIG.
[0063] Figure 14 yes Figure 13 Flowchart of step 1303 in FIG.
[0064] Figure 15 yes Figure 2 Flowchart of step 204 in FIG.
[0065] Figure 16 This is a structural diagram of an energy consumption calculation device for a deep pulse neural network training architecture provided in another embodiment of the present application.
[0066] Figure 17 This is a schematic diagram of the hardware structure of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0068] It should be noted that although the functional modules are divided in the device schematic and the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the order in the flowchart.
[0069] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0070] Against the backdrop of growing demand for intelligent computing, traditional intelligent computing architectures (GPUs, TPUs) are increasingly struggling to meet energy efficiency challenges. Neuromorphic computing, a paradigm designed to mimic the structure and function of the human brain, offers an important path to realizing new, energy-efficient intelligent computing systems. As the foundation of neuromorphic computing, spiking neural networks (SNNs) have attracted significant attention due to their unique potential for high energy efficiency and simulation of biological neural processes. As the classification accuracy of deep SNN models approaches that of traditional deep neural networks (DNNs), SNNs have demonstrated their enormous potential for achieving efficient intelligent computing.
[0071] However, the development of hardware supporting efficient SNN training is currently lagging significantly. Existing near-memory computing chips, such as TrueNorth, Loihi, and Tianjic, are primarily designed for feedforward computation and local learning methods, such as synaptic timing-dependent plasticity. However, they are insufficient for deep SNN training, which relies on global optimization methods based on error backpropagation (BP). This has led to the current reliance of GPUs on SNN training. Due to the lack of targeted optimization for key SNN features such as multi-step computation and spiking convolution, GPUs consume more memory and take longer to train than DNN training on GPUs, resulting in lower training and inference energy efficiency. Therefore, the research and development of energy-efficient hardware architectures tailored to the data representation and computational characteristics of deep SNN global optimization training tasks has become a hot topic in the field of energy-efficient intelligent computing. Systematic energy consumption assessment methods serve as the foundation for rapid iteration of intelligent computing architecture development towards high energy efficiency. A number of mature methods and software tools, such as TimesLoop and ZigZag, have been developed for DNN inference accelerators. However, training energy consumption methods suitable for deep spiking neural network training are currently lacking.
[0072] In order to accurately obtain the energy consumption of the pulse neural network model during the training process, the embodiment of the present application focuses on the number of logical discrimination operations corresponding to multiple variables in the deep pulse neural network training task and the number of accumulation operations corresponding to the accumulation operation, and uses the reuse factor generated by the read and write characteristics of the memory of the pulse neural network model to reduce the number of read and write operations of the same data, and further combines the unit read and write energy consumption and the unit computing energy consumption. It can reduce the task energy consumption corresponding to the deep pulse neural network training task while accurately calculating the task energy consumption corresponding to the neural network computing task.
[0073] The following will further describe the energy consumption calculation method and related equipment of the deep pulse neural network training architecture provided by the embodiment of the present application. First, the deep pulse neural network training architecture provided by the embodiment of the present application is described. Figure 1 , is a structural diagram of a deep pulse neural network training architecture provided by an embodiment of the present application. Figure 1As shown in , the deep pulse neural network training architecture is equipped with a forward pass component, a back propagation component, a unified cache area and a computing processor. Among them, the forward pass component is also the forward pass sub-core (FP Sub-Core), which is mainly responsible for processing the forward pass (Feedforward Propagation, FP) process of the pulse neural network. In this process, the input data is passed through the network layer, and the neurons in each layer calculate the output based on the input and weights until the network's prediction result is finally generated. The back propagation component is also the back propagation sub-core (BP Sub-Core), which is mainly responsible for processing the back propagation (BP) process of the pulse neural network. During the training process, back propagation is used to calculate the gradient of the loss function with respect to the network parameters (such as weights), and these gradients are then used to update the network parameters to reduce the prediction error. The unified cache area is a dynamic random access memory (DRAM), which is used to store all parameter data of the pulse neural network during the training process.
[0074] like Figure 1 As shown in FIG, the forward transfer component includes a forward transfer engine (FP Engine) and a first direct memory access module (ie, Figure 1 The DMA module in the forward pass component is shown in Figure 1). A variable s is designed specifically for spiking neural networks in the forward pass engine. l-1 、w l-1 , ConvFP l The static random access memory (SRAM) has a capacity and bit width of 32KB / 1bit, 576KB / 16bit, and 128KB / 16bit, respectively. A 16×16 FP array with multiplexer-add units suitable for pulse convolution is also designed. Each multiplexer-add unit consists of a 1-bit logic discriminator, an FP16 accumulator, a 1-bit register (storing one pulse data), and two 16-bit registers (storing one weight and one partial sum data, respectively). DMA modules are connected to the DRAM and SRAM, respectively, and are used to read and write data between the two.
[0075] like Figure 1 As shown in , the back propagation component includes a back propagation engine (BP Engine), a weight gradient engine (WGEngine), and a second direct memory access module (i.e. Figure 1 As shown in the DMA module in the back propagation component, the back propagation engine and the weight gradient engine are both connected to the second direct memory access module, which is connected to the unified cache. The BP Engine is designed with a variable ▽u specifically for the spiking neural network. l+1 , w′ l, ConvBP l The SRAM has a capacity / bit width of 128KB / 16bit, 576KB / 16bit, and 128KB / 16bit, respectively. A BP Array of 16×16 Mul-Add units suitable for membrane potential gradient convolution is designed. Each Mul-Add unit consists of an FP16 multiplier and adder, and three 16-bit Regs (store one weight and one partial sum data respectively). The WG Engine has designed a variable s specifically for spiking neural networks. l 、▽w l The SRAM has a capacity and bit width of 16KB / 1bit and 9KB / 16bit respectively. The WG Engine and BP Engine share the variable ▽u of the pulse neural network. l+1 To store data in SRAM, a WG array with 16×16 Mux-Add units was designed for weight gradient calculation. The DMA module is connected to DRAM and SRAM respectively, and is used to read and write data between DRAM and SRAM.
[0076] Based on the above deep pulse neural network training architecture, the energy consumption calculation method of the deep pulse neural network training architecture will be further described below. Figure 2 , which is an optional flow chart of the energy consumption calculation method of the deep pulse neural network training architecture provided in the embodiment of the present application, Figure 2 The method may include but is not limited to steps 201 to 204. It is also understood that this embodiment is for Figure 2 The order of steps 201 to 204 is not specifically limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs. The energy consumption calculation method of the deep pulse neural network training architecture provided in the embodiment of the present application can be applied to the computing processor in the deep pulse neural network training architecture.
[0077] Step 201: Obtain the number of logical discrimination, floating-point addition, and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep pulse neural network training task.
[0078] Step 201 is described in detail below.
[0079] In some embodiments, during the computational process of the spiking neural network, its energy consumption is mainly due to the read and write operations of variable parameter data in the memory, as well as the parameter calculation (including logical judgment, accumulation operation and multiplication operation). Therefore, in order to accurately calculate the energy consumption of the deep spiking neural network training architecture for any deep spiking neural network training task during the training process, it is first necessary to determine the number of logical judgment, floating-point addition and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution and weight gradient in the deep spiking neural network training task, which includes the number of logical judgments corresponding to the logical judgments, the number of accumulation operations corresponding to the floating-point additions and the number of multiplication operations corresponding to the floating-point multiplications.
[0080] In this embodiment, a deep pulse neural network training task with L layers of neurons is taken as an example, and its variables include Each layer L l They are all composed of LIF neuron models with T time steps. The membrane potential, pulse, pulse convolution, weight and gradient of the l-layer neurons are: The reverse membrane potential gradient, pulse gradient, weight transposition and membrane potential gradient convolution of the l-layer neurons are: and in, is a set of real numbers, C l 、H l and W l are the number of channels, length and width of the Feature Map (FM) layer l, M l 、R l and S l They are the convolution kernel w l The number, length and width of , B is the BatchSize of one training.
[0081] The following will further describe how to obtain the number of logical judgments and the number of accumulation operations for the deep pulse neural network training task.
[0082] Reference Figure 3 , obtaining the number of logical discrimination operations corresponding to the logical discrimination operations and the number of accumulation operations corresponding to the accumulation operations on multiple variables in the deep pulse neural network training task, including the following steps 301 to 303.
[0083] Step 301: Generate the number of forward pass discriminations and the number of forward pass accumulation operations according to the convolution operation in the forward pass update function corresponding to the pulse convolution in the deep pulse neural network training task.
[0084] Step 302: Generate the number of backpropagation accumulation operations and the number of backpropagation accumulation operations based on the convolution operation and multiplication operation in the backpropagation update function corresponding to the membrane potential gradient convolution in the deep spiking neural network training task.
[0085] Step 303: Generate the number of weight gradient discrimination operations and the number of weight gradient accumulation operations according to the convolution operation in the weight gradient update function corresponding to the weight gradient in the deep spiking neural network training task.
[0086] Steps 301 to 303 are described in detail below.
[0087] Based on the above-mentioned deep spiking neural network training task of L-layer neurons, the forward pass update function corresponding to the pulse convolution in the forward pass (FP) process of the deep spiking neural network training task can be shown as the following formulas (1) to (3).
[0088]
[0089] Among them, ⊙ represents the element-by-element multiplication of two matrices of the same type, Represents the convolution operation. The potential update includes time and space parts. The time part is determined by the potential, pulse and leakage factor α of the previous moment, while the space part is determined by the weighted accumulation of pulses of the previous layer of neurons. When the potential crosses the threshold th f When , the neuron will stimulate the pulse electric position zero. Among them, f(x) is a step function. If x≥th f , f(x) = 1; otherwise, f(x) = 0. The main computational effort of the forward pass process is concentrated in the pulse convolution of formula (2). The basic computational operations are 1-bit pulse signal logic discrimination (Mux) and FP16 accumulation (Add) operations. The Add operation is performed only when the pulse signal is 1.
[0090] Reference Figure 4 , is a schematic diagram of the changes in convolution calculation during the forward transfer process provided by an embodiment of the present application. Figure 4 As shown in , the basic correspondence between variables is the pulse of the bth FM at the tth time step in the l-1th layer. and the mth weight of the l-1th layer The convolution of the lth layer, the tth time step, the bth FM, and the mth band are obtained. Right now The other operations in the forward pass are element-wise calculations, which are several orders of magnitude lower than the pulse convolution operation and can be ignored.
[0091] Based on this, let the sparsity rate of the l-1 layer of pulse data after convolution be Spar l∈[0,1], the convolution operation in the forward pass update function (1-3) corresponding to the pulse convolution in the deep spiking neural network training task The number of forward pass discrimination operations (i.e., Mux operations) and the number of forward pass accumulation operations (i.e., Add operations) required for the l-th layer of pulse convolution can be further generated as shown in the following formulas (4) and (5), respectively.
[0092]
[0093] Among them, according to the relationship between the convolution calculation dimensions, M l-1 =C l .
[0094] Based on the above-mentioned deep pulse neural network training task of L-layer neurons, the potential gradient in the back propagation (BP) of the deep pulse neural network training task The update definition is as shown in the following formula (6).
[0095]
[0096] The derivative of the step function f′(x) is approximated by the pulse curve. If th l ≤x≤th r , f′(x)=1, otherwise f′(x)=0. Based on this, the back propagation update function corresponding to the membrane potential gradient convolution in the deep spike neural network training task, namely the spike gradient It is defined as shown in the following formula (7) and formula (8).
[0097]
[0098] The gradient of the pulse It also consists of time and space parts. The time part is determined by the potential gradient at the next moment and the potential at the current moment, and the space part is determined by the weighted accumulation of the potential gradient of the next layer.
[0099] Reference Figure 5 , is a schematic diagram of the changes in convolution calculation during the back propagation process provided by an embodiment of the present application. Figure 5 As shown in , the basic correspondence between variables is the membrane potential gradient of the bth FM (b∈{1,…,B}) at the tth time step in the l+1th layer. and the cth transposed weight of the lth layer The convolution of the lth layer, the tth time step, the bth FM, and the cth band are obtained. Right now According to the corresponding relationship between the convolution calculation dimensions, M l =C l+l .
[0100] Since the amount of calculation in the back propagation process is mainly concentrated in formula (8), and since the membrane potential gradient and weight are both FP16, according to the convolution operation and multiplication operation in the back propagation update function corresponding to the membrane potential gradient convolution in the deep spike neural network training task, the back propagation cumulative operation number (i.e., the FP16 Add operation number) and the back propagation cumulative multiplication operation number (i.e., the FP16 Mul operation number) of the l-th layer membrane potential gradient convolution are generated as shown in the following formula (9).
[0101]
[0102] Among them, Figure 5 As shown in , according to the relationship between the convolution calculation dimensions, M 1 =C l+1 .
[0103] Based on the above-mentioned deep spiking neural network training task of L layers of neurons, the weight gradient update function corresponding to the weight gradient in the back propagation (BP) of the deep spiking neural network training task is the weight gradient (WG) As shown in the following formula (10).
[0104]
[0105] Reference Figure 6 , is a schematic diagram of a change in convolution kernel gradient convolution calculation provided by an embodiment of the present application. Figure 6 As shown in , the basic correspondence between variables is: l+1th layer, tth time step, bth FM, cth band (c∈{1,…,C l +1}) of the membrane potential gradient and the pulse of the bth FM at the tth time step of the lth layer Band-by-band convolution obtains the mth weight gradient of the lth layer The partial sum of B×C l+1 The sum of the parts can get the final weight gradient
[0106] As shown in formula (10), the basic calculation operation for weight gradient solution is also 1-bit pulse signal logic discrimination (Mux) and FP16 accumulation (Add). Let the sparsity rate of the convolution expansion of the first layer of pulse data be Spar l According to the convolution operation in the weight gradient update function corresponding to the weight gradient in the deep spike neural network training task, the number of weight gradient discrimination operations (i.e., the number of Mux operations) and the number of weight gradient accumulation operations (i.e., the number of Add operations) of the lth layer are generated as shown in the following formulas (11) and (12), respectively.
[0107]
[0108] Through the above steps 301 to 304, for the convolution operations and multiplication operations required for the forward transfer, error back propagation and weight gradient related update functions in the deep spiking neural network training task, the number of logical discrimination operations, accumulation operations and multiplication operations corresponding to the logical discrimination operations, accumulation operations and multiplication operations performed in the training process of each layer of neurons in the deep spiking neural network training task is accurately obtained, thereby facilitating a more accurate calculation of the energy consumption of the deep spiking neural network training task in the future.
[0109] Step 202: Obtain reuse factors of a plurality of variables for read and write operations in a memory of a deep spiking neural network training architecture.
[0110] Step 202 is described in detail below.
[0111] In some embodiments, in order to effectively reduce the energy consumption of a deep pulse neural network training task during the training process in a deep pulse neural network training architecture, it is necessary to generate a reuse factor in advance based on the repeated data of read and write operations performed on multiple variables of the deep pulse neural network training task in the memory of the deep pulse neural network training architecture, so as to utilize the reuse factor generated by the read and write characteristics of the memory of the deep pulse neural network training architecture to reduce the number of read and write operations on the same data.
[0112] Reference Figure 7 , is a schematic diagram of a memory read and write operation provided by an embodiment of the present application. Figure 7 As shown in , the memory of the deep pulse neural network training architecture includes registers Regs, static memory SRAM (i.e. Figure 1 SRAM for storing variables in the back propagation component and the forward pass component shown in FIG) and dynamic memory DRAM (i.e., Figure 1 Unified Buffer DRAM as shown in ). Figure 1 The computing units shown in (including weight gradient engine, back propagation engine and forward pass engine) drive the data in Data flows between the three levels of memory, forming a data flow. Therefore, the data flow describes the read and write dependencies and data volume of each operator variable at each level of memory. A good data flow can significantly reduce the amount of read and write data by improving data reuse across all levels of memory, thereby reducing the architecture's computing power. Regs refers to the collection of all Regs in the compute unit array, which directly provide data to each compute unit.
[0113] According to the read and write relationship between memories, the following actions are defined. For Regs, Figure 7 As shown in , its actions include writing data from SRAM (Write in from SRAM, W2S) and reading data from SRAM (Read out form SRAM, R2S). For SRAM, Figure 7 As shown, its actions include reading data out to Regs (Read out to Regs, R2R), writing data from Regs (Write in from Regs, W2R), writing data from DRAM (Write in from DRAM, W2D) and reading data out to DRAM (Read out to DRAM, R2D). For DRAM, Figure 7 As shown, its actions include reading data out to SRAM (Read out to SRAM, R2S) and writing data from SRAM (Write in from SRAM, W2S).
[0114] Based on Figure 7 The following further describes how to determine the reuse factors of multiple variables.
[0115] Reference Figure 8 , obtaining a reuse factor of multiple variables for read and write operations in a memory of a deep pulse neural network training architecture, including the following steps 801 to 802.
[0116] Step 801: Take each variable as the target variable one by one.
[0117] Step 802: Generate a reuse factor corresponding to the target variable based on the read and write operations of the target variable in the first data transmission process or the second data transmission process.
[0118] Steps 801 to 802 are described in detail below.
[0119] Based on the above description of the memory read and write operations, it can be determined that the data amounts of a pair of read and write operations between adjacent memories are consistent, for example, the amount of data written to Regs by the W2S operation is equal to the amount of data read from SRAM by the R2R operation.
[0120] Therefore, based on Figure 7 The defined read and write actions and the calling paths of each variable, such as in the forward convolution process, s l-1 and w l-1 As input parameters, data is sent down from DRAM level by level, and Output parameter data is uploaded level by level from Regs. Data reuse occurs across three levels of storage: Regs, SRAM, and DRAM. This defines the reuse factor for each variable at each level.
[0121] Furthermore, each variable is used as a target variable, and then the reuse factor corresponding to the target variable is generated based on the read and write operations of the target variable in the first data transmission process or the second data transmission process. The first data transmission process is the data transmission process between the register Regs and the static memory SRAM, and the second data transmission process is the data transmission process between the static memory SRAM and the dynamic memory DRAM.
[0122] Reference Figure 9 , is a schematic diagram of the reuse factor of each variable at each level of storage provided by the embodiment of the present application. Figure 9 As shown in , the reuse factor of each variable in the deep spike neural network training task (such as RU1, RU2, etc.) is listed, with the variable s l-1 For example, it needs to be read from SRAM and transferred to Regs (i.e. R2R action) and written by Regs (i.e. W2S action) in one read and write operation. These two actions are actually an action group for the same variable data, so they have the same reuse factor RU1.
[0123] Through the above steps 801 to 802, by utilizing the read and write actions defined in the memory of the deep pulse neural network training architecture and the calling path of each variable, combined with the reuse factor generated by the same data in the same read and write action process, the same operation data can be effectively utilized to reduce the energy consumption during the deep pulse neural network training task training process.
[0124] In some embodiments, in order to accurately obtain the energy consumption during the deep pulse neural network training task, it is also necessary to pre-acquire the unit reading and writing energy consumption of each variable during the reading and writing process and the unit calculation energy consumption during the calculation processing (such as logical judgment, floating-point addition and floating-point multiplication).
[0125] Based on Figure 1 The deep pulse neural network training architecture shown in the figure has different unit read and write energy consumption for different hardware devices. Figure 10 , is a schematic diagram of the unit read and write energy consumption of each level of storage provided by the embodiment of the present application. Figure 10 As shown in , the unit read and write energy consumption of hardware with different variables is shown, which can be obtained through the public hardware parameters.
[0126] Reference Figure 11 , is a schematic diagram of the unit read and write energy consumption of each variable at each level of storage provided by the embodiment of the present application. Figure 11 As shown in Figure 10 The unit read and write energy consumption of each level of storage is shown as Figure 9 The reuse factors corresponding to the variables shown are used to generate the unit read and write energy consumption of each variable at each level of storage.
[0127] Based on Figure 1 The deep pulse neural network training architecture shown in the figure has different unit computing energy consumption required for different computing processes (such as logical judgment, floating point addition and floating point multiplication). Figure 12 , is a schematic diagram of the power consumption of an operator provided in an embodiment of the present application. Figure 12 As shown in , the unit computing energy consumption required for different computing processes (such as logical judgment, floating-point addition, and floating-point multiplication) is shown, which can be obtained through public hardware parameters.
[0128] Step 203: Calculate the task read and write energy consumption based on the number of logical determinations, the reuse factor, and the unit read and write energy consumption of the memory.
[0129] Step 203 is described in detail below.
[0130] In some embodiments, based on the number of logical discrimination operations performed in each layer of neurons in the acquired deep pulse neural network training task, the reuse factor of each variable, and the unit read and write energy consumption of the memory, the task read and write energy consumption required for performing variable read and write operations in the memory (including registers Regs, static memory SRAM, and dynamic memory DRAM) in the deep pulse neural network training task can be further calculated, as described below.
[0131] Reference Figure 13 Based on the number of logical judgments, the reuse factor and the unit read and write energy consumption of the memory, the task read and write energy consumption is calculated, including the following steps 1301 to 1305.
[0132] Step 1301: Obtain the forward pass judgment quantity corresponding to the forward pass and the weight gradient judgment quantity corresponding to the weight gradient update from the logical judgment quantity.
[0133] Step 1302: Obtain from the reuse factors a forward pass reuse factor corresponding to the forward pass, a back propagation reuse factor corresponding to the error back propagation, and a weight gradient reuse factor corresponding to the weight gradient update.
[0134] Step 1303: Calculate the forward transfer read and write energy consumption based on the forward transfer judgment quantity, the forward transfer reuse factor, and the unit read and write energy consumption.
[0135] Steps 1301 to 1303 are described in detail below.
[0136] In some embodiments, after obtaining the number of logical discriminants, the number of forward transfer discriminants corresponding to the forward transfer in each layer of neurons (i.e., the above formula (4)) and the number of weight gradient discriminants corresponding to the weight gradient update (i.e., the above formula (11)) are determined one by one.
[0137] Then, from Figure 9 The variables corresponding to the forward pass (including s l-1 、w l-1 , ConvFP l ) corresponding to the forward transfer reuse factor (including RU1, RU2, RU3, RU4, RU5, RU6), and the variables corresponding to the error back propagation (including w′ l , ConvBP l ) corresponding to the back propagation reuse factor (including RU7, RU8, RU9, RU 10 , RU 11 , RU 12 ) and the variables corresponding to the weight gradient updates ( s l 、 ) corresponding to the weight gradient reuse factor (including RU 13 , RU 14 , RU 15 , RU 16 , RU 17 , RU 18 ).
[0138] Next, based on the corresponding forward pass, the number of discriminants The forward transfer reuse factor (including RU1, RU2, RU3, RU4, RU5, RU6) and the unit read and write energy consumption are used to calculate the forward transfer read and write energy consumption. The details are described below.
[0139] Reference Figure 14 Based on the forward transfer judgment quantity, the forward transfer reuse factor and the unit read and write energy consumption, the forward transfer read and write energy consumption is calculated, including the following steps 1401 to 1403.
[0140] Step 1401: For each variable, obtain the variable read / write energy consumption based on the ratio of the corresponding unit read / write energy consumption and the forward transfer reuse factor, and accumulate all variable read / write energy consumptions to obtain the forward variable read / write energy consumption.
[0141] Step 1402: Accumulate the forward propagation discrimination numbers of all neurons to obtain the model forward discrimination number.
[0142] Step 1403: Multiply the model forward discrimination quantity and the forward variable read and write energy consumption to obtain the forward transfer read and write energy consumption.
[0143] Steps 1401 to 1403 are described in detail below.
[0144] In some embodiments, first for each variable corresponding to the forward pass (including s l-1 、w l-1 , ConvFP l ), based on Figure 11 The variable read and write energy consumption is obtained by calculating the ratio of the unit read and write energy consumption corresponding to each variable and the forward transfer reuse factor (including RU1, RU2, RU3, RU4, RU5, and RU6), and the forward variable read and write energy consumption is obtained by summing up all variable read and write energy consumptions as shown below.
[0145]
[0146] Then, the forward propagation discriminant number of all layers of neurons is accumulated to obtain the forward discriminant number of the model. Furthermore, the forward discriminant quantity of the model and the forward variable read and write energy consumption are multiplied to obtain the forward transfer read and write energy consumption as shown in the following formula (13).
[0147]
[0148] Step 1304: Calculate the back propagation read and write energy consumption based on the number of back propagation cumulative multiplication operations, the back propagation reuse factor, and the unit read and write energy consumption.
[0149] Step 1305: Based on the weight gradient discrimination quantity, weight gradient reuse factor and unit read and write energy consumption, the weight gradient read and write energy consumption is calculated, and the forward pass read and write energy consumption, the back propagation read and write energy consumption and the weight gradient read and write energy consumption are accumulated to obtain the task read and write energy consumption.
[0150] Steps 1304 to 1305 are described in detail below.
[0151] In some embodiments, similar to steps 1401 to 1403, based on the number of back propagation cumulative multiplication operations corresponding to the back propagation in each layer of neurons Backward propagation reuse factor corresponding to back propagation (including RU7, RU8, RU9, RU 10 , RU 11 , RU 12 ), and the variables corresponding to the back propagation (including w′ l , ConvBP l ) corresponding to the unit reading and writing energy consumption, and the back propagation reading and writing energy consumption is calculated As shown in the following formula (14).
[0152]
[0153] Similar to steps 1401 to 1403, the number of weight gradients corresponding to the weight gradient updates in each layer of neurons is determined. The weight gradient reuse factor corresponding to the weight gradient update (including RU 13 , RU 14 , RU 15 , RU 16 , RU 17 , RU 18 ), and the variables corresponding to the weight gradient update ( s l 、 ) corresponding to the unit reading and writing energy consumption, and the weighted gradient reading and writing energy consumption is calculated As shown in the following formula (15).
[0154]
[0155] Furthermore, the energy consumption of forward pass reading and writing is accumulated Back propagation read and write energy consumption And the energy consumption of weight gradient reading and writing Get the task reading and writing energy consumption E required for the deep pulse neural network training task to read and write during the training process m As shown in the following formula (16).
[0156]
[0157] Through the above steps 1301 to 1305, and steps 1401 to 1403, the common factors corresponding to the variables corresponding to the forward pass, back propagation and weight gradient update are used one by one, and the number of operations required for the read and write operations corresponding to each forward pass, back propagation and weight gradient update is accurately obtained in advance, so that the task read and write energy consumption required for the deep pulse neural network training task to perform reading and writing during the training process can be accurately obtained, thereby improving the accuracy of the task energy consumption corresponding to the neural network computing task.
[0158] Step 204: Calculate the task computing energy consumption based on the number of accumulated operations, the number of logical determinations, and the unit computing energy consumption of the memory.
[0159] Step 204 is described in detail below.
[0160] In some embodiments, based on the number of logical judgments, the number of accumulation operations, the number of multiplication operations corresponding to the calculation processing (including logical judgments, accumulation operations, and multiplication operations) performed in each layer of neurons in the acquired deep pulse neural network training task, the reuse factor of each variable and the unit calculation energy consumption of the memory, the task calculation energy consumption required for the deep pulse neural network training task to perform variable calculation operations in the register can be further calculated, as described below.
[0161] Reference Figure 15 , based on the number of accumulated operations, the number of logical judgments and the unit calculation energy consumption of the memory, the task calculation energy consumption is calculated, including the following steps 1501 to 1505.
[0162] Step 1501: Obtain the number of forward transfer accumulation operations corresponding to the forward transfer, the number of back propagation accumulation operations corresponding to the error back propagation, and the number of weight gradient accumulation operations corresponding to the weight gradient update from the number of accumulation operations, and obtain the number of back propagation accumulation operations corresponding to the error back propagation from the number of multiplication operations.
[0163] Step 1502: Accumulate all forward pass judgment numbers and multiply them by the judgment unit calculation energy consumption, and add the product of the forward pass accumulation operation number and the accumulation unit calculation energy consumption to obtain the forward pass calculation energy consumption.
[0164] Step 1503: Accumulate the number of all back-propagation accumulation operations, multiply by the accumulation unit calculation energy consumption, and add the product of the number of back-propagation accumulation multiplication operations and the multiplication unit calculation energy consumption to obtain the back-propagation calculation energy consumption.
[0165] Step 1504: Accumulate all weight gradient judgment numbers and multiply them by the judgment unit calculation energy consumption, and then add the product of the weight gradient accumulation operation number and the accumulation unit calculation energy consumption to obtain the weight gradient calculation energy consumption.
[0166] Step 1505: Accumulate the forward pass computing energy consumption, the back propagation computing energy consumption, and the weight gradient computing energy consumption to obtain the task computing energy consumption.
[0167] Steps 1501 to 1505 are described in detail below.
[0168] In some embodiments, after obtaining the number of accumulation operations, the number of forward transfer accumulation operations corresponding to the forward transfer in each layer of neurons (i.e., the above formula (5)), the number of back propagation accumulation operations corresponding to the error back propagation (i.e., the above formula (9)), and the number of weight gradient accumulation operations corresponding to the weight gradient update (i.e., the above formula (12)) are determined one by one, and the number of back propagation accumulation operations corresponding to the error back propagation is obtained from the number of multiplication operations (i.e., the above formula (9)).
[0169] Then, the forward propagation discriminant number of all layers of neurons is accumulated And multiply it by the discriminant unit to calculate the energy consumption o0, plus the number of cumulative operations in the forward pass The product of the accumulated unit computing energy consumption o1 is used to obtain the forward transfer computing energy consumption required in the forward transfer process as shown in the following formula (17).
[0170]
[0171] Similarly, the number of back propagation accumulation operations of all layers of neurons is accumulated And multiply it by the cumulative unit to calculate the energy consumption o1, plus the number of back propagation cumulative operations The product of the multiplication unit calculation energy consumption o2 is obtained to obtain the back propagation calculation energy consumption required in the back propagation process as shown in the following formula (18).
[0172]
[0173] Similarly, the weight gradient discriminant number of neurons in all layers is accumulated And multiply it by the discriminant unit to calculate the energy consumption o0, plus the number of weight gradient accumulation operations The product of the accumulated unit calculation energy consumption o1 is the weight gradient calculation energy consumption required in the weight gradient update process, as shown in the following formula (19).
[0174]
[0175] Finally, the forward pass computation energy consumption is accumulated Back propagation computation energy consumption And the energy consumption of weight gradient calculation The energy consumption required for variable calculation during the training of the deep pulse neural network training task is shown in the following formula (20).
[0176]
[0177] Through the above steps 1501 to 1505, the number of computing operations required for the computing operations corresponding to the variables corresponding to the forward pass, back propagation and weight gradient update, as well as the corresponding unit computing energy consumption, are used one by one, so that the task computing energy consumption required for the variable calculation of the deep pulse neural network training task during the training process can be accurately obtained, thereby improving the accuracy of the task energy consumption corresponding to the neural network computing task.
[0178] Step 205: Accumulate the task reading and writing energy consumption and the task computing energy consumption to obtain the task energy consumption of the deep pulse neural network training task.
[0179] Step 205 is described in detail below.
[0180] In some embodiments, after obtaining the task reading and writing energy consumption E m And task computing energy consumption E c Afterwards, the task reading and writing energy consumption and the task calculation energy consumption are accumulated to obtain the task energy consumption E required for the deep pulse neural network training task to perform network training in the deep pulse neural network training architecture as shown in the following formula (21).
[0181] E=E m +E c (twenty one)
[0182] The energy consumption calculation method and related equipment of the deep pulse neural network training architecture proposed in the embodiment of the present application include: first, according to the convolution operation in the forward transfer update function corresponding to the pulse convolution in the deep pulse neural network training task, the forward transfer discrimination number and the forward transfer accumulation operation number are generated; according to the convolution operation and multiplication operation in the back propagation update function corresponding to the membrane potential gradient convolution in the deep pulse neural network training task, the back propagation accumulation operation number and the back propagation accumulation operation number are generated; according to the convolution operation in the weight gradient update function corresponding to the weight gradient in the deep pulse neural network training task, the weight gradient discrimination number and the weight gradient accumulation operation number are generated; secondly, each variable is used as the target variable one by one, and based on the read and write operations of the target variable in the first data transmission process or the second data transmission process, the reuse factor corresponding to the target variable is generated, the first data transmission process is the data transmission process between the register Regs and the static memory SRAM, and the second data transmission process is the data transmission process between the static memory SRAM and the dynamic memory DRAM; next, From the logical discrimination number, the forward transfer discrimination number corresponding to the forward transfer and the weight gradient discrimination number corresponding to the weight gradient update are obtained. From the reuse factor, the forward transfer reuse factor corresponding to the forward transfer, the back propagation reuse factor corresponding to the error back propagation, and the weight gradient reuse factor corresponding to the weight gradient update are obtained. For each variable, the variable read and write energy consumption is obtained based on the ratio of the corresponding unit read and write energy consumption and the forward transfer reuse factor. The forward variable read and write energy consumption is obtained by summing up all variable read and write energy consumptions. The forward transfer discrimination of all neurons is accumulated. The number of forward discriminants of the model is obtained, and the forward transmission read-write energy consumption is obtained by multiplying the forward discriminant number of the model and the forward variable read-write energy consumption. The back propagation read-write energy consumption is calculated based on the number of back propagation multiplication operations, the back propagation reuse factor, and the unit read-write energy consumption. The number of back propagation multiplication operations corresponds to the error back propagation. The weight gradient read-write energy consumption is calculated based on the number of weight gradient discriminants, the weight gradient reuse factor, and the unit read-write energy consumption. The forward transmission read-write energy consumption, the back propagation read-write energy consumption, and the weight gradient read-write energy consumption are accumulated to obtain the task read-write energy consumption.Then, the forward pass cumulative operation number corresponding to the forward pass, the back propagation cumulative operation number corresponding to the error back propagation, and the weight gradient cumulative operation number corresponding to the weight gradient update are obtained from the cumulative operation number, the back propagation cumulative multiplication operation number corresponding to the error back propagation is obtained from the cumulative multiplication operation number, all forward pass discrimination numbers are accumulated, and multiplied by the discrimination unit calculation energy consumption, and the product of the forward pass cumulative operation number and the cumulative unit calculation energy consumption is added to obtain the forward pass calculation energy consumption, and all back propagation cumulative operation numbers are accumulated and multiplied. The energy consumption of the accumulated unit calculation is added to the product of the number of backpropagation multiplication operations and the multiplication unit calculation energy consumption to obtain the backpropagation calculation energy consumption. The number of all weight gradient discriminations is accumulated and multiplied by the discrimination unit calculation energy consumption. The weight gradient calculation energy consumption is then added to the product of the number of weight gradient accumulation operations and the accumulation unit calculation energy consumption to obtain the weight gradient calculation energy consumption. The forward pass calculation energy consumption, the backpropagation calculation energy consumption, and the weight gradient calculation energy consumption are accumulated to obtain the task calculation energy consumption. Finally, the task read and write energy consumption and the task calculation energy consumption are accumulated to obtain the task energy consumption of the deep spiking neural network training task.
[0183] The embodiment of the present application is directed to the convolution operations and multiplication operations required in the forward transfer, error back propagation and weight gradient related update functions in the deep pulse neural network training task, and accurately obtains the number of logical discrimination operations, accumulation operations and multiplication operations corresponding to the logical discrimination operations, accumulation operations and multiplication operations performed in the training process of each layer of neurons in the deep pulse neural network training task, so as to facilitate the subsequent more accurate calculation of the energy consumption of the deep pulse neural network training task; and, by utilizing the read and write actions defined in the memory of the deep pulse neural network training architecture and the calling path of each variable, combined with the reuse factor generated by the same data in the same read and write action process, the same operation data can be effectively utilized to reduce the energy consumption in the training process of the deep pulse neural network training task; and, by utilizing the common factors corresponding to the variables corresponding to the forward transfer, back propagation and weight gradient update one by one, and accurately obtaining the number of operations required for the read and write operations corresponding to each forward transfer, back propagation and weight gradient update in advance, it is possible to accurately obtain The task reading and writing energy consumption required for reading and writing of the deep pulse neural network training task during the training process is obtained, thereby improving the accuracy of the task energy consumption corresponding to the neural network computing task; secondly, the number of computing operations required for the computing operations corresponding to the variables corresponding to the forward pass, back propagation and weight gradient update, as well as the corresponding unit computing energy consumption are used one by one, so as to accurately obtain the task computing energy consumption required for the variable calculation of the deep pulse neural network training task during the training process, thereby improving the accuracy of the task energy consumption corresponding to the neural network computing task; in short, for the number of logical discrimination operations corresponding to the logical discrimination operations and the number of accumulation operations corresponding to the accumulation operations of multiple variables in the deep pulse neural network training task, the reuse factor generated by the read and write characteristics of the memory of the deep pulse neural network training architecture is used to reduce the number of read and write operations of the same data, and further combined with the unit read and write energy consumption and the unit computing energy consumption, the task energy consumption corresponding to the neural network computing task can be accurately calculated while reducing the task energy consumption corresponding to the deep pulse neural network training task.
[0184] The present application also provides an energy consumption calculation device for a deep pulse neural network training architecture, which can implement the energy consumption calculation method of the above-mentioned deep pulse neural network training architecture, referring to Figure 16 , the apparatus 1600 comprises:
[0185] A calculation quantity acquisition module 1610 is used to obtain the number of logical discrimination, floating-point addition, and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep spiking neural network training task, wherein the operation quantity includes the number of logical discrimination operations corresponding to the logical discrimination, the number of accumulation operations corresponding to the floating-point addition, and the number of accumulation operations corresponding to the floating-point multiplication;
[0186] A reuse factor acquisition module 1620 is used to respectively obtain reuse factors of a plurality of the variables for read and write operations in a memory of the deep spiking neural network training architecture, wherein the memory includes DRAM, SRAM, and registers;
[0187] The read / write energy consumption calculation module 1630 is configured to calculate the task read / write energy consumption based on the number of logical determinations, the reuse factor, and the unit read / write energy consumption of the memory;
[0188] The energy consumption calculation module 1640 is configured to calculate the task computing energy consumption based on the number of accumulation operations, the number of multiplication operations, the number of logic determinations, and the corresponding unit computing energy consumption;
[0189] The task energy consumption calculation module 1650 is used to accumulate the task reading and writing energy consumption and the task calculation energy consumption to obtain the task energy consumption of the deep pulse neural network training task.
[0190] In some embodiments, the read / write energy consumption calculation module 1630 is further configured to:
[0191] Obtain the forward pass discriminant number corresponding to the forward pass and the weight gradient discriminant number corresponding to the weight gradient update from the logical discriminant number;
[0192] Obtaining from the reuse factors a forward pass reuse factor corresponding to the forward pass, a backpropagation reuse factor corresponding to the error backpropagation, and a weight gradient reuse factor corresponding to the weight gradient update;
[0193] Based on the number of forward pass judgments, the forward pass reuse factor, and the unit read and write energy consumption, the forward pass read and write energy consumption is calculated;
[0194] The backpropagation read and write energy consumption is calculated based on the number of backpropagation cumulative multiplication operations, the backpropagation reuse factor, and the unit read and write energy consumption. The number of backpropagation cumulative multiplication operations corresponds to the error backpropagation;
[0195] Based on the number of weight gradient discriminations, the weight gradient reuse factor, and the unit read and write energy consumption, the weight gradient read and write energy consumption is calculated, and the forward pass read and write energy consumption, the back propagation read and write energy consumption, and the weight gradient read and write energy consumption are accumulated to obtain the task read and write energy consumption.
[0196] In some embodiments, the read / write energy consumption calculation module 1630 is further configured to:
[0197] For each variable, the variable read and write energy consumption is obtained based on the ratio of the corresponding unit read and write energy consumption and the forward transfer reuse factor, and the forward variable read and write energy consumption is obtained by summing up all variable read and write energy consumptions.
[0198] Accumulate the forward propagation discrimination number of all neurons to obtain the forward discrimination number of the model;
[0199] The forward transmission read and write energy consumption is obtained by multiplying the model forward discriminant quantity and the forward variable read and write energy consumption.
[0200] In some embodiments, the energy consumption calculation module 1640 is further configured to:
[0201] Obtain the number of forward transfer accumulation operations corresponding to the forward transfer, the number of back propagation accumulation operations corresponding to the error back propagation, and the number of weight gradient accumulation operations corresponding to the weight gradient update from the number of accumulation operations, and obtain the number of back propagation accumulation multiplication operations corresponding to the error back propagation from the number of accumulation multiplication operations;
[0202] Accumulate all forward pass judgment numbers and multiply them by the judgment unit calculation energy consumption, and then add the product of the forward pass accumulation number and the accumulation unit calculation energy consumption to get the forward pass calculation energy consumption;
[0203] Accumulate the number of all backpropagation accumulation operations and multiply it by the accumulation unit calculation energy consumption, and then add the product of the number of backpropagation accumulation operations and the multiplication unit calculation energy consumption to get the backpropagation calculation energy consumption;
[0204] Accumulate all weight gradient discriminant numbers and multiply them by the discriminant unit calculation energy consumption, and then add the product of the number of weight gradient accumulation operations and the accumulation unit calculation energy consumption to obtain the weight gradient calculation energy consumption;
[0205] The forward pass computing energy consumption, the back propagation computing energy consumption, and the weight gradient computing energy consumption are accumulated to obtain the task computing energy consumption.
[0206] In some embodiments, the reuse factor acquisition module 1620 is further configured to:
[0207] Take each variable as the target variable one by one;
[0208] Based on the read and write operations of the target variable in the first data transmission process or the second data transmission process, a reuse factor corresponding to the target variable is generated. The first data transmission process is the data transmission process between the register and the SRAM, and the second data transmission process is the data transmission process between the SRAM and the DRAM.
[0209] In some embodiments, the calculation quantity acquisition module 1610 is further configured to:
[0210] Generate the number of forward pass discriminations and the number of forward pass accumulation operations based on the convolution operation in the forward pass update function corresponding to the pulse convolution in the deep pulse neural network training task;
[0211] Generate the number of backpropagation accumulation operations and the number of backpropagation multiplication operations based on the convolution operation and multiplication operation in the backpropagation update function corresponding to the membrane potential gradient convolution in the deep spike neural network training task;
[0212] According to the convolution operation in the weight gradient update function corresponding to the weight gradient in the deep spiking neural network training task, the number of weight gradient discriminations and the number of weight gradient accumulation operations are generated.
[0213] In the above embodiments, the description of each embodiment has its own focus. For the part that is not described in detail in a certain embodiment, the specific implementation method of the energy consumption calculation device of the deep pulse neural network training architecture is basically the same as the specific implementation method of the energy consumption calculation method of the above-mentioned deep pulse neural network training architecture, and will not be repeated here.
[0214] In the embodiment of the present application, the energy consumption calculation device of the deep pulse neural network training architecture accurately obtains the number of logical discrimination operations, accumulation operations and multiplication operations corresponding to the logical discrimination operations, accumulation operations and multiplication operations performed in the training process of each layer of neurons in the deep pulse neural network training task, for the convolution operations and multiplication operations required in the related update functions of the forward pass, error back propagation and weight gradient in the deep pulse neural network training task, so as to facilitate the subsequent more accurate calculation of the energy consumption of the deep pulse neural network training task; and, by utilizing the read and write actions and the calling paths of each variable defined in the memory of the deep pulse neural network training architecture, combined with the reuse factor generated by the same data in the same read and write action process, the same operation data can be effectively utilized to reduce the energy consumption during the training process of the deep pulse neural network training task; and, by utilizing the common factors corresponding to the variables corresponding to the forward pass, back propagation and weight gradient update one by one, and accurately obtaining the number of operations required for the read and write operations corresponding to each forward pass, back propagation and weight gradient update in advance. The amount can accurately obtain the task reading and writing energy consumption required for the deep pulse neural network training task to read and write during the training process, thereby improving the accuracy of the task energy consumption corresponding to the neural network computing task; secondly, the number of computing operations required for the computing operations corresponding to the variables corresponding to the forward pass, back propagation and weight gradient update, as well as the corresponding unit computing energy consumption, can accurately obtain the task computing energy consumption required for the deep pulse neural network training task to perform variable calculations during the training process, thereby improving the accuracy of the task energy consumption corresponding to the neural network computing task; in short, for the number of logical discrimination operations corresponding to the logical discrimination operations and the number of accumulation operations corresponding to the accumulation operations for multiple variables in the deep pulse neural network training task, the reuse factor generated by the read and write characteristics of the memory of the deep pulse neural network training architecture is used to reduce the number of read and write operations of the same data, and further combined with the unit read and write energy consumption and the unit computing energy consumption, the task energy consumption corresponding to the neural network computing task can be accurately calculated while reducing the task energy consumption corresponding to the deep pulse neural network training task.
[0215] An embodiment of the present application further provides an electronic device, including:
[0216] at least one memory;
[0217] at least one processor;
[0218] at least one program;
[0219] The program is stored in the memory, and the processor executes the at least one program to implement the energy consumption calculation method for the deep pulse neural network training architecture implemented in this application. The electronic device can be any smart terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), an in-vehicle computer, etc.
[0220] See also Figure 17 , Figure 17 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0221] The processor 1701 can be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0222] The memory 1702 can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device or RAM (Random Access Memory). The memory 1702 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1702, and the processor 1701 calls and executes the energy consumption calculation method of the deep pulse neural network training architecture of the embodiment of this application;
[0223] Input / output interface 1703, used to implement information input and output;
[0224] Communication interface 1704, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0225] Bus 1705 , which transmits information between various components of the device (e.g., processor 1701 , memory 1702 , input / output interface 1703 , and communication interface 1704 );
[0226] The processor 1701 , the memory 1702 , the input / output interface 1703 and the communication interface 1704 are connected to each other in communication within the device via a bus 1705 .
[0227] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, which, when executed by a processor, implements the energy consumption calculation method of the above-mentioned deep pulse neural network training architecture.
[0228] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0229] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0230] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0231] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0232] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0233] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0234] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0235] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0236] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0237] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0238] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0239] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A method for calculating energy consumption of a deep spiking neural network training architecture, characterized in that: The method comprises: Obtain the number of logical discrimination, floating-point addition, and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep spiking neural network training task, where the number of operations includes the number of logical discrimination operations corresponding to the logical discrimination, the number of accumulation operations corresponding to the floating-point addition, and the number of accumulation operations corresponding to the floating-point multiplication; Obtaining reuse factors for read and write operations on a plurality of variables in a memory of the deep spiking neural network training architecture, the memory comprising DRAM, SRAM, and registers; Calculating task read and write energy consumption based on the number of logical judgments, the reuse factor, and the unit read and write energy consumption of the memory; Calculating the task computing energy consumption based on the number of accumulation operations, the number of multiplication operations, the number of logical determinations, and the corresponding unit computing energy consumption; Accumulating the task reading and writing energy consumption and the task computing energy consumption to obtain the task energy consumption of the deep pulse neural network training task; The calculating the task read / write energy consumption based on the number of logical determinations, the reuse factor, and the unit read / write energy consumption of the memory includes: Obtaining, from the logical discrimination quantity, a forward pass discrimination quantity corresponding to the forward pass and a weight gradient discrimination quantity corresponding to the weight gradient update; Obtaining from the reuse factors a forward pass reuse factor corresponding to the forward pass, a back propagation reuse factor corresponding to error back propagation, and a weight gradient reuse factor corresponding to the weight gradient update; Calculating forward transfer read and write energy consumption based on the forward transfer judgment quantity, the forward transfer reuse factor, and the unit read and write energy consumption; Calculating the back propagation read and write energy consumption based on the number of back propagation cumulative multiplication operations, the back propagation reuse factor, and the unit read and write energy consumption, wherein the number of back propagation cumulative multiplication operations corresponds to error back propagation; Based on the weight gradient judgment quantity, the weight gradient reuse factor and the unit read and write energy consumption, the weight gradient read and write energy consumption is calculated, and the forward pass read and write energy consumption, the back propagation read and write energy consumption and the weight gradient read and write energy consumption are accumulated to obtain the task read and write energy consumption.
2. The energy consumption calculation method for the deep pulse neural network training architecture according to claim 1 is characterized in that: The deep pulse neural network training task includes multiple layers of neurons, and the forward transfer read and write energy consumption is calculated based on the forward transfer discriminant number, the forward transfer reuse factor, and the unit read and write energy consumption, including: For each of the variables, obtaining the variable read / write energy consumption based on the ratio of the corresponding unit read / write energy consumption to the forward transfer reuse factor, and accumulating all the variable read / write energy consumptions to obtain the forward variable read / write energy consumption; Accumulating the forward propagation discrimination quantities of all the neurons to obtain the model forward discrimination quantity; The forward transfer read-write energy consumption is obtained by multiplying the model forward discrimination quantity and the forward variable read-write energy consumption.
3. The energy consumption calculation method for the deep pulse neural network training architecture according to claim 1 is characterized in that: The unit calculation energy consumption includes determination unit calculation energy consumption, accumulation unit calculation energy consumption, and multiplication unit calculation energy consumption. The task calculation energy consumption is calculated based on the number of accumulation operations, the number of multiplication operations, the number of logical determinations, and the corresponding unit calculation energy consumption, including: Obtaining, from the number of accumulation operations, the number of forward transfer accumulation operations corresponding to the forward transfer, the number of back propagation accumulation operations corresponding to the error back propagation, and the number of weight gradient accumulation operations corresponding to the weight gradient update, and obtaining, from the number of multiplication operations, the number of back propagation accumulation operations corresponding to the error back propagation; Accumulating all the forward transfer determination numbers and multiplying the result by the determination unit calculation energy consumption, and adding the result to the product of the forward transfer accumulation operation number and the accumulation unit calculation energy consumption to obtain the forward transfer calculation energy consumption; Accumulating all the back-propagation accumulation operation numbers and multiplying the result by the accumulation unit calculation energy consumption, and then adding the product of the back-propagation accumulation multiplication operation number and the multiplication unit calculation energy consumption to obtain the back-propagation calculation energy consumption; Accumulating all the weight gradient discrimination quantities and multiplying the result by the discrimination unit calculation energy consumption, and then adding the product of the weight gradient accumulation operation quantity and the accumulation unit calculation energy consumption to obtain the weight gradient calculation energy consumption; The forward pass computing energy consumption, the back propagation computing energy consumption, and the weight gradient computing energy consumption are accumulated to obtain the task computing energy consumption.
4. The energy consumption calculation method for the deep pulse neural network training architecture according to claim 1 is characterized in that: The step of respectively obtaining reuse factors of the plurality of variables for reading and writing operations in the memory of the deep pulse neural network training architecture includes: Taking each of the variables as the target variable one by one; The reuse factor corresponding to the target variable is generated based on the read and write operations of the target variable in the first data transmission process or the second data transmission process, where the first data transmission process is a process of transmitting data between the register and the SRAM, and the second data transmission process is a process of transmitting data between the SRAM and the DRAM.
5. The energy consumption calculation method for the deep pulse neural network training architecture according to claim 1 is characterized in that: The number of logical judgments includes the number of forward pass judgments and the number of weight gradient judgments, the number of accumulation operations includes the number of forward pass accumulation operations, the number of back propagation accumulation operations, and the number of weight gradient accumulation operations, the number of multiplication operations includes the number of back propagation accumulation operations, and the number of logical judgments, floating-point additions, and floating-point multiplications in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep pulse neural network training task includes: Generate the forward pass discrimination number and the forward pass accumulation operation number according to the convolution operation in the forward pass update function corresponding to the pulse convolution in the deep spiking neural network training task; Generate the number of backpropagation accumulation operations and the number of backpropagation accumulation operations according to the convolution operation and the multiplication operation in the backpropagation update function corresponding to the membrane potential gradient convolution in the deep spiking neural network training task; The weight gradient discrimination quantity and the weight gradient accumulation operation quantity are generated according to the convolution operation in the weight gradient update function corresponding to the weight gradient in the deep pulse neural network training task.
6. A deep spiking neural network training architecture, characterized in that The deep spiking neural network training architecture includes a forward propagation component, a backpropagation component, a unified buffer area and a computing processor; The forward transfer component includes a forward transfer engine and a first direct memory access module connected to each other, and the first direct memory access module is connected to the unified cache area; The back propagation component includes a back propagation engine, a weight gradient engine, and a second direct memory access module, wherein the back propagation engine and the weight gradient engine are both connected to the second direct memory access module, and the second direct memory access module is connected to the unified cache area; The computing processor is used to execute the energy consumption calculation method of the deep pulse neural network training architecture as described in any one of claims 1 to 5.
7. The deep spiking neural network training architecture according to claim 6, characterized in that include: The forward transfer component is used to perform forward transfer processing in the deep spiking neural network training task; The back propagation component is used to perform error back propagation processing and weight gradient update processing in deep pulse neural network training tasks.
8. An energy consumption calculation device for a deep pulse neural network training architecture, characterized in that: The device comprises: A calculation quantity acquisition module is used to obtain the number of logical discrimination, floating-point addition, and floating-point multiplication operations in the pulse convolution, membrane potential gradient convolution, and weight gradient of the deep pulse neural network training task. The operation quantity includes the number of logical discrimination operations corresponding to the logical discrimination, the number of accumulation operations corresponding to the floating-point addition, and the number of accumulation operations corresponding to the floating-point multiplication; A reuse factor acquisition module is used to respectively obtain reuse factors of a plurality of variables for read and write operations in a memory of the deep spiking neural network training architecture, wherein the memory includes DRAM, SRAM, and registers; a read / write energy consumption calculation module, configured to calculate the task read / write energy consumption based on the number of logical determinations, the reuse factor, and the unit read / write energy consumption of the memory; A calculation energy consumption calculation module, configured to calculate the task calculation energy consumption based on the number of accumulation operations, the number of multiplication operations, the number of logic judgments and the corresponding unit calculation energy consumption; A task energy consumption calculation module, configured to accumulate the task reading and writing energy consumption and the task computing energy consumption to obtain the task energy consumption of the deep pulse neural network training task; The calculating the task read / write energy consumption based on the number of logical determinations, the reuse factor, and the unit read / write energy consumption of the memory includes: Obtaining, from the logical discrimination quantity, a forward pass discrimination quantity corresponding to the forward pass and a weight gradient discrimination quantity corresponding to the weight gradient update; Obtaining from the reuse factors a forward pass reuse factor corresponding to the forward pass, a back propagation reuse factor corresponding to error back propagation, and a weight gradient reuse factor corresponding to the weight gradient update; Calculating forward transfer read and write energy consumption based on the forward transfer judgment quantity, the forward transfer reuse factor, and the unit read and write energy consumption; Calculating the back propagation read and write energy consumption based on the number of back propagation cumulative multiplication operations, the back propagation reuse factor, and the unit read and write energy consumption, wherein the number of back propagation cumulative multiplication operations corresponds to error back propagation; Based on the weight gradient judgment quantity, the weight gradient reuse factor and the unit read and write energy consumption, the weight gradient read and write energy consumption is calculated, and the forward pass read and write energy consumption, the back propagation read and write energy consumption and the weight gradient read and write energy consumption are accumulated to obtain the task read and write energy consumption.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, it implements the energy consumption calculation method of the deep pulse neural network training architecture described in any one of claims 1 to 5.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the energy consumption calculation method of the deep pulse neural network training architecture as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Dynamic generalized user NOMA packet CCHN-MEC network unloading decision optimization method
CN116193546A
Pulse convolutional neural network algorithm, integrated circuit, computing apparatus, and storage medium
WO2021115262A1