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

Design document of the Branch Prediction Unit #233

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

dragon540
Copy link
Collaborator

This is the design document for the branch prediction unit to be added to Olympia simulator. This document aims to give an overview of the micro-architectural and implementation detail of the BPU.

Document will be further updated as development progresses. Any suggestions are appreciated.

@dragon540 dragon540 marked this pull request as draft December 2, 2024 16:29
Copy link
Collaborator

@jeffnye-gh jeffnye-gh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are organization changes I would suggest. I would compare this to the template. I would like a better understanding of your class sets and their hierarchy, their methods.

I would like to get a better understanding of how you intend the unit to operate and a sense of how much code needs to be written. With some mention of the existing classes and APIs.

Global comments;
take advantage of the adoc syntax when inserting code fragments to help readability.
Be sure to document your material references when external information is used. Such as figures etc.

outcomes and branch targets before branch instructions are actually
resolved in the pipeline in order to reduce latency between a branch and a
subsequent instruction.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"in order to reduce latency between a branch and a subsequent instruction."

this is unclear. For this kind of introductory matter, there a number of bpu descriptions available on the web that you can adapt. Use your own style but:

"This prediction allows the processor to prefetch and execute subsequent instructions without waiting to resolve the branch condition, minimizing stalls and maintaining high throughput in the pipeline."

|0.2 | 2024.11.18 | Shobhit Sinha | BPU design documentation
|0.1 | 2024.11.12 | Jeff Nye | initial template
|===

Copy link
Collaborator

@jeffnye-gh jeffnye-gh Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the revision history updated with summary of changes.

there are no change bars in adoc so this summary save time re-reading unchanged portions of the document

=== Overview Block Diagram

image:media/bpu_overview.png[image,width=576,height=366]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might consider removing this diagram and/or moving the subsequent diagram to this location. The 2nd diagram conveys more information.

Also if you are using diagrams from the web be sure you quote the references.

first tier provides a simple but fast prediction. The second tier consists
of a more accurate predictor which can predict even complex branches but takes an
additional cycle.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Branch Prediction Unit in Olympia is a two-tiered branch predictor"

Are you describing the current state of Olympia or the future state with this design completed?

slots.

** `out_bpu_prediction_req` - in Fetch.cpp. To send PredictionInput to BPU.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a reference to the existing BPU API found in BranchPredIF.hpp and how these ports interact with that API. The intent of the API is to allow parallel development of other BPUs with a common interface.

** `pred_req_num` - Total number of prediction requests made to BPU
** `num_mispred` - Total number of mis-predictions
** `mispred_perc` - Percentage of mis-predictions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would expect stats/counters for most of the structures in the bpu. These statistics are often used to assess the qualities/configuration of a branch predictor implementation but also used to support application analysis.

Consider adding these stats/counters
prediction hit/miss rates by conditional branch type and direction
structure specific stats such as PHT hit/miss/aliasing conflicts, similar for BTB
histograms of entries usage, PHT entries for example
ras high/low water marks, ras utilization
global distribution of taken/not taken, speculative and resolved T/NT

some measure of false sharing in the tables.

tage will add additional stats/counters. I would mention this but I think you could leave the exact list for the future.

image:media/bpu_uarch.png[image,width=800,height=366]

Figure 2 - Unit block diagram of BPU

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment, perhaps replace the previous figure with this one.


Olympia's Branch Predictor API intends the implementation of Branch Predictor to
define custom PredictionInput

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this sentence.

PredictionInput is received by the BPU from the Fetch unit whenever a request for
the prediction is made. Based on the data provided by this input, BPU makes the
prediction.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment on the existing BPU API. This design should conform to that API.

If you propose future changes to that API it is best to put that in a section of it's own.

define custom PredictionInput

[[Overview_of_PredictionInput]]
=== Overview
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there header formatting issues with the document? The organization from this point on does not follow a progression I understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants