Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move early misprediction check logic to the branch prediction interface #20

Open
hal-jones opened this issue Feb 11, 2019 · 1 comment · May be fixed by #446
Open

Move early misprediction check logic to the branch prediction interface #20

hal-jones opened this issue Feb 11, 2019 · 1 comment · May be fixed by #446
Labels
enhancement New feature or request

Comments

@hal-jones
Copy link
Contributor

A new function should be added to the branch predictor interface, to allow branch predictor implementations to determine whether the target of a branch was mispredicted once it's been decoded, but before execution. This logic is currently implemented as Instruction::checkEarlyBranchMisprediction; moving this out of the instruction implementation and into the model/predictor allows for ISA-independent branch prediction models.

This enables the addition of more informed predictor models, such as backwards taken/forwards not taken static prediction, and return address stack predictors.

The expected function signature would be as follows:

/** Improve a branch prediction according to decoded information.
 * Returns a tuple of values, signifying whether the branch was
 * mispredicted and, if so, the updated branch target prediction. */
std::tuple<bool, uint64_t> improvePrediction(Instruction& uop);

Any changes to the prediction should be propagated to the uop via setBranchPrediction().

This change would also require the addition of numerous additional public "metadata" functions on the Instruction interface, to allow the branch predictor to request and retrieve the necessary information to make an informed decision. Examples may include isBranchConditional, isBranchImmediate, isBranchReturn, isBranchSubroutine, and getBranchTarget.

@hal-jones hal-jones added the enhancement New feature or request label Feb 11, 2019
@ABenC377
Copy link
Contributor

I was a bit overzealous here. Reopening.

@ABenC377 ABenC377 reopened this Dec 18, 2024
@ABenC377 ABenC377 linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants