System and method for mitigating the impact of branch misprediction when exiting spin loops
Abstract
A computer system may recognize a busy-wait loop in program instructions at compile time and/or may recognize busy-wait looping behavior during execution of program instructions. The system may recognize that an exit condition for a busy-wait loop is specified by a conditional branch type instruction in the program instructions. In response to identifying the loop and the conditional branch type instruction that specifies its exit condition, the system may influence or override a prediction made by a dynamic branch predictor, resulting in a prediction that the exit condition will be met and that the loop will be exited regardless of any observed branch behavior for the conditional branch type instruction. The looping instructions may implement waiting for an inter-thread communication event to occur or for a lock to become available. When the exit condition is met, the loop may be exited without incurring a misprediction delay.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 18 · Forward citations: 7.
Claims (1 — 1 Independent, 0 Dependent)
- Claim 1Independent Claim
A method, comprising: performing, by a computer: initiating execution of program instructions; determining that the program instructions comprise a busy-wait type loop and that a conditional branch type instruction specifies an exit condition for the busy-wait type loop that, when met, causes an exit path for the busy-wait type loop to be taken following the conditional branch type instruction; and in response to said determining: predicting that the path taken following the conditional branch type instruction will be the exit path for the busy-wait type loop; while the specified exit conditio
Technical Overview & Description
Full multi-page specification text is archived at the issuing office. Read complete official specification ↗
Cited By — Indexed Forward Citations (7 of 7 total)
References Cited — Backward Prior Art (18)
Non-Patent Literature (2)
- IA-32, "7.6.7.2 Pause Instruction" from IA-32 Intel Architecture Software Developer's Manual vol. 3: System Programming Guide, Intel 2003, p. 7-33.
- LWN, "Likely unlikely()s", a blog page posted on Dec. 2010, accessed through internet page "Iwn.net/Articles/420019/", pp. 1-5 (hereinafter LWN).