C8 · Problem set 8
Problem set 8: datapaths, pipelines and prediction
These problems use lessons 35 to 42: the single-cycle processor, caches and pipelines, pipelining and hazards, branch prediction with superscalar and multicore processors, and SIMD and vector instructions. Addresses are 32 bits, 1 KiB is 1024 bytes, and a pipeline's branch penalty is paid only on mispredictions.
Check
A single-cycle processor's units take: register clock-to-Q 30, each memory 160, register-file read 130, ALU 170, result mux 25, register-file setup 45 (all ps).
(a)
What is the clock period?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
What percentage of the cycle does an R-type instruction, which skips the data memory, actually need?
Check
A slow unit of 400 ps is added in parallel with the 120 ps ALU of a 700 ps single-cycle processor, on the critical path. A fraction 0.1 of instructions use it.
(a)
What is the new clock period?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
By what factor does every program slow down, however few instructions use the unit?
Check
A cache hits in 1 cycles and misses 0.02 of the time, with a 100-cycle miss penalty.
(a)
What is the average memory access time?
(b)
A larger cache with the same hit time misses only 0.015 of the time. By what factor does the AMAT improve?
Check
A direct-mapped cache holds 16 KiB in 16-byte lines, for 32-bit addresses.
(a)
How many offset bits?
(b)
How many tag bits?
Check
A single-cycle design with 1000 ps of logic and a 40 ps register is pipelined into 6 equal stages, each adding a 40 ps register. It runs 50 instructions with no stalls.
(a)
How many cycles does the pipeline take?
(b)
How many times faster than the single-cycle design is it on these instructions?
Check
A five-stage pipeline's stages take 170, 200, 150, 200 and 150 ps, and each pipeline register adds 55 ps.
(a)
What is the clock period?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
What is the clock frequency?
Check
0.2 of instructions are loads, 0.25 of which are used by the very next instruction; 0.18 are branches, 0.7 of them taken, predicted not taken at a 2-cycle penalty. Forwarding is complete.
(a)
What is the CPI?
(b)
What percentage of the stall cycles come from load-use hazards?
Check
An inner loop of 6 iterations runs 50 times; ignore the first run.
(a)
What accuracy does a 1-bit predictor reach on the loop's closing branch?
(b)
How many mispredictions does a 2-bit predictor make in the counted runs?
Check
Design X has a short pipeline: 400 ps cycle, 2-cycle misprediction penalty. Design Y is deeper: 250 ps cycle, 14-cycle penalty. Branches are 0.2 of instructions, predicted with accuracy 0.9; the base CPI is 1.
(a)
What is X's time per instruction?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
How many times faster is Y than X?
Check
A 3-wide superscalar processor loses 0.05 cycles per instruction to stalls.
(a)
What is its CPI?
(b)
What fraction of the CPI of a 1-wide design with the same stalls is that?
Check
A fraction 0.85 of a job runs in parallel on 2 cores.
(a)
What is the speedup over one core?
(b)
What is the most any number of cores could give?
Check
A chip uses 4 cores at 0.5 of the original clock and 0.85 of the voltage, in place of one fast core.
(a)
What is its dynamic power relative to the single core?
(b)
How many times the single core's work per joule does it do on parallel work?
Check
Without forwarding, 30% of instructions stall 2 cycles for the one before. With forwarding, only loads (20%) used at once (50% of them) stall 1 cycle.
(a)
What is the CPI without forwarding?
(b)
How many times faster does forwarding make it?
Check
800 ps of logic is split into 5 equal stages, each with 40 ps of register overhead.
(a)
What is the clock period?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
What is the speedup at a CPI of 1?
Check
15% of instructions are branches, predicted with 85% accuracy; a misprediction costs 10 cycles.
(a)
What is the CPI, with no other stalls?
(b)
What share of cycles are lost to mispredictions?
Check
A fraction 0.85 of a program vectorizes onto 4 lanes, and its hot loop handles 1000 elements.
(a)
What's the overall speedup?
(b)
What's the most any vector width could give?
Have paper and a calculator ready. Work each problem out by hand, then enter the answer. Your first try on each one counts toward your score.
Practice
Keep practicing
16 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.