Seyed Masoud Hosseini · Overview · Study log · Ideas · Transcript · RSS feed
Digital Design & Computer Architecture · Lecture 31 of 37 · 1:53:02
Lecture 25: Prefetching II and Parting Thoughts
Study guide
What this lecture covers
This is the final lecture of the course. It continues the prefetching material from the previous lecture with two concrete designs: a reinforcement-learning-based hardware prefetcher called Pythia, and run-ahead execution, a technique the lecturer co-invented during his PhD. It then closes with an epilogue reflecting on the whole course rather than new technical material; processing-in-memory, despite appearing in the video's title, is not actually covered due to time.
After watching, you should be able to explain how a prefetcher can be framed as a reinforcement-learning problem, describe what run-ahead execution does when a cache miss reaches the head of the instruction window, and explain why both techniques trade some extra work for tolerance of long memory latencies.
Key ideas
- Reinforcement learning: an agent observes a state, takes an action, and receives a reward; over many interactions it learns which action maximizes reward in each state.
- Pythia: a prefetcher that treats prefetching as a reinforcement-learning problem, where the state is derived from features like the program counter and recent address deltas, the action is a prefetch offset, and the reward reflects accuracy, timeliness, and memory bandwidth usage.
- Q-learning: the specific reinforcement-learning method Pythia uses, storing a table of quality (Q) values for state-action pairs and picking the action with the highest value.
- Memory bandwidth as a first-order constraint: an accurate prefetch can still hurt performance if it is issued when the memory system is already bandwidth-constrained.
- Run-ahead execution: when the oldest instruction in an out-of-order processor is a long-latency cache miss, checkpoint the register state, keep speculatively executing (dropping instructions that depend on the miss), and use the resulting loads purely to generate accurate prefetches.
- Precise checkpoint and restore: run-ahead mode ends by restoring the checkpointed state and re-executing normally, so nothing speculative is ever kept as an architectural result.
- Instruction window size versus run-ahead: run-ahead recovers much of the memory-level parallelism of a much larger instruction window without the hardware cost of actually building one.
Walkthrough
Reinforcement learning for prefetching: Pythia (10:55)
The lecture introduces reinforcement learning with the analogy of touching a hot stove: an agent takes actions in a given state and receives rewards or punishments, and over time learns which action to take in which state. Prefetching is then reframed in these terms: the prefetcher is the agent, the processor and memory subsystem are the environment, the state is built from features of a memory request, and the action is a prefetch offset relative to the requesting address. Unlike earlier prefetchers where a human designer fixes the policy directly, here the designer only chooses which features and actions to consider; the policy itself is learned online from Q-values.
Configuring Pythia: state, action, and reward (19:00)
Building a practical version requires narrowing an unbounded design space. State ends up using two features: the program counter combined with the last delta seen at that instruction, and the sequence of the last four address deltas. Action is limited to a pruned set of 16 candidate prefetch offsets within the same physical page, including a zero offset that means "don't prefetch." Reward combines usefulness (accuracy, lateness, whether the prefetch stayed within the page) with system feedback, mainly memory bandwidth usage, so that an accurate but badly timed prefetch under high bandwidth pressure gets a strongly negative reward.
Results: Pythia versus heuristic prefetchers (31:06)
Across many workloads and core counts, Pythia outperforms prior heuristic-based prefetchers, and its advantage grows with core count. Tested across a range of available memory bandwidth, some heuristic prefetchers actually lose performance under tight bandwidth (one example loses about 20% on average), while Pythia adapts and avoids that regression, though the lecture notes there is still room to improve it further.
Prefetching challenges in real, multi-core systems (36:11)
Real processors combine multiple hardware prefetchers to cover different access patterns, which improves coverage but adds complexity: prefetchers can interfere with each other and with demand requests, and in multi-core systems they compete for shared cache space and memory bandwidth. Prefetching shared data raises coherence questions, and GPUs, with many cores and heavy bandwidth demand, generally avoid prefetching, though the lecturer's own work shows it can still help under the right conditions. Real designs also need throttling heuristics to make a prefetcher less aggressive or turn it off when it isn't helping.
Run-ahead execution: turning cache-miss stalls into prefetches (42:13)
The motivation is the same problem tackled by large instruction windows: a long-latency cache miss at the head of the window stalls the whole processor because no new instructions can be fetched, even though a larger window would let independent, younger instructions keep executing. Building a much bigger window is expensive in power, cycle time, and design complexity. Run-ahead execution instead checkpoints the architectural state when the oldest instruction is a long-latency miss, then keeps speculatively executing without stalling, marking any instruction that depends on the miss as invalid and dropping it. This makes room for later independent loads, which generate their own early, highly accurate prefetches; when the original miss finally returns, the checkpoint is restored and normal execution resumes with the needed data already in the cache.
Run-ahead in real processors, and its limits (1:06:12)
In simulation, combining run-ahead with a good prefetcher improved performance by about 22% over prefetching alone across roughly 147 workloads, and run-ahead on a 128-entry window approached the performance of a much larger 384-entry window without building one. Sun Microsystems later implemented the idea (calling it "scouting") in the Rock processor, and Nvidia's Denver processor used a version of it as well; the lecture frames this as a case where a simpler mechanism beat a "build ever-bigger structures" trend that dominated the field at the time. Run-ahead has real limits: it depends on branch prediction accuracy, it struggles with pointer-chasing code where one cache miss's address depends on the data from a prior miss, and it burns extra energy on instructions that are ultimately discarded, which motivated later "efficient run-ahead" work to detect when it isn't paying off.
Parting thoughts: trade-offs, critical thinking, and what's next (1:30:27)
The lecture closes without new technical content, instead reviewing the course as a whole: the transistor-to-virtual-memory arc, and the recurring theme that ideas need to be evaluated by their trade-offs in context rather than judged as universally good or bad. The lecturer argues that the deeper goal of the course was training critical thinking and trade-off analysis, not memorizing facts, and that many of the ideas covered (out-of-order execution, VLIW, GPUs) faced skepticism before becoming standard practice. He previews unfinished territory, particularly processing-in-memory, and closes with general advice on pursuing ideas that others doubt.
Before you watch
- Watch the earlier prefetching lecture in this course, since this one continues directly from concepts like prefetcher accuracy, timeliness, and coverage introduced there.
- Review the out-of-order execution and precise-exception lectures; run-ahead execution's checkpoint-and-restore mechanism builds directly on those ideas.
- A rough sense of reinforcement learning (states, actions, rewards) helps, though the lecture explains the basics from scratch.
Check your understanding
- In Pythia's design, what problem does including memory bandwidth usage in the reward function solve that a purely accuracy-based reward would not?
- Why does a prefetcher based on Q-learning behave differently from earlier prefetchers where a human designer directly sets the policy?
- Explain, in order, what happens to a processor's state from the moment a long-latency cache miss reaches the head of the instruction window until run-ahead mode ends.
- Why does run-ahead execution struggle with pointer-chasing code, and what would need to be true for a value predictor to fix that?
- What does the lecturer mean by saying ideas should be judged by their trade-offs "in context" rather than declared simply good or bad?
From the YouTube description
Digital Design and Computer Architecture, ETH Zürich, Spring 2025 (https://safari.ethz.ch/ddca/spring2025/)
Lecture 25: Prefetching II, Processing-in-Memory, and Parting Thoughts
Lecturer: Prof. Onur Mutlu
Date: 30 May 2025
Lecture 25 Slides (pptx): https://safari.ethz.ch/ddca/spring2025/lib/exe/fetch.php?media=onur-ddca-2025-lecture25a-prefetching-ii-beforelecture.pptx
Lecture 25 Slides (pdf): https://safari.ethz.ch/ddca/spring2025/lib/exe/fetch.php?media=onur-ddca-2025-lecture25a-prefetching-ii-beforelecture.pdf
Recommended Reading:
====================
Intelligent Architectures for Intelligent Computing Systems
https://people.inf.ethz.ch/omutlu/pub/intelligent-architectures-for-intelligent-computingsystems-invited_paper_DATE21.pdf
A Modern Primer on Processing in Memory
https://people.inf.ethz.ch/omutlu/pub/ModernPrimerOnPIM_springer-emerging-computing-bookchapter21.pdf
RowHammer: A Retrospective
https://people.inf.ethz.ch/omutlu/pub/RowHammer-Retrospective_ieee_tcad19.pdf
RECOMMENDED LECTURE VIDEOS & PLAYLISTS:
========================================
Computer Architecture Fall 2021 Lectures Playlist:
https://www.youtube.com/watch?v=4yfkM_5EFgo&list=PL5Q2soXY2Zi-Mnk1PxjEIG32HAGILkTOF
Computer Architecture Fall 2022 Lectures Playlist:
https://www.youtube.com/watch?v=BIpPTqHK-Lc&list=PL5Q2soXY2Zi-cAls3cyauNzM7-74Eq31O
Digital Design and Computer Architecture Spring 2022 Livestream Lectures Playlist:
https://www.youtube.com/watch?v=cpXdE3HwvK0&list=PL5Q2soXY2Zi97Ya5DEUpMpO2bbAoaG7c6
Digital Design and Computer Architecture Spring 2021 Livestream Lectures Playlist:
https://www.youtube.com/watch?v=LbC0EZY8yw4&list=PL5Q2soXY2Zi_uej3aY39YB5pfW4SJ7LlN
Featured Lectures:
https://www.youtube.com/watch?v=jVYCchBGNVc&list=PL5Q2soXY2Zi8VrmOTz44l2WupethSdh-M&index=1
Interview with Professor Onur Mutlu:
https://www.youtube.com/watch?v=8ffSEKZhmvo&list=PL5Q2soXY2Zi8VrmOTz44l2WupethSdh-M&index=9
The Story of RowHammer Lecture:
https://www.youtube.com/watch?v=sgd7PHQQ1AI&list=PL5Q2soXY2Zi8D_5MGV6EnXEJHnV2YFBJl&index=39
Accelerating Genome Analysis Lecture:
https://www.youtube.com/watch?v=r7sn41lH-4A&list=PL5Q2soXY2Zi8D_5MGV6EnXEJHnV2YFBJl&index=41
Memory-Centric Computing Systems Tutorial at IEDM 2021:
https://www.youtube.com/watch?v=H3sEaINPBOE&list=PL5Q2soXY2Zi8D_5MGV6EnXEJHnV2YFBJl&index=35
Intelligent Architectures for Intelligent Machines Lecture:
https://www.youtube.com/watch?v=GTieZPY4Wmc&list=PL5Q2soXY2Zi8D_5MGV6EnXEJHnV2YFBJl&index=38
Computer Architecture Fall 2020 Lectures Playlist:
https://www.youtube.com/watch?v=c3mPdZA-Fmc&list=PL5Q2soXY2Zi9xidyIgBxUz7xRPS-wisBN
Digital Design and Computer Architecture Spring 2020 Lectures Playlist:
https://www.youtube.com/watch?v=AJBmIaUneB0&list=PL5Q2soXY2Zi_FRrloMa2fUYWPGiZUBQo2
Public Lectures by Onur Mutlu, Playlist:
https://www.youtube.com/watch?v=kgiZlSOcGFM&list=PL5Q2soXY2Zi8D_5MGV6EnXEJHnV2YFBJl
Computer Architecture at Carnegie Mellon Spring 2015 Lectures Playlist:
https://www.youtube.com/watch?v=zLP_X4wyHbY&list=PL5PHm2jkkXmi5CxxI7b3JCL1TWybTDtKq
Rethinking Memory System Design Lecture @stanfordonline :
https://www.youtube.com/watch?v=F7xZLNMIY1E&list=PL5Q2soXY2Zi8D_5MGV6EnXEJHnV2YFBJl&index=4
← Lecture 24: Virtual Memory · Lecture 26: Problem Solving I →
