METHODS AND DEVICES OF SCHEDULING MULTI-KERNELS FOR CONVOLUTION OPERATIONS
Methods and devices for convolution operations computation are proposed. One method includes to read first input data from a first line buffer corresponding to a first designated layer by using a first kernel to generate a first computation result, read second input data from a second line buffer corresponding to a second designated layer by using a second kernel to generate a second computation result, and write the first computation result and the second computation result respectively to the second line buffer and a third line buffer corresponding to a third designated layer during a first period, as well as to read updated second input data from the second line buffer by using the first kernel to generate an updated second computation result, and read third input data from the third line buffer by using the second kernel to generate a third computation result during a second period.
Latest Novatek Microelectronics Corp. Patents:
The disclosure relates to methods and devices of scheduling multi-kernels for convolution operations.
BACKGROUNDVarious schemes and criteria to optimize the performance of neural network accelerators have been introduced. The deployment of multiple kernels for different layers that leads to high parallelism and utilization is one of promising techniques to enhance the optimality. However, most neural networks typically exhibit data dependency between consecutive layers, in which a subsequent layer must wait for the output of the previous layer, and this may incur inefficiency due to processing idle time.
SUMMARY OF THE DISCLOSURETo solve the prominent issue, methods and devices of scheduling multi-kernels for convolution operations are proposed.
According to one of the exemplary embodiments, the method includes to perform the following steps during a first period and a second period following the first period. During the first period, the steps include to read first input data from a first line buffer corresponding to a first designated layer by using a first kernel to generate a first computation result, read second input data from a second line buffer corresponding to a second designated layer by using a second kernel to generate a second computation result, and write the first computation result generated by the first kernel and the second computation result generated by the second kernel respectively to the second line buffer and a third line buffer corresponding to a third designated layer. During the second period, the steps further include to read updated second input data from the second line buffer by using the first kernel to generate an updated second computation result, and read third input data from the third line buffer by using the second kernel to generate a third computation result.
According to one of the exemplary embodiments, the device includes a processor, a memory, and multiple line buffers. The processor is configured to perform the following steps. During a first period, the steps include to read first input data from a first line buffer corresponding to a first designated layer by using a first kernel to generate a first computation result, read second input data from a second line buffer corresponding to a second designated layer by using a second kernel to generate a second computation result, and write the first computation result generated by the first kernel and the second computation result generated by the second kernel respectively to the second line buffer and a third line buffer corresponding to a third designated layer. During a second period, the steps further include to read updated second input data from the second line buffer by using the first kernel to generate an updated second computation result, and read third input data from the third line buffer by using the second kernel to generate a third computation result.
According to one of the exemplary embodiments, the method includes to read first input data and second input data from a first line buffer corresponding to a first designated layer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result, and write the first computation result generated by the first kernel and the second computation result generated by the second kernel to a second line buffer corresponding to a second designated layer.
According to one of the exemplary embodiments, the device includes a processor, a memory, and multiple line buffers. The processor is configured to read first input data and second input data from a first line buffer corresponding to a first designated layer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result, and write the first computation result generated by the first kernel and the second computation result generated by the second kernel to a second line buffer corresponding to a second designated layer.
According to one of the exemplary embodiments, the method includes to read first partial input data and second partial input data of input data from a first buffer corresponding to a first designated layer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result, and write the first computation result generated by the first kernel and the second computation result generated by the second kernel to a second buffer corresponding to a second designated layer.
According to one of the exemplary embodiments, the device includes a processor, a memory, and multiple buffers. The processor is configured to read first partial input data and second partial input data of input data from a first buffer corresponding to a first designated layer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result, and write the first computation result generated by the first kernel and the second computation result generated by the second kernel to a second buffer corresponding to a second designated layer.
It should be understood, however, that this summary may not contain all of the aspect and embodiments of the disclosure and is therefore not meant to be limiting or restrictive in any manner. Also, the disclosure would include improvements and modifications which are obvious to one skilled in the art.
The accompanying drawings are included to provide a further understanding of the disclosure, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the disclosure and, together with the description, serve to explain the principles of the disclosure.
To make the above features and advantages of the application more comprehensible, several embodiments accompanied with drawings are described in detail as follows.
DESCRIPTION OF THE EMBODIMENTSSome embodiments of the disclosure will now be described more fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments of the application are shown. Indeed, various embodiments of the disclosure may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will satisfy applicable legal requirements. Like reference numerals refer to like elements throughout.
Referring to
In the current implementation, each of the buffers 1300-130N is a line buffer and is associated with an individual convolutional layer in a convolutional neural network (CNN). That is, input data is processed in a line-based manner, where data is handled line-by-line to enable continuous pipelined execution. For clarity, the buffers 1301~130N in the present exemplary embodiment are collectively referred to as “line buffer 1301~130N”.
Referring to
Still during the first period, the processor 110 writes the first computation result generated by the first kernel and the second computation result generated by the second kernel respectively to the second line buffer 1302 corresponding to the second designated layer and the third line buffer 1303 corresponding to the third designated layer (S206). These computation results thereby serve as inputs for further processing in the corresponding downstream layers.
During a second period following the first period, the processor 110 concurrently reads updated second input data from the second line buffer 1302 by using the first kernel to generate an updated second computation result (S208) and reads third input data from the third line buffer 1303 by using the second kernel to generate a third computation result (S210). In other words, the updated second input data includes the first computation result previously written to the second line buffer 1302, and the third input data includes the second computation result written to the third line buffer 1303.
Still during the second period, the processor 110 further writes the updated second computation result generated by the first kernel to the third line buffer 1303 corresponding to the third designated layer and writes the third computation result generated by the second kernel to the fourth line buffer 1304 corresponding to the fourth designated layer (S212). This enables continued processing of the CNN across subsequent layers.
In later periods, the processor 110 continues reading input data from corresponding line buffers, executing computations via the respective kernels, and writing results to subsequent line buffers, thereby establishing a continuous pipelined processing mechanism across the CNN layers. The proposed line-based processing method enables data to flow continuously through multiple layers without waiting for the complete processing of an entire layer, thereby improving parallelism and maximizing computational resource utilization.
To further optimize resource utilization, once the two kernels complete processing up to the final layer of the CNN, the two kernels may return to the initial layers to begin processing new lines of input data. In one embodiment, the processing roles of the first and second kernels are swapped during this new iteration. In detail,
Referring to
During a new second period following the new first period, the processor 110 reads new updated second input data from the second line buffer 1302 by using the second kernel to generate a new updated second computation result (S308), and reads new third input data from the third line buffer 1303 by using the first kernel to generate a new third computation result (S310).
Still during the new second period, the processor 110 writes the new updated second computation result generated by the second kernel to the third line buffer 1303 corresponding to the third designated layer and writes the new third computation result generated by the first kernel to the fourth line buffer 1304 corresponding to the fourth designated layer (S312). The proposed scheduling approach supports continuous pipelined execution across multiple layers without necessitating full layer-wise completion. In addition, dynamically swapping kernel roles across iterations effectively balances the workload and enhances the overall computational efficiency.
For better comprehension,
Referring to
At time T1, the first kernel reads 4 lines of first input data from the first line buffer 1301 corresponding to layer N (i.e. block 402a) to generate a first computation result, and the second kernel reads 3 lines of second input data from the second line buffer 1302 corresponding to the layer N+1 (i.e. block 402b) to generate a second computation result. Next, the first kernel writes 1 line of the first computation result to the second line buffer 1302 corresponding to layer N+1 (i.e. block 404a), and the second kernel writes 2 lines of the second computation result to the third line buffer 1303 corresponding to layer N+2 (i.e. block 404b). At time T2, the first kernel reads 4 lines of updated second input data from the second line buffer 1302 corresponding to layer N+1 (i.e. block 404a), and the second kernel reads 3 lines of third input data from the third line buffer 1303 corresponding to the layer N+2 (i.e. block 404b). Similar operations are repeated for subsequent layers and are omitted herein for brevity.
Next, at time T11 as a new iteration in which the processing roles of the first kernel and the second kernel are swapped, the second kernel reads 3 lines of new first input data from the first line buffer 1301 corresponding to layer N (i.e. block 412a) to generate a new first computation result, and the first kernel reads 4 lines of new second input data from the second line buffer 1302 corresponding to the layer N+1 (i.e. block 412b) to generate a new second computation result. Next, the second kernel writes 2 lines of the new first computation result to the second line buffer 1302 corresponding to layer N+1 (i.e. block 414a), and the first kernel writes 1 line of the new second computation result to the third line buffer 1303 corresponding to layer N+2 (i.e. block 414b). At time T12, the second kernel reads three lines of updated second input data from the second line buffer 1302 corresponding to layer N+1 (i.e. block 414a), and the first kernel reads four lines of new third input data from the third line buffer 1303 corresponding to the layer N+2 (i.e. block 414b). Again, similar operations are repeated for subsequent layers and are omitted herein for brevity.
In the current implementation, each of the buffers 1300~130N is also a line buffer and is associated with an individual convolutional layer in a CNN. For clarity purposes, the buffers 1301~130N in the present exemplary embodiment are referred to as “line buffer 1301~130N”.
Referring to
In the present embodiment, both the first kernel and the second kernel concurrently access the same line buffer corresponding to the same designated layer but operate on different portions of input data. This enables simultaneous multi-kernel computation and enhances the data throughput and resource utilization of the processing system on a per-layer basis.
For better comprehension,
Referring to
It should be noted that, as for a new iteration, the first kernel and the second kernel may return to process other lines in layer N in one exemplary embodiment. Alternatively, as also for a new iteration, the first kernel and the second kernel may transition to process other lines in any designated layer based on specific constraints, which may be defined according to flow control settings, to optimize processing efficiency in another exemplary embodiment. The disclosure is not limited in this regard.
Referring to
For better comprehension,
Referring to
H1′=(H»2)+(H»4)
H1=(H1′»1)«1
H2=H−H1
Herein, H1 and H2 denote the heights assigned for the first kernel and the second kernel respectively. In this case, the dimensions of the first partial input data 801a and the second partial input data 801b are ⅔H×W and ⅓H×W respectively. The first kernel reads the first partial input data 801a from the first buffer 1301 to generate a first computation result, and the second reads the second partial input data 801b from the first buffer 1302 to generate a second computation result. Next, both the first computation result and the second computation result are written to the second designated layer. Since the throughput of the first kernel is twice that of the second kernel and since the same layer is partitioned into a 2:1 ratio, such configuration allows both kernels to complete their respective processing tasks within a same time frame, thereby achieving efficient parallel execution.
In summary, the disclosure enables concurrent convolution operations using heterogeneous kernels for pipelined execution, thereby minimizing processing latency and idle time, and maximizing computational resource utilization and throughput.
No element, act, or instruction used in the detailed description of disclosed embodiments of the present application should be construed as absolutely critical or essential to the present disclosure unless explicitly described as such. Also, as used herein, each of the indefinite articles “a” and “an” could include more than one item. If only one item is intended, the terms “a single” or similar languages would be used. Furthermore, the terms “any of” followed by a listing of a plurality of items and/or a plurality of categories of items, as used herein, are intended to include “any of”, “any combination of”, “any multiple of”, and/or “any combination of multiples of the items and/or the categories of items, individually or in conjunction with other items and/or other categories of items. Further, as used herein, the term “set” is intended to include any number of items, including zero. Further, as used herein, the term “number” is intended to include any number, including zero.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the disclosed embodiments without departing from the scope or spirit of the disclosure. In view of the foregoing, it is intended that the disclosure cover modifications and variations of this disclosure provided they fall within the scope of the following claims and their equivalents.
Claims
1. A method of scheduling multi-kernels for convolution operations comprising:
- during a first period: reading first input data from a first line buffer corresponding to a first designated layer by using a first kernel to generate a first computation result; reading second input data from a second line buffer corresponding to a second designated layer by using a second kernel to generate a second computation result, wherein the second designated layer is subsequent to the first designated layer; and writing the first computation result generated by the first kernel and the second computation result generated by the second kernel respectively to the second line buffer corresponding to the second designated layer and a third line buffer corresponding to a third designated layer, wherein the third designated layer is subsequent to the second designated layer; and
- during a second period following the first period: reading updated second input data from the second line buffer by using the first kernel to generate an updated second computation result; and reading third input data from the third line buffer by using the second kernel to generate a third computation result.
2. The method according to claim 1,
- wherein the updated second input data read from the second line buffer by the first kernel comprises the first computation result, and
- wherein the third input data read from the third line buffer by the second kernel comprises the second computation result.
3. The method according to claim 1 further comprising:
- writing the updated second computation result generated by the first kernel and the third computation result generated by the second kernel respectively to the third line buffer corresponding to the third designated layer and a fourth line buffer corresponding to a fourth designated layer, wherein the fourth designated layer is subsequent to the third designated layer.
4. The method according to claim 1 further comprising:
- during a new first period in which the first line buffer is loaded by new first input data: reading the new first input data from the first line buffer by using the second kernel to generate new first computation result; reading new second input data from the second line buffer by using the first kernel to generate new second computation result; and writing the new first computation result generated by the second kernel and the new second computation result generated by the first kernel respectively to the second line buffer and the third line buffer.
5. The method according to claim 4 further comprising:
- during a new second period following the later first period: reading new updated second input data from the second line buffer by using the second kernel to generate new updated second computation result; and reading new third input data from the third line buffer by using the first kernel to generate new third computation result; and writing the new second computation result generated by the second kernel and the new third computation result generated by the first kernel respectively to the third line buffer corresponding to the third designated layer and a fourth line buffer corresponding to a fourth designated layer, wherein the fourth designated layer is subsequent to the third designated layer.
6. The method according to claim 5,
- wherein the new updated second input data read from the second line buffer by the second kernel comprises the new first computation result, and
- wherein the new third input data read from the third line buffer by the first kernel comprises the new second computation result.
7. The method according to claim 1 further comprising:
- wherein a size of the first kernel is larger than that of the second kernel.
8. A method of scheduling multi-kernels for convolution operations comprising:
- reading first input data and second input data from a first line buffer corresponding to a first designated layer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result; and
- writing the first computation result generated by the first kernel and the second computation result generated by the second kernel to a second line buffer corresponding to a second designated layer, wherein the second designated layer is subsequent to the first designated layer.
9. The method according to claim 8,
- wherein the first input data and the second input data are partially overlapped.
10. The method according to claim 8,
- wherein a size of the first kernel is larger than that of the second kernel.
11. A method of scheduling multi-kernels for convolution operations comprising:
- reading first partial input data and second partial input data of input data from a first buffer corresponding to a first designated layer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result; and
- writing the first computation result generated by the first kernel and the second computation result generated by the second kernel to a second buffer corresponding to a second designated layer, wherein the second designated layer is subsequent to the first designated layer.
12. The method according to claim 11,
- wherein the first partial input data and the second partial input data are partitioned from the input data according to sizes of the first kernel and the second kernel.
13. The method according to claim 11,
- wherein a size of the first kernel is larger than that of the second kernel.
14. A computing device comprising:
- a memory;
- a plurality of line buffers comprising a first line buffer associated with a first designated layer, a second line buffer associated with a second designated layer subsequent to the first designated layer, and a third line buffer associated with a third designated layer subsequent to the second designated layer; and
- a processor, configured to: during a first period: read first input data from the first line buffer by using a first kernel to generate a first computation result; read second input data from the second line buffer by using a second kernel to generate a second computation result; and write the first computation result generated by the first kernel and the second computation result generated by the second kernel respectively to the second line buffer and the third line buffer; and during a second period following the first period: read updated second input data from the second line buffer by using the first kernel to generate an updated second computation result; and read third input data from the third line buffer by using the second kernel to generate a third computation result.
15. A computing device comprising:
- a memory;
- a plurality of line buffers comprising a first line buffer associated with a first designated layer and a second line buffer associated with a second designated layer subsequent to the first designated layer; and
- a processor configured to: read first input data and second input data from the first line buffer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result; write the first computation result generated by the first kernel and the second computation result generated by the second kernel to the second line buffer.
16. A computing device comprising:
- a memory;
- a plurality of buffers comprising a first buffer associated with a first designated layer and a second buffer associated with a second designated layer subsequent to the first designated layer; and
- a processor configured to: read first partial input data and second partial input data of input data from the first buffer respectively by using a first kernel and a second kernel to generate a first computation result and a second computation result; and write the first computation result generated by the first kernel and the second computation result generated by the second kernel to the second buffer.
Type: Application
Filed: May 26, 2025
Publication Date: Nov 26, 2026
Applicant: Novatek Microelectronics Corp. (Hsinchu)
Inventor: Chieh-Cheng Chen (Changhua County)
Application Number: 19/218,554