A method for realizing load balancing of task distribution of a slave core array based on a new-generation Sunway many-core processor

By using a master-slave asynchronous acceleration mode and multiple slave core grouping methods, the problem of unbalanced slave core array load in Shenwei many-core processors has been solved, achieving balanced task quantity and improved computing performance.

CN114968600BActive Publication Date: 2026-04-24SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN
Filing Date
2022-07-19
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In the new generation of Shenwei many-core processors, the number of tasks is inconsistent and varies greatly during the single-core group optimization process, resulting in an unbalanced load on the slave core array, causing resource waste and low computing efficiency.

Method used

It adopts a master-slave asynchronous acceleration mode, which automatically obtains the next task through communication between the slave core and the master core. The master core is responsible for task allocation and updating. It uses multiple grouping methods such as single slave core, row slave core, column slave core and slave core cluster to automatically obtain tasks, ensuring load balance.

Benefits of technology

This achieves a balanced number of tasks across cores, improves program parallel efficiency, saves core waiting time, and enhances computational performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968600B_ABST
    Figure CN114968600B_ABST
Patent Text Reader

Abstract

The application relates to a method for realizing load balancing of slave core array task distribution based on a new generation of Shenwei many-core processors, which comprises the following steps: after each slave core finishes a current task, the slave core communicates with a master core, automatically acquires a next task, and continues to execute the acquired task until the task is finished; the master core is responsible for task distribution and updating; the automatic acquisition of the next task by the slave core comprises automatic acquisition of the task by a single slave core and automatic acquisition of the task by multiple slave cores, wherein the automatic acquisition of the task by the multiple slave cores is carried out according to slave core grouping, the slave core can adopt multiple slave core grouping modes according to the hardware architecture of the Shenwei many-core processor, and the modes mainly comprise a row slave core automatic acquisition task mode, a column slave core automatic acquisition task mode and a slave core cluster automatic acquisition task mode. The application realizes the automatic acquisition of the task by the slave core based on a master-slave asynchronous acceleration mode, carries out acceleration processing, and further solves the method for solving the load imbalance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of electronic information, and specifically relates to a method for load balancing based on the task allocation of a slave core array using a new generation of Shenwei many-core processor. Background Technology

[0002] Currently, China's domestically produced supercomputers have made significant progress, with many domestically developed high-performance processors successfully developed and put into use. The Shenwei series of many-core processors is a representative work of my country's domestically developed high-performance processors.

[0003] The new generation Sunway supercomputer uses my country's independently developed next-generation high-performance heterogeneous many-core processor—the SW26010pro. Each computing node of the new generation Sunway supercomputer contains two Sunway SW26010pro processors and 192GB of memory. The nodes are connected through a domestically developed and controllable high-speed interconnect network.

[0004] The SW26010pro processor consists of six core groups (CGs) connected in a ring architecture via an on-chip network. Each core group comprises one Management Processing Element (MPE, also known as the master core) and one Computing Processing Elements (CPES) array. Each CPES array consists of 64 Computing Processing Elements (CPEs) arranged in an 8×8 mesh pattern. The SW26010pro contains a total of 6 master cores and 390 slave cores. The slave cores are networked using a CMESH network, allowing for data communication via registers. Four adjacent slave cores share a single slave cluster management unit. The SW26010pro contains a total of 6 master cores and 384 slave cores. The hardware architecture of the SW26010pro processor is as follows: Figure 1 As shown.

[0005] The new generation of Sunway supercomputers primarily employs four heterogeneous parallelism methods: master-slave accelerated parallelism, master-slave cooperative parallelism, master-slave asynchronous parallelism, and master-slave dynamic parallelism. Master-slave accelerated parallelism refers to the program's computational core being loaded onto the slave core via Athread or OpenAcc* for accelerated computation, while the master core only handles application communication, I / O, and some serial code computation. During the slave core's computation, the master core waits until the slave core completes its computational task. Master-slave cooperative parallelism involves the master and slave cores performing parallel computation as equal entities, distributing the load according to their respective computing capabilities to jointly complete the core segment's computation. Master-slave asynchronous parallelism means that while the slave core performs accelerated computation, the master core does not wait but performs other operations such as computation, communication, or I / O, thereby improving the computational efficiency of master-slave collaboration. Master-slave dynamic parallelism involves the master core being responsible for task allocation, while the slave core is responsible for task computation and writing back the computation results. This parallelism method is suitable for programs where the computation time of slave core computation tasks is not fixed or for programs with some tasks running in parallel.

[0006] In single-core group optimization, the main approach is to launch the program on the master core and move the hot, parallelizable code segments of the application to the slave cores to accelerate parallel processing. When the application assigns tasks to the slave cores after startup on the master core, it doesn't know the execution time of each task on each slave core. Currently, the common method is to distribute the number of tasks equally among the slave cores, meaning each slave core receives an equal number of tasks. Therefore, when there are many tasks to be assigned and the execution times of each task vary significantly, this average distribution method leads to an unbalanced load across the slave cores. That is, a slave core that finishes its task earlier needs to wait for other slave cores to complete their tasks. This situation results in a waste of computing resources in the slave core array. Specifically, the average task distribution is as follows... Figure 2 As shown. Summary of the Invention

[0007] To address the shortcomings of existing technologies, this invention provides a method for load balancing through task allocation on a slave core array based on a new generation of Shenwei many-core processors;

[0008] This invention focuses on the problem of uneven load distribution caused by inconsistent and large differences in the number of tasks to be optimized during single-core group optimization.

[0009] This invention primarily utilizes a master-slave asynchronous acceleration mode to enable slave cores to automatically acquire tasks and accelerate processing, thereby resolving load imbalance. Unlike previous methods that evenly distribute tasks, each slave core automatically acquires the next task based on its current task completion status through data communication with the master core, and then executes the next task. That is, the slave core that completes its current task first communicates with the master core to automatically acquire the next task and continues executing it. Once all tasks have been completed, the slave cores automatically exit, ending the task execution phase. While the slave cores are executing tasks, the master core is responsible for task allocation and updates.

[0010] Terminology Explanation:

[0011] 1. athread_spawn(): A function interface that creates a thread group that runs on a slave core group and starts all available slave core resources in the core group.

[0012] 2. DMA: Direct Memory Access. Data is copied from one address space to another. The transfer itself is executed and completed by the DMA controller, without relying on a large CPU interrupt load.

[0013] The technical solution of this invention is as follows:

[0014] A method for load balancing based on task allocation from a slave core array using a new generation of Shenwei many-core processors includes:

[0015] Each slave core completes its current initial task, then communicates with the master core to automatically obtain the next task and continues to execute the obtained task until the task ends; the master core is responsible for task allocation and updating.

[0016] Automatic task retrieval from a core includes single-core automatic task retrieval and multi-core automatic task retrieval. The multi-core automatic task retrieval method is based on core grouping, including row-based automatic task retrieval, column-based automatic task retrieval, and core cluster-based automatic task retrieval.

[0017] According to a preferred embodiment of the present invention, the automatic task acquisition via a single slave core refers to: employing a master-slave asynchronous parallel acceleration method, achieving automated task acquisition through data transfer between a single slave core and the master core; including:

[0018] After the master core calls `athread_spawn()` to start the slave cores, the master core begins to allocate tasks and store them at designated addresses. Simultaneously, the slave cores begin executing their initial tasks. Once a slave core finishes its initial task, it enters the task critical section and retrieves the next task number from the master core via DMA. After successfully retrieving the task, the slave core sends a signal to the master core, allowing it to allocate the next task. During this process, any other slave cores that have finished executing their tasks must wait outside the task critical section until the previous slave core successfully retrieves its task. Only then can the waiting slave cores enter the task critical section and retrieve the next new task allocated by the master core. This process continues until all slave cores have retrieved all the tasks allocated by the master core.

[0019] According to a preferred embodiment of the present invention, automatically acquiring tasks from a single core specifically includes:

[0020] First, the main core initiates the program's execution, and the slave cores are started by calling the athread_spawn() interface. Each slave core acquires tasks simultaneously.

[0021] Then, the kernel enters the task acquisition phase when the initial task ends;

[0022] The task acquisition phase consists of two parts: acquiring the new task number and executing the new task.

[0023] Obtaining a new task number: When a slave core enters the task critical section, the slave core in the task critical section continuously attempts to obtain the address data where the new task number is stored in the master core. At this time, the master core assigns the new task number to the corresponding address. The new task number is obtained by the slave core continuously obtaining the address where the new task is stored. At the same time, the obtained new task number is compared with the previous task number. After confirming that they are different, the new task is executed.

[0024] Executing a new task: After the slave core obtains a new task number and uses DMA to transfer data with the master core, the slave core leaves the task critical section and executes the new task; at the same time, the new slave core enters the task critical section after completing its initialization task, continues to interact with the master core, obtains a new task number, and executes the new task.

[0025] Determine whether the task allocation in the main core has been completed. If the allocation is complete, the task acquisition phase ends; otherwise, continue executing the task acquisition phase.

[0026] According to a preferred embodiment of the present invention, the method of automatically acquiring tasks from the kernel, the method of automatically acquiring tasks from the kernel, or the method of automatically acquiring tasks from the kernel cluster is selected according to the number of tasks. Specifically, when the number of tasks is less than 64, the method of automatically acquiring tasks from the kernel or the method of automatically acquiring tasks from the kernel is used; otherwise, the method of automatically acquiring tasks from the kernel cluster is used.

[0027] According to a preferred embodiment of the present invention, the automatic acquisition of tasks from the kernel includes:

[0028] The kernel array is divided into groups, and the kernels in each row are selected as the units to process tasks. The units communicate with each other through registers to ensure the smooth progress of the tasks. The first kernel in the row obtains the task. Based on the column ID of the obtained kernel, only the kernel with column ID 0 is allowed to enter the task critical section to obtain the new task number. After obtaining the new task number, the kernels communicate with the other kernels in the row to process the new task.

[0029] According to a preferred embodiment of the present invention, the column automatically retrieves tasks from the core, including:

[0030] The kernel array is divided into groups from each column. Each kernel in each column is selected as the unit to process tasks. The units communicate with each other through registers to ensure the smooth execution of tasks. The first kernel in the column obtains the task. Based on the row ID of the obtained kernel, only the kernel with row ID 0 is allowed to enter the task critical section to obtain the new task number. After obtaining the new task number, the kernel communicates with the other kernels in the column to process the new task.

[0031] According to a preferred embodiment of the present invention, automatically obtaining tasks from a kernel cluster includes:

[0032] The system uses four adjacent slave cores as the unit for processing tasks. The units communicate with each other through the slave core cluster to ensure the smooth execution of tasks. The first slave core in the slave core cluster obtains the task. It determines whether it is the first slave core in the slave core cluster based on the ID value of the slave core array it belongs to. Only the first slave core is allowed to enter the task critical section to obtain the new task number. After obtaining the new task number, it processes the new task together with other slave cores in the same slave core cluster through register communication between slave core clusters.

[0033] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement a method for load balancing based on a slave core array task allocation using a new generation Shenwei many-core processor.

[0034] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of a method for load balancing through task allocation of a slave core array based on a new generation Shenwei many-core processor.

[0035] The beneficial effects of this invention are as follows:

[0036] This invention focuses on the problem of uneven load distribution caused by inconsistent and large differences in the size of tasks to be optimized during single-core group optimization.

[0037] 1. This invention provides a method for solving the load balancing problem of different task numbers, which saves the waiting time of slave cores, ensures the balance of the number of tasks on each slave core, and improves the parallel efficiency of the program.

[0038] 2. This invention can determine the task acquisition method based on the number of tasks, mainly including automatic task acquisition by a single slave core, automatic task acquisition by a row slave core, automatic task acquisition by a column slave core, and automatic task acquisition by a cluster of slave cores. This flexibility can improve the parallel efficiency of the program.

[0039] 3. This invention is based on a master-slave asynchronous acceleration mode to enable slave cores to automatically acquire tasks. The master core can communicate with a single slave core, a row of slave cores, a column of slave cores, or a cluster of slave cores to accelerate processing, thereby solving the problem of load imbalance. Attached Figure Description

[0040] Figure 1 This is a schematic diagram of the SW26010pro architecture;

[0041] Figure 2 The original method of evenly distributing the number of tasks among each core;

[0042] Figure 3 A diagram comparing task distribution on an even basis and task acquisition automatically;

[0043] Figure 4 A diagram illustrating the automatic task acquisition process for a single core;

[0044] Figure 5 A diagram illustrating the automatic task acquisition process from the kernel.

[0045] Figure 6 This is a diagram illustrating the automatic task acquisition process from the core.

[0046] Figure 7 This is a diagram illustrating the automatic acquisition of tasks from a kernel cluster. Detailed Implementation

[0047] The present invention will be further defined below with reference to the accompanying drawings and embodiments, but is not limited thereto.

[0048] Example 1

[0049] A method for load balancing based on task allocation from a slave core array using a new generation of Shenwei many-core processors includes:

[0050] Each slave core completes its current initial task, then communicates with the master core to automatically obtain the next task and continues to execute the obtained task until the task ends; the master core is responsible for task allocation and updating.

[0051] Automatic task retrieval from a core includes single-core automatic task retrieval and multi-core automatic task retrieval. The multi-core automatic task retrieval method is based on core grouping. According to the hardware architecture of the Shenwei many-core processor, cores can be grouped in various ways, mainly including row-based automatic task retrieval, column-based automatic task retrieval, and core cluster-based automatic task retrieval.

[0052] Example 2

[0053] The method for load balancing based on the new generation Shenwei many-core processor for task allocation in the slave core array, as described in Example 1, differs in that:

[0054] Single-core automatic task retrieval refers to: using a master-slave asynchronous parallel acceleration method, data is transferred between a single slave core and the master core to achieve automated task retrieval; including:

[0055] After the master core calls `athread_spawn()` to start the slave cores, the master core begins allocating tasks and storing them at designated addresses. Simultaneously, the slave cores begin executing their initial tasks. Once a slave core completes its initial task, it enters the task critical section and retrieves the next task number from the master core via DMA. After successfully retrieving the task, the slave core sends a signal to the master core, allowing it to allocate the next task. During this process, any other slave cores that have completed their tasks must wait outside the task critical section until the previous slave core successfully retrieves its task. Only then do the waiting slave cores enter the task critical section and retrieve the next new task allocated by the master core. This process continues until all slave cores have retrieved all tasks allocated by the master core. The specific implementation is as follows: Figure 4 As shown.

[0056] Tasks are automatically retrieved from the core, specifically including:

[0057] First, the master core initiates program execution, launching slave cores via the `athread_spawn()` interface to begin executing their respective code. Each slave core (the number of slave cores is configurable) simultaneously acquires tasks.

[0058] Then, the kernel enters the task acquisition phase when the initial task ends;

[0059] The task acquisition phase consists of two parts: acquiring the new task number and executing the new task.

[0060] Obtaining a new task ID: Obtaining a new task uses a task critical section, which ensures that only one slave core can obtain the task from the master core at any given time, thus ensuring the uniqueness of task execution. To ensure that the slave core can correctly obtain the task ID assigned by the master core, the slave core enters the task critical section. The slave core in the task critical section continuously attempts to obtain the address data where the new task ID is stored in the master core. At this time, the master core assigns the new task ID to the corresponding address. The new task ID is obtained by the slave core continuously obtaining the address where the new task is stored. To prevent acquisition errors, the new task ID is compared with the previous task ID (the first one is the initial task ID). If they are different, the new task is executed.

[0061] Executing a new task: After the slave core obtains a new task number and uses DMA to transfer data with the master core, the slave core leaves the task critical section and executes the new task; at the same time, after the new slave core completes its initialization task, it enters the task critical section, continues to interact with the master core, obtains a new task number, and executes the new task.

[0062] Determine whether the task allocation in the main core has been completed. If the allocation is complete, the task acquisition phase ends; otherwise, continue executing the task acquisition phase.

[0063] Because the master and slave cores are independent, to ensure the controllability of their execution order, multiple flag variables and loop control statements are used in both the master and slave cores. The slave core returns the condition variable value from the master core to ensure the loop control statement passes smoothly. Similarly, the slave core uses loop condition values ​​to continuously retrieve data from the master core, and then the master core modifies these loop condition values ​​to ensure the slave core can pass the loop control statement smoothly. The master and slave cores are mutually constrained and communicate with each other, ensuring that the slave core can accurately obtain a unique and correct task number from the master core each time. The specific pseudocode is shown below:

[0064] Main core pseudocode:

[0065] for(int i=64; i <total_task; i++)

[0066] {

[0067] Assign a task number;

[0068] while (failed to fetch new task from kernel);

[0069] if (i == total_task-1) {

[0070] Assign a special task number

[0071] }

[0072] ...

[0073] }

[0074] From the kernel pseudocode:

[0075] / / Initial processing of computational allocation tasks

[0076] while (main kernel task assignment end flag) {

[0077] CRTS_smutex_lock_array(); / / Add a mutex lock

[0078] do{

[0079] get(newtask_number) / / Get the new task

[0080] if (new task is correct) {

[0081] Exit the do...while loop;

[0082] }

[0083] while(flag)

[0084] do{

[0085] put(main kernel loop condition); / / Modify the main kernel loop condition to ensure it exits the loop successfully.

[0086] ...

[0087] The `while(put function failed to execute)` loop continues.

[0088] ...

[0089] CRTS_smutex_unlock_array (void); / / End the mutex lock;

[0090] Execute the acquired task

[0091] }

[0092] The main program starts the slave core resource using the `athread_spawn()` function. The master core enters the task allocation phase, placing the tasks to be allocated at the specified address, and then waits for the identifier to continue the next task allocation. Simultaneously, the slave core begins executing the initial task (obtained based on the slave core number). After completing the initial task, the slave core enters the automatic task acquisition phase. This phase uses nested mutexes, allowing only one slave core to enter the nested critical section at a time to acquire a task. At this point, the master core has already allocated the task to the specified address. Once inside the critical section, the slave core acquires the task stored at the specified address by the master core via DMA. Upon successful acquisition, it checks the task number to ensure it's correct. If the correct number isn't found, it continues acquiring until the correct number is found. After acquiring the correct task, the slave core sends a signal to the master core, which then continues with the next task allocation. Simultaneously, the slave core leaves the critical section and continues executing the newly acquired task. Other slave cores outside the critical section then enter to acquire the next task, and so on, until the master core has allocated all tasks. After receiving the last successful task acquisition flag from the slave core, a special task number will be assigned. When all slave cores have completed all assigned tasks and continue to acquire tasks, they will obtain this special task number, identify it, and directly terminate the slave core resource acquisition, thus completing the entire slave core task acquisition process.

[0093] Example 3

[0094] The method for load balancing based on the new generation Shenwei many-core processor for task allocation in a slave core array, as described in Embodiment 1 or 2, differs in that:

[0095] The automatic task retrieval method is selected based on the number of tasks and the number of task groups. Specifically, it can be categorized into row-based, column-based, or cluster-based automatic task retrieval. Row-based and column-based automatic task retrieval processes one task by grouping eight slave cores per row or column, allowing for the simultaneous processing of eight tasks. Cluster-based automatic task retrieval processes one task per cluster, allowing for the simultaneous processing of 16 tasks. When the number of tasks is less than 64, either row-based or column-based automatic task retrieval is used; otherwise, cluster-based automatic task retrieval is used.

[0096] The task is automatically retrieved from the core, including:

[0097] Similar to the automatic task acquisition method for a single core, each row in the core array is divided into a group. The slave cores in each row are selected as the task processing units. These units communicate via registers to ensure smooth task execution. The first slave core in that row acquires the task. Based on the column ID of the acquired slave core, only the slave core with column ID 0 is allowed to enter the task critical section to acquire a new task number. After acquiring the new task number, it processes the new task together with the other slave cores in that row through row communication. The method for acquiring the master core task is the same as the automatic acquisition method for a single slave core, and the pseudocode is the same. A diagram illustrating automatic task acquisition by row slave cores is shown below. Figure 5 As shown.

[0098] The column automatically retrieves tasks from the core, including:

[0099] The kernel array is divided into groups from each column, and a slave kernel in each column is selected as the task processing unit. Units communicate via registers to ensure smooth task execution. The first slave kernel in that column acquires the task. Based on the row ID of the acquired slave kernel, only the slave kernel with row ID 0 is allowed to enter the task critical section to acquire the new task number. After acquiring the new task number, it processes the new task together with other slave kernels in that column via column communication. The method for acquiring the master kernel task is the same as the automatic acquisition method for a single slave kernel, and the pseudocode is the same. A diagram illustrating the automatic task acquisition of a row of slave kernels is shown below. Figure 6 As shown.

[0100] Tasks are automatically retrieved from the kernel cluster, including:

[0101] The system uses four adjacent slave cores as task processing units. Communication between these units is achieved through a slave core cluster to ensure smooth task execution. The first slave core in the cluster retrieves the task. Its position (id) determines whether it is the first slave core in the cluster. Only the first slave core is allowed to enter the task critical section to retrieve the new task number. After retrieving the new task number, it processes the new task through register communication between slave core clusters and in collaboration with other slave cores in the same cluster. The method for retrieving the master core task is the same as the automatic task retrieval method for a single slave core, and the pseudocode is identical. An illustration of automatic task retrieval by a slave core cluster is shown below. Figure 7 As shown.

[0102] Suppose there are n tasks, each with a different computation time. We optimize by distributing these tasks across slave cores. Taking the automatic task acquisition method using a slave core cluster (4 slave cores) as an example, the execution time of the original average allocation method compared to the execution time using this method is as follows: Figure 3 As shown.

[0103] This embodiment also tested the automatic acquisition method for a single kernel task. This test experiment used a matrix multiplication function to verify task overhead and result correctness. To ensure the diversity between tasks, a random number generator was used to generate integers between 1 and 1000 as the number of loops in the matrix multiplication function. Different numbers of loops corresponded to different numbers of tasks.

[0104] 100, 500, 1000, and 3000 tasks were used as the number of test tasks, respectively. The test times were compared with those of a serial program and a typical many-core optimized program. The speedup (milliseconds) using the method of this invention is shown in Table 1.

[0105] Table 1

[0106] Number of tasks serial time Common optimization method time Invention optimization method time Speedup of ordinary optimization methods Invention method speedup The efficiency improvement of the inventive method compared to the conventional method 100 1779654 193323 144976 9.21 12.27 ↑33% 500 8787516 638633 484011 13.76 18.16 ↑32% 1000 17599362 1155919 913740 15.22 19.26 ↑27% 3000 53713133 3047035 2577438 17.63 20.84 ↑18%

[0107] Experimental results demonstrate that the method of this invention has a significant speedup effect compared to serial programs and ordinary many-core optimized programs.

[0108] Example 4

[0109] A computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method for load balancing based on the new generation Shenwei many-core processor for task allocation of the slave core array as described in any of Embodiments 1-3.

[0110] Example 5

[0111] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the method for load balancing based on the task allocation of a slave core array using a new generation Shenwei many-core processor as described in any of Embodiments 1-3.

Claims

1. A method for load balancing based on task allocation of a slave core array using a new generation of Shenwei many-core processors, characterized in that, include: Each slave core completes its current initial task, then communicates with the master core to automatically obtain the next task and continues to execute the obtained task until the task ends; the master core is responsible for task allocation and updating. Automatic task retrieval from a core includes single-core automatic task retrieval and multi-core automatic task retrieval. The multi-core automatic task retrieval method is based on core grouping, including row-based automatic task retrieval, column-based automatic task retrieval, and core cluster-based automatic task retrieval. Automatic task retrieval via a single slave core refers to the automated retrieval of tasks through a master-slave asynchronous parallel acceleration method, where data is transferred between a single slave core and the master core. This includes: After the master core calls `athread_spawn()` to start the slave cores, the master core begins to allocate tasks and store them at a specified address. At the same time, the slave cores begin to execute their initial tasks. After the slave cores finish executing their initial tasks, they enter the task critical section and obtain the next task number from the master core via DMA. After successfully obtaining the task, the slave core sends a signal to the master core, allowing the master core to continue allocating the next task. During this process, if any of the other slave cores have finished executing their tasks, they need to wait outside the task critical section until the previous slave core successfully obtains its task. Only then can the remaining waiting slave cores enter the task critical section and obtain the next new task allocated by the master core. This process continues until all slave cores have obtained all the tasks allocated by the master core. The task is automatically retrieved from the core, including: The kernel array is divided into groups, and the kernels in each row are selected as the units to process tasks. The units communicate with each other through registers to ensure the smooth progress of the tasks. The first kernel in the row obtains the task. According to the column ID of the obtained kernel, only the kernel with column ID 0 is allowed to enter the task critical section to obtain the new task number. After obtaining the new task number, the kernels communicate with the other kernels in the row to process the new task. The column automatically retrieves tasks from the core, including: The kernel array is divided into groups from each column. Each kernel in each column is selected as the unit to process tasks. The units communicate with each other through registers to ensure the smooth execution of tasks. The first kernel in the column obtains the task. Based on the row ID of the obtained kernel, only the kernel with row ID 0 is allowed to enter the task critical section to obtain the new task number. After obtaining the new task number, the kernel communicates with the other kernels in the column to process the new task. Tasks are automatically retrieved from the kernel cluster, including: The system uses four adjacent slave cores as the unit for processing tasks. The units communicate with each other through the slave core cluster to ensure the smooth execution of tasks. The first slave core in the slave core cluster obtains the task. It determines whether it is the first slave core in the slave core cluster based on the ID value of the slave core array it belongs to. Only the first slave core is allowed to enter the task critical section to obtain the new task number. After obtaining the new task number, it processes the new task together with other slave cores in the same slave core cluster through register communication between slave core clusters.

2. The method for load balancing based on task allocation of a slave core array using a new generation Shenwei many-core processor according to claim 1, characterized in that, Tasks are automatically retrieved from the core, specifically including: First, the main core initiates the program's execution, and the slave cores are started by calling the athread_spawn() interface. Each slave core acquires tasks simultaneously. Then, the kernel enters the task acquisition phase when the initial task ends; The task acquisition phase consists of two parts: acquiring the new task number and executing the new task. Obtaining a new task number: When a slave core enters the task critical section, the slave core in the task critical section continuously attempts to obtain the address data where the new task number is stored in the master core. At this time, the master core assigns the new task number to the corresponding address. The new task number is obtained by the slave core continuously obtaining the address where the new task is stored. At the same time, the obtained new task number is compared with the previous task number. After confirming that they are different, the new task is executed. Executing a new task: After the slave core obtains a new task number and uses DMA to transfer data with the master core, the slave core leaves the task critical section and executes the new task; at the same time, the new slave core enters the task critical section after completing its initialization task, continues to interact with the master core, obtains a new task number, and executes the new task. Determine whether the task allocation in the main core has been completed. If the allocation is complete, the task acquisition phase ends; otherwise, continue executing the task acquisition phase.

3. The method for load balancing based on task allocation of a slave core array using a new generation Shenwei many-core processor according to claim 1, characterized in that, Depending on the number of tasks, the system selects between automatically acquiring tasks from the kernel (row-based), automatically acquiring tasks from the kernel (column-based), or automatically acquiring tasks from the kernel cluster. Specifically, when the number of tasks is less than 64, either the row-based or column-based method is used for automatic task acquisition; otherwise, the kernel cluster method is used.

4. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method for load balancing based on the task allocation of the slave core array of the new generation Shenwei many-core processor as described in any one of claims 1-3.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for load balancing based on the task allocation of the slave core array of the new generation Shenwei many-core processor as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Heterogeneous many-core processor-oriented multi-task parallel scheduling method

    CN112416539A