Operation method, device and equipment based on systolic array and storage medium

By adopting one-by-one subtraction operations and preprocessing methods in the pulsating array, the division operation is realized, which solves the problem in the existing technology that the division operation requires external units or lookup tables, and improves the calculation efficiency and accuracy.

CN118519610APending Publication Date: 2024-08-20SHENZHEN LICHI SEMICONDUCTOR TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410552179.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-06
Publication Date
2024-08-20

AI Technical Summary

Technical Problem

Existing systolic arrays require external arithmetic units or lookup tables for division operations when performing complex calculations, resulting in problems such as high data interaction bandwidth, long latency, and low memory usage and accuracy.

Method used

By introducing feature registers, multipliers and adders, comparators and weight registers into the systolic array, the division operation is implemented using one-by-one subtraction operations and preprocessing, and the interaction between the result buffer and adjacent basic operation units is used to gradually complete the division calculation cycle .

Benefits of technology

It effectively improves the utilization of the systolic array, reduces the calls to external computing units, improves the performance and operating efficiency of the accelerator, and avoids the problem of insufficient accuracy of the lookup table.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118519610A_ABST
    Figure CN118519610A_ABST
Patent Text Reader

Abstract

The invention provides an operation method and device based on a systolic array, equipment and a storage medium. The method comprises the steps of obtaining to-be-processed data and the systolic array; inputting the weight data into a weight register of a basic operation unit in the systolic array; according to a first preset sequence, inputting the feature data into a first basic operation unit one by one for subtraction operation to obtain first output data and second output data; sequentially preprocessing the first output data, taking the preprocessed first output data as new feature data, outputting the new feature data into a transversely adjacent second basic operation unit, repeatedly carrying out subtraction operation, and stopping operation until a calculation period is met; according to the method and the device, division operation can be realized based on the systolic array unit, the utilization rate of the systolic array is effectively improved, calling of an external operation unit is avoided, and the performance and the operation efficiency of the accelerator are improved at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer processing technology, and in particular to a systolic array-based computing method, device, equipment and storage medium. Background Art

[0002] Neural network is a computational model that simulates the neural network of the human brain, and performs complex computational tasks through a large number of neurons and neural connections. Commonly used computational methods in traditional neural networks include Softmax, Normalization, etc., which can support complex operations including division. Among them, the division operation plays a very important role in the forward propagation process of the neural network, and is a necessary computing capability in the complete neural network calculation process.

[0003] A systolic array is a computing unit that accelerates matrix multiplication and convolution operations. Currently, existing systolic arrays usually only support multiplication and addition calculations. When encountering complex calculations, the data required for the operation must be moved out of the systolic array and completed by an external dedicated hardware computing unit, or a lookup table is used to perform fast approximate calculations.

[0004] Among them, the use of additional computing units will limit the performance and efficiency of the accelerator, resulting in longer delays, as the data exchange between different computing units requires a large amount of bandwidth resources and additional logic circuits; while the use of lookup tables will have problems such as memory occupation and low precision. Therefore, how to reduce the bandwidth occupation and delay of data exchange between different computing units, and / or solve the limitations of memory occupation and insufficient precision of the lookup table method are issues that need to be urgently addressed in the current research on neural network accelerators. Summary of the invention

[0005] The present disclosure provides a systolic array-based computing method, device, equipment and storage medium to at least solve the above technical problems existing in the prior art.

[0006] According to a first aspect of the present disclosure, a systolic array-based computing method is provided, the method comprising:

[0007] Acquire data to be processed and a systolic array, wherein the systolic array comprises a plurality of basic operation units connected in a matrix arrangement, each basic operation unit comprises a feature register, a multiplier-adder, a comparator, a weight register and a result buffer, the data to be processed comprises a plurality of feature data and weight data, the plurality of feature data are dividends, and the weight data are divisors;

[0008] Inputting the weight data into the weight register of the basic computing unit in the systolic array;

[0009] According to a first preset order, the feature data are input into a first basic operation unit one by one to perform a subtraction operation to obtain first output data and second output data;

[0010] Preprocessing the first output data in sequence, and outputting the preprocessed first output data as new feature data to a second laterally adjacent basic operation unit to repeat the subtraction operation until the calculation cycle is satisfied and the operation is stopped;

[0011] A plurality of second output data are obtained and output as the division operation result.

[0012] In one possible implementation, the subtraction operation includes:

[0013] Inputting the characteristic data / new characteristic data into a characteristic register in the first basic operation unit / the second basic operation unit;

[0014] Based on the multiplier-adder, a subtraction operation is performed on the data stored in the feature register and the weight data stored in the weight register to obtain first output data and store them in the result buffer;

[0015] According to the preset extraction rules, the second output data is obtained and output.

[0016] In one possible implementation, obtaining the second output data according to a preset extraction rule includes:

[0017] By means of the comparator, determining whether the first output data is less than a first preset value;

[0018] According to the judgment result, a second preset value corresponding to the judgment result is used as the second output data.

[0019] In one possible implementation manner, the preprocessing of the first output data includes:

[0020] Counting the number of bits of the first output data, wherein the number of bits is set to N;

[0021] According to a second preset order, the N-1th digit of the first output data is obtained.

[0022] In one possible implementation manner, the obtaining a plurality of second output data as a division operation result and outputting the same includes:

[0023] Obtaining the number of extraction times according to the number of the plurality of feature data;

[0024] Based on the storage space occupied by the plurality of second output data, starting from the storage space unit of the first row and the first column, a single extraction is performed in a column-by-column manner of adding one, wherein the storage space is composed of a plurality of storage space units;

[0025] In a single extraction process, the data stored in each storage space unit is extracted one by one in a manner of cumulatively adding one to the horizontal and vertical coordinates as a single extraction result;

[0026] The individual extraction results are summarized and output as a division result.

[0027] In one possible implementation manner, after obtaining the data to be processed and the systolic array, the method further includes:

[0028] Obtaining the maximum number of digits of the plurality of feature data;

[0029] The calculation period is determined according to the maximum number of bits and the number of the characteristic data.

[0030] In one possible implementation manner, after stopping the operation, the method further includes:

[0031] Determining whether the result buffer stores temporary data;

[0032] If yes, the temporary data is taken as the remainder, output to the adjacent third basic operation unit, and directly output by the third basic operation unit.

[0033] Accordingly, obtaining a plurality of second output data as the division operation result for output includes:

[0034] A plurality of second output data and a remainder are obtained and output as a division operation result.

[0035] According to a second aspect of the present disclosure, there is provided a computing device based on a systolic array, the device comprising:

[0036] an acquisition module, configured to acquire data to be processed and a systolic array, wherein the systolic array comprises a plurality of basic operation units connected in a matrix arrangement, each basic operation unit comprises a feature register, a multiplier-adder, a comparator, a weight register and a result buffer, the data to be processed comprises a plurality of feature data and weight data, the plurality of feature data are dividends, and the weight data are divisors;

[0037] A weight input module, used for inputting the weight data into the weight register of the basic operation unit in the systolic array;

[0038] A first operation module, configured to input the feature data into a first basic operation unit one by one according to a first preset order to perform a subtraction operation to obtain first output data and second output data;

[0039] A second operation module is used to pre-process the first output data in sequence, and output the pre-processed first output data as new feature data to a second basic operation unit adjacent to the horizontal direction, and repeat the subtraction operation until the calculation cycle is satisfied, and then stop the operation;

[0040] The output module is used to obtain a plurality of second output data and output them as the division operation result.

[0041] In one possible implementation mode, the first operation module is specifically used to: input the feature data / new feature data into a feature register in the first basic operation unit / second basic operation unit; based on the multiplier, perform a subtraction operation on the data stored in the feature register and the weight data stored in the weight register to obtain first output data and store it in the result buffer; obtain and output second output data according to a preset fetching rule.

[0042] In one possible implementation manner, the first operation module is further specifically used to: determine, by the comparator, whether the first output data is less than a first preset value; and, based on the determination result, use a second preset value corresponding to the determination result as the second output data.

[0043] In one possible implementation, the second operation module is specifically used to: count the number of bits of the first output data, where the number of bits is set to N; and obtain the N-1th bit of the first output data according to a second preset order.

[0044] In one possible implementation, the output module is specifically used to: obtain the number of extraction times according to the number of the multiple feature data; based on the storage space occupied by the multiple second output data, start from the storage space unit in the first row and the first column, and perform a single extraction in a column-by-column manner, wherein the storage space is composed of multiple storage space units; in a single extraction process, extract the data stored in each storage space unit one by one in a manner of cumulatively adding one to the horizontal and vertical coordinates as a single extraction result; summarize the single extraction results and output them as a division operation result.

[0045] In one possible implementation, the acquisition module is further specifically used to: after acquiring the data to be processed and the systolic array, acquire the maximum number of bits of the multiple feature data; and determine the calculation cycle according to the maximum number of bits and the number of the feature data.

[0046] In one possible implementation, the second operation module is further specifically used to: after the operation is stopped, determine whether the result buffer stores temporary data; if so, output the temporary data as a remainder to an adjacent third basic operation unit, and directly output it by the third basic operation unit.

[0047] Correspondingly, the output module is specifically used to obtain a plurality of second output data and a remainder as a division operation result for output.

[0048] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0049] at least one processor; and

[0050] a memory communicatively connected to the at least one processor; wherein,

[0051] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.

[0052] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.

[0053] The disclosed systolic array-based computing method, device, equipment and storage medium obtain data to be processed and a systolic array; input the weight data into the weight register of the basic computing unit in the systolic array; input the feature data into the first basic computing unit one by one according to a first preset order to perform a subtraction operation to obtain first output data and second output data; pre-process the first output data in turn, and output the pre-processed first output data as new feature data to a laterally adjacent second basic computing unit to repeat the subtraction operation until the calculation cycle is satisfied and the operation is stopped; obtain multiple second output data as division operation results for output, so that the division operation can be realized based on the systolic array unit, effectively improving the utilization rate of the systolic array, avoiding the call of external computing units, and also improving the performance and operation efficiency of the accelerator.

[0054] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:

[0056] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0057] Figure 1A schematic diagram of the structure of a systolic array system provided by an embodiment of the present disclosure is shown;

[0058] Figure 2 A schematic diagram of the structure of a systolic array provided by an embodiment of the present disclosure is shown;

[0059] Figure 3 A schematic diagram of the structure of a basic computing unit provided by an embodiment of the present disclosure is shown;

[0060] Figure 4 A flowchart of a systolic array-based computing method provided by an embodiment of the present disclosure is shown;

[0061] Figure 5 A schematic diagram (I) showing a process of an exemplary division operation method provided by an embodiment of the present disclosure;

[0062] Figure 6 A schematic diagram (II) showing a process of an exemplary division operation method provided by an embodiment of the present disclosure;

[0063] Figure 7 A schematic diagram showing an exemplary second output data display method provided by an embodiment of the present disclosure is shown;

[0064] Figure 8 A schematic diagram of the structure of a computing device based on a systolic array provided in an embodiment of the present disclosure is shown;

[0065] Fig. 9 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0066] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0067] For ease of understanding, the present disclosure first briefly introduces the systolic array system and the systolic array. Figure 1 A schematic diagram of the structure of a systolic array system provided in an embodiment of the present disclosure includes: a systolic array, a system bus, an array controller, a feature buffer, a weight buffer, and an output buffer, which are used to complete a division operation in a division operation mode.

[0068] The system bus is connected to the array controller, the feature buffer, the weight buffer and the output buffer respectively, and is used to send a division control instruction to the array controller, and after the division operation is completed, receive the division operation result uploaded by the output buffer;

[0069] The array controller is respectively connected to the feature buffer, the systolic array, the weight buffer and the output buffer, and is used to control the input of multiple feature data into the feature buffer and the weight data into the weight buffer after sending a division control signal according to a division control instruction, and after the configuration value of the division operation mode of the control register of each basic operation unit in the systolic array is allocated, the feature data and weight data in the feature buffer are input into the systolic array one by one to perform a division operation, and after the division is completed, the second output data is transmitted to the output buffer, wherein the feature data is the dividend and the weight data is the divisor.

[0070] Among them, the system bus is the main component connecting the computer system, which is used to receive the work instructions sent by the central controller and the data that needs to be divided, and send the division control instructions to the array controller. The array controller is used to control and decode the received division control instructions to realize the storage, forwarding and management of the entire array. The feature buffer is used to store multiple feature data as dividends, the weight buffer is used to store weight data as divisors, and the output buffer is used to receive the second output data result uploaded by the pulsating array, and then transmit it back to the system bus.

[0071] Among them, the division control instruction is an instruction obtained by the system bus after parsing the working instruction, and is sent to the array control system. The division control signal is a division execution signal for each device in the array control system to interact, which is used to implement the division operation. Since the systolic array in this embodiment can not only realize the division operation, but also realize other types of operations, such as convolution operation and sorting operation, the control register of each basic operation unit in the systolic array will set multiple sets of configuration values, and different configuration values ​​correspond to different working modes, thereby sending control signals under different working modes to each device in the basic operation unit. If the systolic array needs to be used to realize the division operation in this embodiment, the configuration value of the division operation mode can be sent to the control register of each basic operation unit.

[0072] Specifically, taking the convolutional neural network processing image as an example, the first feature data is the scores of multiple candidate detection frames generated by the neural network model. After receiving the work instruction, the system bus in this embodiment will send a first control instruction to the array controller according to the content of the work instruction, and the array controller will then send a first control signal to the relevant devices in the systolic array system according to the first control instruction to complete the sorting operation. Specifically, in this embodiment, the image data participating in the sorting operation is transmitted to the feature buffer as the first feature data in a preset format to change the data order used in the actual sorting calculation; the first configuration value of the control register is assigned to each basic operation unit in the systolic array so that each basic operation unit cooperates to perform the sorting operation; the first feature data in the feature buffer is input into the systolic array one by one for sorting operation; after the sorting is completed, the first data result in the systolic array is transmitted to the output buffer and returned to the system bus.

[0073] Figure 2 The structure diagram of a systolic array provided by an embodiment of the present disclosure is shown in FIG. 1 , and the systolic array may be composed of M x N configurable basic operation units. The systolic array includes a plurality of basic operation units connected in a matrix arrangement, and each basic operation unit includes a feature register, a multiplier-adder, a comparator, a weight register, and a result buffer, and is used to complete a division operation in a division operation mode, such as Figure 3 shown.

[0074] Figure 3 A schematic diagram of the structure of a basic computing unit provided in an embodiment of the present disclosure. Figure 3 As shown, the control register is connected to the feature register, the multiplier-accumulator, the comparator, the weight register and the result buffer, and the connection relationship is omitted in the figure.

[0075] Among them, the basic operation unit refers to the smallest component unit in the systolic array, and each basic operation unit can independently complete the division operation. The feature register can be a register for storing feature data; the weight register can be a register for storing weight data; the multiplier can be an electronic component that calculates the feature data output by the feature register and the weight data output by the weight register, and outputs the first output data to the result buffer and the comparator at the output end; the comparator refers to an electronic component that outputs the second output data at the output end by comparing the first output data with the first preset value; the result buffer can be a memory for storing the first output data, and outputs it to the next basic operation unit after preprocessing the first output data; the control register refers to a memory storing execution commands of different working modes. Among them, the register refers to a high-speed storage component with limited storage capacity, which can be used to temporarily store instructions, data and addresses; the buffer refers to a memory that can perform high-speed data exchange. This embodiment can realize the division operation of the systolic array through the hardware structure based on the basic operation unit.

[0076] Figure 4 A flowchart of a systolic array-based computing method provided in an embodiment of the present disclosure is provided. The method can be executed by a systolic array-based computing device provided in an embodiment of the present disclosure, and the device can be implemented in software and / or hardware. The method specifically includes:

[0077] S410, obtaining data to be processed and a systolic array.

[0078] The systolic array includes a plurality of basic operation units connected in a matrix arrangement, each basic operation unit includes a feature register, a multiplier, a comparator, a weight register and a result buffer, and the data to be processed includes a plurality of feature data and weight data, the plurality of feature data are dividends, and the weight data are divisors.

[0079] The feature data is a series of data arranged in a certain order and requiring division operation, and the weight data is the divisor, which can be the same or different. The basic operation units occupied by the division operation in this embodiment are determined by the number of bits of the feature data. For example, if the number of bits (binary form) of the feature data is 4, 4 basic operation units are occupied; if the number of bits (binary form) of the feature data is 5, 5 basic operation units are occupied.

[0080] S420, inputting the weight data into the weight register of the basic operation unit in the systolic array.

[0081] Specifically, this embodiment inputs the weight data into the weight register of each basic operation unit in the systolic array. If the divisors are different, the weight data is arranged in a certain order and waits to be input into the weight register of each basic operation unit.

[0082] S430: Input the feature data into the first basic operation unit one by one according to a first preset order to perform a subtraction operation to obtain first output data and second output data.

[0083] The first preset order may be an order set according to user needs, the first output data is the data after subtracting the feature data from the weight data, and is also the data that needs to be output to the next adjacent basic operation unit; the second output data is the partial data that needs to be output as the result of the division operation. Specifically, since the present embodiment performs a division operation, the dividend may be split into multiple subtraction processes for operation.

[0084] Figure 5 A process diagram (I) of an exemplary division operation method provided in an embodiment of the present disclosure. Figure 5 As shown, it includes a systolic array 510 and each basic operation unit 520. This embodiment takes the characteristic data as 4, 11 and 9 and the weight data as 3 as an example to complete the division operation. Figure 5 Four basic computing units 520 are shown as an example.

[0085] S440, preprocessing the first output data in sequence, and outputting the preprocessed first output data as new feature data to a second laterally adjacent basic operation unit to repeat the subtraction operation until the calculation cycle is satisfied, and then stopping the operation.

[0086] Since the multipliers and adders in each basic operation unit can only perform simple addition and subtraction calculations and multiplication operations, and the present application completes the division operation without changing the original systolic array structure, the present embodiment adaptively adjusts the calculation logic to achieve the division operation. For example, the shift module in the multiplier can be used to perform subsequent shift operations, which can effectively save hardware overhead.

[0087] Specifically, the first basic operation unit is the first basic operation unit of the characteristic data input pulsation array, and the second basic operation unit has the same function as the first basic operation unit, both of which perform subtraction operations. In order to successfully complete the division operation, this embodiment requires multiple second basic operation units to perform repetitive subtraction operations in sequence.

[0088] Specifically, this embodiment needs to preprocess the first output data, input the preprocessed first output data into the adjacent second basic operation unit to repeat the subtraction operation, and the second basic operation unit will also output a first output data, which will be input into the next adjacent second basic operation unit after preprocessing until the calculation cycle is met to complete the division operation.

[0089] In an embodiment of the present disclosure, the preprocessing of the first output data includes: counting the number of bits of the first output data, where the number of bits is set to N; and obtaining the N-1th digit of the first output data according to a second preset order.

[0090] The second preset order may be a left-to-right order. Since the first output data is a binary representation, the present embodiment obtains the N-1th digit according to the second preset order. Exemplarily, the present embodiment actually shifts the first output data right by one position and then inputs it into the second basic operation unit.

[0091] S450, obtaining a plurality of second output data as a division operation result and outputting them.

[0092] Specifically, for the same dividend, since subtraction operations need to be performed through multiple basic operation units, and each basic operation unit will output a second output data, this embodiment can aggregate the multiple second output data corresponding to the outputs of the multiple basic operation units and output them to the output buffer as the division operation result.

[0093] This embodiment obtains data to be processed and a systolic array; inputs the weight data into the weight register of the basic operation unit in the systolic array; inputs the feature data into the first basic operation unit one by one for subtraction operation in a first preset order to obtain first output data and second output data; preprocesses the first output data in turn, and outputs the preprocessed first output data as new feature data to a second laterally adjacent basic operation unit to repeat the subtraction operation until the calculation cycle is satisfied and the operation is stopped; obtains multiple second output data as division operation results for output, and can implement division operation based on the systolic array unit, effectively improves the utilization rate of the systolic array, avoids calling external operation units, and also improves the performance and operation efficiency of the accelerator.

[0094] In the embodiment of the present disclosure, the subtraction operation includes: inputting the feature data / new feature data into the feature register in the first basic operation unit / second basic operation unit; based on the multiplier, performing a subtraction operation on the data stored in the feature register and the weight data stored in the weight register to obtain the first output data and store it in the result buffer; according to the preset retrieval rule, obtaining the second output data and outputting it.

[0095] Specifically, both the first basic operation unit and the second basic operation unit need to perform subtraction operations. Exemplarily, in this embodiment, the feature data is input into the feature register in the first basic operation unit; based on the multiplier, the data stored in the feature register and the weight data stored in the weight register are subtracted, and the subtracted data is stored as the first output data in the result buffer, and the first output data is processed in the result buffer as new feature data and output to the second basic operation unit for the next subtraction operation. At the same time, this embodiment obtains the second output data according to the preset extraction rule.

[0096] Exemplarily, this embodiment also inputs the new feature data output from the first basic operation unit into the feature register in the second basic operation unit; based on the multiplier-adder, the new feature data stored in the feature register and the weight data stored in the weight register are subtracted again, and the obtained first output data for the second basic operation unit is stored in the result buffer. At the same time, the second output data for the second basic operation unit is obtained according to the preset fetching rule.

[0097] It should be noted that, in this embodiment, because the division operation is divided into multiple consecutive subtraction operation processes, the second basic operation unit is set to multiple, so after the second basic operation unit is completed, the data stored in the result buffer will also be processed and output to the next adjacent second basic operation unit. This embodiment continuously performs repetitive subtraction operation processes in the next adjacent second basic operation unit until the calculation cycle is reached and the calculation is stopped.

[0098] It should be noted that the above embodiment is for the same characteristic data (dividend), specifically, the same characteristic data is continuously transferred to the next adjacent basic operation unit during multiple subtraction operations. Therefore, if it is a division operation for multiple characteristic data (dividends), the embodiment can continuously input characteristic data in the first basic operation unit, and each characteristic data must be transferred to the second basic operation unit for repeated subtraction operations after the first basic operation unit performs subtraction operations.

[0099] The subtraction operation method provided in this embodiment can not only realize the division operation of multiple dividends, but also make maximum use of each basic operation unit and improve the utilization rate of the basic operation unit.

[0100] In the disclosed embodiment, obtaining the second output data according to the preset extraction rule includes: judging, by the comparator, whether the first output data is less than a first preset value; and according to the judgment result, taking the second preset value corresponding to the judgment result as the second output data.

[0101] The first preset value may be any value set according to the computing requirements, for example, the first preset value may be 0; the second preset value may be a directional value set in accordance with the judgment result.

[0102] Specifically, this embodiment performs a subtraction operation on the feature data and the weight data, outputs the subtracted data as the first output data to the comparator, and determines whether the first output data is less than the first preset value through the comparator. If less than, the value 0 is output as the second preset value as the second output data; if greater than or equal to, the value 1 is output as the second preset value as the second output data.

[0103] Figure 6 A schematic diagram (II) of an exemplary division operation method provided in an embodiment of the present disclosure. Figure 6 As shown, this embodiment represents the feature data and weight data in binary form, and takes the feature data of 4, 11 and 9 and the weight data of 3 as an example for explanation. At the same time, for the convenience of understanding, this embodiment exemplarily shows the subtraction process of four cycles; and the basic operation units with the same filling pattern belong to the subtraction process of the same feature data in different cycles.

[0104] Specifically, in the first cycle, this embodiment inputs the feature data 9 into the first basic operation unit, the binary representation of the feature data 9 is 1001, and the binary representation of the weight data 3 is 11. After the first operation unit performs a subtraction operation, the subtraction result 110 is input as the first output data to the next horizontally adjacent basic operation unit, that is, the second basic operation unit. At the same time, this embodiment determines whether the first output data 110 is less than 0. Since it is greater than 0, the value 1 is output as the second output data related to the first basic operation unit in the first cycle.

[0105] It should be noted that, in the first cycle, except for the first basic operation unit that performs subtraction operation, the other basic operation units are in an initialization state and only receive the weight data 11 for display, but do not perform actual subtraction operation.

[0106] Specifically, in the second cycle, this embodiment shifts the result 110 after subtraction in the previous cycle right by one bit and inputs it to the second basic operation unit, that is, obtains the binary representation number 11. In the second basic operation unit, the new feature data 11 and the weight data 11 are subtracted. Since the result after subtraction is 0, 0 is input as the first output data to the next horizontally adjacent second basic operation unit. Similarly, this embodiment determines whether the first output data 0 is less than 0. Since it is equal to 0, the value 1 is output as the second output data related to the second basic operation unit in the second cycle.

[0107] At the same time, in the second cycle, this embodiment continues to input the feature data 11 into the first basic operation unit, and the binary representation of the feature data 11 is 1011. After the first operation unit performs a subtraction operation, the subtraction result 1000 is input as the first output data to the second basic operation unit. Similarly, this embodiment determines whether the first output data 1000 is less than 0. Since it is greater than 0, the value 1 is output as the second output data related to the first basic operation unit in the second cycle.

[0108] Specifically, in the third cycle, for the feature data 9, this embodiment shifts the result 0 after subtraction in the previous cycle right by one position and inputs it to the next adjacent second basic operation unit, that is, inputs 0 to the second second basic operation unit. In order to reduce power consumption, when the new feature data is 0, it can be ignored. Therefore, in the second second basic operation unit, the value 0 can be directly output as the second output data related to the second second basic operation unit in the third cycle.

[0109] At the same time, in the third cycle, for the feature data 11, this embodiment shifts the result 1000 after subtraction in the previous cycle right by one position to obtain 100 and inputs it into the second basic operation unit. In the second basic operation unit, the new feature data 100 and the weight data 11 are subtracted. Since the result after subtraction is 1, 1 is input as the first output data to the second second basic operation unit. Similarly, this embodiment determines whether the result after subtraction is less than 0. Since it is greater than 0, the value 1 is output as the second output data related to the first second basic operation unit in the third cycle.

[0110] At the same time, in the third cycle, for feature data 4, this embodiment continues to input feature data 4 into the first basic operation unit, and the binary representation of feature data 4 is 100. After the first operation unit performs a subtraction operation, the subtraction result 1 is input into the second basic operation unit as the first output data. Similarly, this embodiment determines whether the first output data 1 is less than 0. Since it is greater than 0, the value 1 is output as the second output data related to the first basic operation unit in the second cycle.

[0111] Specifically, in the fourth cycle, for the feature data 4, this embodiment shifts the result 1 after subtraction in the previous cycle right by one bit and inputs it to the second basic operation unit, that is, inputs 0 to the second basic operation unit. In the second basic operation unit, the new feature data 0 can be directly output as the second output data related to the first second basic operation unit in the fourth cycle.

[0112] It should be noted that, since the subtraction process for feature data 9 and feature data 11 in the fourth cycle is similar to the above, it will not be repeated. Meanwhile, in the fourth week, since new feature data is input to the first basic operation unit, the first basic operation unit will be dormant.

[0113] This embodiment does not need to call external computing units, which reduces the bandwidth requirements for data exchange between different computing units. At the same time, no special hardware resources are required to calculate division that cannot be calculated by conventional systolic arrays, which can reduce the system bandwidth required for hardware logic circuits or calling CPU calculations and the resulting calculation delays.

[0114] In the disclosed embodiment, the obtaining of multiple second output data as a division result and outputting them includes: obtaining the number of extraction times according to the number of the multiple feature data; based on the storage space occupied by the multiple second output data, starting from the storage space unit in the first row and the first column, performing a single extraction in a column-by-column manner, wherein the storage space is composed of multiple storage space units; in the single extraction process, extracting the data stored in each storage space unit one by one in a manner of cumulatively adding one to the horizontal and vertical coordinates as a single extraction result; summarizing the single extraction results and outputting them as a division result.

[0115] Specifically, since this embodiment performs a division operation, if there are several dividends, the number of times to extract is several. For example, Figure 5 and Figure 6As shown, since there are three feature data, the number of extractions is 3. Since the second output data output by each basic operation unit occupies different storage space units in the output buffer of the system array, this embodiment can extract according to the calculation logic involved in the division calculation in the output buffer of the system array according to the coordinates of the storage space, the horizontal and vertical coordinates are added one by one, that is, the diagonal extraction method is used for extraction, and the single extraction results are summarized as the division operation result for output.

[0116] Figure 7 This is a schematic diagram showing an exemplary second output data display method provided by the embodiment of the present disclosure. In order to facilitate viewing of the extraction method, this embodiment fills the storage space units extracted by different feature data with different patterns. Figure 7 As shown, the division result for feature data 9 is 1100; the division result for feature data 11 is 1100; and the division result for feature data 4 is 1000.

[0117] The method for extracting the division operation result provided in this embodiment improves the division operation process of the systolic array, so that the systolic array can perform diversified operation modes.

[0118] In the disclosed embodiment, after obtaining the data to be processed and the systolic array, the method further includes: obtaining the maximum number of bits of the plurality of characteristic data; and determining the calculation cycle according to the maximum number of bits and the number of the characteristic data.

[0119] In this embodiment, the characteristic data is represented in binary form, and the maximum number of digits of each binary number and the number of characteristic data are counted. The calculation period is determined by the number of characteristic data and the maximum number of digits. For example, the calculation period can be calculated by adding the characteristic data and the maximum number of digits and then subtracting 1, thereby determining the termination mark of the division operation and extracting the division operation result. For example, Figure 5 and Figure 6 The characteristic data shown are 4, 11 and 9. Since there are 3 characteristic data and the maximum number of digits is 4, the calculation cycle is 6.

[0120] This embodiment can obtain the calculation cycle through the maximum number of bits of the characteristic data and the number of characteristic data, thereby improving the division operation performed by the systolic array.

[0121] In the embodiment of the present disclosure, after the operation is stopped, it further includes: determining whether the result buffer stores temporary data; if so, outputting the temporary data as a remainder to an adjacent third basic operation unit, and the third basic operation unit directly outputs the temporary data. Accordingly, obtaining a plurality of second output data as a division operation result for output includes: obtaining a plurality of second output data and a remainder as a division operation result for output.

[0122] The third basic operation unit is an operation unit that outputs a remainder and does not perform any calculation process.

[0123] Since the division operation process of the above embodiment only extracts the quotient and does not involve the extraction of the remainder, if you want to obtain the remainder, you can determine whether the result buffer in the last second basic operation unit stores temporary data. If temporary data is stored, the temporary data is used as the remainder and output to the adjacent third basic operation unit. No calculation is performed in the third basic operation unit, but the remainder input by the feature input register is directly output to the result buffer, and the result is output by the result buffer. At the same time, the division operation result extracted by this embodiment includes not only multiple second output data, but also the remainder.

[0124] This embodiment provides a more complete division operation process, which can obtain not only the quotient but also the remainder.

[0125] Figure 8 is a schematic diagram of a structure of a computing device based on a systolic array provided in an embodiment of the present disclosure, the device specifically comprising:

[0126] An acquisition module 810 is used to acquire data to be processed and a systolic array, wherein the systolic array comprises a plurality of basic operation units connected in a matrix arrangement, each basic operation unit comprises a feature register, a multiplier-adder, a comparator, a weight register and a result buffer, the data to be processed comprises a plurality of feature data and weight data, the plurality of feature data are dividends, and the weight data are divisors;

[0127] A weight input module 820, used to input the weight data into the weight register of the basic computing unit in the systolic array;

[0128] A first operation module 830, configured to input the feature data into a first basic operation unit one by one in a first preset order to perform a subtraction operation to obtain first output data and second output data;

[0129] A second operation module 840 is used to pre-process the first output data in sequence, and output the pre-processed first output data as new feature data to a second basic operation unit adjacent to the horizontal direction, and repeat the subtraction operation until the calculation cycle is satisfied, and then stop the operation;

[0130] The output module 850 is used to obtain a plurality of second output data and output them as division operation results.

[0131] In one possible implementation, the first operation module 830 is specifically used to: input the feature data / new feature data into a feature register in the first basic operation unit / second basic operation unit; based on the multiplier, perform a subtraction operation on the data stored in the feature register and the weight data stored in the weight register to obtain first output data and store it in the result buffer; obtain and output second output data according to a preset fetching rule.

[0132] In one possible implementation, the first operation module 830 is further specifically used to: determine, by the comparator, whether the first output data is less than a first preset value; and, based on the determination result, use a second preset value corresponding to the determination result as the second output data.

[0133] In one possible implementation, the second operation module 840 is specifically used to: count the number of bits of the first output data, where the number of bits is set to N; and obtain the N-1th bit of the first output data according to a second preset order.

[0134] In one possible implementation, the output module 850 is specifically used to: obtain the number of extraction times according to the number of the multiple feature data; based on the storage space occupied by the multiple second output data, starting from the storage space unit in the first row and the first column, perform a single extraction in a column-by-column manner, wherein the storage space is composed of multiple storage space units; in a single extraction process, extract the data stored in each storage space unit one by one in a manner of cumulatively adding one to the horizontal and vertical coordinates as a single extraction result; summarize the single extraction results and output them as a division operation result.

[0135] In one possible implementation, the acquisition module 810 is further specifically used to: after acquiring the data to be processed and the systolic array, acquire the maximum number of bits of the multiple feature data; and determine the calculation cycle according to the maximum number of bits and the number of the feature data.

[0136] In one possible implementation, the second operation module 840 is further configured to: after the operation is stopped, determine whether the result buffer stores temporary data; if so, output the temporary data as a remainder to an adjacent third basic operation unit, and the third basic operation unit directly outputs the temporary data. Accordingly, the output module 850 is further configured to: obtain a plurality of second output data and a remainder as a division operation result for output.

[0137] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0138] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0139] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0140] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0141] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as the operation method based on the systolic array. For example, in some embodiments, the operation method based on the systolic array may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the operation method based on the systolic array described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute the sound effect correction method in any other appropriate manner (for example, by means of firmware).

[0142] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0143] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0144] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0146] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0147] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0148] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0149] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0150] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A computational method based on a systolic array, characterized in that: The method comprises: Acquire data to be processed and a systolic array, wherein the systolic array comprises a plurality of basic operation units connected in a matrix arrangement, each basic operation unit comprises a feature register, a multiplier-adder, a comparator, a weight register and a result buffer, the data to be processed comprises a plurality of feature data and weight data, the plurality of feature data are dividends, and the weight data are divisors; Inputting the weight data into the weight register of the basic computing unit in the systolic array; According to a first preset order, the feature data are input into a first basic operation unit one by one to perform a subtraction operation to obtain first output data and second output data; Preprocessing the first output data in sequence, and outputting the preprocessed first output data as new feature data to a second laterally adjacent basic operation unit to repeat the subtraction operation until the calculation cycle is satisfied and the operation is stopped; A plurality of second output data are obtained and output as the division operation result.

2. The method according to claim 1, wherein: The subtraction operation includes: Inputting the characteristic data / new characteristic data into a characteristic register in the first basic operation unit / the second basic operation unit; Based on the multiplier-adder, a subtraction operation is performed on the data stored in the feature register and the weight data stored in the weight register to obtain first output data and store them in the result buffer; According to the preset extraction rules, the second output data is obtained and output.

3. The method according to claim 2, characterized in that The step of obtaining the second output data according to the preset extraction rule includes: By means of the comparator, determining whether the first output data is less than a first preset value; According to the judgment result, a second preset value corresponding to the judgment result is used as the second output data.

4. The method according to claim 1 or 3, characterized in that: The preprocessing of the first output data comprises: Counting the number of bits of the first output data, wherein the number of bits is set to N; According to a second preset order, the N-1th digit of the first output data is obtained.

5. The method according to claim 4, characterized in that The obtaining of a plurality of second output data as a division operation result and outputting the same comprises: Obtaining the number of extraction times according to the number of the plurality of feature data; Based on the storage space occupied by the plurality of second output data, starting from the storage space unit of the first row and the first column, a single extraction is performed in a column-by-column manner of adding one, wherein the storage space is composed of a plurality of storage space units; In a single extraction process, the data stored in each storage space unit is extracted one by one in a manner of cumulatively adding one to the horizontal and vertical coordinates as a single extraction result; The individual extraction results are summarized and output as a division result.

6. The method according to claim 5, characterized in that After obtaining the data to be processed and the systolic array, the method further includes: Obtaining the maximum number of digits of the plurality of feature data; The calculation period is determined according to the maximum number of bits and the number of the characteristic data.

7. The method according to claim 6, characterized in that After the stopping operation, the method further includes: Determining whether the result buffer stores temporary data; If yes, the temporary data is output as a remainder to an adjacent third basic operation unit, and is directly output by the third basic operation unit; Accordingly, obtaining a plurality of second output data as the division operation result for output includes: A plurality of second output data and a remainder are obtained and output as a division operation result.

8. A computing device based on a systolic array, characterized in that: The device comprises: an acquisition module, configured to acquire data to be processed and a systolic array, wherein the systolic array comprises a plurality of basic operation units connected in a matrix arrangement, each basic operation unit comprises a feature register, a multiplier-adder, a comparator, a weight register and a result buffer, the data to be processed comprises a plurality of feature data and weight data, the plurality of feature data are dividends, and the weight data are divisors; A weight input module, used for inputting the weight data into the weight register of the basic operation unit in the systolic array; A first operation module, configured to input the feature data into a first basic operation unit one by one according to a first preset order to perform a subtraction operation to obtain first output data and second output data; A second operation module is used to pre-process the first output data in sequence, and output the pre-processed first output data as new feature data to a second basic operation unit adjacent to the horizontal direction, and repeat the subtraction operation until the calculation cycle is satisfied, and then stop the operation; The output module is used to obtain a plurality of second output data and output them as the division operation result.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-7.

Citation Information

Cited By

  • Data processing method for neural network, accelerator and electronic equipment

    CN118709729A