Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The importance of having a good branch predictor depends on how often conditiona

ID: 3613120 • Letter: T

Question

The importance of having a good branch predictor depends on how often conditional branches are executed. Together with branch predictor accuracy, this will determine how much time is spent stalling due to mispredicted branches. In this exercise, assume that the breakdown of dynamic instructions into various instruction categories is as follows: Also, assume the following branch predictor accuracies: Stall cycles due to mispredicted branches increase the CPI. What is the extra CPI due to mispredicted branches with the always-taken predictor? Assume that branch outcomes are determined in the EX stage, that there are no data hazards, and that no delay slots are used. Repeat Exercise 4.23.1 for the "always not-taken" predictor. Repeat Exercise 4.23.1 for the 2-bit predictor. With the 2-bit predictor, what speed-up would be achieved if we could convert half of the branch instructions in a way that replaces a branch instruction with an ALU instruction? Assume that correctly and incorrectly predicted instructions have the same chance of being replaced.

Explanation / Answer

please rate - thanks 4.23.1 Each branch that is not correctly predicted by thealways-taken predictor will cause 3 stall cycles, so we have:               Extra CPI a. 3 × (1 – 0.40) × 0.15 = 0.27 b. 3 × (1 – 0.60) × 0.10 = 0.12 4.23.2 Each branch that is not correctly predicted by thealways-not-taken predictor will cause 3 stall cycles, so we have:               Extra CPI a. 3 × (1 – 0.60) × 0.15 = 0.18 b. 3 × (1 – 0.40) × 0.10 = 0.18 4.23.3 Each branch that is not correctly predicted by the 2-bitpredictor will cause 3 stall cycles, so we have:                    Extra CPI a. 3 × (1 – 0.80) × 0.15 = 0.090 b. 3 × (1 – 0.95) × 0.10 = 0.015 4.23.4 Correctly predicted branches had CPI of 1 and now theybecome ALU instructions whose CPI is also 1. Incorrectly predictedinstructions that are converted also become ALU instructions with a CPI of 1, so we have:                 CPI withoutconversion                 CPI withconversion                                       Speed-up from conversion a. 1 + 3 × (1 – 0.80) × 0.15 =1.090           1 + 3 × (1 – 0.80) × 0.15 × 0.5 =1.045           1.090/1.045 = 1.043 b. 1 + 3 × (1 – 0.95) × 0.10 =1.015           1 + 3 × (1 – 0.95) × 0.10 × 0.5 =1.008               1.015/1.008 = 1.007