Calculation circuit and calculation method thereof, chip, storage medium and electronic equipment

By designing a computing circuit that includes a memory, a control module and a computing array, tensor computing and vector computing are unified, solving the problem of high hardware overhead in the existing technology, meeting actual needs and improving computing efficiency.

CN118626050APending Publication Date: 2024-09-10BEIJING HORIZON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410703123.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing chips need to implement tensor calculations and vector calculations through dedicated computing circuits, resulting in high hardware overhead and difficulty in meeting actual needs.

Method used

Design a computing circuit that includes a memory, a control module, and a computing array. By generating different control signals, the computing circuit can perform tensor calculations and vector calculations in different working modes. The same computing circuit supports both tensor calculations and vector calculations. .

Benefits of technology

It reduces hardware overhead, realizes the unification of tensor calculation and vector calculation, meets actual needs, and improves calculation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626050A
    Figure CN118626050A
Patent Text Reader

Abstract

The invention discloses a calculation circuit, a calculation method thereof, a chip, a storage medium and electronic equipment. Wherein the computing circuit comprises: a memory for storing a first input feature, an input weight, and a second input feature; the control module is used for generating a first control signal and a second control signal; the calculation array is used for executing tensor calculation on the first input feature and the input weight in response to the first control signal to obtain an intermediate calculation result; and the calculation array is also used for responding to the second control signal and executing vector calculation on the intermediate calculation result and the second input characteristic to obtain an output calculation result. The calculation circuit in the embodiment of the invention not only can support the tensor calculation, but also can support the vector calculation, and the tensor calculation and the vector calculation do not need to be realized through special calculation circuits respectively, so that the hardware overhead can be reduced, and the actual requirements can be well met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to integrated circuit technology, and in particular to a computing circuit and a computing method thereof, a chip, a storage medium and an electronic device. Background Art

[0002] At present, the application of chips is very extensive. Chips can include computing circuits. Generally speaking, tensor calculations and vector calculations need to be implemented through dedicated computing circuits respectively, which will result in very large hardware overhead and is difficult to meet actual needs. Summary of the invention

[0003] In order to solve the above technical problems, the present disclosure provides a computing circuit and a computing method thereof, a chip, a storage medium and an electronic device.

[0004] According to one aspect of an embodiment of the present disclosure, there is provided a computing circuit, including:

[0005] A memory, the memory being used to store the first input feature, the input weight, and the second input feature;

[0006] A control module, the control module is used to generate a first control signal and a second control signal;

[0007] A computing array, wherein the computing array is used to perform tensor calculations on the first input features and the input weights in response to the first control signal to obtain intermediate calculation results; the computing array is also used to perform vector calculations on the intermediate calculation results and the second input features in response to the second control signal to obtain output calculation results.

[0008] According to another aspect of an embodiment of the present disclosure, a chip is provided, comprising the above-mentioned computing circuit.

[0009] According to another aspect of the embodiments of the present disclosure, a calculation method based on a calculation circuit is provided, comprising:

[0010] generating a first control signal and a second control signal;

[0011] In response to the first control signal, performing tensor calculation on the first input feature and input weight stored in the memory in the computing circuit through the computing array in the computing circuit to obtain an intermediate calculation result;

[0012] In response to the second control signal, the calculation array performs vector calculation on the intermediate calculation result and the second input feature stored in the memory to obtain an output calculation result.

[0013] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned calculation method based on the calculation circuit.

[0014] According to another aspect of the embodiments of the present disclosure, an electronic device is provided, the electronic device comprising:

[0015] processor;

[0016] a memory for storing instructions executable by the processor;

[0017] The processor is used to read the executable instructions from the memory and execute the instructions to implement the above-mentioned calculation method based on the calculation circuit.

[0018] According to another aspect of the embodiments of the present disclosure, a computer program product is provided. When instructions in the computer program product are executed by a processor, the above-mentioned calculation method based on the calculation circuit is executed.

[0019] Based on the computing circuit and its computing method, chip, storage medium, electronic device and program product provided by the above-mentioned embodiments of the present disclosure, the computing circuit can be placed in a first working mode through a first control signal generated by a control module. In the first working mode, the computing array can perform tensor calculations on the first input feature obtained from the memory and the input weight obtained from the memory to obtain an intermediate calculation result. In addition, the computing circuit can be placed in a second working mode through a second control signal generated by the control module. In the second working mode, the computing array can perform vector calculations on the intermediate calculation results obtained in the first working mode and the second input feature obtained from the memory to obtain an output calculation result. It can be seen that through the collaborative work of the memory, the control module and the computing array, the computing circuit in the embodiments of the present disclosure can not only support tensor calculations, but also support vector calculations. Tensor calculations and vector calculations do not need to be implemented by dedicated computing circuits respectively, so it is beneficial to reduce hardware overhead and better meet actual needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 Some exemplary embodiments of the present disclosure provide schematic diagrams of the structure of a computing circuit.

[0021] Figure 2 Some other exemplary embodiments of the present disclosure provide schematic diagrams of the structures of computing circuits.

[0022] Figure 3 Schematic diagram of the structure of the computing array in some exemplary embodiments of the present disclosure.

[0023] Figure 4 Schematic diagram of the structure of the target computing element in some exemplary embodiments of the present disclosure.

[0024] Figure 5 Schematic diagram of the structure of the target computing element in other exemplary embodiments of the present disclosure.

[0025] Figure 6 It is a flowchart of a calculation method based on a calculation circuit provided by an exemplary embodiment of the present disclosure.

[0026] Figure 7 It is a flowchart of a method for controlling the state of a first selector in an exemplary embodiment of the present disclosure.

[0027] Figure 8 It is a flowchart of a method for controlling the state of a second selector in an exemplary embodiment of the present disclosure.

[0028] Fig. 9 is a structural diagram of an electronic device provided by some exemplary embodiments of the present disclosure. DETAILED DESCRIPTION

[0029] To explain the present disclosure, example embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. It should be understood that the present disclosure is not limited to the example embodiments.

[0030] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0031] Application Overview

[0032] The chip may include a computing circuit for implementing tensor calculations and a computing circuit for implementing vector calculations. Tensor calculations may also be referred to as matrix calculations. Tensor calculations may include convolution calculations. Convolution calculations may include, but are not limited to, two-dimensional convolution calculations, three-dimensional convolution calculations, and the like. Vector calculations may also be referred to as vector calculations. Vector calculations may include point-to-point element-wise calculations. Point-to-point element-wise calculations may include, but are not limited to, point-to-point element-wise multiplication calculations, point-to-point element-wise addition calculations, and the like.

[0033] It should be pointed out that since tensor calculations and vector calculations need to be implemented through dedicated computing circuits respectively, the hardware overhead is very large and it is difficult to meet actual needs.

[0034] Exemplary Systems

[0035] An embodiment of the present disclosure provides a computing circuit. The computing circuit can be configured to include two operating modes, namely a first operating mode and a second operating mode. In the first operating mode, the computing circuit can perform tensor calculations. In the second operating mode, the computing circuit can perform vector calculations. In this way, tensor calculations and vector calculations can be implemented by the same computing circuit, without having to implement tensor calculations and vector calculations by dedicated computing circuits respectively, which is conducive to reducing hardware overhead and better meeting actual needs.

[0036] Example Circuit

[0037] Figure 1 is a schematic diagram of the structure of a computing circuit provided by some exemplary embodiments of the present disclosure. Figure 2 Schematic diagram of a computing circuit provided by some other exemplary embodiments of the present disclosure. Figure 1 , Figure 2 As shown, the calculation circuit may include:

[0038] A memory 10, the memory 10 is used to store the first input feature, the input weight and the second input feature;

[0039] A control module 20, the control module 20 is used to generate a first control signal and a second control signal;

[0040] The computing array 30 is used to perform tensor calculations on the first input feature and the input weight in response to a first control signal to obtain an intermediate calculation result; the computing array 30 is also used to perform vector calculations on the intermediate calculation result and the second input feature in response to a second control signal to obtain an output calculation result.

[0041] Optionally, the memory 10 may be a module for storing data. The memory 10 may also be referred to as an on-chip memory, including but not limited to a synchronous dynamic random access memory (SDRAM), a register file, a flash memory, etc. Specifically, the memory 10 may be used to store a first input feature, an input weight, and a second input weight. The first input feature may be in the form of an image or a data representation of a feature map. The input weight may be in the form of a data representation of a convolution kernel. The second input feature may be in the form of an image or a data representation of a feature map.

[0042] Optionally, the computing array 30 may be a module that supports tensor computing and vector computing. The computing array 30 may be electrically connected to the memory 10 so that the memory 10 transmits data to be calculated to the computing array 30. It should be noted that the basic calculations involved in tensor computing and vector computing are both multiplication and addition calculations, which can be considered as a combination of multiplication and addition calculations. Figure 2 , Figure 3 As shown, the computing array 30 may include multiple computing elements 301 , each of which may be used to perform multiplication and addition calculations, and the calculation results corresponding to the multiple computing elements 301 may be combined into an output calculation result of the computing array 30 .

[0043] Optionally, the control module 20 may be a module for controlling other modules. The control module 20 may be electrically connected to the memory 10 and the computing array 30, respectively, so that the control module 20 controls the memory 10 and the computing array 30. For example, the control module 20 may generate a first control signal and a second control signal to control the computing array 30 to perform tensor calculations through the first control signal and to control the computing array 30 to perform vector calculations through the second control signal. For another example, the control module 20 may generate a read / write request to control the memory 10 to transmit data to be calculated to the computing array 30 through the read / write request.

[0044] In an embodiment of the present disclosure, the computing circuit can be placed in a first working mode by a first control signal generated by the control module 20. In the first working mode, the computing array 30 can perform tensor calculations on the first input feature obtained from the memory 10 and the input weight obtained from the memory 10 to obtain an intermediate calculation result. The intermediate calculation result can be in the form of a data representation of a feature map. Assuming that the first input feature is a feature map F1, the input weight is a convolution kernel W1, and the intermediate calculation result is a feature map F2, then: F2 = F1 * W1. In addition, the computing circuit can be placed in a second working mode by a second control signal generated by the control module 20. In the second working mode, the computing array 30 can perform vector calculations on the intermediate calculation result obtained in the first working mode and the second input feature obtained from the memory 10 to obtain an output calculation result. The output calculation result can be in the form of a data representation of a feature map. Assuming that the second input feature is a feature map F3, the vector calculation is represented by a function f, and the output calculation result is a feature map F4, then: F4 = f (F2, F3). In one example, vector calculation includes point-to-point element-by-element addition calculation, then: F4=f(F2, F3)=F2+F3. In another example, vector calculation includes point-to-point element-by-element multiplication calculation, then: F4=f(F2, F3)=F2*F3. It can be seen that through the collaborative work of the memory 10, the control module 20 and the computing array 30, the computing circuit in the embodiment of the present disclosure can not only support tensor calculation, but also support vector calculation. Tensor calculation and vector calculation do not need to be implemented by dedicated computing circuits respectively, which is conducive to reducing hardware overhead and better meeting actual needs.

[0045] In some optional examples, the computing array 30 may include a plurality of computing elements 301;

[0046] The computing array 30 is used to perform tensor calculation on the first input feature and the input weight in response to the first control signal to obtain an intermediate calculation result, which may include:

[0047] Any computing element 301 among the multiple computing elements 301 is used as a target computing element, and the target computing element is used to respond to a first target control signal in the first control signal pointing to the target computing element, receive the first sub-input feature in the first input feature and the sub-input weight in the input weight and perform multiplication and addition calculations to obtain an intermediate calculation sub-result in the intermediate calculation result.

[0048] Optionally, the plurality of computing elements 301 included in the computing array 30 may be represented as S computing elements 301, and the first control signal may include control signals corresponding to the S computing elements 301. The control signal corresponding to any computing element 301 in the first control signal may be a control signal provided to the computing element 301 to assist in implementing tensor calculations, and the control signal may also be referred to as a control signal directed to the computing element 301.

[0049] It should be noted that, in order to obtain an intermediate calculation result, each of the S calculation elements 301 can be run several times, and each calculation element 301 can obtain an intermediate calculation sub-result after one run, and all the intermediate calculation sub-results can be combined into an intermediate calculation result.

[0050] If any computing element 301 among the S computing elements 301 is used as a target computing element, the control signal corresponding to the computing element 301 in the first control signal can be used as a first target control signal. The control module 20 can transmit the first target control signal to the target computing element. In addition, the control module 20 can send a read and write request to the memory 10 so that the memory 10 transmits the first sub-input feature in the first input feature and the sub-input weight in the input weight to the target computing element. In response to the first target control signal from the control module 20, the target computing element can receive the first sub-input feature and the sub-input weight from the memory 10, and perform multiplication and addition calculations on the first sub-input feature and the sub-input weight to obtain an intermediate calculation sub-result. Continuing with the example above, the first input feature is the feature map F1, the input weight is the convolution kernel W1, the intermediate calculation result is the feature map F2, the first sub-input feature can be a local pixel block in the feature map F1, and the sub-input weight can be the weighted weight data for the pixel values ​​of each pixel point included in the local pixel block in the convolution kernel W1. By performing multiplication and addition calculations on the first sub-input feature and the sub-input weight, the pixel value of the pixel point corresponding to the local pixel block in the feature map F2 can be obtained, and the pixel value of the pixel point can be used as an intermediate calculation sub-result obtained by a single operation of the target calculation unit.

[0051] What is introduced above is the case where the pixel value of a single pixel point is used as a single intermediate calculation sub-result. The composition of a single intermediate calculation sub-result is not limited to this. For example, the first sub-input feature may include at least two local image blocks in the feature map F1, and the sub-input weight may include at least two weight data corresponding to the at least two local image blocks and used for pixel value weighting. For each of the at least two local image blocks, a multiplication and addition calculation may be performed on the local image block and the corresponding weight data, thereby obtaining the pixel values ​​of at least two pixels corresponding to the at least two local image blocks in the feature map F2, and the pixel values ​​of the at least two pixels may constitute an intermediate calculation sub-result.

[0052] According to the above-introduced method, the intermediate calculation sub-results corresponding to the S calculation elements 301 can be obtained, and these intermediate calculation sub-results can constitute the intermediate calculation result.

[0053] It can be seen that each computing element 301 in the computing array 30 can concurrently perform multiplication and addition calculations to obtain corresponding intermediate calculation sub-results, and all intermediate calculation sub-results can form an intermediate calculation result, which is equivalent to obtaining an intermediate calculation result through tensor calculation at the computing array 30. Since different computing elements 301 can concurrently perform multiplication and addition calculations, it is beneficial to improve the calculation efficiency of tensor calculations.

[0054] In some optional examples, the first sub-input feature may include N feature elements, and the sub-input weight may include N weight elements corresponding to the N feature elements one by one; the target computing element may obtain the intermediate computing sub-result through N clock cycles;

[0055] like Figure 4 As shown, the target computing element may include a multiplier 31, a register 33 and an adder 35, and the target computing element may be configured as follows:

[0056] A multiplier 31, in an i-th clock cycle in N clock cycles, the multiplier 31 is used to receive an i-th characteristic element in the N characteristic elements and an i-th weight element in the N weight elements and perform a multiplication calculation to obtain an i-th first product value; wherein i is an integer greater than or equal to 1 and less than or equal to N;

[0057] Register 33, register 33 is used to store the calculation result output by adder 35 in the most recent clock cycle;

[0058] The adder 35 is used to perform an addition calculation on the calculation result output by the adder 35 in the most recent clock cycle stored in the register 33 and the i-th first product value output by the multiplier 31 in the i-th clock cycle, to obtain the first sum value output by the adder 35 in the i-th clock cycle, and to use the first sum value output by the adder 35 in the N-th clock cycle as the intermediate calculation sub-result;

[0059] The calculation result output by the adder 35 in the most recent clock cycle includes the first sum value obtained by the adder 35 performing the addition calculation in the most recent clock cycle.

[0060] Optionally, the input weights may be in the form of convolution kernels, and the value of N may be determined based on the size of the convolution kernel. For example, if the size of the convolution kernel is 2*2, it means that the width and height of the convolution kernel are both 2, then N=2*2=4. For another example, if the size of the convolution kernel is 3*3, it means that the width and height of the convolution kernel are both 3, then N=3*3=9.

[0061] Optionally, the adder 35 may be electrically connected to the multiplier 31 and the register 33 respectively, so that the output of the multiplier 31 may be transmitted to the adder 35 , and the output of the adder 35 may be transmitted to the register 33 .

[0062] Optionally, the chip to which the computing circuit belongs may include a clock source, and the clock source may be used to provide clock signals to various components in the computing circuit.

[0063] As described above, assuming that the first input feature is feature map F1, the input weight is convolution kernel W1, and the intermediate calculation result is feature map F2, then: F2 = F1 * W1. Assuming N = 2 * 2 = 4, the intermediate calculation sub-result that the target calculation unit needs to calculate is the pixel value of the pixel point located in the upper left corner of feature map F2, and, in order from left to right and from top to bottom, the pixel values ​​of the four pixels located in the upper left area of ​​feature map F1 are respectively a1, a2, a3, and a4, and in order from left to right and from top to bottom, the four weight elements in convolution kernel W1 are respectively b1, b2, b3, and b4. Then, the first feature element, the second feature element, the third feature element, and the fourth feature element of the N feature elements included in the first sub-input feature can be respectively a1, a2, a3, and a4, and the first weight element, the second weight element, the third weight element, and the fourth weight element of the N weight elements included in the sub-input weight can be respectively b1, b2, b3, and b4. In addition, the register 33 may store an initial register value, and the initial register value is, for example but not limited to, 0.

[0064] In the first clock cycle of the N clock cycles, the multiplier 31 can receive a1 as the first characteristic element and b1 as the first weight element and perform a multiplication calculation to obtain and output a1*b1 as the first first product value. Correspondingly, the adder 35 can receive a1*b1 from the multiplier 31. The adder 35 can perform an addition calculation on a1*b1 and the current initial register value (which can be 0) of the register 33 to obtain and output a1*b1 as the current first sum value. The current register value of the register 33 can be updated from 0 to a1*b1 as the current first sum value.

[0065] In the second clock cycle of the N clock cycles, the multiplier 31 can obtain a2*b2 as the second first product value by performing a multiplication calculation. Accordingly, the adder 35 can receive a2*b2 from the multiplier 31. The adder 35 can perform an addition calculation on a2*b2 and a1*b1 as the current register value of the register 33, and obtain and output a1*b1+a2*b2 as the current first sum value. The current register value of the register 33 can be updated from a1*b1 to a1*b1+a2*b2 as the current first sum value.

[0066] In the third clock cycle of the N clock cycles, the multiplier 31 can obtain a3*b3 as the third first product value by performing a multiplication calculation. Accordingly, the adder 35 can receive a3*b3 from the multiplier 31. The adder 35 can perform an addition calculation on a3*b3 and a1*b1+a2*b2 as the current register value of the register 33, and obtain and output a1*b1+a2*b2+a3*b3 as the current first sum value. The current register value of the register 33 can be updated from a1*b1+a2*b2 to a1*b1+a2*b2+a3*b3 as the current first sum value.

[0067] In the fourth clock cycle of the N clock cycles, the multiplier 31 can obtain a4*b4 as the fourth first product value through multiplication calculation. Accordingly, the adder 35 can receive a4*b4 from the multiplier 31, and the adder 35 can perform addition calculation on a4*b4 and a1*b1+a2*b2+a3*b3 as the current register value of the register 33, and obtain and output a1*b1+a2*b2+a3*b3+a4*b4 as the first sum value. The current register value of the register 33 can be updated from a1*b1+a2*b2+a3*b3 to a1*b1+a2*b2+a3*b3+a4*b4 as the current first sum value. a1*b1+a2*b2+a3*b3+a4*b4 can be used as the intermediate calculation sub-result corresponding to the target calculation element.

[0068] In some embodiments, in the first clock cycle of the N clock cycles, after the multiplier 31 performs the multiplication calculation to obtain a1*b1 as the first first product value, the multiplier 31 may not transmit a1*b1 to the adder 35, but directly transmit a1*b1 to the register 33 for storage, and accordingly, the adder 35 does not need to perform the addition calculation on a1*b1 and 0. Of course, in order for the multiplier 31 to be able to directly transmit a1*b1 to the register 33, an additional direct bus needs to be added between the multiplier 31 and the register 33.

[0069] In some embodiments, if the storage space in register 33 is sufficient, the stored value in register 33 may not be replaced and updated in N clock cycles. Instead, the first sum value obtained each time may be stored in register 33. When addition calculation needs to be performed by adder 35, register 33 may transmit the stored corresponding first sum value to adder 35.

[0070] It can be seen that the intermediate calculation sub-result is essentially obtained by accumulating several first product values, and the accumulation of several first product values ​​is not achieved in one go, but is achieved through several clock cycles, which is equivalent to spreading the accumulation of several first product values ​​in time, which is conducive to reducing the number of multipliers 33 and adders 35 that need to be set, thereby saving hardware resources. In addition, the target computing element includes a multiplier 31, a register 33 and an adder 35, and the overall structure of the target computing element is relatively simple and low in cost.

[0071] In some optional examples, such as Figure 4 As shown, the target computing element may also include:

[0072] a first selector 37, the first selector 37 being used to, in response to a first state control signal in the first target control signal, turn on a weight transmission bus between the memory 10 and the multiplier 31 so that the multiplier 31 receives each weight element in the sub-input weight;

[0073] The second selector 39 is used to respond to the second state control signal in the first target control signal, turn on the register value transmission bus between the register 33 and the adder 35, so that the adder 35 receives the calculation result of the adder 35 output in the most recent clock cycle stored in the register 33.

[0074] Optionally, the first selector 37 may be configured to include two states, namely a first state and a second state. In the first state of the first selector 37, the first selector 37 may turn on the weight transmission bus between the memory 10 and the multiplier 31. In the second state of the first selector 37, the first selector 37 may not turn on the weight transmission bus between the memory 10 and the multiplier 31. The weight transmission bus may be a bus for transmitting weight elements.

[0075] Optionally, the second selector 39 may be configured to include two states, namely a first state and a second state. In the first state of the second selector 39, the second selector 39 may turn on the register value transmission bus between the register 33 and the adder 35. In the second state of the second selector 39, the second selector 39 may not turn on the register value transmission bus between the register 33 and the adder 35. The register value transmission bus may be a bus for transmitting the current register value in the register 33.

[0076] Optionally, the first target control signal may include a first state control signal and a second state control signal. The first state control signal may be used to perform state control on the first selector 37. The second state control signal may be used to perform state control on the second selector 39.

[0077] In an embodiment of the present disclosure, in response to a first state control signal, the first selector 37 can be placed in a first state to turn on the weight transmission bus between the memory 10 and the multiplier 31. In this way, through the weight transmission bus, each weight element in the sub-input weight can be transmitted from the memory 10 to the multiplier 31. Accordingly, the multiplier 30 can obtain each first product value by performing a multiplication calculation. In response to a second state control signal, the second selector 39 can be placed in a first state to turn on the register value transmission bus between the register 33 and the adder 35. In this way, through the register value transmission bus, the current register value in the register 33 can be transmitted from the register 33 to the adder 35. Accordingly, the adder 35 can obtain the corresponding first sum value by performing an addition calculation. In this way, through N clock cycles, the target computing element can obtain an intermediate calculation sub-result. Optionally, the entire process of the target computing element obtaining the intermediate calculation sub-result through N clock cycles can be considered as a run of the target computing unit.

[0078] It can be seen that by controlling the states of the first selector 37 and the second selector 39, corresponding data can be efficiently and reliably provided to the multiplier 31 and the adder 35 for calculation, so that the target computing element successfully obtains the intermediate calculation sub-result.

[0079] In some optional examples, the computing array 30 may include a plurality of computing elements 301;

[0080] The calculation array 30 is further used to perform vector calculation on the intermediate calculation result and the second input feature in response to the second control signal to obtain the output calculation result, which may include:

[0081] Any computing element 301 among the multiple computing elements 301 is used as a target computing element, and the target computing element is used to respond to a second target control signal in the second control signal pointing to the target computing element, receive the second sub-input feature in the second input feature and the intermediate calculation sub-result corresponding to the target computing element in the intermediate calculation result, and perform multiplication and addition calculations to obtain the output calculation sub-result in the output calculation result.

[0082] Optionally, the plurality of computing elements 301 included in the computing array 30 may be represented as S computing elements 301, and the second control signal may include control signals corresponding to the S computing elements 301. The control signal corresponding to any computing element 301 in the second control signal may be a control signal provided to the computing element 301 to assist in implementing vector calculations, and the control signal may also be referred to as a control signal directed to the computing element 301.

[0083] It should be noted that, in order to obtain the output calculation result, each of the S calculation elements 301 can be run several times, and each calculation element 301 can obtain an output calculation sub-result after one run, and all output calculation sub-results can be combined into the output calculation result.

[0084] If any computing element 301 among the S computing elements 301 is used as a target computing element, the control signal corresponding to the computing element 301 in the second control signal can be used as a second target control signal. The control module 20 can transmit the second target control signal to the target computing element. In addition, the control module 20 can send a read and write request to the memory 10 so that the memory 10 transmits the second sub-input feature in the second input feature to the target computing element. In response to the second target control signal from the control module 20, the target computing element can receive the second sub-input feature from the memory 10, and the target computing element can also receive the intermediate calculation sub-result corresponding to the target computing element in the intermediate calculation result, and perform multiplication and addition calculations on the second sub-input feature and the intermediate calculation sub-result to obtain the output calculation sub-result corresponding to the target computing element. Continuing with the example above, the intermediate calculation result is feature map F2, the second input feature is feature map F3, the output calculation result is feature map F4, and the intermediate calculation sub-result corresponding to the target computing element is the pixel value of a pixel point in feature map F2 (hereinafter referred to as the first pixel point for ease of description). Then the second sub-input feature can be the pixel value of the second pixel point in feature map F3, and the distribution position of the second pixel point in feature map F3 can be consistent with the distribution position of the first pixel point in feature map F2. For example, the first pixel point is the pixel point located in the upper left corner of feature map F2, and the second pixel point is the pixel point located in the upper left corner of feature map F3. By performing multiplication and addition calculations on the first sub-input feature and the sub-input weight, the pixel value of the third pixel point in feature map F4 can be obtained, and the distribution position of the third pixel point in feature map F4 can be consistent with the distribution position of the first pixel point in feature map F2, and the pixel value of the third pixel point can be used as an output calculation sub-result corresponding to the target computing element.

[0085] The above description is about the case where the pixel value of a single pixel point is used as a single output calculation sub-result. Referring to the above description of the intermediate calculation sub-result, a single output calculation sub-result may also be composed of the pixel values ​​of at least two pixels.

[0086] According to the above-described method, the output calculation sub-results corresponding to the S calculation elements 301 can be obtained, and these output calculation sub-results can constitute the output calculation result.

[0087] It can be seen that each computing element 301 in the computing array 30 can concurrently perform multiplication and addition calculations to obtain corresponding output calculation sub-results, and all output calculation sub-results can form an output calculation result, which is equivalent to obtaining an output calculation result through vector calculation at the computing array 30. Since different computing elements 301 can concurrently perform multiplication and addition calculations, it is beneficial to improve the calculation efficiency of vector calculations.

[0088] It should be noted that tensor computing often involves data reuse. For example, each operation of the target computing element uses the four weight elements b1, b2, b3, and b4, that is, b1, b2, b3, and b4 are reused. For another example, a certain operation of the target computing element uses the four characteristic elements a1, a2, a3, and a4, and another operation of the target computing element uses the four characteristic elements a2, a4, a5, and a7, that is, a2 and a4 are reused. For another example, a certain operation of the target computing element uses the four characteristic elements a1, a2, a3, and a4, as well as the four weight elements b1, b2, b3, and b4, and another operation of the target computing element uses the four characteristic elements a1, a2, a3, and a4, as well as the four weight elements b5, b6, b7, and b8, that is, a1, a2, a3, and a4 are reused. In this way, tensor computing has a smaller demand for bandwidth. In addition, since vector calculation follows tensor calculation, and in tensor calculation, the accumulation of several first product values ​​is spread out in time, it is beneficial to dilute the bandwidth required for vector calculation from the time dimension, and the difference in bandwidth requirements between tensor calculation and vector calculation can be reduced.

[0089] In some optional examples, the second sub-input feature may include a multiplier feature and an addend feature, such as Figure 5 As shown, the target computing element may include:

[0090] Register 33, register 33 is used to store intermediate calculation results;

[0091] The multiplier 31 is used to receive the multiplier characteristic and the intermediate calculation sub-result stored by the register 33 and perform a multiplication calculation to obtain a second product value;

[0092] The adder 35 is used to receive the addend feature and the second product value output by the multiplier 31 and perform addition calculation to obtain a second sum value, and use the second sum value as the output calculation sub-result.

[0093] Optionally, intermediate computation results can be obtained using Figure 4 The intermediate calculation result can be stored in the register 33.

[0094] Optionally, the adder 35 may be electrically connected to the multiplier 31 , so that the output of the multiplier 31 may be transmitted to the adder 35 .

[0095] In the embodiment of the present disclosure, the multiplier 31 can receive a multiplier feature from the memory 10. The multiplier feature can be an operand for multiplying other values. The multiplier 31 can also receive an intermediate calculation sub-result from the register 33. The multiplier 31 can perform a multiplication calculation on the multiplier feature and the intermediate calculation sub-result to obtain and output a second product value. Correspondingly, the adder 35 can receive the second product value from the multiplier 31. The adder 35 can also receive an addend feature from the memory 10. The addend feature can be an operand for adding other values. The adder 35 can perform an addition calculation on the addend feature and the second product value to obtain a second sum value as an output calculation sub-result. In this way, through the coordinated work of the multiplier 31, the register 33 and the adder 35, the output calculation sub-result can be obtained efficiently and reliably. In addition, the overall structure of the target computing element is relatively simple and low in cost.

[0096] In one example, the output calculation result is a feature map F4, the intermediate calculation sub-result that the target calculation element needs to calculate is the pixel value of the pixel point located in the upper left corner of the feature map F4, and the second input feature is two feature maps, namely, feature map F3' and feature map F3'', feature map F3' corresponds to the multiplication calculation logic, and feature map F3'' corresponds to the addition calculation logic, then the feature element located in the upper left corner of the feature map F3' can be used as the multiplier feature in the second sub-input feature, and the feature element located in the upper left corner of the feature map F3'' can be used as the addend feature in the second sub-input feature. According to the multiplier feature, the addend feature and the intermediate calculation sub-result, by sequentially performing multiplication calculation and addition calculation, the output calculation sub-result can be obtained. The output calculation sub-results corresponding to each of the S calculation elements 301 can constitute the output calculation result. In this way, the feature map F4 can be calculated using the following formula: F4 = F3'*F2+F3''.

[0097] It can be seen from the above formula that if all the characteristic elements in the characteristic graph F3' are 1, then: F4 = F3'*F2 + F3'' = F2 + F3'', then the vector calculation performed by the calculation array 30 can be specifically a point-to-point element-by-element addition calculation. It can also be seen from the above formula that if all the characteristic elements in the characteristic graph F3'' are 0, then: F4 = F3'*F2 + F3'' = F3'*F2, then the vector calculation performed by the calculation array 30 can be specifically a point-to-point element-by-element multiplication calculation.

[0098] In some optional examples, such as Figure 5 As shown, the target computing element may also include:

[0099] a first selector 37, the first selector 37 being used for, in response to a third state control signal in the second target control signal, turning on a register value transmission bus between the register 33 and the multiplier 31, so that the multiplier 31 receives the intermediate calculation result stored by the register 33;

[0100] The second selector 39 is used for responding to the fourth state control signal in the second target control signal to turn on the addend transmission bus between the memory 10 and the adder 35 so that the adder 35 receives the addend feature.

[0101] Optionally, the first selector 37 may be configured to include two states, namely a first state and a second state. In the second state of the first selector 37, the first selector 37 may turn on the register value transmission bus between the register 33 and the multiplier 31. In the first state of the first selector 37, the first selector 37 may not turn on the register value transmission bus between the register 33 and the multiplier 31. The register value transmission bus may be a bus for transmitting the current register value in the register 33.

[0102] Optionally, the second selector 39 may also be configured to include two states, namely a first state and a second state. In the second state of the second selector 39, the second selector 39 may turn on the addend transmission bus between the memory 10 and the adder 35. In the second state of the second selector 39, the second selector 39 may not turn on the addend transmission bus between the memory 10 and the adder 35. The addend transmission bus may be a bus for transmitting addend characteristics.

[0103] Optionally, the second target control signal may include a third state control signal and a fourth state control signal. The third state control signal may be used to perform state control on the first selector 37. The fourth state control signal may be used to perform state control on the second selector 39.

[0104] In the embodiment of the present disclosure, in response to the third state control signal, the first selector 37 can be placed in the second state to turn on the register value transmission bus between the register 33 and the multiplier 31. In this way, the intermediate calculation sub-result stored by the register 33 can be transmitted from the register 33 to the multiplier 31 through the register value transmission bus. Accordingly, the multiplier 31 can obtain the second product value by performing the multiplication calculation. In response to the fourth state control signal, the second selector 39 can be placed in the second state to turn on the addend transmission bus between the memory 10 and the adder 35. In this way, the addend feature can be transmitted from the memory 10 to the adder 35 through the addend transmission bus, and accordingly, the adder 35 can obtain the output calculation sub-result by performing the addition calculation.

[0105] It can be seen that by controlling the states of the first selector 37 and the second selector 39, corresponding data can be efficiently and reliably provided to the multiplier 31 and the adder 35 for calculation, so that the target computing element successfully obtains the output calculation sub-result.

[0106] In some optional embodiments of the present disclosure, Figure 4 , Figure 5 As shown, the first selector 37 may include a first input terminal P1, a second input terminal P2 and a first output terminal P3. The first input terminal P1 may be electrically connected to the memory 10. The second input terminal P2 may be electrically connected to the register 33. The first output terminal P3 may be electrically connected to the multiplier 31. The first state control signal may be used to turn on the first input terminal P1 and the first output terminal P3, and turn off the second input terminal P2 and the first output terminal P3, so as to place the first selector 37 in the first state. At this time, the weight transmission bus (which may include bus 41 and bus 42) between the memory 10 and the multiplier 31 may be turned on, and the register value transmission bus (which may include bus 43 and bus 42) between the register 33 and the multiplier 31 may not be turned on. The third state control signal may be used to turn off the first input terminal P1 and the first output terminal P3, and turn on the second input terminal P2 and the first output terminal P3, so as to place the first selector 37 in the second state. At this time, the weight transmission bus (which may include bus 41 and bus 42) between the memory 10 and the multiplier 31 may not be conductive, while the register value transmission bus (which may include bus 43 and bus 42) between the register 33 and the multiplier 31 may be conductive. It should be noted that Figure 4 , Figure 5 In the figure, the dotted line indicates cut-off, and the solid line indicates conduction.

[0107] In some optional embodiments of the present disclosure, Figure 4 , Figure 5As shown, the second selector 39 may include a third input terminal P4, a fourth input terminal P5, and a second output terminal P6. The third input terminal P4 may be electrically connected to the register 33. The fourth input terminal P5 may be electrically connected to the memory 10. The second output terminal P6 may be electrically connected to the adder 35. The second state control signal may be used to turn on the third input terminal P4 and the second output terminal P6, and turn off the fourth input terminal P5 and the second output terminal P6, so as to place the second selector 39 in the first state. At this time, the register value transmission bus (which may include bus 44 and bus 45) between the register 33 and the adder 35 may be turned on, and the addend transmission bus (which may include bus 46 and bus 45) between the memory 10 and the adder 35 may not be turned on. The fourth state control signal may be used to turn off the third input terminal P4 and the second output terminal P6, and turn on the fourth input terminal P5 and the second output terminal P6, so as to place the second selector 39 in the second state. At this time, the register value transmission bus (which may include bus 44 and bus 45) between register 33 and adder 35 may be closed, while the addend transmission bus (which may include bus 46 and bus 45) between memory 10 and adder 35 may be closed.

[0108] In this way, by controlling the states of the first selector 37 and the second selector 39, the computing array 30 can perform tensor calculations in some cases and vector calculations in other cases, so that the computing array 30 supports both tensor calculations and vector calculations.

[0109] In summary, by using the embodiments of the present disclosure, by adding a number of selectors, each computing element 301 can be time-division multiplexed, so that at a relatively low cost, the computing circuit supports both tensor computing and vector computing, which is beneficial to reducing hardware overhead. Since vector computing follows tensor computing, and the accumulation of a number of first product values ​​in tensor computing is spread out in time, it is beneficial to dilute the bandwidth required for vector computing from the time dimension, and it is beneficial to balance the bandwidth requirements of tensor computing and vector computing, so it is beneficial to unify the two computing logics of tensor computing and vector computing in the architecture.

[0110] An embodiment of the present disclosure further provides a chip, comprising the computing circuit in any of the above embodiments.

[0111] Since the computing circuit can achieve the above-mentioned technical effects, the chip including the computing circuit can also achieve the corresponding technical effects, which will not be elaborated here.

[0112] Exemplary Methods

[0113] Figure 6 It is a flowchart of a computing method based on a computing circuit provided by some exemplary embodiments of the present disclosure. Figure 6 The methods shown may include:

[0114] Step 610, generating a first control signal and a second control signal;

[0115] Step 620, in response to the first control signal, performing tensor calculation on the first input feature and the input weight stored in the memory in the computing circuit through the computing array in the computing circuit to obtain an intermediate calculation result;

[0116] Step 630: In response to the second control signal, a vector calculation is performed on the intermediate calculation result and the second input feature stored in the memory through the calculation array to obtain an output calculation result.

[0117] In some optional examples, the computing array includes multiple computing elements, any computing element among the multiple computing elements is used as a target computing element, and the target computing element may include a multiplier, a register, an adder, a first selector, and a second selector. Figure 7 is a flowchart of a method for controlling the state of a first selector provided by some exemplary embodiments of the present disclosure. Figure 7 The methods shown may include:

[0118] Step 710, in response to a first state control signal in the first control signal, placing the first selector in a state of conducting a weight transmission bus between the memory and the multiplier;

[0119] Step 720: In response to the second state control signal in the first control signal, the second selector is placed in a state of turning on the register value transmission bus between the register and the adder.

[0120] Optionally, step 710 and step 720 may be performed after step 610 of the present disclosure.

[0121] In some optional examples, the computing array includes multiple computing elements, any computing element among the multiple computing elements is used as a target computing element, and the target computing element may include a multiplier, a register, an adder, a first selector, and a second selector. Figure 8 is a flowchart of a method for controlling the state of a second selector provided by some exemplary embodiments of the present disclosure. Figure 8 The methods shown may include:

[0122] Step 810, in response to a third state control signal in the second control signal, placing the first selector in a state of turning on a register value transmission bus between the register and the multiplier;

[0123] Step 820: In response to a fourth state control signal in the second control signal, the second selector is placed in a state of conducting the addend transmission bus between the memory and the adder.

[0124] Optionally, step 810 and step 820 may be performed after step 610 of the present disclosure.

[0125] In the method disclosed in the present invention, various optional embodiments, optional implementation methods and optional examples disclosed in the above exemplary circuit part can be flexibly selected and combined as needed to achieve corresponding functions and effects, and the present invention does not list them one by one.

[0126] The beneficial technical effects corresponding to the exemplary embodiment of the method can be found in the corresponding beneficial technical effects of the above exemplary circuit part, which will not be repeated here.

[0127] Exemplary Electronic Devices

[0128] Fig. 9 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. The electronic device 900 includes one or more processors 910 and a memory 920 .

[0129] The processor 910 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 900 to perform desired functions.

[0130] The memory 920 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 910 may execute one or more computer program instructions to implement the methods of the various embodiments of the present disclosure described above and / or other desired functions.

[0131] In one example, the electronic device 900 may further include: an input device 930 and an output device 940 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0132] The input device 930 may also include, for example, a keyboard, a mouse, etc.

[0133] The output device 940 can output various information to the outside, and may include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.

[0134] Of course, to simplify, Fig. 9Only some of the components related to the present disclosure in the electronic device 900 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 900 may also include any other appropriate components.

[0135] Exemplary computer program products and computer-readable storage media

[0136] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the method according to various embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of this specification.

[0137] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0138] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the method according to various embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.

[0139] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0140] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations. It cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present disclosure. The specific details disclosed above are only for the purpose of illustration and ease of understanding, not limitation. The above details do not limit the present disclosure to being implemented by adopting the above specific details.

[0141] Those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present disclosure claims and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. A computing circuit, comprising: A memory, the memory being used to store the first input feature, the input weight, and the second input feature; A control module, the control module is used to generate a first control signal and a second control signal; a computing array, the computing array being used to perform tensor calculation on the first input feature and the input weight in response to the first control signal to obtain an intermediate calculation result; The calculation array is also used to perform vector calculation on the intermediate calculation result and the second input feature in response to the second control signal to obtain an output calculation result.

2. The computing circuit according to claim 1, wherein: The computing array includes a plurality of computing elements; The computing array is used to perform tensor calculation on the first input feature and the input weight in response to the first control signal to obtain an intermediate calculation result, including: Any one of the multiple computing elements is used as a target computing element, and the target computing element is used to respond to a first target control signal in the first control signal pointing to the target computing element, receive a first sub-input feature in the first input feature and a sub-input weight in the input weight and perform multiplication and addition calculations to obtain an intermediate calculation sub-result in the intermediate calculation result.

3. The computing circuit according to claim 2, wherein: The first sub-input feature includes N feature elements, and the sub-input weight includes N weight elements corresponding to the N feature elements one by one; The target computing element obtains the intermediate computing sub-result through N clock cycles; The target computing element includes a multiplier, a register and an adder, and the target computing element is configured as follows: A multiplier, in an i-th clock cycle among the N clock cycles, the multiplier is used to receive the i-th characteristic element among the N characteristic elements and the i-th weight element among the N weight elements and perform a multiplication calculation to obtain an i-th first product value; wherein i is an integer greater than or equal to 1 and less than or equal to N; A register, the register being used to store the calculation result output by the adder in the most recent clock cycle; an adder, wherein when the ith clock cycle does not belong to the first clock cycle, the adder is used to perform addition calculation on the calculation result output by the adder in the most recent clock cycle stored in the register and the ith first product value output by the multiplier in the ith clock cycle to obtain the first sum value output by the adder in the ith clock cycle, and use the first sum value output by the adder in the Nth clock cycle as the intermediate calculation sub-result; The calculation result output by the adder in the most recent clock cycle includes the first sum value obtained by the addition calculation performed by the adder in the most recent clock cycle.

4. The computing circuit according to claim 3, wherein: The target computing element further comprises: a first selector, the first selector being used for switching on a weight transmission bus between the memory and the multiplier in response to a first state control signal in the first target control signal, so that the multiplier receives each of the weight elements in the sub-input weights; A second selector, the second selector is used to respond to a second state control signal in the first target control signal, turn on the register value transmission bus between the register and the adder, so that the adder receives the calculation result of the adder output in the most recent clock cycle stored in the register.

5. The computing circuit according to claim 1, wherein: The computing array includes a plurality of computing elements; The calculation array is further used to perform vector calculation on the intermediate calculation result and the second input feature in response to the second control signal to obtain an output calculation result, including: Any one of the multiple computing elements is used as a target computing element, and the target computing element is used to respond to a second target control signal in the second control signal pointing to the target computing element, receive the second sub-input feature in the second input feature and the intermediate calculation sub-result corresponding to the target computing element in the intermediate calculation result, and perform multiplication and addition calculations to obtain an output calculation sub-result in the output calculation result.

6. The computing circuit according to claim 5, wherein: The second sub-input feature includes a multiplier feature and an addend feature, and the target computing element includes: A register, the register being used to store the intermediate calculation sub-result; a multiplier, the multiplier being configured to receive the multiplier characteristic and the intermediate calculation sub-result stored by the register and perform a multiplication calculation to obtain a second product value; An adder, the adder is used to receive the addend feature and the second product value output by the multiplier and perform an addition calculation to obtain a second sum value, and use the second sum value as the output calculation sub-result.

7. The computing circuit according to claim 6, wherein: The target computing element further comprises: a first selector, the first selector being used for switching on a register value transmission bus between the register and the multiplier in response to a third state control signal in the second target control signal, so that the multiplier receives the intermediate calculation sub-result registered by the register; A second selector, wherein the second selector is used to respond to a fourth state control signal in the second target control signal to turn on an addend transmission bus between the memory and the adder so that the adder receives the addend feature.

8. A chip comprising the computing circuit as claimed in any one of claims 1 to 7.

9. A calculation method based on a calculation circuit, comprising: generating a first control signal and a second control signal; In response to the first control signal, performing tensor calculation on the first input feature and input weight stored in the memory in the computing circuit through the computing array in the computing circuit to obtain an intermediate calculation result; In response to the second control signal, the calculation array performs vector calculation on the intermediate calculation result and the second input feature stored in the memory to obtain an output calculation result.

10. The method according to claim 9, wherein: The computing array includes a plurality of computing elements, any computing element among the plurality of computing elements is used as a target computing element, the target computing element includes a multiplier, a register, an adder, a first selector and a second selector, and the method further includes: In response to a first state control signal in the first control signal, placing the first selector in a state of conducting a weight transmission bus between the memory and the multiplier; In response to a second state control signal in the first control signal, the second selector is placed in a state of conducting a register value transmission bus between the register and the adder.

11. The method according to claim 9, wherein: The computing array includes a plurality of computing elements, any computing element among the plurality of computing elements is used as a target computing element, the target computing element includes a multiplier, a register, an adder, a first selector and a second selector, and the method further includes: In response to a third state control signal in the second control signal, placing the first selector in a state of conducting a register value transmission bus between the register and the multiplier; In response to a fourth state control signal in the second control signal, the second selector is placed in a state of conducting an addend transmission bus between the memory and the adder.

12. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the method for obtaining a calculation result based on circuit reuse as recited in any one of claims 9 to 11.

13. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method for obtaining calculation results based on circuit multiplexing as described in any one of claims 9 to 11.