System and method for dynamically spawning thread blocks within multi-threaded processing systems
First Claim
1. A method for compiling a thread program to support dynamic thread spawning, the method comprising:
- compiling a first portion of a source code into a first thread program associated with a first predicate table;
identifying a partition indicator within the first portion of the source code;
partitioning a second portion of the source code following the partition indicator into a code block;
instantiating a second predicate table for the code block to indicate which thread blocks in a thread grid are to execute the code block; and
compiling the second portion of the source code into a second thread program configured to populate the second predicate table,wherein, during execution of particular thread programs, thread blocks in the thread grid are spawned as indicated by the predicate tables corresponding to the particular thread programs, andwherein the partition indicator comprises a conditional statement that, when executed as part of the first thread program, is configured to write a true value in the second predicate table for each thread block in the thread grid that is to execute the second thread program.
1 Assignment
0 Petitions
Accused Products
Abstract
One embodiment of the present invention sets forth a technique for partitioning a predecessor thread program into sub-programs and dynamically spawning a thread grid of the sub-programs based on the outcome of a conditional statement in the predecessor thread program. The programming instructions for the predecessor thread program are analyzed to assess the benefit of partitioning the thread program at a conditional statement into sub-programs. If the predecessor thread program is partitioned, then each branch of the conditional statement may be used to form a separate sub-program. Predicate tables are populated at the predecessor thread program run-time to establish which possible instances of the thread sub-programs should be spawned in subsequent execution phases.
29 Citations
19 Claims
-
1. A method for compiling a thread program to support dynamic thread spawning, the method comprising:
-
compiling a first portion of a source code into a first thread program associated with a first predicate table; identifying a partition indicator within the first portion of the source code; partitioning a second portion of the source code following the partition indicator into a code block; instantiating a second predicate table for the code block to indicate which thread blocks in a thread grid are to execute the code block; and compiling the second portion of the source code into a second thread program configured to populate the second predicate table, wherein, during execution of particular thread programs, thread blocks in the thread grid are spawned as indicated by the predicate tables corresponding to the particular thread programs, and wherein the partition indicator comprises a conditional statement that, when executed as part of the first thread program, is configured to write a true value in the second predicate table for each thread block in the thread grid that is to execute the second thread program. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 18, 19)
-
-
9. A non-transitory computer-readable medium including instructions that, when executed by a processing unit, cause the processing unit to compile a thread program to support dynamic thread spawning, by performing the steps of:
-
compiling a first portion of a source code into a first thread program associated with a first predicate table; identifying a partition indicator within the first portion of the source code; partitioning a second portion of the source code following the partition indicator into a code block; instantiating a second predicate table for the code block to indicate which thread blocks in a thread grid are to execute the code block; and compiling the second portion of the source code into a second thread program configured to populate the second predicate table, wherein, during execution of particular thread programs, zero or more thread blocks in the thread grid are spawned as indicated by the predicate tables corresponding to the particular thread programs, and wherein the partition indicator comprises a conditional statement that, when executed as part of the first thread program, is configured to write a true value in the second predicate table for each thread block in the thread grid that is to execute the second thread program. - View Dependent Claims (10, 11, 12, 13, 14, 15, 16)
-
-
17. A computing system, comprising:
-
a parallel processing unit; and a memory coupled to the parallel processing unit and including a compiler configured to compile a thread program for execution on the parallel processing unit, by performing the steps of; compiling a first portion of a source code into a first thread program associated with a first predicate table, identifying a partition indicator within the first portion of the source code, partitioning a second portion of the source code following the partition indicator into a code block, instantiating a second predicate table for the code block to indicate which thread blocks in a thread grid are to execute the code block, and compiling the second portion of the source code into a second thread program configured to populate the second predicate table, wherein, during execution of particular thread programs by the parallel processing unit, zero or more thread blocks in the thread grid are spawned as indicated by the predicate tables corresponding to the particular thread programs, and wherein the partition indicator comprises a conditional statement that, when executed as part of the first thread program, is configured to write a true value in the second predicate table for each thread block in the thread grid that is to execute the second thread program.
-
Specification