Data Prefetcher: Cross Cache Hierarchy
预取跨 Cache 层级决策
| Title | Year | From | URL |
|---|---|---|---|
| Puppeteer: A Random Forest-based Manager for Hardware Prefetchers Across the Memory Hierarchy | 2022 | ACM TACO | https://doi.org/10.1145/3570304 |
| Reducing Load Latency with Cache Level Prediction | 2022 | HPCA | https://doi.org/10.1109/HPCA53966.2022.00054 |
| Title | Filing year | Inc. | Number | URL |
|---|---|---|---|---|
| Cache prefetching of L2 and L3 | 1999 | IBM | US6446167B1 | https://patents.google.com/patent/US6446167B1/en |
| Victim cache prefetching | 2008 | IBM | US8209489B2 | https://patents.google.com/patent/US8209489B2/en |
| US8281078B2 - Multi-level cache prefetch | 2009 | Intel | https://patents.google.com/patent/US8281078B2/en | |
| Using cache hit information to manage prefetches | 2012 | NVIDIA | US9262328B2 | https://patents.google.com/patent/US9262328B2/en |
| Coordinated prefetching based on training in hierarchically cached processors | 2012 | Apple | US9098418B2 | https://patents.google.com/patent/US9098418B2/en |
| Unified prefetch circuit for multi-level caches | 2016 | Apple | US10621100B1 | https://patents.google.com/patent/US10621100B1/en |
| Prefetch mechanism for servicing demand miss | 2016 | Qualcomm | US9934149B2 | https://patents.google.com/patent/US9934149B2/en |
| Prefetching in a lower level exclusive cache hierarchy | 2019 | Samsung | US10963388B2 | https://patents.google.com/patent/US10963388B2/en |
| Secondary prefetch circuit that reports coverage to a primary prefetch circuit to limit prefetching by primary prefetch circuit | 2020 | Apple | US11176045B2 | https://patents.google.com/patent/US11176045B2/en |
| Prefetch unit filter for microprocessor | 2022 | IBM | US11947461B2 | https://patents.google.com/patent/US11947461B2/en |
| Prefetcher with multi-cache level prefetches and feedback architecture | 2022 | SiFive | WO2023287512A1 | https://patents.google.com/patent/WO2023287512A1/en |
| Technique for handling prefetching using trigger circuitry | 2023 | Arm | US12541457B2 | https://patents.google.com/patent/US12541457B2/en |
Puppeteer (Eris et al., ACM TACO 2022)
- 背景:现代 memory hierarchy 中可能同时存在多个 hardware prefetcher,人工规则很难覆盖组合状态。
- 核心 insight:可用 random forest 根据运行时特征管理跨层 prefetcher 的 enable/disable 和 aggressiveness。
- 设计:把 prefetcher management 作为 supervised ML 分类/决策问题。
- 价值:面向“across the memory hierarchy”的多预取器管理,适合与 L1/L2/LLC 协同讨论
Reducing Load Latency with Cache Level Prediction
- 背景:即使有 aggressive prefetcher,仍有许多 load 暴露在逐级 lookup latency 中。
- 核心 insight:对于 L1 miss,应预测请求会命中 L2、LLC 还是 memory,从而绕过低价值 lookup 或并行访问。
- 核心设计:LocMap metadata cache 记录 block location,metadata miss 时用 Popular Level Detector 做历史预测;失误由 directory/return-path logic 修正。
- 实验结论:HPCA 2022 版本报告在 aggressive prefetcher baseline 上仍有明显 speedup,并降低 hierarchy energy
US6446167B1 - Cache prefetching of L2 and L3 (IBM)
- 背景:IBM 多级 cache 系统中,L1/L2/L3 都可能成为 prefetch target。
- 核心 insight:prefetch request bus 与普通 data transfer bus 分离,可让 prefetch engine 直接向 L2/L3 发请求,降低与 demand data path 的冲突。
- 核心设计:processor 内 prefetch engine 为 L1/L2/L3 生成 prefetch,L2/L3 prefetch 通过 private prefetch request bus 传递,并可通知 L3 也执行 prefetch。
- 相关性:非常直接的跨 cache 层级 prefetch 专利,是早期 L2/L3 coordinated prefetching 的工业例子。
US8209489B2 - Victim cache prefetching (IBM)
- 背景:L2/L3 victim cache/exclusive-ish hierarchy 中,prefetch request miss 后若都由 upper-level state machine 追踪,会增加上层资源压力。
- 核心 insight:lower-level victim cache 可为 upper-level cache miss 的 prefetch 分配 prefetch machine,由低层负责继续向其他 processing unit/system 发请求并安装数据。
- 核心设计:processor core 的 prefetch request 若 miss in upper-level cache,lower-level victim cache 检查 directory;若也 miss,则在 lower-level victim cache 分配 state machine 处理该 prefetch。部分 claim 还描述 leading/trailing prefetch:leading 可只安装到 lower-level victim cache,trailing 再把目标 block 提供给 upper-level cache。
- 相关性:直接覆盖 lower-level cache 代管 prefetch request、降低 upper-level miss-handling resource 的工业策略。
US9262328B2 - Using cache hit information to manage prefetches (NVIDIA)
- 背景:prefetch distance 若只随 pattern confidence 增长,很容易超过实际需要,导致 bandwidth waste 和 L2 cache pollution;但过小又无法及时隐藏 L1 miss 后的 L2 latency。
- 核心 insight:L1 miss 之后访问 L2 是否命中,是判断 L2 prefetch distance 已经足够的直接反馈信号。
- 核心设计:prefetcher 向 second cache/L2 预取 cache lines,并接收 feedback:由 first cache/L1 miss 触发的 access request 是否在 second cache/L2 hit。若已经 hit,可 cap 当前 L2 prefetch distance;也可允许继续增加一个 margin 后再 cap。
- 相关性:它是“cache hit information -> prefetch distance control”的工业版本,和 Cache Level Prediction 不重复:这里不是预测命中层级来跳查找,而是用跨层级 hit/miss 反馈调节下一轮 L2 prefetch aggressiveness。
US8281078B2 - Multi-level cache prefetch (Intel)
- 背景:预取请求若一律把数据拉到较小/较快 cache,会污染上层 cache 并占用 request queue;若只放到低层 cache,又可能降低 timely benefit。
- 核心 insight:prefetch request 可以携带 data parking bits,根据 request queue 状态和预取距离,把数据停放在 L1 或 L2/MLC/LLC 等不同层级。
- 核心设计:data parking logic 根据 prefetch engine status、request queue occupancy、demand-to-prefetch distance 等生成 cache-level indicia;远距离/更 speculative 的预取可只停在较大较慢 cache,并提前释放上层 request queue entry。
- 相关性:这是非常直接的工业 “prefetch target cache level / data parking” 方案,可补充 Apple unified/coordinated prefetch 专利。
US9098418B2 - Coordinated prefetching based on training in hierarchically cached processors
- 背景:多级 cache 各自训练 stream 会重复、滞后或使用不一致的 stream 信息。
- 核心 insight:上层/core 侧统一训练 stream,再把 stream ID 和训练信息打包下发给 L2/L3 prefetch units。
- 核心设计:prefetch request 携带 packet,包含 stream ID、stride/page/temporal 等训练属性;低层级 cache 根据这些信息继续生成 prefetch。
- 相关性:这是 Apple 多级 prefetcher coordination 的核心专利,和 “L1 learns, L2/L3 act ahead” 思路高度贴合。
US10621100B1 - Unified prefetch circuit for multi-level caches (Apple)
- 背景:各 cache level 独立 AMPM/pattern prefetch 会降低 observability 和 controllability。
- 核心 insight:集中式 prefetch circuit 可同时观察访问图、为不同 cache level 生成 prefetch,并分别根据准确性调节。
- 核心设计:AMPM-style unified prefetch circuit 支持不同 cache level 的 prefetch pattern、accuracy control 和 granularity adjustment。
- 相关性:直接面向 multi-level caches 的统一 prefetch generation/fill control。
US9934149B2 - Prefetch mechanism for servicing demand miss (Qualcomm)
- 背景:L1 fill buffer/MSHR 等资源可能在 burst miss 或 context switch 时被占满,传统处理会让新的 L1 demand miss 等待 fill buffer 空出来。
- 核心 insight:当 L1 fill buffer 不可用时,可把 demand miss 转换成 L2 prefetch operation,先把目标 cache line 拉到作为 L1 backing store 的 L2。
- 核心设计:用 prefetch request queue 暂存 miss address,并把请求发给 L2 prefetch mechanism;当 L1 fill buffer 后续可用,再从 L2 把 cache line 返回并填入 L1。部分 claim 还提到对 L2 中该 line 打 hint,避免在服务 demand miss 前被替换。
- 相关性:这是跨层级“demand miss 临时降级为 lower-level prefetch”的处理机制,重点不是预测地址,而是 L1/L2 fill path 和资源压力下的 prefetch/demand request 转换。
US10963388B2 - Prefetching in a lower level exclusive cache hierarchy
- 背景:exclusive hierarchy 中低层级 prefetch 可能请求已存在于上层 cache 的数据。
- 核心 insight:lower-level prefetcher 可发 speculative prefetch,但 memory interconnect/directory 应在发现上层已有数据时取消请求。
- 核心设计:L3/lower-tier prefetcher 向 memory interconnect 发请求;interconnect 检查 upper cache tier,命中则 cancel speculative request。
- 相关性:这是 lower-level prefetch 与 upper-level presence/directory 交互的典型工业策略。
US11176045B2 - Secondary prefetch circuit reports coverage to primary prefetch circuit
- 背景:同一 demand access 可能触发 primary 和 secondary prefetch circuits,导致重复/过度 prefetch。
- 核心 insight:secondary prefetcher 一旦达到足够 confidence/coverage,应反向通知 primary prefetcher 限流。
- 核心设计:secondary circuit 向 primary circuit 发送 coverage hint,primary circuit 据此减少该 demand access 触发的 prefetch request 数量。
- 相关性:虽然不一定严格对应 L1/L2/L3,但它提供了多个 prefetch mechanisms 之间 coverage-based coordination 的专利样例。
US11947461B2 - Prefetch unit filter for microprocessor
- 背景:prefetch request 到达 cache 后,需要在继续下行和提前终止之间做选择。
- 核心 insight:以 prefetch stream 的 hit count 作为反馈信号,判断该 stream 的 prefetch request 是否应被终止。
- 核心设计:cache 识别 demand/prefetch request;若为 prefetch,则按对应 stream 的 hit 数决定 terminate 或继续服务。
- 相关性:是较新的工业 prefetch filtering 专利,可作为层级内/层级间抑制无用 prefetch 的补充。
WO2023287512A1 - Multi-cache-level prefetches and feedback (SiFive)
- 背景:低层 cache 有更多 MSHR 和 MLP,L1 MSHR 更稀缺;单一层级 prefetch target 很难同时满足 timeliness 与 resource pressure
- 核心 insight:一个 hardware prefetcher 可同时连接多个 cache level,并接收各层 MSHR feedback,按 trained entry 决定向 L1、L2 或更高层发多少 prefetch
- 核心设计:每个 cache level 提供 MSHR fullness/confirmation/hit-counter 等反馈;prefetcher 可在 L1 MSHR 不足时发 L2 prefetch,或把 prefetch on-the-fly 转为另一层级;issue queue 可为不同 cache level 保留 slot
- 描述的是 multi-cache-level prefetch + feedback architecture,更强调 MSHR/resource feedback
US12541457B2 - Trigger circuitry for higher-level prefetch (Arm)
- 背景:较低层 cache 往往能容纳更复杂的 prefetch circuitry,可能比 L1 prefetcher 更可靠地预测某些数据;但数据只停在 L2 时,性能收益不如提前晋升到 L1。
- 核心 insight:当 lower-level cache 处理的 prefetch request 满足指定条件时,trigger circuitry 向 higher-level cache/control circuitry 发 prefetch trigger signal,使 higher-level cache 从 lower-level cache 取回这条 prefetched data。
- 核心设计:以 L2 prefetch circuitry/L2 data cache 和 L1 data cache 为示例,L2 对满足 accuracy/queue/timing 条件的 prefetch 设置 trigger active 状态,并触发 L1 linefill/prefetch;同时可把 L1 使用信息反馈给 L2 prefetch circuitry,避免 L2 因数据被 L1 命中而失去 usefulness/training 信息。
XiangShan 跨层预取策略 (Kunminghu)
XiangShan Kunminghu RTL
- L1 发送 hint 到 L2/L3
- SMS: 触发 AGT 后直接发送 L2 hint
- Stream: Active Region 命中则发送 L2/L3 hint
- Stride: 检测到稳定时发送 L2 hint
- Berti: 只发送 L2 Hint
- L2/L3 通过 PrefetchReceiver 接受 hint ,并将本级的 hint 转发到本级的 Prefetch Queue
- L1 hint 发送到 L2/L3 时会经过一个 Filter: 确认是否完成地址翻译、PMP、过滤地址重复等等
- L1 通过 FDP 反馈调节 prefetcher degree
L1 Stride Prefetcher Distance:
| 目标 | sink | 距离 | 说明 |
|---|---|---|---|
| L1 | SINK_L1 |
stride << l1_stride_ratio,默认 stride * 4 |
近距离 |
| L2 | SINK_L2 |
stride << l2_stride_ratio,默认 stride * 32 |
远距离 pf-ahead |
L1 Stream Prefetcher Distance:
| 目标 | sink | 默认距离 | 默认宽度 | 是否跨层有效 |
|---|---|---|---|---|
| L1 | SINK_L1 |
64 个 cache block | 2 line | 进入 L1 DCache |
| L2 | SINK_L2 |
640 个 cache block | 4 line | 通过 l1_pf_to_l2 发给 L2 |
| L3 | SINK_L3 |
640 个 cache block | 8 line | enableL3StreamPrefetch 默认 false,且当前未导出到 LLC |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.