SYSTEM AND METHOD FOR SYNCHRONIZING STRINGS IN A DIVERGENTIC CODE AREA

The method addresses synchronization challenges in divergent code areas by generating a number of strands entering such regions, using barriers and compiler automation to ensure synchronized execution, thereby preventing blockages and improving system efficiency.

DE102013022722B4Active Publication Date: 2024-10-17NVIDIA CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
DE102013022722
Authority / Receiving Office
DE · DE
Patent Type
Patents
Current Assignee / Owner
Priority Date
2012-09-10
Filing Date
2013-09-09
Publication Date
2024-10-17
Estimated Expiration
2033-09-09

AI Technical Summary

Technical Problem

Existing multi-threaded processing systems face challenges in effectively synchronizing strands in divergent code areas, leading to potential execution blockages and inefficiencies.

Method used

A method for synchronizing multiple strands by generating a number representing the number of strands entering a divergent region before execution, using barriers or synchronization operations implemented in hardware or software to ensure all strands reach the barrier before proceeding, and employing a compiler to automate this process.

Benefits of technology

Ensures efficient execution of strands in divergent code areas by preventing blockages and enhancing overall system performance through automated synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

A method for synchronizing multiple strands of a SIMD architecture, wherein the method comprises: prior to a conditional statement in a code that requires a jump to a divergent code region, calculating a flag on each of the multiple strands indicating whether the strand will enter the divergent region, synchronizing (202) the multiple strands that will arrive at the divergent region by applying a first barrier operation that receives the flag from each strand as well as a number for the number of strands that will arrive at the divergent region and computes a first number of strands that have set the flag to true, and initializing a second barrier in the divergent region using the first number of strands.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL AREA

[0001] This application relates generally to multi-strand parallel processing systems and in particular to a Method for synchronizing strands in a divergent code domain. BACKGROUND

[0002] In the area of ​​graphics processing and in other processing areas, programs often need to Process large collections of data points, including collections such as an image or an audio file. Often, such programs can be advantageously structured as a sequence of actions, each of which can be executed simultaneously at all data points in the collection.

[0003] A type of processing system designed to support such programs is called a Single-Instruction Multiple Data (SIMD) system. A SIMD system provides multiple processors, each of which The program's commands are applied to a single data point. In hardware, subgroups of multiple data points can be used. Processors can be implemented as multiple processing units (MPUs). Dietz, H. et al. describe this in: Static Scheduling for Barrier MIMD Architectures: In: The Journal of Supercomputing, 5, 1992. pp. 263-289, a method for using Barriers in MIMD architecture. Ramakrishnan, V. et al. describe in "Efficient Techniques for Fast Nested Barrier". Synchronization In SPAA '95: Proceedings of the seventh annual ACM symposium on Parallel algorithms and architectures, July 1995, pages 157-164, a method for the nested execution of barriers.

[0004] The object of the invention is an effective synchronization of multiple strands in programs with divergent Code areas. OVERVIEW

[0005] This problem is solved by the features of the independent claims. One aspect is a method for Synchronization of multiple strands according to claim 1 is provided. SHORT DESCRIPTION

[0006] Reference is now made to the following descriptions in conjunction with the accompanying drawings, in those: Fig. 1 is a schematic view of a system according to the disclosure; and Fig. 2 shows a method according to the disclosure. DETAILED DESCRIPTION

[0007] Fig. 1 is a schematic view of a system 100 according to the disclosure. The system comprises a a higher-level processor or a main processor 102, which is connected to a higher-level memory or main memory 104 and is connected to a graphics processing unit (GPU) 106. The GPU 106 is also connected to the main memory. 104 is connected and can write data to and read data from main memory 104 using a Direct memory access (DMA).

[0008] The GPU 106 is further connected to a display 108 or another output device and is configured to be to display the information generated by the GPU 106 using the display 108. In other embodiments, the Display 108 can also or alternatively be connected to the main processor 102 for displaying information that is provided by is generated by the main processor 102.

[0009] The GPU 106 contains several multi-processing units (MPUs) 112 under the control of a String execution control unit (TECU) 110. The TECU 110 is connected to the main processor 102 and is configured to To receive control signals from the main processor 102. The MPUs 112 are connected to a device memory 114. and are trained to write data to and read data from the device memory 114. The device memory 114 is connected to main memory 104 and is designed to write data to and from main memory. to read out.

[0010] The main processor 102 can execute a program that is a sequence of SIMD programs that are called cores or kernels, is structured. As part of the program execution, the main processor 102 can... Initiate sequence of kernels in GPU 106.

[0011] The GPU 106 provides a parallel computing architecture that enables parallel processing as a hierarchy of It arranges strands, strand blocks (or simply blocks), and grids or nets. A grid or net is a A collection of strands, all executing a common kernel. A single strand carries its kernel or... Its kernel is designed as a self-contained unit with independent data, stack, and program counter. Strands are divided into strand blocks of user-defined size (number of strands in the block). It is ensured that Strands within a block are executed simultaneously.

[0012] For the assignment to and execution by the MPUs 112, the strands of a block are, if necessary, divided into subdivided into subgroups. These subgroups can alternatively be referred to as "bulges" or "wavefronts". The size of a subgroup is typically expressed as a multiple of a power of two (i.e., 1, 2, 4, etc.) of the The number of processors in an MPU 112 is selected. The strands of a bulge are assigned to a single MPU 112. assigned, and the MPU 112 executes a single command of the strands of the bulge in a corresponding 1, 2, 4, etc. Number of clock cycles.

[0013] The strands of a block can be separated by applying an execution barrier operation (or simply barrier) or another synchronization operation. A barrier is often used to prevent this. to enforce a predefined sequence of operations that were issued before and after the barrier. Once a Once a strand reaches a barrier, it cannot proceed further until all strands have reached the barrier.

[0014] A barrier can be implemented as a counting signal or semaphore. When a string calls the barrier, The strand submits a number corresponding to the number of active strands in the block. This is in response to the first such request. The signal initializes its number to the received number minus one, thus representing the number of strands. those that remain to call the signal. Since each subsequent strand calls the counting signal, the signal decreases. its counter value. As soon as the number is 0, all strands may proceed.

[0015] In other embodiments, a barrier can be implemented as a per-strand marker, such as a bit field. For example, if a barrier has 64 possible participants, a system according to the revelation could be binary (1 / 0) bits. Use a 64-bit value to mark an arrival. A mask would assign a value to a subset of strands. To enable participation (thus realizing a "waiting for exactly N strands" behavior). That is, the bit-field barrier. would be initialized by creating a mask with a number of set (or cleared) bits equal to is the number of active strands in the block that was received.

[0016] In other embodiments, a system according to the disclosure can be a network of logic gates This can be implemented to perform an AND operation with multiple inputs on waiting strands. In a In such a system, the subgroup operation would be performed by passing a number of inputs equal to the received number of active strands in the block in a programmable manner set to TRUE (or FALSE) is set.

[0017] Barriers and other synchronization operations can be performed in hardware in the GPU or by means of software that is integrated into the The GPU is running and needs to be configured. Some GPUs provide a certain number of hardware barriers and Additional barriers can be provided using software if needed.

[0018] Kernels can contain sections or areas of code that may or may not be executed, wherein This depends on a data-dependent conditional test. Such sections of code can be considered divergent areas. be designated. If a barrier is placed in such a divergent area, it may reach Some strands do not cross the barrier, depending on the data on which the strand operates. Since no strand crosses a barrier If the process can continue until all strands have reached the barrier, this can lead to a blockage or a faulty operation. This leads to execution. For this reason, it is typically not permissible to create barriers in divergent code areas. use.

[0019] Although the processing unit 106 is referred to herein as a graphics processing unit, it should be noted that that the processing unit 106 can be used for data processing that is not related to graphics stands – i.e., in any application that requires multi-strand processing. In other embodiments, it can The processing unit 106 contains a circuit optimized for general-purpose processing, while retaining the underlying computing architecture as described herein.

[0020] The main processor 102 contains one or more subsystems configured to receive programs which are stored in one or more types of computer-readable media. The term "computer-readable medium" includes any type of medium that can be accessed by a computer, such as read-only memory (ROM), random access memory (RAM), a hard disk drive, a compact floppy disk (CD), a digital video disk or digital versatility disk (DVD), or some other type of medium.

[0021] Fig. 2 is a method 200 according to the disclosure. The method 200 is suitable for use in which is a program written using a structured control flow. Steps that go beyond the The actions shown by the dashed line 208 are executed before entering a divergent code area, while Steps below the dashed line 208 are to be taken when present within the divergent area.

[0022] Before entering the divergent code region, in step 202 all strands that are connected to the divergent region are They arrive and are synchronized using a barrier operation. Once all strands are synchronized, the process continues. Step 204 generates a number for the number of strands that will enter the divergent region.

[0023] Subsequently, in step 206, strands within the divergent region can be synchronized by the A number is passed to a barrier operation that anticipates exactly that number of strands arriving at the barrier. waits before continuing the execution of all strands within the divergent area.

[0024] In some embodiments, each strand can further compute a Boolean variable (or label) that indicates, whether the strand will enter the divergent region. After that, steps 202 and 204 can be combined under Applying a barrier operation, which further includes the current_number, i.e., a number representing the number of Strands arriving at the divergent area are received from each strand. The barrier synchronizes all strands that arrive at the divergent region using current_number and then returns new_number, i.e., a number the number of strands that reach the barrier, with the value still set to true.

[0025] In other embodiments, in which strands are arranged in subgroups (also called bulges or (where wavefronts are known) step 204 can include determining for each subgroup whether a strand in the subgroup will enter the divergent territory, thereby increasing the number of subgroups that form such a strand It is included, listed, and the number is generated by applying the entirety of subgroups. In some In certain embodiments, the number of strands entering the divergent region can be generated by The total number of subgroups is multiplied by the number of strands in each subgroup.

[0026] In some embodiments, all strands that do not enter the first divergent region enter a second one. divergent territory. Such conditions arise, for example, for an if statement that is both a It has both a then- and an else- statement. In such embodiments, in which a Synchronization of the strands entering the second divergent region is desired, and the Boolean value continues. Once a number of strands has been calculated for each strand, a number of strands entering the second divergent region can be generated. are done using !weiter (or NICHT weiter, which is the logical negation of weiter).

[0027] If a second divergent region is encountered which lies within the first divergent region and if If the goal is to synchronize strands entering the second divergent area, similar actions can be used. are carried out as described for the first divergent region. When strands are synchronized that are connected to Upon reaching the second divergent area, in step 202 the number for the strands that meet the second divergent Entering the area, be equal to the number of strands entering the first divergent area (new_number in some embodiments described above).

[0028] In some embodiments, commands to execute the steps of method 200 (or another (Model of the disclosure) is automatically generated by a compiler when the compiler includes an "if" statement. a statement, a "while" statement, or another statement that generates a divergent code area, where such a divergent code region contains a synchronization operation. Such a compiler can potentially generate a more efficient implementation than a programmer who manually defines a procedure according to the Revelation is encoded. Furthermore, the programmer will find the use of a compiler more convenient, since the The programmer does not need to add any code that implements such a procedure before and within each divergent Code area implemented.

[0029] It should be noted that such a compiler may use the method 200 or another method according to the disclosure can utilize such a compiler. It can utilize more than one method that realizes the disclosure in a single... Use a program. Such a procedure can use more than one type of barrier to facilitate the process. This can be achieved by distinguishing between synchronization operations implemented in hardware and barriers implemented in software. are configured, select. Such a selection can be based on a number of such synchronization operations, which are already in use in a program that contains several divergent areas requiring synchronization require.

[0030] generates a code area, encounters such a divergent code area containing a synchronization operation. Such a compiler can potentially produce a more efficient implementation than a programmer who... Manually coded a procedure according to the disclosure. The programmer will likely find using a compiler more convenient, since the programmer does not have to write any code. must add that such a procedure is implemented before and within each divergent code area.

[0031] It should be noted that such a compiler can perform the method 200 or another method according to the disclosure can utilize such a compiler. It can utilize more than one method that realizes the disclosure in a single... Use a program. Such a procedure can use more than one type of barrier to facilitate the process. This can be achieved by distinguishing between synchronization operations implemented in hardware and barriers implemented in software. are configured, select. Such a selection can be based on a number of such synchronization operations, which are already in use in a program that contains several divergent areas requiring synchronization require.

[0032] The present invention contains the following concepts: Concept 1. A method for synchronizing multiple strands, wherein the method comprises (i) generating a A number representing the number of strands that will enter a divergent area, where the number is generated before a strand enters the divergent region; and (ii) using the number within the divergent area for synchronizing the strands in the divergent area. Concept 2. The procedure as described in Concept 1, wherein generating the number further comprises (a) (a) Synchronizing the multiple strands; and (b) generating the number once the multiple strands are synchronized. are. Concept 3. The procedure as described in Concept 1, wherein the multiple strands are divided into multiple groups. are arranged in strands, and wherein the generation of the number further comprises (a) for each group of strands Determine whether a strand in the group will enter the divergent region; and (b) generate the number on the Basis of the investigation result. Concept 4. The procedure as described in Concept 3, wherein determining whether a strand from the group belongs in the entering a divergent area, furthermore includes: recognizing a strand within the group that leads into the divergent area. area will enter; and wherein the generation of the number based on the result of the determination further Includes: Generating the number based on the detected strands. Concept 5. The procedure as described in one of concepts 1-4, where the use of the number for Synchronizing the strands further includes: using a barrier that acts as a counting signal, a bit field or a network of logic gates is implemented, with the barrier being set up in hardware or software. Concept 6. The procedure as described in Concept 5, further including the use of the barrier: Initializing the barrier using a value of the number. Concept 7. The procedure as described in one of concepts 1-6, where the number is a first number, which a divergent area is a first divergent area, and the first divergent area is a second divergent area. area includes, wherein the procedure further comprises (iii) generating a second number which represents a number of strands represents those that will enter the second divergent area, with the second number being generated before a The strand enters the second divergent region, generating the second number using the first number. will; and (iv) using the second number within the second divergent region to synchronize the Strands in the second divergent area. Concept 8. A non-volatile, computer-readable medium that stores commands which, when issued by a multiple- The processing unit is executed, causing the multiple processing unit to process several strands that are in to synchronize the multi-processing unit by performing the following steps: (i) Generating a number representing the number of strands that will enter a divergent area, where the number is generated before a strand enters the divergent region; and (ii) using the number within the divergent area to synchronize the strands in the divergent area. Concept 9. The computer-readable medium as described in Concept 8, wherein the step of generating a number furthermore, it includes (a) synchronizing the multiple strands; and (b) generating the number as soon as the multiple strands are Strands are synchronized. Concept 10. The computer-readable medium as described in Concept 8, wherein the multiple strands are in multiple groups of strands are arranged, and the generation of the number further involves (a) determining for each group of strands, whether a strand in the group will enter the divergent region; and (b) generating the Number based on the result of the investigation. Concept 11. The computer-readable medium as described in Concept 8, wherein the instructions are generated by a compiler. automatically generated when the compiler encounters a statement that creates a divergent code area that includes a synchronization operation. Concept 12. The computer-readable medium as described in Concept 8, wherein the step of using the The number used to synchronize the strands further includes: using a barrier that acts as a counting signal, a A bit field or a network of logic gates is implemented, with the barrier set up in hardware or software. is, where the barrier is initialized using a value of the number. Concept 13. The computer-readable medium as described in Concept 8, where the number is a first number that a divergent area is a first divergent area and the first divergent area is a second divergent area includes, wherein the steps further include (iii) generating a second number which is a number of strands represents those who will enter the second divergent area, with the second number being generated before a The strand enters the second divergent region, generating the second number by applying the first number. will; and (iv) using the second number within the second divergent region to synchronize the Strands in the second divergent area. Concept 14. A computing device with a multiple processing unit that is designed to handle multiple strands to synchronize those executed in the multi-processing unit, wherein the multi- The processing unit is designed to (i) generate a number representing a number of strands that will enter a divergent region, with the number being generated before a strand enters the divergent region occurs; and (ii) using the number within the divergent region to synchronize the strands in the divergent area. Concept 15. The computing devices as described in Concept 14, wherein the generation of the number is further This includes (a) synchronizing the multiple strands; and (b) generating the number once the multiple strands are synchronized. are synchronized. Concept 16. The computing device as described in Concept 14, wherein the multiple strands are in several groups of strands are arranged, and wherein generating a number further involves (a) determining for each group of strands, whether a strand in the group will enter the divergent region; and (b) generating the Number based on the result of the investigation. Concept 17. The computing device as described in Concept 16, wherein determining whether a strand is in the The group will enter the divergent territory, furthermore includes: recognizing a strand within the group that leads into the divergent territory will be entered; and the generation of the number is based on the result of the The investigation further includes: generating the number based on the identified strands. Concept 18. The computing device as described in Concept 14, wherein the use of the number for Synchronizing the strands further includes: using a barrier that acts as a counting signal, a bit field or a network of logic gates is implemented, with the barrier being set up in hardware or software. Concept 19. The computing setup as described in Concept 18, furthermore including the use of a barrier. Initializing the barrier using a value of the number is included. Concept 20. The computing device as described in Concept 14, where the number is a first number, which a divergent area is a first divergent area and the first divergent area is a second divergent area includes, wherein the steps further include (iii) generating a second number which is a number of strands represents those who will enter the second divergent area, with the second number being generated before a The strand enters the second divergent region, generating the second number by applying the first number. will; and (iv) using the second number within the second divergent region to synchronize the Strands in the second divergent area.

[0033] The person skilled in the art, for whom this application is intended, will recognize that other and further additions, Deletions, replacements and modifications can be made to the described embodiments.

Claims

1. A method for synchronizing multiple threads of a SIMD architecture, the method comprising: before a conditional statement in a code that causes a jump into a divergent code area, Calculating a flag for each of the multiple strands indicating whether the strand enters the divergent area will enter, Synchronizing (202) the plurality of strands that will arrive at the divergent area using a first barrier operation, which returns the flag of each strand and a number for the number of strands that are divergent area and a first number of strands that set the flag to true have, calculated, Initializing a second barrier in the divergent region using the first number of strands.

2. The method of claim 1, wherein the plurality of strands are arranged in a plurality of groups of strands, and wherein generating the number further comprises (a) for each group of strands, determining whether a strand in the group falls into the divergent region will occur; and (b) generating the number based on the result of the determination.

3. The method of claim 2, wherein determining whether a strand from the group enters the divergent region further comprising: detecting a strand in the group that will enter the divergent area; and wherein the Generating the number based on the result of the determination further comprises: Generating the number based on the identified strands.

4. The method according to any one of claims 1-3, wherein the use of the number to synchronize the strands further comprises includes: Using a barrier implemented as a counting signal, a bit field, or a network of logic gates where the barrier is set up in hardware or software.

5. The method according to any one of claims 1-4, wherein the number is a first number, the divergent region is a first divergent region, and the first divergent region includes a second divergent region, the method further comprising comprises (iii) generating a second number representing a number of strands extending into the second divergent region will occur, the second number being generated before a strand enters the second divergent region, the second number is generated using the first number; and (iv) using the second number within the second divergent area to synchronize the strands in the second divergent area.