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

Branch predictor enhancements,corrections and coexistence with pipelined execution #143

Open
ppisa opened this issue Jul 8, 2024 · 0 comments

Comments

@ppisa
Copy link
Member

ppisa commented Jul 8, 2024

The pull request #135 is initial step to provide branch prediction visualization for teaching but there are more issues to solve when pipelined execution is considered.

  1. the BHT update is late for the short loops (body less than three instructions plus branch one) - this is probably hard to solve and can be used to demonstrate interaction of BHT and pipeline and their consequences
  2. the BHT cannot correctly predict the first pass through branch and jump instructions for other initial condition cas then BNT/BSNT/BWNT, because it is not known that instruction is branch before decode - it is solved on real processor by classification branch instructions during fetch into cache and addition of flags to cache - we do not want this for initial educational case because it is complexity much above branch introduction in textbooks.
  3. BHR is delayed if the single one is used and for tightly placed branches it would seriously misbehave
  4. even for single cycle the branch which is never taken is not considered in previous prediction, it should be discussed and resolved
  5. it should be considered that a BHT entry is not allocated for unconditional/jump branches and these branches should be marked in BTB as unconditional type and should not consult BHT during PC computation
  6. even for instructions which are not of branch/jump type the predictor update should be called probably because stalled BHT and or BTB entries for self-modifying code would cause significant misbehave where branch is replaced by non branch instruction.

Input and discussion from community, BHT/BTB visualization author (@jiristefan) and reviewer @jdupak are strongly appreciated.

ppisa added a commit that referenced this issue Jul 8, 2024
The branch prediction demonstration developed by Jiri Stefan
in the frame of his master's thesis is welcomed step
for QtRvSim to cover more computer architectures lectures topics.
The visualization and correct/wrong prediction statistic counting matches
teaching needs of the classes when demonstrated on single-cycle processor.

For pipelined version there are more topics to discussion, see #143.
It is questionable if solution matching basic textbooks principles
on the pipelined version without classification of branched during
cache fills can be found. Probably not, but some updates would
provide better insight to the problem and code should be enhanced.

Signed-off-by: Pavel Pisa <[email protected]>
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

No branches or pull requests

1 participant