cd ../work
Completed

TUM Computer Systems Lab · WS 2025/26 · 10 ECTS · grade 1.7

Timeliness Rewards for an RL Prefetcher

A systems lab project that extended Pythia, a CPU cache prefetcher that learns with reinforcement learning, with cycle-level timing rewards, and measured whether they helped.

Question
Does telling a learning CPU prefetcher how early or late each prefetch arrived help it learn better?

role
Team of four. Reward-logic fixes and report
stack
C++, ChampSim, Python
updated

The problem

A prefetcher loads data into the CPU cache before the program asks for it, which hides slow memory. Pythia (MICRO 2021) learns what to prefetch with online reinforcement learning: every prefetch earns a reward, and the reward teaches the agent which choices are good.

For a correct prefetch, Pythia only knows “arrived in time” or “arrived late”. A prefetch that was barely late earns the same reward as one that was far too late. Our question was whether a finer timing signal would teach the agent better.

What we built

Working in the ChampSim simulator, we first ran Pythia’s published baseline, then changed how it scores correct prefetches.

  1. 1 · actThe agent picks an address offset and issues a prefetch
  2. 2 · first eventCache fill or demand access, whichever comes first, stores the cycle count
  3. 3 · second eventThe other event computes the distance in cycles
  4. 4 · rewardScaled by how close the distance is to a target lead time
The extension: one timestamp per tracked prefetch adds timing to the binary "filled in time" flag, so the reward can say how early or late a correct prefetch was.

A configurable target lead time and scaling factor shape the reward, and a small bias moves the reward peak a few cycles earlier as a safety margin, so the agent does not drift towards prefetches that are just slightly late.

My part: I fixed how the timestamp rewards were assigned and how the new tuning parameters were read from the configuration, and I wrote parts of the report.

What we found

  • No speedup. We swept reward settings on a subset of Ligra and PARSEC traces, then ran the best setting on the 150 traces of the original paper (SPEC CPU 2006 and 2017, PARSEC, Ligra, CloudSuite). It roughly matched Pythia, sometimes slightly worse, and never beat it.
  • More storage for nothing. The timestamps add 256 × 8 bytes of tracking state, so at equal speed the extension is the worse design.
  • Why. In the run we logged in detail, the timing-shaped reward applied to fewer than 15% of prefetches. Most correct prefetches were not filled into the cache before their tracking entries were evicted, so their reward stayed constant and the timing information never reached the agent.
  • The mechanism worked. Logged rewards followed the cycle distance exactly as designed, so the null result does not come from a bug in the reward computation.

A negative result, reported as one: the extension did what it was built to do, and the measurement showed why that could not help without larger changes to how Pythia tracks prefetches.

Limits

  • No complete grid search of the reward settings, so a slightly better combination may exist; the low share of timing-shaped rewards limits how much it could gain.
  • The detailed reward analysis covers one logged run; other traces may behave differently.
  • Single-core simulation in ChampSim, not hardware.