Skip to content
Tactiverge

School/✦ Research Engineer/Week 27

Explaining results from first principles

Your 8-bit version runs 2.6× faster than float, but the arithmetic is only 2× cheaper. Where did the rest come from?

About 50 min · 3 goals · Checked by automated tests

1.Why should I care?

A comparison is finished only when you can explain it. Explaining a speed-up with the Iron Law and AMAT, and an accuracy change with quantisation error, is what turns a table into understanding that transfers to the next design.

  • ◇ Decompose a measured speed-up into Iron Law factors (IC, CPI, cycle time) and memory effects (AMAT).
  • ◇ Check that a first-principles model explains the measured result within its uncertainty, and say what it does not explain.
  • ◇ Write the results, recommendation and limitations of the term project honestly.

2.Predict

Halving data size (32-bit → 16-bit) often speeds up a memory-heavy loop by more than the arithmetic alone suggests. Why?

Guess first. Being wrong here is how the surprise works.

3.Understand

Explain the numbers

For each metric, give the mechanism and check the size: operation counts for compute, bytes and AMAT for memory, quantisation step for accuracy, P = αCV²f and duty cycle for energy. A mechanism that predicts the right size of effect is far stronger than one that only predicts its direction.

Results that resist explanation

If the model leaves a gap, report it as an open question rather than stretching the explanation. 'The model predicts 2.75× but we measured 3.4×; we suspect hardware prefetching, which our model omits' is honest and useful.

The final report

Question and prediction; method (as pre-registered, with any deviations); results with uncertainty; first-principles explanation; recommendation from the pre-stated rule; limitations: simulation versus hardware, one workload, one compiler, toy data. No claim beyond the evidence.

Explain it another way

A detective doesn't stop at 'the window was broken'; they explain how, and check the explanation fits every clue, including the ones that don't fit neatly.

Derivation: Decomposing a speed-up
  1. T = IC × CPI × t_clk, with CPI = CPI_base + (memory accesses per instruction) × miss rate × miss penalty.

  2. Speed-up S = T_A/T_B = (IC_A/IC_B) × (CPI_A/CPI_B) × (t_A/t_B). Taking logs, ln S = ln(IC ratio) + ln(CPI ratio) + ln(clock ratio): each factor's share adds.

  3. Example: SIMD packing halves IC (ratio 2). Smaller data cuts the miss rate from 6% to 3% with 0.4 accesses per instruction and a 50-cycle penalty: CPI 1 + 1.2 = 2.2 → 1 + 0.6 = 1.6 (ratio 1.375). Clock unchanged.

  4. Predicted S = 2 × 1.375 = 2.75×. If you measured 2.6× ± 0.1, the model explains it within uncertainty; the shares are ln 2 / ln 2.75 ≈ 68% from IC and 32% from CPI.

  5. If the model and measurement disagree beyond uncertainty, something unmodelled matters (branch behaviour, prefetching, frequency scaling): say so and investigate.

Worked example 1

Float: IC 10⁹, CPI 1.8, 1 GHz. Int8: IC 0.3×10⁹, CPI 2.1, 1 GHz. Speed-up and its sources?

T_f = 1.8 s, T_i = 0.63 s: S ≈ 2.86×. IC ratio 3.33 (ln 1.20) and CPI ratio 0.857 (ln −0.15): ln S = 1.05. Packing fewer, wider operations gained a lot; CPI got slightly worse (perhaps extra rescaling instructions or stalls) and gave some back.

Common mix-ups

  • A good result needs no explanation.
    ✓ Without a mechanism, you cannot predict whether it will hold on the next workload or chip.
  • If the model doesn't match, the experiment failed.
    ✓ A mismatch is information: it points to an effect your model left out.

4.Discover

Model your two systems. Pin the float version (your measured or estimated IC, CPI and miss rate). Then change only what precision changes: fewer instructions if SIMD packs more values, a lower miss rate if data is smaller. Does the model's speed-up match your measurement? Which factor explains most of it?

Loading the interactive…

Can't use the interactive? Read a description instead

The derivation splits a speed-up into factors: instruction-count ratio × CPI ratio × clock ratio. Halving instructions and cutting CPI from 2.2 to 1.6 predicts 2.75×, about two-thirds from fewer instructions and one-third from fewer cache-miss stalls.

5.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

A program executes 750 million instructions with an average CPI of 0.8 on a 2 GHz processor. How long does it take, in milliseconds?

ms

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

A pipeline has base CPI 1. Branches are 15% of instructions, 20% of them are mispredicted, costing 2 cycles each. Loads and stores are 20% of instructions, 10% of them miss in the cache, costing 100 cycles each. What is the effective CPI?

Practice 3

Version B executes 0.5× the instructions of A, and its CPI falls from 2.0 to 1.5. Same clock. What speed-up does the Iron Law predict?

×

Practice 4

Your model predicts 2.0× and you measured 2.9× ± 0.2. What should the report say?

Practice 5 · a fresh version every time

L1: hit time 2 cycles, miss rate 5%. L2: hit time 8 cycles, local miss rate 40%. Main memory: 200 cycles. What is the AMAT in cycles?

cycles

Practice 6

Which is a genuine limitation to state for a browser-simulated precision study?

7.Apply it

Complete the term project report: results table with uncertainty, Iron Law and AMAT (or energy) decomposition of each difference, recommendation from your pre-stated rule, and a limitations section of at least four specific items.

8.Reflect

Concepts: Evaluation metrics · Comparing conditions with uncertainty · Reproducibility and documentation · Memory hierarchy and caches · Pipelining, hazards and the Iron Law