In-core multi-thread optimization method and system based on Shenwei multi-core processor

By combining and optimizing the slave kernel functions of Shenweizhong core processors, and using the master core and slave core to coordinate processing, the problem of frequent alternating calculation tasks by the slave core group and master core is solved, and the computing efficiency and completion degree are improved.

CN119271619BActive Publication Date: 2025-03-28SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411803189.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-28
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

When using the Shenweizhong core processor SW26010Pro, due to dependencies and other issues, it is impossible to effectively use the slave core group for calculation, resulting in the slave core group and the master core frequently performing calculation tasks alternately, slowing down the overall running speed of the program.

Method used

By combining the scattered slave kernel functions, and rationally using the main computing power, using multiple instruction streams and multiple data streams to complete the calculation tasks in parallel, reducing the number of data transmissions between the main memory and the slave kernel group LDM, and reducing the bandwidth pressure of slave kernel memory access.

Benefits of technology

The calculation efficiency of each operation core in the core group is improved, the number of communications within the core group is reduced, the precious LDM space is saved, the independence of the core function is enhanced, and the calculation efficiency and completion of the overall computing task is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271619B_ABST
    Figure CN119271619B_ABST
Patent Text Reader

Abstract

The present invention relates to a multi-thread optimization method and system within a core group based on a Shenwei multi-core processor, and belongs to the field of electronic information technology; it includes: (1) data preprocessing; separating the computing tasks containing dependencies and the computing tasks that can be slaved in the task; (2) main core and slave core assisted processing; according to the calculation logic of the original computing task, the computing tasks containing dependencies and the computing tasks that can be slaved are respectively handed over to the main core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams within the core group; (3) slave core calculation optimization; applying for a separate area in the slave core LDM to store intermediate results; in addition, applying for a part of the main memory space to receive the slave core calculation results; when all threads in the core group reach the predetermined end position, the calculation results are merged. The present invention avoids calculation interruption and data errors caused by multiple data transmissions, effectively enhances the independence of the slave core function, and improves the calculation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a multi-thread optimization method and system within a core group based on a Shenwei multi-core processor, and belongs to the field of electronic information technology. Background Art

[0002] After decades of development, China's high-performance computing has explored the development path of domestic high-performance computers represented by the Sunway supercomputer, enabling China to independently develop high-performance processors and accelerators. Supercomputers are of great significance to many aspects, including basic scientific research, industrial application of scientific and technological achievements, and sustainable development of the national economy.

[0003] The processor chip used in the new generation of Sunway supercomputer is the Sunway SW26010Pro processor, which adopts a similar heterogeneous architecture, such as Figure 1 As shown in the figure, each core group includes a computing control core (MPE, referred to as the master core) and an 8×8 computing core (CPE, referred to as the slave core) array. Any two computing cores in the array can communicate data and collectively through remote memory access (RMA). Six core groups (CGs) are integrated in a processor chip and connected through an on-chip interconnect network. Each node contains two SW26010Pro processors, and the node computing performance can reach 6.12TFlpos. The entire system has 512 nodes, and the peak performance of the machine can reach 3.13PFlops.

[0004] Both the master core and the slave core use the SW64 instruction set with independent intellectual property rights. The master core supports 256-bit SIMD vector operations, and the slave core supports 512-bit SIMD vector operations. The master core storage hierarchy includes registers, data cache, instruction cache, secondary cache shared by data and instructions, and main memory. The slave core storage hierarchy includes registers, on-chip data storage space, instruction cache, and main memory. The data storage space can be configured as a software-managed local data storage (LDM) or a hardware-managed L1 data cache. The slave core can initiate a direct memory access (DMA) operation to realize data transfer between the LDM and the main memory, and can also realize data transfer between the local LDM and other slave core LDMs through RMA operations.

[0005] Given the unique architecture of the Shenwei multi-core processor SW26010Pro, in the process of computing optimization, computing tasks need to be assigned to the slave core group as much as possible for calculation. However, in some programs, due to dependency and other issues, the slave core group cannot be used for calculation, resulting in the slave core group and the main core frequently alternating to perform computing tasks, slowing down the overall running speed of the program. Summary of the invention

[0006] In view of the deficiencies of the prior art, the present invention provides a multi-thread optimization method within a core group based on the Shenwei multi-core processor;

[0007] The present invention also provides a multi-thread optimization system within a core group based on the Shenwei multi-core processor.

[0008] The present invention merges scattered slave core functions, reasonably utilizes the main core computing power, adopts a multi-instruction stream and multi-data stream approach, completes the entire computing task in parallel, reduces the number of data transmissions between the main memory and the slave core group LDM, and reduces the bandwidth pressure of the slave core memory access, thereby achieving the effect of improving the computing efficiency of each computing core in the core group.

[0009] In the process of slave core optimization, when only part of the computing tasks can be assigned to the slave core group for calculation due to dependencies and other problems in the program, resulting in frequent alternating calculations between the slave core group and the main core, a suitable slave core function merging method is designed based on its computing characteristics and the architectural characteristics of the Shenwei multi-core processor SW26010Pro chip, with the appropriate participation of the main core, to achieve better computing results.

[0010] The technical solution of the present invention is:

[0011] The multi-thread optimization method within the core group based on the Shenwei multi-core processor includes:

[0012] (1) Data preprocessing

[0013] Separate the computational tasks that contain dependencies from the core;

[0014] When the same initial data is needed, the initial data is copied and transferred to the slave core LDM; the data packaging method is used to transfer all the calculation data to the slave core LDM at one time;

[0015] (2) Master and slave cores assist in processing

[0016] According to the calculation logic of the original calculation task, the calculation tasks with dependencies and the calculation tasks that can be processed by slave cores are respectively assigned to the master core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams within the core group;

[0017] During the calculation process of the slave core and the master core, when the slave core needs the intermediate result of the calculation of the master core, or when the master core needs the intermediate result of the calculation of the slave core, these intermediate results of the calculation are classified separately, specifically: the transmission time and the calculation time of the intermediate result are compared, if the transmission time is less than the calculation time, then the intermediate result is an intermediate result that requires a long calculation time and obviously affects the overall calculation efficiency; otherwise, the intermediate result is an intermediate result that requires a short calculation time and does not affect the overall calculation efficiency;

[0018] For intermediate results calculation tasks that require a short calculation time and do not affect the overall computing efficiency, both the slave core and the master core execute them; for intermediate results calculation tasks that require a long calculation time and significantly affect the overall computing efficiency, the method of intra-core group communication is used to transmit the required intermediate results;

[0019] (3) Optimization from the core calculation

[0020] A separate area is applied for in the slave core LDM to store intermediate results. Through the RMA interface, the local slave core obtains the intermediate results of the area, or the local slave core transmits the intermediate results of the area to other slave cores. In addition, a part of the main memory space is applied to receive the calculation results of the slave core. When all threads in the core group reach the predetermined end position, the results of the operation are merged.

[0021] Preferably, according to the present invention, the segmentation is performed by reorganizing the computational tasks containing dependencies and the computational tasks that can be sub-kernelized into a main kernel function and a sub-kernel function respectively.

[0022] Preferably, according to the present invention, the calculation data transmitted to the slave core is optimized, including: dividing the three-dimensional operation array into a two-dimensional array.

[0023] Preferably, according to the present invention, by calculating the time required for each part of the computing task and combining the computing logic, the order of each computing task is adjusted to find a suitable data synchronization node and complete data synchronization; a suitable data synchronization node means that the time to reach the synchronization node is the same.

[0024] Preferably, according to the present invention, finding a suitable data synchronization node to complete data synchronization means: by adjusting the sequence of various computing tasks, finding a node with the same end time as the preceding computing task, and performing synchronization after the node.

[0025] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a multi-thread optimization method within a core group based on a Shenwei multi-core processor are implemented.

[0026] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a multi-thread optimization method within a core group based on a Shenwei multi-core processor.

[0027] The multi-thread optimization system in the core group based on the Sunway multi-core processor includes:

[0028] The data preprocessing module is configured to: separate the computing tasks containing dependencies and the computing tasks that can be kernelized;

[0029] When the same initial data is needed, the initial data is copied and transferred to the slave core LDM; the data packaging method is used to transfer all the calculation data to the slave core LDM at one time;

[0030] The master core and slave core assist processing module is configured to: according to the calculation logic of the original calculation task, respectively transfer the calculation tasks with dependencies and the calculation tasks that can be slaved to the master core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams in the core group;

[0031] During the calculation process of the slave core and the master core, when the slave core needs the intermediate result of the calculation of the master core, or when the master core needs the intermediate result of the calculation of the slave core, these intermediate results of the calculation are classified separately, specifically: the transmission time and the calculation time of the intermediate result are compared, if the transmission time is less than the calculation time, then the intermediate result is an intermediate result that requires a long calculation time and obviously affects the overall calculation efficiency; otherwise, the intermediate result is an intermediate result that requires a short calculation time and does not affect the overall calculation efficiency;

[0032] For intermediate results calculation tasks that require a short calculation time and do not affect the overall computing efficiency, both the slave core and the master core execute them; for intermediate results calculation tasks that require a long calculation time and significantly affect the overall computing efficiency, the method of intra-core group communication is used to transmit the required intermediate results;

[0033] The slave core calculation optimization module is configured as follows: applying for a separate area in the slave core LDM to store intermediate results, and obtaining the intermediate results of the area through the RMA interface by the local slave core, or the local slave core and other slave cores mutually transmit the intermediate results of the area; in addition, applying for a part of the main memory space to receive the slave core calculation results; when all threads in the core group reach the predetermined end position, the results of the operation are merged.

[0034] The beneficial effects of the present invention are:

[0035] 1. The present invention reduces the number of data transmissions between the slave core group and the main memory, avoids calculation interruptions and data errors caused by multiple data transmissions, effectively enhances the independence of the slave core function, and improves calculation efficiency.

[0036] 2. The present invention reduces the number of communications within the slave core group, saves valuable LDM space, and improves the load balancing degree among the slave cores.

[0037] 3. The present invention increases the utilization efficiency of the computing power of each computing core in the core group, reduces the idle waiting time, and improves the computing efficiency and completion of the overall computing task. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is a schematic diagram of the architecture of the Shenwei multi-core processor SW26010Pro;

[0039] Figure 2 This is a schematic diagram of data transfer;

[0040] Figure 3 Optimization schematic for core calculation;

[0041] Figure 4 A schematic diagram of a main core processing a computing task with dependencies; DETAILED DESCRIPTION

[0042] The present invention will be further defined below in conjunction with the accompanying drawings and embodiments, but is not limited thereto.

[0043] Example 1

[0044] The multi-thread optimization method within the core group based on the Shenwei multi-core processor includes:

[0045] (1) Data preprocessing

[0046] In order to save the time of data transmission between the main memory and the slave core, and to make the slave core group more efficient, it is necessary to separate the dependent computing tasks and the slave core computing tasks. The dependent computing tasks refer to the tasks that are closely related to each other in the calculation, for example, the tasks that need MPI communication to continue the calculation. The slave core computing tasks refer to the tasks that are less related to each other in the calculation, for example, the for loops that do not reuse the same data.

[0047] The data required for calculations between them do not affect each other. In actual operations, it is inevitable that the same initial data is needed. Figure 2 As shown in the figure, when the same initial data is needed, the initial data is copied and transferred to the slave core LDM, avoiding the mutual influence between the data. In addition, the data packaging method is adopted to transfer all the calculation data to the slave core LDM at one time, reducing the number of data transmissions between the slave core group and the main memory, avoiding calculation interruptions and data errors caused by multiple data transmissions, effectively enhancing the independence of the slave core function, and improving the calculation efficiency.

[0048] (2) Master and slave cores assist in processing

[0049] like Figure 3 As shown, according to the calculation logic of the original calculation task, the calculation tasks containing dependencies and the calculation tasks that can be processed by slave cores are respectively assigned to the main core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams within the core group;

[0050] In the calculation process, the ideal situation is that the slave core and the master core do not affect each other, that is, they do not need the intermediate results of the calculations of other cores, but in actual situations, this situation is inevitable. In order to solve such problems, the present invention classifies these intermediate results of calculations separately when the slave core needs the intermediate results of the calculations of the master core, or when the master core needs the intermediate results of the calculations of the slave core, specifically: compare the transmission time and calculation time of the intermediate result, if the transmission time is less than the calculation time, then the intermediate result is an intermediate result that takes a long time to calculate and obviously affects the overall computing efficiency; otherwise, the intermediate result is an intermediate result that takes a short time to calculate and does not affect the overall computing efficiency;

[0051] For intermediate results that require a short calculation time and do not affect the overall computing efficiency, both the slave core and the master core execute the tasks. The calculation time is not greater than the transmission time. Combined with "does not affect the overall computing efficiency", this indicates that this part of time accounts for a small proportion of the total running time of the program. If the strategy of "both slave cores and master cores execute" is adopted, the computing efficiency of the program will not be affected, and the greater time overhead caused by data communication within the core group can be avoided.

[0052] For computing tasks that require a long time to calculate intermediate results and obviously affect the overall computing efficiency, the method of intra-core group communication is used to transmit the required intermediate results; the "long time" required for calculation is compared with the time required to transmit the intermediate variable. The calculation time is greater than the transmission time, and combined with the "obvious impact on the overall computing efficiency", it means that this part of time accounts for a large proportion of the total running time of the program. If the strategy of "execution of both slave cores and main cores" is adopted, the computing efficiency of the program will decrease; for example, after the main core and the slave core have run for a period of time, when they continue to run, the slave core needs part of the calculation results of the master core, so the master core and the slave core need to communicate within the core group to transmit the calculation results to the slave core.

[0053] (3) Optimization from the core calculation

[0054] Dispersed slave core functions will not only cause frequent start and stop of the slave core group, but also cause frequent data transmission, resulting in reduced utilization of the slave core group, reduced efficiency, and failure to bring into play the full performance of the Shenwei multi-core processor SW26010Pro. Merging slave core functions can effectively solve the above problems. The present invention provides a method that can effectively solve the problem of saving intermediate data caused by function merging. Figure 3 As shown, the method applies for a separate area in the slave core LDM to store intermediate results. The data in this area is not affected by the data in the calculation, and the area exists in the private LDM of each slave core. Through the RMA interface, the local slave core obtains the intermediate results of the area at high speed, or the local slave core and other slave cores transmit the intermediate results of the area to each other; the number of communications within the slave core group is effectively reduced, the efficiency of the slave core obtaining data is improved, and the precious LDM space is saved.

[0055] After the calculation of the slave core group is completed, in order to avoid data interference caused by directly transferring back to the original position of the main memory, which may cause subsequent calculation errors, the method of the present invention applies for another part of the main memory space to receive the calculation results of the slave core; when all threads in the core group reach the predetermined end position, the calculation results are merged. This effectively isolates the data interference between different threads and improves the efficiency of collaborative calculation.

[0056] The present invention focuses on solving the problem of merging scattered slave core functions, including data preprocessing to solve the interference in the transmission and calculation process of the initial data, and storage optimization of the slave core LDM to protect the intermediate data generated by the merged slave core function after running for a stage and the acquisition of other computing data. The present invention defines the main core as an auxiliary computing core to handle computing tasks with strong dependencies that cannot be calculated by the slave core group. The main computing tasks are concentrated on the slave core group for processing, and the computing tasks of the main core account for a small proportion of the total computing tasks.

[0057] Example 2

[0058] The difference between the multi-thread optimization method within a core group based on the Shenwei multi-core processor described in Example 1 is that:

[0059] The partitioning is performed by reorganizing the dependent computing tasks and the slave kernel-capable computing tasks into the main kernel function and the slave kernel function respectively.

[0060] Optimize the computational data passed into the slave core, including: splitting the three-dimensional computational array into a two-dimensional array that is convenient for computation. This is also beneficial for storage in the slave core LDM. Figure 3 For example, the data originally calculated is a three-dimensional array of size 3×4×5, and each time the calculation is performed in units of a one-dimensional array of size 5, for a total of 3×4 calculations. After optimization, when performing slave core data transmission and calculation, the three-dimensional array can be converted into a two-dimensional array of size 12×5, and transmitted in units of a one-dimensional array of size 5, so that the data input to the slave core LDM is logically and physically continuous. All slave cores in the slave core group are evenly allocated 3×4 one-dimensional arrays according to the idea of ​​load balancing. This method can effectively improve the computing and transmission efficiency of each slave core, and can make the computing time between each slave core basically equivalent, avoiding that some slave cores affect the computing progress of the entire core group due to more computing tasks.

[0061] By calculating the time required for each part of the computing task, combined with the computing logic, adjusting the order of each computing task, finding the appropriate data synchronization node, and completing data synchronization; the appropriate data synchronization node means that the time to reach the synchronization node is the same. Avoid waiting for the master core or slave core, which wastes computing power.

[0062] Finding a suitable data synchronization node to complete data synchronization means: by adjusting the order of each computing task, finding a node with the same end time as the previous computing task, and synchronizing after this node. This method can effectively reduce the number of data synchronizations within the core group, increase the utilization efficiency of the computing power of each computing core within the core group, and improve the computing efficiency and completion of the overall computing task.

[0063] The present invention defines the main core as an auxiliary computing core to process computing tasks with strong dependencies that cannot be calculated by the slave core group. The main computing tasks are concentrated on the slave core group for processing, and the computing tasks of the main core account for a small proportion of the total computing tasks.

[0064] Through the implementation of the above method, the method of this embodiment was tested in a single core group.

[0065] This test takes the plasma fluid simulation program as an example. Under the same input conditions, the number of points in the Z direction of the test data are 65, 129, and 257 respectively, and the acceleration ratio of the time required for one iteration of the test program is measured.

[0066] The time and speedup ratio of the master core serial version, the common slave core version and the optimized version of the present invention are compared. The specific results and comparisons are shown in Tables 1 to 3 below.

[0067] Table 1 shows the running time and speedup ratio required for one iteration of the test program before and after optimization when the number of points in the Z direction of the test data is 65;

[0068] Table 1 Speedup comparison table when Z=65;

[0069] Program Version Main core serial Ordinary nuclearization The present invention multithreaded optimization Run time (μs) 410,196 69.930 53,559 Speedup / 5.87 7.66

[0070] Table 2 shows the running time and speedup ratio required for one iteration of the test program before and after optimization when the number of points in the Z direction of the test data is 129;

[0071] Table 2 Speedup comparison table when Z=129;

[0072] Program Version Main core serial Ordinary nuclearization The present invention multithreaded optimization Run time (μs) 803,415 144,215 107,535 Speedup / 5.57 7.47

[0073] Table 3 shows the running time and speedup ratio required for one iteration of the test program before and after optimization when the number of points in the Z direction of the test data is 257;

[0074] Table 3 Speedup comparison table when Z=257;

[0075] Program Version Main core serial Ordinary nuclearization Multithreading optimization of the present invention Run time (μs) 1,650,097 314,510 236,653 Speedup / 5.25 6.97

[0076] Experimental results show that compared with the master core serial version and the common slave core version, the method of the present invention has an obvious acceleration effect.

[0077] Example 3

[0078] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the multi-thread optimization method within a core group based on the Shenwei multi-core processor described in Example 1 or 2 are implemented.

[0079] Example 4

[0080] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the multi-thread optimization method within a core group based on the Shenwei multi-core processor described in Example 1 or 2.

[0081] Example 5

[0082] The multi-thread optimization system in the core group based on the Sunway multi-core processor includes:

[0083] The data preprocessing module is configured to: separate the computing tasks containing dependencies and the computing tasks that can be kernelized;

[0084] When the same initial data is needed, the initial data is copied and transferred to the slave core LDM; the data packaging method is used to transfer all the calculation data to the slave core LDM at one time;

[0085] The master core and slave core assist processing module is configured to: according to the calculation logic of the original calculation task, respectively transfer the calculation tasks with dependencies and the calculation tasks that can be slaved to the master core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams in the core group;

[0086] During the calculation process of the slave core and the master core, when the slave core needs the intermediate result of the calculation of the master core, or when the master core needs the intermediate result of the calculation of the slave core, these intermediate results of the calculation are classified separately, specifically: the transmission time and the calculation time of the intermediate result are compared, if the transmission time is less than the calculation time, then the intermediate result is an intermediate result that requires a long calculation time and obviously affects the overall calculation efficiency; otherwise, the intermediate result is an intermediate result that requires a short calculation time and does not affect the overall calculation efficiency;

[0087] For intermediate results calculation tasks that require a short calculation time and do not affect the overall computing efficiency, both the slave core and the master core execute them; for intermediate results calculation tasks that require a long calculation time and significantly affect the overall computing efficiency, the method of intra-core group communication is used to transmit the required intermediate results;

[0088] The slave core calculation optimization module is configured as follows: applying for a separate area in the slave core LDM to store intermediate results, and obtaining the intermediate results of the area through the RMA interface by the local slave core, or the local slave core and other slave cores mutually transmit the intermediate results of the area; in addition, applying for a part of the main memory space to receive the slave core calculation results; when all threads in the core group reach the predetermined end position, the results of the operation are merged.

Claims

1. A multi-thread optimization method within a core group based on the Shenwei multi-core processor, characterized in that: include: (1) Data preprocessing Separate the computational tasks that contain dependencies from the core; When the same initial data is needed, the initial data is copied and transferred to the slave core LDM; the data packaging method is used to transfer all the calculation data to the slave core LDM at one time; (2) Master core and slave core assist in processing According to the calculation logic of the original calculation task, the calculation tasks with dependencies and the calculation tasks that can be processed by slave cores are respectively assigned to the master core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams within the core group; During the calculation process of the slave core and the master core, when the slave core needs the intermediate result of the calculation of the master core, or when the master core needs the intermediate result of the calculation of the slave core, these intermediate results of the calculation are classified separately, specifically: the transmission time and the calculation time of the intermediate result are compared, if the transmission time is less than the calculation time, then the intermediate result is an intermediate result that requires a long calculation time and obviously affects the overall calculation efficiency; otherwise, the intermediate result is an intermediate result that requires a short calculation time and does not affect the overall calculation efficiency; For intermediate results calculation tasks that require a short calculation time and do not affect the overall computing efficiency, both the slave core and the master core execute them; for intermediate results calculation tasks that require a long calculation time and significantly affect the overall computing efficiency, the method of intra-core group communication is used to transmit the required intermediate results; (3) Optimization from the core computing perspective A separate area is applied for in the slave core LDM to store intermediate results. The local slave core obtains the intermediate results of the area through the RMA interface, or the local slave core transmits the intermediate results of the area to other slave cores. In addition, a part of the main memory space is applied to receive the calculation results of the slave core. When all threads in the core group reach the predetermined end position, the results of the operation are merged.

2. The method for optimizing multithreading in a core group based on the Shenwei multi-core processor according to claim 1, characterized in that: The partitioning is performed by reorganizing the dependent computing tasks and the slave kernel-capable computing tasks into the main kernel function and the slave kernel function respectively.

3. The method for optimizing multithreading in a core group based on the Shenwei multi-core processor according to claim 1, characterized in that: Optimize the computational data passed into the slave core, including: splitting the three-dimensional computational array into a two-dimensional array.

4. The method for optimizing multi-threading in a core group based on a Shenwei multi-core processor according to any one of claims 1 to 3, characterized in that: By calculating the time required for each part of the computing task and combining it with the computing logic, the order of each computing task is adjusted to find a suitable data synchronization node and complete data synchronization; a suitable data synchronization node means that the time to reach the synchronization node is the same.

5. The method for optimizing multithreading in a core group based on the Shenwei multi-core processor according to claim 4, characterized in that: Find a suitable data synchronization node to complete data synchronization; this means: by adjusting the order of each computing task, find a node with the same end time as the previous computing task, and synchronize after this node.

6. The multi-thread optimization system within the core group based on the Shenwei multi-core processor is characterized by: include: The data preprocessing module is configured to: separate the computing tasks containing dependencies and the computing tasks that can be kernelized; When the same initial data is needed, the initial data is copied and transferred to the slave core LDM; the data packaging method is used to transfer all the calculation data to the slave core LDM at one time; The master core and slave core assist processing module is configured to: according to the calculation logic of the original calculation task, respectively transfer the calculation tasks with dependencies and the calculation tasks that can be slaved to the master core and the slave core for processing, so as to realize the parallel operation of multiple instruction streams and multiple data streams in the core group; During the calculation process of the slave core and the master core, when the slave core needs the intermediate result of the calculation of the master core, or when the master core needs the intermediate result of the calculation of the slave core, these intermediate results of the calculation are classified separately, specifically: the transmission time and the calculation time of the intermediate result are compared, if the transmission time is less than the calculation time, then the intermediate result is an intermediate result that requires a long calculation time and obviously affects the overall calculation efficiency; otherwise, the intermediate result is an intermediate result that requires a short calculation time and does not affect the overall calculation efficiency; For intermediate results calculation tasks that require a short calculation time and do not affect the overall computing efficiency, both the slave core and the master core execute them; for intermediate results calculation tasks that require a long calculation time and significantly affect the overall computing efficiency, the method of intra-core group communication is used to transmit the required intermediate results; The slave core calculation optimization module is configured as follows: apply for a separate area in the slave core LDM to store intermediate results, and obtain the intermediate results of the area through the RMA interface by the local slave core, or the local slave core and other slave cores transmit the intermediate results of the area to each other; in addition, apply for a part of the main memory space to receive the slave core calculation results; when all threads in the core group reach the predetermined end position, merge the results of the operation.

Citation Information

Patent Citations

  • Method and system for processor encryption algorithm transplantation

    CN112148361A

  • Dependence and cross cycle contained slave core optimization method based on SW many-core processor

    CN118409801A