IP Library Granted Patent US 7,577,826
Granted Patent B2
US 7,577,826 · App. 11/700,448 · Granted Aug 18, 2009

Stall prediction thread management

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,577,826
App. No.
11/700,448
Granted
Aug 18, 2009
Kind
B2
Abstract

Thread switching prevents pipeline stalls when executing multiple threads. An analysis of a first thread identifies instructions capable of causing pipeline stalls. If pipeline stalls from the identified instructions are likely, thread switching instructions are added to the first thread in place of the identified instructions. Thread switching instructions direct a microprocessor to suspend executing the thread and begin executing a second thread. Thread switching instructions can be added to the second thread to enable the resumption of the first thread at the location specified by the identified instruction. The thread switching instructions are configured to avoid pipeline stalls when switching threads. Thread switching instructions can store and retrieve thread-specific information upon the suspension and resumption of threads. Thread switching instructions can schedule the execution of two or more threads in accordance with load balancing schemes. Threads can be modified using static or dynamic code analysis and modification techniques.

Claims (47)

1. A method of optimizing a plurality of threads to be executed by a processor, the method comprising:

identifying a conditional branch instruction of a first thread;

determining a branch lead time associated with the identified conditional branch instruction;

determining whether a condition associated with the identified conditional branch instruction has a known value prior to the branch lead time;

determining if a pipeline stall is likely from the identified instruction in response to a determination that the condition does not have a known value prior to the branch lead time; and

in response to a determination that the pipeline stall is likely from the identified instruction, adding at least one thread switching instruction to the first thread, wherein the thread switching instruction is adapted to switch from the execution of the first thread to a second thread.

2. The method of claim 1 , wherein adding the at least one thread switching instruction comprises:

adding an instruction prehint to the first thread, wherein the instruction prehint is adapted to prevent a pipeline stall during the switch from the execution of the first thread to a second thread.

3. The method of claim 1 , wherein adding the at least one thread switching instruction comprises:

configuring the at least one thread switching instruction to direct execution to an entry point of the second thread.

4. The method of claim 3 , wherein the entry point of the second thread is the beginning of the second thread.

5. The method of claim 3 , wherein the entry point of the second thread is a branch target associated with a branch instruction of the second thread.

6. The method of claim 5 , wherein the entry point of the second thread was previously stored by at least one thread switching instruction of the second thread.

7. The method of claim 3 , wherein the entry point of the second thread is a first instruction of the second thread intended to be executed after a second instruction of the second thread, wherein the second instruction may potentially cause a pipeline stall in the second thread.

8. The method of claim 7 , wherein the second instruction of the second thread is a high-latency instruction.

9. The method of claim 1 , further comprising:

adding at least one thread switching instruction to the second thread, wherein the thread switching instruction of the second thread is adapted to switch from the execution of the second thread to the first thread.

10. The method of claim 9 , wherein the thread switching instruction of the second thread is configured to direct execution to a thread resumption point of the first thread.

11. The method of claim 10 , wherein the thread resumption point of the first thread is a first instruction of the first thread intended to be executed following the identified instruction of the first thread.

12. The method of claim 11 , wherein adding at least one thread switching instruction to the second thread further comprises:

analyzing at least the identified instruction to determine the location of the first instruction of the first thread intended to be executed following the identified instruction; and

configuring the thread switching instruction of the second thread to direct execution to the location of the first instruction of the first thread.

13. The method of claim 12 , wherein analyzing at least the identified instruction comprises determining a value of a condition, wherein the identified instruction is responsive to the value of the condition.

14. The method of claim 12 , wherein analyzing at least the identified instruction comprises:

determining an address of the first instruction of the first thread intended to be executed following the identified instruction;

storing the address of the first instruction of the first thread intended to be executed following the identified instruction; and

configuring the at least one thread switching instruction of the second thread to access the stored address.

15. The method of claim 14 , further comprising:

storing the address of the first instruction of the first thread intended to be executed following the identified instruction in a register.

16. The method of claim 14 , further comprising:

storing the address of the first instruction of the first thread intended to be executed following the identified instruction in a stack.

17. The method of claim 14 , further comprising:

storing the address of the first instruction of the first thread intended to be executed following the identified instruction in a memory.

18. The method of claim 1 , wherein the thread switching instruction of the first thread includes an instruction to store data associated with the first thread.

19. The method of claim 1 , wherein the thread switching instruction of the first thread includes an instruction to retrieve data associated with the second thread and previously stored.

20. The method of claim 9 , wherein the thread switching instruction of the second thread is located at the end of the second thread.

21. The method of claim 9 , wherein adding the thread switching instruction of the second thread comprises:

identifying an instruction of the second thread that may potentially cause a pipeline stall;

determining if a pipeline stall is likely from the identified instruction of the second thread; and

in response to a determination that the pipeline stall is likely from the identified instruction of the second thread, replacing the identified instruction of the second thread with the at least one thread switching instruction of the second thread.

22. The method of claim 9 , further comprising:

adding a second instruction prehint to the second thread, wherein the second instruction prehint is adapted to prevent a pipeline stall during the switch from the execution of the second thread to the first thread.

23. The method of claim 1 , further comprising:

selecting one of a plurality of threads according to a load balancing scheme; and

adding at least one thread switching instruction to the second thread, wherein the thread switching instruction of the second thread is adapted to switch from the execution of the second thread to the selected thread.

24. The method of claim 1 , wherein adding the at least one thread switching instruction comprises:

replacing the identified instruction of the first thread with the at least one thread switching instruction of the first thread.

Assignments (3)
CHANGE OF NAME Recorded Jul 1, 2016
From: SONY COMPUTER ENTERTAINMENT INC.
To: SONY INTERACTIVE ENTERTAINMENT INC.
Reel/Frame 039239/0356 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 27, 2011
From: SONY NETWORK ENTERTAINMENT PLATFORM INC.
To: SONY COMPUTER ENTERTAINMENT INC.
Reel/Frame 027481/0351 →
CHANGE OF NAME Recorded Dec 26, 2011
From: SONY COMPUTER ENTERTAINMENT INC.
To: SONY NETWORK ENTERTAINMENT PLATFORM INC.
Reel/Frame 027445/0657 →