Parallelizing non-countable loops with hardware transactional memory
First Claim
1. A method for parallelizing program code of an application, the method comprising:
- examining one or more program instructions of a multi-threaded application;
identifying a non-countable loop pattern, wherein the non-countable loop includes a first function that uses a loop index variable as a parameter, wherein the first function performs input/output and modifies data, wherein identifying the non-countable loop pattern comprises determining whether the non-countable loop pattern meets a set of conditions including;
a) an iteration count of the non-countable loop pattern cannot be determined by a compiler;
b) an exit condition function of the non-countable loop pattern does not modify the loop index variable; and
c) the first function that uses the loop index variable as a parameter does not modify the loop index variable;
if the non-countable loop pattern is determined to meet the set of conditions, replacing the non-countable loop pattern with a parallelized loop pattern, wherein the parallelized loop pattern is configured to squash and re-execute any speculative thread of the parallelized loop pattern that is signaled to have a transaction failure; and
if the non-countable loop pattern is determined to not meet the set of conditions, compiling the non-countable loop to execute in a serial manner.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method for speculatively parallelizing non-countable loops in a multi-threaded application. A multi-core processor receives instructions for a multi-threaded application. The application may contain non-countable loops. Non-countable loops have an iteration count value that cannot be determined prior to the execution of the non-countable loop, a loop index value that cannot be non-speculatively determined prior to the execution of an iteration of the non-countable loop, and control that is not transferred out of the loop body by a code line in the loop body. The compiler replaces the non-countable loop with a parallelized loop pattern that uses outlined function calls defined in a parallelization library (PL) in order to speculatively execute iterations of the parallelized loop. The parallelized loop pattern is configured to squash and re-execute any speculative thread of the parallelized loop pattern that is signaled to have a transaction failure.
35 Citations
23 Claims
-
1. A method for parallelizing program code of an application, the method comprising:
-
examining one or more program instructions of a multi-threaded application; identifying a non-countable loop pattern, wherein the non-countable loop includes a first function that uses a loop index variable as a parameter, wherein the first function performs input/output and modifies data, wherein identifying the non-countable loop pattern comprises determining whether the non-countable loop pattern meets a set of conditions including; a) an iteration count of the non-countable loop pattern cannot be determined by a compiler; b) an exit condition function of the non-countable loop pattern does not modify the loop index variable; and c) the first function that uses the loop index variable as a parameter does not modify the loop index variable; if the non-countable loop pattern is determined to meet the set of conditions, replacing the non-countable loop pattern with a parallelized loop pattern, wherein the parallelized loop pattern is configured to squash and re-execute any speculative thread of the parallelized loop pattern that is signaled to have a transaction failure; and if the non-countable loop pattern is determined to not meet the set of conditions, compiling the non-countable loop to execute in a serial manner. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A system comprising:
-
one or more processors; and memory storing program instructions that implement a compiler, wherein the compiler is executable by the one or more processors to; examine one or more program instructions of a multi-threaded application; identify a non-countable loop pattern, wherein the non-countable loop pattern includes a first function that uses a loop index variable as a parameter, wherein the first function performs input/output and modifies data, wherein identifying the non-countable loop pattern comprises determining whether the non-countable loop pattern meets a set of conditions including; a) an iteration count of the non-countable loop pattern cannot be determined by the compiler; b) an exit condition function of the non-countable loop pattern does not modify the loop index variable; and c) the first function that uses the loop index variable as a parameter does not modify the loop index variable; if the non-countable loop pattern is determined to meet the set of conditions, replace the non-countable loop pattern with a parallelized loop pattern, wherein the parallelized loop pattern is configured to squash and re-execute any speculative thread of the parallelized loop pattern that is signaled to have a transaction failure; and if the non-countable loop pattern is determined to not meet the set of conditions, compile the non-countable loop to execute in a serial manner. - View Dependent Claims (10, 11, 12, 13, 14, 15)
-
-
16. A non-transitory computer readable storage medium storing program instructions that implement a compiler, wherein the compiler is executable by one or more processors to:
-
examine one or more program instructions of a multi-threaded application; identify a non-countable loop pattern, wherein the non-countable loop pattern includes a first function that uses a loop index variable as a parameter, wherein the first function performs input/output and modifies data, wherein identifying the non-countable loop pattern comprises determining whether the non-countable loop pattern meets a set of conditions including; a) an iteration count of the non-countable loop pattern cannot be determined by the compiler; b) an exit condition function of the non-countable loop pattern does not modify the loop index variable; and c) the first function that uses the loop index variable as a parameter does not modify the loop index variable; if the non-countable loop pattern is determined to meet the set of conditions, replace the non-countable loop pattern with a parallelized loop pattern, wherein the parallelized loop pattern is configured to squash and re-execute any speculative thread of the parallelized loop pattern that is signaled to have a transaction failure; and if the non-countable loop pattern is determined to not meet the set of conditions, compiling the non-countable loop to execute in a serial manner. - View Dependent Claims (17, 18, 19, 20, 21, 22, 23)
-
Specification