TactivergeLite

Lite / Independent Engineering Research / 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 · Full interactive version

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.

Predict

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

  1. 16-bit numbers are magic
  2. Twice as many values fit in each cache block and in the cache, so the miss rate falls
  3. The clock speeds up
  4. The compiler stops working
Guess first, then reveal

Smaller data doubles the values per block and per cache, cutting misses. Lower AMAT lowers memory-stall CPI, a second source of speed-up on top of cheaper operations: exactly what an Iron Law decomposition reveals.

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?

What the interactive shows (text version)

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.

You can also open the interactive on the full site when you have a faster connection.

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

Intuitive

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.

Technical

Performance counters (instructions retired, cycles, cache misses, branch mispredictions) measure each Iron Law factor directly on real hardware; in simulation, the model provides them. Attribution should use the same counters for both systems.

Mathematical

Log-decomposition: ln S = Σ ln rᵢ, so each factor's share of the speed-up is ln rᵢ / ln S. Shares are additive in log space, unlike percentages of the raw ratio.

Applied

Performance engineers routinely present 'top-down' breakdowns of where cycles go (front-end stalls, back-end memory stalls, bad speculation, useful work) to justify which part of a system to optimise next.

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

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

ms

×

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

cycles

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

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.

Reflect

Which part of this term's toolkit (complexity, Iron Law, AMAT, yield, PPA, optimisation) do you expect to use first in your capstone, and for what?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Designing an architecture comparisonFrom a topic to a research question →