Speculative Return Address Restoration via Committed Stack Segmentation
Solution Overview
Problem
Existing branch prediction mechanisms struggle with accurately predicting target addresses of return branch instructions due to their variability based on the location of function calls, leading to pipeline flush events and corruption of speculative return address stacks, while maintaining a full-sized committed call return stack structure increases circuit area and power usage.
Innovation Solution
Implement a speculative call return stack structure (CRS) for tracking speculative return addresses and a smaller committed CRS based on committed program flow, using return address restoration circuitry to restore addresses from the committed CRS during pipeline flush events, thereby preventing the use of cancelled speculative return addresses for predictions, and employing cancellation indicators to manage speculative return addresses.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a full-sized committed call return stack structure is maintained to restore return addresses during pipeline flush events, then branch prediction accuracy is improved, but circuit area and power usage increase
Solution Approach 1:
The patent divides the call return stack into two separate structures: a speculative call return stack for tracking speculative return addresses and a committed call return stack for tracking committed return addresses. This segmentation allows the committed stack to be smaller in capacity, reducing circuit area and power usage, while still providing the necessary return addresses for branch prediction after pipeline flush events.
Solution Approach 2:
The committed call return stack is designed with limited capacity, effectively making it a resource-constrained structure that only stores the most recent committed return addresses. This approach accepts that not all speculative return addresses can be restored, but the limited committed stack provides sufficient information to improve branch prediction accuracy without requiring a full-sized stack structure.
2Reliability
If a full-sized committed call return stack structure is maintained to restore return addresses during pipeline flush events, then branch prediction accuracy is improved, but power consumption increases
Solution Approach 1:
The patent divides the call return stack into two separate structures: a speculative call return stack for tracking speculative return addresses and a committed call return stack for tracking committed return addresses. This segmentation allows the committed stack to be smaller in capacity, reducing circuit area and power usage, while still providing the necessary return addresses for branch prediction after pipeline flush events.
3Speed
If speculative return addresses are allowed to be used for branch prediction, then branch prediction speed is improved, but prediction accuracy deteriorates due to pipeline flush events
Solution Approach 1:
The patent introduces a mechanism where the committed call return stack acts as an intermediary source for restoring return addresses after pipeline flush events. When a pipeline flush occurs, the branch prediction circuitry can restore return addresses from the committed stack, which contains validated committed program flow information, thereby improving prediction accuracy while maintaining the speed benefits of speculative execution.
Solution Approach 2:
The patent implements a feedback mechanism where the outcomes of speculative branch predictions are monitored. When pipeline flush events occur indicating mispredictions, the system uses the committed call return stack to provide corrected return addresses for subsequent predictions. This feedback loop allows the system to learn from past prediction errors and improve future prediction accuracy.
Data Source
AI summary
An apparatus comprises speculative return address tracking circuitry to maintain a speculative call return stack structure to track speculative return addresses predicted based on speculative program flow; branch prediction circuitry to predict a target address of a return branch instruction based on the speculative call return stack structure; committed return address tracking circuitry to maintain a committed call return stack structure to track committed return addresses detected based on committed program flow for instructions executed by processing circuitry; and return address restoration circuitry responsive to a pipeline flush event to perform return address restoration based on one or more committed return addresses from the committed call return stack structure to prevent the branch prediction circuitry using one or more cancelled speculative return addresses of the speculative call return stack structure for predicting the target address of the return branch instruction. The committed call return stack structure has a smaller capacity for storing return addresses than the speculative call return stack structure.


