Lite / Independent Engineering Research / Term 3 worksheet
Worksheet: Independent Engineering Research, term 3
Name: Date:
Week 19: How fast does the work grow?
1. How many times is work() called when n = 16? Code: i = n; while i > 1: { work(); i = floor(i / 2) }
Answer: calls
2. Which is the tightest description of f(n) = 4n³ + 200n² log n + 10⁶?
- Θ(n³)
- Θ(n² log n)
- Θ(10⁶)
- O(n⁴) and nothing tighter
3. A braking controller must finish its computation within 2 ms every cycle. Which complexity matters most?
- Best case
- Average case
- Worst case
- Space complexity only
4. How many times is work() called when n = 270? Code: for i in 0 … n−1: for j in i+1 … n−1: work()
Answer: calls
5. An n³ algorithm handles n = 200 in one second. The machine is replaced with one 8 times faster. What n now fits in one second?
Answer:
6. Merge sort (Θ(n log n) time, Θ(n) extra space) and heapsort (Θ(n log n) time, Θ(1) extra space) must sort 40 KB of samples on a chip with 48 KB of free RAM. Which is safer?
- Merge sort, it is usually faster
- Heapsort, it fits in memory
- Either: they have the same time complexity
- Neither can sort on a microcontroller
Week 19: Divide, conquer and count with recurrences
1. T(n) = 3·T(n/2) + n for n > 1, with T(1) = 1. What is T(32)?
Answer:
2. An algorithm checks the middle of a sorted array, then recurses on one half. Which recurrence describes it?
- T(n) = 2T(n/2) + 1
- T(n) = T(n/2) + 1
- T(n) = T(n − 1) + 1
- T(n) = 2T(n/2) + n
3. T(n) = 2·T(n/2) + 1 for n > 1, with T(1) = 1. What is T(32)?
Answer:
4. For T(n) = 8T(n/2) + n², which part of the recursion tree dominates?
- The root: Θ(n²)
- All levels equally: Θ(n² log n)
- The leaves: Θ(n³)
- It cannot be solved
5. Quicksort's worst case gives T(n) = T(n − 1) + n with T(1) = 1. What is T(10)?
Answer:
Week 19: When exact answers are out of reach
1. Which statement captures membership of NP?
- It can be solved in polynomial time
- A proposed solution can be checked in polynomial time
- It can never be solved exactly
- It needs a non-deterministic computer
2. How many distinct round trips (direction ignored) through 8 cities?
Answer:
3. Your greedy scheduler beats random scheduling on every test. What should the report claim?
- It is optimal
- It is better than random on these tests; its gap to optimal is measured on small cases where the optimum can be computed
- NP-hard problems cannot be evaluated
- Nothing until P vs NP is solved
4. How many times is work() called when n = 270? Code: for i in 0 … n−1: for j in i+1 … n−1: work()
Answer: calls
5. Which problem has a known polynomial-time algorithm?
- Shortest path between two nodes in a road graph with positive lengths
- Shortest tour visiting every node once
- Choosing a subset of parcels that exactly fills a van's weight limit
- Colouring a map with 3 colours so neighbours differ
Week 20: Single-cycle, multi-cycle and the Iron Law
1. 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?
Answer: ms
2. A program's mix is 60% ALU (1 cycle), 15% loads (2 cycles), 20% branches (3 cycles) and 5% stores (2 cycles). What is the average CPI?
Answer:
3. A compiler optimisation removes redundant instructions without changing the hardware. Which Iron Law factor does it change most directly?
- Instruction count
- Cycle time
- Clock frequency
- None
4. A program executes 200 million instructions with an average CPI of 1.8 on a 3 GHz processor. How long does it take, in milliseconds?
Answer: ms
5. Design A: CPI 1.6 at 3 GHz. Design B: CPI 1.0 at 2.4 GHz, same instruction count. What is B's speed-up over A?
Answer: ×
Week 20: Pipelining: an assembly line for instructions
1. 127 instructions run on a 4-stage pipeline. Hazards insert 6 stall cycles in total. How many clock cycles until the last instruction completes?
Answer: cycles
2. A single-cycle datapath has a 5 ns cycle. It is split into 10 equal stages, each adding 0.1 ns of register (latch) overhead. What is the speed-up for 100 instructions with no stalls?
Answer: ×
3. Compared with the unpipelined design, the latency of a single instruction in a pipeline is…
- k times shorter
- About the same or slightly longer
- Always exactly one cycle
- Zero once the pipeline is full
4. 83 instructions run on a 8-stage pipeline. Hazards insert 9 stall cycles in total. How many clock cycles until the last instruction completes?
Answer: cycles
5. A 1,200 ps datapath is split into 6 perfectly balanced stages with 50 ps register overhead each. What is the speed-up limit for very long programs?
Answer: ×
Week 20: Hazards, forwarding and branch prediction
1. lw r5, 4(r2) / add r6, r5, r1. Which hazard and, with forwarding, how many stall cycles?
- Structural, 0
- Data (load-use), 1
- Control, 2
- Data, 0 thanks to forwarding
2. 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?
Answer:
3. Design B doubles the pipeline depth of A, raising the clock 1.6× and the branch penalty from 2 to 5 cycles. Branch fraction 20%, mispredict 10%, base CPI 1 for both, memory ignored. Which is faster?
- A
- B
- Equal
- Cannot tell without IC
4. A pipeline has base CPI 1. Branches are 20% of instructions, 10% of them are mispredicted, costing 15 cycles each. Loads and stores are 35% of instructions, 4% of them miss in the cache, costing 50 cycles each. What is the effective CPI?
Answer:
5. On the classic 5-stage pipeline with no forwarding, a chain of 4 ALU instructions each uses the previous one's result. How many total cycles? (Ideal is 8.)
Answer: cycles
6. Why do most processors have separate L1 instruction and data caches?
- To store more data
- To remove the structural hazard of fetch and load/store needing memory in the same cycle
- Because instructions are larger than data
- To make branch prediction possible
Week 21: Locality and the memory hierarchy
1. A filter applies the same 5 coefficients to every sample. Which locality do the coefficients show?
- Temporal
- Spatial only
- Neither
- Only compulsory misses
2. A loop reads 256 consecutive 4-byte floats into an empty cache with 64-byte blocks. How many misses?
Answer: misses
3. A direct-mapped cache has 4 lines of 16 bytes and starts empty. The CPU reads these byte addresses in order: 124, 272, 272, 368, 20, 20, 272, 144, 144, 144. How many reads hit?
Answer: hits
4. Reading every 64th byte with 16-byte blocks gives 100% misses. What happens if blocks grow to 32 bytes?
- Misses halve
- Still 100% misses
- No misses
- Misses double
5. Which list is ordered from fastest to slowest?
- DRAM, L1, registers, SSD
- Registers, L1, L2, DRAM, SSD
- L1, registers, DRAM, L2
- SSD, DRAM, L2, L1
Week 21: Inside a cache: tags, sets and ways
1. A 32 KB 4-way set-associative cache has 16-byte blocks and 64-bit byte addresses. How many offset bits are there?
Answer: bits
2. A 8 KB direct-mapped cache has 128-byte blocks and 32-bit byte addresses. How many offset bits are there?
Answer: bits
3. A direct-mapped cache has 4 lines of 16 bytes and starts empty. The CPU reads these byte addresses in order: 124, 272, 272, 368, 20, 20, 272, 144, 144, 144. How many reads hit?
Answer: hits
4. Going from direct-mapped to 4-way set-associative at the same capacity mainly costs…
- More tag comparators and a way multiplexer
- More capacity
- Smaller blocks
- Nothing: it is free
5. A single set with 2 ways and LRU replacement sees blocks A, B, A, C, B. Which accesses hit?
- Only the second A
- The second A and the last B
- None
- All after the first two
6. How many single-bit XNOR gates do the tag comparators of an 8-way cache with 20-bit tags need?
Answer: XNORs
Week 21: Average memory access time
1. A cache has a hit time of 3 cycles, a miss rate of 1% and a miss penalty of 100 cycles. What is the AMAT in cycles?
Answer: cycles
2. L1: hit time 1 cycles, miss rate 10%. L2: hit time 8 cycles, local miss rate 10%. Main memory: 300 cycles. What is the AMAT in cycles?
Answer: cycles
3. A cache has a hit time of 2 cycles, a miss rate of 5% and a miss penalty of 100 cycles. What is the AMAT in cycles?
Answer: cycles
4. L1 miss rate is 4% and L2 local miss rate is 25%. What percentage of all accesses go to main memory?
Answer: %
5. AMAT = 1 + 0.08 × 50. Which single change helps most?
- Cut hit time from 1 to 0.5 cycles
- Cut miss rate from 8% to 6%
- Cut miss penalty from 50 to 45 cycles
- All save the same
6. Base CPI is 1. There are 0.4 memory accesses per instruction, L1 hit time is included in base CPI, and AMAT is 3 cycles with a 1-cycle hit time. What is the effective CPI?
Answer:
Week 22: Hardware or software? Partitioning a task
1. 80% of a program's run time is moved onto a hardware accelerator that makes that part 2× faster. What is the overall speed-up?
Answer: ×
2. 50% of a program's run time is moved onto a hardware accelerator that makes that part 20× faster. What is the overall speed-up?
Answer: ×
3. Which function is the best candidate for a hardware accelerator in a drone?
- The menu system of its phone app
- A fixed FIR filter run on every IMU sample at 8 kHz
- The mission planner that changes every flight
- Error logging that runs once per crash
4. How many levels of 2-input XOR gates does a balanced parity tree need for a 32-bit word?
Answer: levels
5. A task is 40% accelerable. What is the best overall speed-up any accelerator can give?
- 1.4×
- About 1.67×
- 2.5×
- Unlimited
Week 22: Inside an integrated circuit
1. Why are standard cells all the same height?
- So they look tidy
- So they can be placed in rows sharing power and ground rails
- Because transistors are all the same size
- To make them slower
2. A critical path totals 400 ps of logic and wire, plus 60 ps clock-to-Q, 40 ps setup and 25 ps skew. Maximum clock frequency in GHz?
Answer: GHz
3. An unbuffered wire 1 mm long has 20 ps delay. Using the RC model (delay ∝ L²), what is the delay of a 3 mm wire?
Answer: ps
4. Why does clock gating an idle block save power?
- It lowers the supply voltage
- Its flip-flops and clock buffers stop switching, so no dynamic power is spent on them
- It removes leakage completely
- It makes the clock faster elsewhere
5. A chip switches an effective capacitance of 1 nF with activity factor α = 0.3, at 0.7 V and 2 GHz. What is its dynamic power in watts?
Answer: W
Week 22: Wafers, lithography and yield
1. With a Poisson yield model Y = e^(−D·A), what percentage of 20 mm² dies work when the defect density is 0.3 defects per cm²?
Answer: %
2. Estimate the whole dies on a 200 mm wafer for a 200 mm² die using DPW = π(d/2)²/A − πd/√(2A). Round down.
Answer: dies
3. A processed 300 mm wafer costs $5000 (an illustrative figure). It holds 306 dies of 200 mm², and the defect density is 0.1 per cm² (yield Y = e^(−D·A)). What is the cost per good die in dollars?
Answer: $
4. Which order is right for patterning one layer?
- Etch, expose, coat resist, develop
- Coat resist, expose through a mask, develop, etch or deposit
- Dice, expose, etch, package
- Dope, dice, coat, expose
5. What does a process node name such as '5 nm' mean today?
- Every transistor gate is exactly 5 nm long
- A technology generation label; it no longer matches a single physical dimension
- The wafer is 5 nm thick
- The chip runs at 5 GHz
6. With D = 0.2 /cm², what is the yield (as a percentage) of one 6 cm² monolithic die? (Four 1.5 cm² chiplets would each yield 74%.)
Answer: %
Week 23: Training versus inference: counting the cost
1. A convolution layer takes a 8×8 image with 8 channels and produces a 8×8 output with 32 channels using 5×5 kernels. How many MACs does it need?
Answer: MACs
2. A network has two fully connected layers: 784 inputs → 16 hidden units → 2 outputs. How many multiply-accumulate operations (MACs) does one inference need (ignore biases and activations)?
Answer: MACs
3. Which phase normally runs on a battery-powered sensor?
- Training
- Inference
- Both, equally
- Neither
4. A model needs 3,000,000 MACs. The core does 2 MACs per cycle at 80 MHz. Ignoring memory stalls, what is the latency in ms?
Answer: ms
5. A neural network has 600000 weights stored at 16 bits each. How many kilobytes (1 KB = 1024 bytes) do the weights occupy?
Answer: KB
Week 23: Quantisation: fewer bits, smaller models
1. Weights lie in [−2, 2] and are quantised to symmetric int8 with qmax = 127. What is the scale (step size)?
Answer:
2. A neural network has 50000 weights stored at 4 bits each. How many kilobytes (1 KB = 1024 bytes) do the weights occupy?
Answer: KB
3. With scale 0.02, what integer does w = −0.537 quantise to (round to nearest)?
Answer:
4. One weight in a layer is 50× larger than all the others. What happens with a single per-layer int8 scale?
- Nothing: int8 is exact
- Most small weights round to a handful of levels near zero, losing resolution
- The large weight is clipped to zero
- Footprint grows
5. Which evaluation of an int8 model is fair?
- Accuracy on the training set
- Accuracy of float and int8 models on the same held-out test set, with uncertainty
- Accuracy on whichever test examples int8 gets right
- Model size only
Week 23: Fitting a model into memory, time and energy
1. One inference performs 1000000 MACs at 0.2 pJ each and reads 50000 bytes from memory at 100 pJ per byte. What is the energy per inference in microjoules (µJ)?
Answer: µJ
2. One inference performs 50000 MACs at 3 pJ each and reads 10000 bytes from memory at 5 pJ per byte. What is the energy per inference in microjoules (µJ)?
Answer: µJ
3. A network has two fully connected layers: 64 inputs → 32 hidden units → 4 outputs. How many multiply-accumulate operations (MACs) does one inference need (ignore biases and activations)?
Answer: MACs
4. Your model's weights fit in flash, but one layer's input and output activations together exceed RAM. What is the most direct fix?
- Quantise the weights further
- Process the layer in tiles, or redesign it with smaller activations
- Raise the clock
- Train for longer
5. A 200 mAh, 3 V coin cell stores about 2,160 J. If each inference costs 5 µJ and nothing else used energy, how many inferences is that? (Answer in millions.)
Answer: million
Week 24: Power, performance and area
1. A chip switches an effective capacitance of 0.5 nF with activity factor α = 0.2, at 0.9 V and 3 GHz. What is its dynamic power in watts?
Answer: W
2. A chip switches an effective capacitance of 5 nF with activity factor α = 0.1, at 0.8 V and 0.5 GHz. What is its dynamic power in watts?
Answer: W
3. Voltage drops from 1.1 V to 0.8 V and frequency from 2.4 GHz to 1.2 GHz. What fraction of the original dynamic power remains? (Answer as a decimal.)
Answer:
4. Halving the clock frequency at the same voltage changes dynamic energy per operation by…
- Halving it
- Nothing
- Doubling it
- Quartering it
5. Replacing one fast core with four slow low-voltage cores at equal throughput mainly costs…
- Power
- Area (and leakage), plus software that can use four cores
- Nothing
- Clock frequency of the cores is higher
Week 24: Energy budgets and duty cycling
1. A sensor node wakes every 5 s, runs for 2 ms at 30 mW, and sleeps the rest of the time at 10 µW. What is its average power in microwatts (µW)?
Answer: µW
2. A sensor node wakes every 2 s, runs for 50 ms at 5 mW, and sleeps the rest of the time at 1 µW. What is its average power in microwatts (µW)?
Answer: µW
3. A device averages 50 µW from a battery storing 10,000 J. Ignoring self-discharge, how many days will it last?
Answer: days
4. A node's average is 200 µW active + 3 µW sleep. Which change helps most?
- Halve the sleep current
- Halve the awake time per cycle
- Use a bigger enclosure
- Double the clock but keep awake time the same
5. Core A runs a task in 2 ms at 30 mW; core B takes 10 ms at 8 mW. Both sleep afterwards at the same power. Which uses less energy for the task?
- A (60 µJ)
- B (80 µJ)
- They are equal
- B, because its power is lower
Week 24: Reduced precision: range, resolution and error
1. What is the step size (resolution) of a signed Q4.12 number?
Answer:
2. What is the largest value a signed Q4.12 (16-bit) number can hold? (Give it to 4 decimal places.)
Answer:
3. Multiplying two Q1.15 numbers gives a 32-bit result in which format?
- Q1.15
- Q2.30
- Q1.31
- Q16.16
4. A neural network has 120000 weights stored at 8 bits each. How many kilobytes (1 KB = 1024 bytes) do the weights occupy?
Answer: KB
5. Why write the accuracy requirement before testing precisions?
- It is a formality
- So the choice follows from the requirement, not from whichever result looks best afterwards
- To make the code faster
- Because precision cannot be measured
Week 25: Gradient descent and the learning rate
1. Minimise f(x) = 1(x − -2)² by gradient descent with learning rate η = 0.2, starting from x₀ = 8. What is x after 6 steps?
Answer:
2. Minimise f(x) = 0.5(x − 3)² by gradient descent with learning rate η = 0.05, starting from x₀ = -4. What is x after 5 steps?
Answer:
3. f(x, y) = ½(3x² + 12y²). What is the largest learning rate for which gradient descent converges? (Strict upper bound.)
Answer:
4. Gradient descent zig-zags slowly down a long, narrow valley. The most direct cure is…
- A larger learning rate
- Rescaling the variables so the curvature is similar in every direction
- More random starting points
- Stopping earlier
5. For f(x) = ½·5x², which learning rate reaches the minimum in exactly one step from any start?
Answer:
Week 25: Convexity and local minima
1. Which function is convex on all real x?
- sin x
- x³
- eˣ + x²
- x⁴ − x²
2. Your optimiser returns a point with zero gradient on a convex objective. What can you conclude?
- It may be a local maximum
- It is a global minimum
- Nothing without more starts
- It is a saddle point
3. For f(x) = (x² − 1)², below what value of |x| is f''(x) negative? (3 decimal places.)
Answer:
4. Minimise f(x) = 1(x − 3)² by gradient descent with learning rate η = 0.25, starting from x₀ = 8. What is x after 3 steps?
Answer:
5. You tune a robot arm design with a non-convex objective. What is the honest report?
- 'We found the optimal design.'
- 'Best of 50 random starts; 38 reached within 1% of this value; results from the other 12 are shown.'
- 'Gradient descent converged, so it is optimal.'
- Report only the best run
Week 25: Newton's method, momentum and constraints
1. Apply one step of Newton's method to f(x) = 3x² − 12x + 1 from x₀ = 10. What is x₁?
Answer:
2. Minimise (x − 2)² subject to x ≤ 1 with the penalty μ(x − 1)² for x > 1 and μ = 9. What x does the penalised problem give?
Answer:
3. For a problem with a million variables, why is plain Newton's method rarely used?
- It converges too slowly
- Storing and solving with a million-by-million Hessian is far too expensive
- It only works in 1-D
- It cannot handle convex problems
4. A motor current must never exceed its rating. Which constraint method suits that best?
- A small penalty
- An exact constraint method (projection, interior-point or clamping) that guarantees feasibility
- Ignore it and check afterwards
- A random search
5. Minimise f(x) = 2(x − 1)² by gradient descent with learning rate η = 0.05, starting from x₀ = 5. What is x after 4 steps?
Answer:
Week 26: Benchmarking computer systems fairly
1. Why discard warm-up runs?
- To hide slow results
- Because first runs include one-off costs (cold caches, loading, JIT compilation) not present in steady state
- To make the numbers smaller
- Because the first run is always wrong
2. Sixteen paired runs give a mean difference of 0.8 ms with standard deviation 1.6 ms. What is the standard error of the mean difference, in ms?
Answer: ms
3. Design A: 10 ms, 50 mJ. B: 12 ms, 30 mJ. C: 14 ms, 55 mJ. Which are Pareto-optimal (lower is better on both)?
- A only
- A and B
- B and C
- All three
4. A program executes 200 million instructions with an average CPI of 1.8 on a 3 GHz processor. How long does it take, in milliseconds?
Answer: ms
5. Which practice makes a two-system timing comparison fairest?
- Run all of A, then all of B, on a warming laptop
- Interleave A and B runs on a fixed-frequency machine, same inputs, with the order randomised
- Run each once on different machines
- Use whichever run of each was fastest
Week 26: Ablations: which part made it better?
1. Which is an ablation?
- Comparing your system with a competitor's
- Removing one component of your system at a time and measuring the change
- Running the full system ten times
- Tuning all parameters together
2. A 2×2 study of predictor (P) and cache (C) gives run times (ms): neither 100, P only 80, C only 70, both 55. What is the main effect of P (ms)?
Answer: ms
3. A direct-mapped cache has 4 lines of 16 bytes and starts empty. The CPU reads these byte addresses in order: 124, 272, 272, 368, 20, 20, 272, 144, 144, 144. How many reads hit?
Answer: hits
4. A cache has a hit time of 2 cycles, a miss rate of 8% and a miss penalty of 150 cycles. What is the AMAT in cycles?
Answer: cycles
5. Doubling the L1 cache cut run time by 20%. Which follow-up best explains it from first principles?
- Report '20% faster' and stop
- Measure the miss rate before and after and check whether AMAT × accesses per instruction accounts for the CPI change
- Try a third cache size and pick the best
- Measure clock frequency
Week 27: Designing an architecture comparison
1. Which is the best research question for an adder comparison?
- Which adder is best?
- Is carry-lookahead cool?
- How do worst-case delay and gate count scale with width (4–32 bits) for ripple-carry and carry-lookahead adders?
- Can I build an adder?
2. With a model of 2 gate delays per bit for the carry, what is the worst-case carry delay of a 24-bit ripple-carry adder, in gate delays?
Answer: gate delays
3. How many times is work() called when n = 210? Code: for i in 0 … n−1: for j in i+1 … n−1: work()
Answer: calls
4. Why measure several sizes rather than one?
- It looks better in a report
- Growth rates and crossovers only show up across sizes; one point can mislead
- It is required by law
- Smaller sizes are always more accurate
5. 90% of a program's run time is moved onto a hardware accelerator that makes that part 5× faster. What is the overall speed-up?
Answer: ×
Week 27: Explaining results from first principles
1. 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?
Answer: ms
2. 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?
Answer:
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?
Answer: ×
4. Your model predicts 2.0× and you measured 2.9× ± 0.2. What should the report say?
- Adjust the model until it gives 2.9×
- The model explains part of the gain; the remaining gap is unexplained, with candidate causes and a test to check them
- Drop the measurement
- Claim the model is confirmed
5. 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?
Answer: cycles
6. Which is a genuine limitation to state for a browser-simulated precision study?
- 'Results are perfect'
- 'Results come from one workload in simulation; real hardware, compilers and data could change the ranking'
- 'No limitations'
- 'Someone else might disagree'