Complement the cycle count of the previous simulator with more details about the execution of the program in a pipeline, focusing on the hazards of cnotrole.
Remember concepts about CPI and hazards ..
Attention: This exercise, like all others, is individual. This means that you cannot, under any circumstances, look at the code of one of your colleagues. You can take questions away from the computer or ask the teacher for help.
Before you start
You should remember the concepts related to performance measures. Try to think of answers to the following questions (you do not need to include them in your report):
What is CPI?
What is hazard?
What types of hazards can happen in the MIPS 5-stage pipeline?
What is the impact of each hazard on the performance of a program? Is it possible to improve performance?
How does branch prediction work? What is the standard MIPS pipeline technique in this case (see the course book)?
Without deviation prediction, what is the earliest moment in the pipeline at which branch instruction can be executed?
List some deviation prediction techniques and how they work.
It is important that you know how to answer these questions before continuing the activity.
Activity
In this activity you must use the same programs as 1 Exercise. But I recommend that you first do an evaluation on "Hello World" for its size and ease of debugging. Subsequently run your code with the 3 largest programs.
Pre-activity
You already did the pre-activity in exercise 2.
Hazard control and deviation prediction
Similar to data hazards, control hazards will only occur in some of the instructions' executions. So they need to be counted correctly. You need to identify which instructions are subject to control hazards and what the impact is when these hazards happen. The next step is to capture this information directly in the simulator, calculating the impact on the execution time of the programs. Start by considering that diversion instructions can only be completed in the fourth stage of the pipeline (initial version of the book chapter, quite pessimistic).
After calculating the impact on the deviation instructions, you should assess how they can be improved using deviation prediction. For this, consider the following deviation forecasting techniques:
Deviation never taken: This technique is the same as that simulated until now. Just use this name to identify the column with the results you have obtained so far and include the overhead of the deviations.
Deviation always taken: This technique is impossible to implement on hardware, but in the simulator you can be aware of the impact it would have on your program.
1-bit predictor: Allocate a bit per address, start the forecast with not taken and calculate the impact of this predictor on your program.
Another predictor: Choose another jump prediction technique, implement it and see the impact on your program.
Delivery
Everyone must submit a 1 page report, in PDF format, through the Susy. Keep the source code until the end of the semester.
In your report, include a table with at least the following columns:
Program that has been evaluated
Number of cycles considering CPI = 1
Number of cycles considering CPI for exercise 1
Number of cycles considering CPI of exercise 1 and the existence of data hazard, with forward in the pipeline (last column of exercise 2). Use this setting for later measurements.
Deviation forecast: Never taken
Deviation forecast: Always taken
Deviation prediction: 1-bit predictor
Deviation forecast: Another predictor
Also indicate, for each deviation forecasting technique, its average hit rate in the evaluated programs (the average of the percentages of the three programs for each of the techniques).