mipt-mips icon indicating copy to clipboard operation
mipt-mips copied to clipboard

Describe simulation of BP and BTB pipelines

Open pavelkryukov opened this issue 5 years ago • 18 comments

We have a detailed description of BPU model, but it does not cover interaction with pipeline and process of flush.

New manual should answer these questions:

  1. What are the 3 branch types?
  2. What prediction should be made for the each of branch type?
  3. What are the stages where prediction may be verified?
  4. What is performed on branch misprediction?
  5. What signals are distributed between stages to maintain the behavior?

pavelkryukov avatar May 02 '19 21:05 pavelkryukov

@BEANefiT Disclaimer: you have 10 points already in this term. Any additional work will not affect your your course result (however, in the contribution score table all the points will be mentioned) .

pavelkryukov avatar May 05 '19 21:05 pavelkryukov

@BEANefiT Disclaimer: you have 10 points already in this term. Any additional work will not affect your your course result (however, in the contribution score table all the points will be mentioned) .

Thank you for the disclaimer. I just want to try myself in explaining some things to others, that's why I've assigned this issue.

beanefit avatar May 05 '19 21:05 beanefit

I've attempted to explain some basics of this simulation. Here it is.

beanefit avatar May 06 '19 17:05 beanefit

Your manual requires a lot of pictures,

pavelkryukov avatar May 06 '19 17:05 pavelkryukov

https://github.com/MIPT-ILab/mipt-mips/wiki/github-markdown-bkms#how-to-upload-a-picture

pavelkryukov avatar May 06 '19 17:05 pavelkryukov

  1. Have you read this: https://github.com/MIPT-ILab/mipt-mips/wiki/How-to-write-Wiki-manuals ?
  2. It's very hard to read about all 3 types of branchex mixed. Can we process type by type?
    • Each section for each branch should start with the topology — 5 stages and wires used.
    • Then you put examples for each case: correct prediction, incorrect prediction etc.
  3. What do these pentagons mean?
  4. What should I understand from that picture? https://github.com/MIPT-ILab/mipt-mips/wiki/Interaction-between-BPU-and-pipeline-pictures/pic_1.png
  5. You should not copy-paste C++ code — if we wanted to read C++ code, we would go to the repository. You should explain what it does and, more imporantly, why it does it.
  6. Introduction section does not introduce to anywhere — it just says that BPU is a BPU. There is no logical connection to the next paragraph!
  7. https://github.com/MIPT-ILab/mipt-mips/wiki/Interaction-between-BPU-and-pipeline#fetch-stage — why should I know all that information? Shall it be actual if we add one more source of target?

pavelkryukov avatar May 06 '19 23:05 pavelkryukov

I've begun refactoring. Will finish this evening. Could you please have a quick look at it just to notice some general mistakes?

beanefit avatar May 07 '19 11:05 beanefit

I've begun refactoring. Will finish this evening.

Please do not rush — write permission won't disappear after the deadline.

pavelkryukov avatar May 07 '19 11:05 pavelkryukov

I've begun refactoring. Will finish this evening.

Please do not rush — write permission won't disappear after the deadline.

No, I mean I'll continue working on it this evening.

beanefit avatar May 07 '19 11:05 beanefit

See my comments inlined on the Wiki page: https://github.com/MIPT-ILab/mipt-mips/wiki/Branch-prediction-pipelines

I suggest to stop writing the manual now. Please provide the structure of your story instead — the lack of the skeleton would make refactoring infinite.

pavelkryukov avatar May 07 '19 13:05 pavelkryukov

I've attempted to shortly introduce my view of structure. Pictures and formatting are ignored for now.

beanefit avatar May 07 '19 20:05 beanefit

Pipeline modeling

That should actually be an introduction. I advise to put a simple picture for these three stages without any branch prediction data, like it is in our slides: fetch (and multiplexer between PC + 4 and target), decode (mentioning that it is reads target from branch encoding) and execution.

Then I suggest to write about branches performance problem — that you have to multiplex on Fetch, but control signal is ready only on late stages.

Then branch prediction is naturally introduced, we explain here why we need it. Why we need a direction prediction? Why we need a target prediction?

I've chosen the idea of deductive method of explanation, i.e., I'll describe pipeline from tail to head. In my opinion, this will be clearer for readers.

Please no. You need to have Tarantino's talent to shoot Pulp Fiction.

I advise to start with indirect jumps. They are the simplest — predict target, calculate target, check target.

Then should go direct jumps — predict target, decode target, check target.

Then should go branches — predict direction, predict target (if branch is predicted taken), check target (if branch is predicted taken), calculate direction, check direction.

pavelkryukov avatar May 12 '19 17:05 pavelkryukov

Hello. I didn't forget about this task. I just want to take a several days break, because I have some stuff to complete till the end of this term.

beanefit avatar May 15 '19 18:05 beanefit

Sure.

Just a reminder — you wanted to clean up that code:

https://github.com/MIPT-ILab/mipt-mips/blob/a1762774254bd4484415053c685e1b3faf17611a/simulator/modules/decode/decode.cpp#L121-L126

pavelkryukov avatar May 16 '19 10:05 pavelkryukov

@BEANefiT The manual is still actual for us. Could you please spend some time to complete it?

pavelkryukov avatar Aug 25 '19 20:08 pavelkryukov

@BEANefiT The manual is still actual for us. Could you please spend some time to complete it?

Hello, just saw this reply and it reminded me of this manual. Sorry for inconveniences, will refresh the work soon

beanefit avatar Oct 14 '19 03:10 beanefit

Should we expect this or it's better to put it back to the pool of tasks?

pavelkryukov avatar Dec 02 '19 19:12 pavelkryukov

Should we expect this or it's better to put it back to the pool of tasks?

If there is someone who wants to take this task, then it's ok to put it back to the pool. Nevertheless, I will have much more time in the end of January. That was awkward, sorry :-)

beanefit avatar Dec 05 '19 10:12 beanefit