Computer Architecture · All levels

Replacement Policy and Miss Behavior — Debug Playbook

Debug Playbook for Replacement Policy and Miss Behavior (Memory Hierarchy).

On-call / interview prompt

Replacement Policy and Miss Behavior looks wrong — walk your first five debug steps.

diagram
ARCHITECTURE ANALYSIS CHAIN

1. METRIC     — IPC, CPI, MPKI, bandwidth, latency, queue depth, stall cycles
2. HYPOTHESIS — microarch or system cause ordered by likelihood
3. EXPERIMENT — trace, PMU counter, simulation, or RTL probe
4. CHANGE      — pipeline, cache, NoC, or memory hierarchy adjustment
5. VALIDATION  — workload replay, regression suite, PPA impact

Reference workflow

diagram
1. Replay before/after trace windows to isolate workload mix shift versus policy behavior change.
2. Inspect top thrashing sets and classify line lifetimes (dead-on-fill vs useful reuse).
3. Quantify prefetch pollution and coherence-induced evictions separately.
4. Apply bounded policy experiment on shadow simulation with fairness monitors.
5. Validate p50/p95 latency and bandwidth impact before rollout.

Mechanism to narrate

  • Separate symptom from root cause

  • Fix systematic clusters before one-offs

Common pitfalls

  • Random optimization without metric

  • Skipping regression after local fix

Staff-level debug discipline

For Replacement Policy and Miss Behavior, senior debug is branch-and-bound: reduce the search space quickly, keep experiments reversible, and avoid hiding a systematic issue behind one local fix.

Debug decision tree

  1. Reproduce the failure with the same workload, model tag, seed, and counter setup.

  2. Classify the failure as workload issue, model issue, microarchitecture issue, software issue, implementation issue, or true product limitation.

  3. Run one cheap experiment that can falsify the leading hypothesis.

  4. Prefer a fix that improves a cluster over one that only hides the worst line.

  5. After the fix, re-check LLC miss decomposition + reuse distance report and the likely regression surface: SoC QoS enforcement, firmware scheduling, and customer-perceived performance stability rely on miss behavior..

Escalation triggers

  • The failure crosses architecture, RTL, verification, software, PD, or product ownership.

  • The proposed fix consumes area, power, latency, or verification margin needed elsewhere.

  • The issue repeats across workloads or blocks, suggesting methodology or model root cause.

  • The remaining risk is silicon-facing: Mis-tuned replacement can cause latency SLO violations and noisy-neighbor behavior in shared-cache systems..

Debug branch diagram

diagram
VISUAL MODEL — Memory Hierarchy / Replacement Policy and Miss Behavior

        workload / trace
              │
              ▼
   metric symptom (LLC miss decomposition + reuse distance report)
              │
              ▼
     likely microarchitectural mechanism
              │
      ┌───────┼────────┐
      ▼       ▼        ▼
  pipeline  memory    fabric/coherency
  stalls    misses    queues / ordering
      │       │        │
      └───────┼────────┘
              ▼
        bounded design change
              │
              ▼
   validation workload + PPA regression

Tradeoff matrix

diagram
TRADEOFF MATRIX — Replacement Policy and Miss Behavior

+----------------------+----------------------+----------------------+----------------------+
| Option               | Helps                | Can hurt             | Validation needed    |
+----------------------+----------------------+----------------------+----------------------+
| Larger / wider block | peak perf, miss rate | area, power, timing  | workload sweep       |
| Smarter policy       | hit rate, QoS, IPC   | verification risk    | corner cases + PMU   |
| More buffering       | latency tails, stalls| deadlock, leakage    | stress traffic tests |
| Software contract    | locality, ordering   | portability, APIs    | production workload  |
+----------------------+----------------------+----------------------+----------------------+

Senior rule: pick the smallest change that proves or disproves the mechanism.

Architecture deep dive

Cache hierarchy trades area and power for AMAT and bandwidth.

Concept diagram

diagram
MEMORY HIERARCHY

Core
 ├─ L1I / L1D  (cycles: 1-4, tiny, latency critical)
 ├─ L2         (cycles: 8-20, private or cluster)
 ├─ LLC / SLC  (shared, bandwidth + coherency point)
 ├─ NoC        (queueing + arbitration)
 └─ DRAM/HBM   (large penalty, high energy)

AMAT = hit_time + miss_rate × miss_penalty
But senior analysis also asks: MLP, bandwidth, QoS, and tail latency.

Metric graph

diagram
MISS PENALTY WATERFALL

L1 hit          ██  3 cyc
L2 hit          ████████  12 cyc
LLC hit         ███████████████  32 cyc
DRAM miss       ████████████████████████████████████  180 cyc

Small MPKI can still dominate if miss penalty is huge.

Metrics and artifacts

  • MPKI per level

  • L2/L3 bandwidth utilization

  • replacement policy stats

  • prefetch accuracy

Mini case study

Doubling L2 size reduces capacity misses but IPC improves only 3% because conflict misses dominate a shared workload. Fix data layout and false sharing before more SRAM.

Debug branches

  • If MPKI high but bandwidth low, footprint may exceed capacity.

  • If bandwidth saturated, coherency or DMA may be the real limit.

Senior review question

Ask: what single metric would prove this concept is working or failing on your workload?

Key takeaways

  • Connect every architecture claim to a workload and measurable metric.

  • State verification and PPA impact before proposing design changes.

Common pitfalls

  • Feature-driven design without MPKI/IPC/bandwidth evidence.

  • Ignoring coherency and NoC traffic in cache and accelerator sizing.

Study notes

Re-read this topic with one concrete workload.