Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for executing program code in a processor, comprising: executing the program code in a normal mode using a primary strand; concurrently executing the program code ahead of the primary strand using a subordinate strand in a scout mode; upon resolving a branch using the subordinate strand, recording a resolution for the branch in a speculative branch resolution table; upon subsequently encountering the branch using the primary strand, using the recorded resolution from the speculative branch resolution table to predict a resolution for the branch for the primary strand; and upon determining that the resolution of the branch was mispredicted for the primary strand, determining that the subordinate strand mispredicted the branch and is incorrectly fetching instructions for execution following the misprediction; and recovering the subordinate strand to the branch and restarting the subordinate strand executing the program code from the branch in scout mode.
2. The method of claim 1 , wherein recovering the subordinate strand involves: halting executing program code in scout mode using the subordinate strand; invalidating instructions fetched for execution by the subordinate strand following the mispredicted branch; updating the speculative branch resolution table with the correct resolution for the branch; and updating a state of the subordinate strand by copying a present state of the primary strand into the subordinate strand, which involves copying a program counter for the branch and other state information from the primary strand to the subordinate strand to enable the subordinate strand to restart execution from the branch in scout mode.
3. The method of claim 2 , wherein resolving the branch using the subordinate strand during scout mode involves: upon encountering the branch using the subordinate strand, if a previously recorded resolution of the branch is available, using the recorded resolution to predict the resolution of the branch; otherwise, guessing the resolution for the branch; and subsequently attempting to compute an actual resolution for the branch using the subordinate strand, wherein the actual resolution cannot be computed for the branch when a source register for the branch is “not there.”
4. The method of claim 3 , wherein recording the resolution for the branch involves: upon computing the actual resolution for the branch using the subordinate strand, recording the actual resolution in the speculative branch resolution table; and otherwise, recording the predicted resolution or the guessed resolution in the speculative branch resolution table.
5. The method of claim 1 , wherein upon determining that the branch was mispredicted for the primary strand, the method further comprises: halting the primary strand; invalidating instructions fetched for execution by the primary strand following the mispredicted branch; and resuming executing program code from the branch using a correct branch resolution using the primary strand.
6. The method of claim 1 , wherein executing program code in the normal mode using the primary strand involves committing results of executing instructions to an architectural state of the processor; and executing program code in the scout mode using the subordinate strand involves prefetching cache lines and recording branch resolutions, but not committing results of executing instructions to the architectural state of the processor.
7. An apparatus for executing program code, comprising: a processor; and a speculative branch resolution table in the processor; wherein the processor is configured to execute the program code in a normal mode using a primary strand while concurrently executing the program code ahead of the primary strand using a subordinate strand in a scout mode; upon resolving a branch using the subordinate strand, the processor is configured to record a resolution for the branch in the speculative branch resolution table; upon subsequently encountering the branch using the primary strand, the processor is configured to use the recorded resolution from the speculative branch resolution table to predict a resolution for the branch for the primary strand; and upon determining that the resolution of the branch was mispredicted for the primary strand, the processor is configured to: determine that the branch was mispredicted for the subordinate strand and instructions are being incorrectly fetched for execution for the subordinate strand following the misprediction; and recover the subordinate strand to the branch and restart the subordinate strand executing the program code from the branch in scout mode.
8. The apparatus of claim 7 , wherein when recovering the subordinate strand, the processor is configured to: halt executing program code in scout mode using the subordinate strand; invalidate instructions fetched for execution by the subordinate strand following the mispredicted branch; update the speculative branch resolution table with the correct resolution for the branch; and update a state of the subordinate strand by copying a present state of the primary strand into the subordinate strand.
9. The apparatus of claim 8 , wherein when copying the present state of the primary strand into the subordinate strand, the processor is configured to instantaneously copy a program counter for the branch and other state information from the primary strand to the subordinate strand to enable the subordinate strand to restart execution from the branch in scout mode.
10. The apparatus of claim 8 , wherein upon encountering the branch using the subordinate strand in scout mode, the processor is configured to: if a recorded resolution is available, use the recorded resolution to predict the resolution of the branch; otherwise, guess the resolution for the branch; and subsequently attempt to compute an actual resolution for the branch using the subordinate strand, wherein the processor is unable to compute the actual resolution for the branch when a source register for the branch is “not there.”
11. The apparatus of claim 10 , wherein the processor is configured to: upon computing the actual resolution for the branch using the subordinate strand, record the actual resolution in the speculative branch resolution table; and otherwise, record the predicted resolution or the guessed resolution in the speculative branch resolution table.
12. The apparatus of claim 7 , wherein upon determining that the branch was mispredicted for the primary strand, the processor is configured to: halt the primary strand; invalidate instructions fetched for execution by the primary strand following the mispredicted branch; and resume executing program code from the branch using a correct branch resolution using the primary strand.
13. The apparatus of claim 7 , wherein the apparatus further comprises: a branch prediction table in the processor; wherein upon resolving a branch using the primary strand in a normal-execution mode, the processor is configured to record the resolution in the branch prediction table; wherein the processor is further configured to use available recorded resolutions from the branch prediction table to predict the resolution of branches when the speculative branch resolution table does not contain resolutions for the branches.
14. A computer system for executing program code, comprising: a processor; a memory coupled to the processor, wherein the memory stores data and instructions for the processor; and a speculative branch resolution table in the processor; wherein the processor is configured to execute the program code in a normal mode using a primary strand while concurrently executing the program code ahead of the primary strand using a subordinate strand in a scout mode; upon resolving a branch using the subordinate strand, the processor is configured to record a resolution for the branch in the speculative branch resolution table; upon subsequently encountering the branch using the primary strand, the processor is configured to use the recorded resolution from the speculative branch resolution table to predict a resolution for the branch for the primary strand; and upon determining that the resolution of the branch was mispredicted for the primary strand, the processor is configured to: determine that the branch was mispredicted for the subordinate strand and instructions are being incorrectly fetched for execution for the subordinate strand following the misprediction; and recover the subordinate strand to the branch and restart the subordinate strand executing the program code from the branch in scout mode.
15. The computer system of claim 14 , wherein when recovering the subordinate strand, the processor is configured to: halt executing program code in scout mode using the subordinate strand; invalidate instructions fetched for execution by the subordinate strand following the mispredicted branch; update the speculative branch resolution table with the correct resolution for the branch; and update a state of the subordinate strand by copying a present state of the primary strand into the subordinate strand.
16. The computer system of claim 15 , wherein when copying the present state of the primary strand into the subordinate strand, the processor is configured to instantaneously copy a program counter for the branch and other state information from the primary strand to the subordinate strand to enable the subordinate strand to restart execution from the branch in scout mode.
17. The computer system of claim 15 , wherein upon encountering the branch using the subordinate strand in scout mode, the processor is configured to: if a recorded resolution is available, use the recorded resolution to predict the resolution of the branch; otherwise, guess the resolution for the branch; and subsequently attempt to compute an actual resolution for the branch using the subordinate strand, wherein the processor is unable to compute the actual resolution for the branch when a source register for the branch is “not there.”
18. The computer system of claim 17 , wherein the processor is configured to: upon computing the actual resolution for the branch using the subordinate strand, record the actual resolution in the speculative branch resolution table; and otherwise, record the predicted resolution or the guessed resolution in the speculative branch resolution table.
19. The computer system of claim 14 , wherein upon determining that the branch was mispredicted for the primary strand, the processor is configured to: halt the primary strand; invalidate instructions fetched for execution by the primary strand following the mispredicted branch; and resume executing program code from the branch using a correct branch resolution using the primary strand.
20. The computer system of claim 14 , wherein the computer system further comprises: a branch prediction table in the processor; wherein upon resolving a branch using the primary strand in a normal-execution mode, the processor is configured to record the resolution in the branch prediction table; wherein the processor is further configured to use available recorded resolutions from the branch prediction table to predict the resolution of branches when the speculative branch resolution table does not contain resolutions for the branches.
Unknown
February 16, 2010
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.