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.