Cache prefetching: Difference between revisions

Content deleted Content added
Methods of hardware prefetching: Sentence case in section headings.
Fix cite date error
Line 21:
[[File:CachePrefetching_StreamBuffers.png|center|<ref name=":1"/> A typical stream buffer setup as originally proposed by Norman Jouppi in 1990|alt=A typical stream buffer setup as originally proposed|thumb|400x400px]]
* Whenever the prefetch mechanism detects a miss on a memory block, say A, it allocates a stream to begin prefetching successive blocks from the missed block onward. If the stream buffer can hold 4 blocks, then we would prefetch A+1, A+2, A+3, A+4 and hold those in the allocated stream buffer. If the processor consumes A+1 next, then it shall be moved "up" from the stream buffer to the processor's cache. The first entry of the stream buffer would now be A+2 and so on. This pattern of prefetching successive blocks is called '''Sequential Prefetching'''. It is mainly used when contiguous locations are to be prefetched. For example, it is used when prefetching instructions.
* This mechanism can be scaled up by adding multiple such 'stream buffers' - each of which would maintain a separate prefetch stream.<ref>{{Cite journal |last=Ishii |first=Yasuo |last2=Inaba |first2=Mary |last3=Hiraki |first3=Kei |date=2009-06-08 |title=Access map pattern matching for data cache prefetch |url=https://doi.org/10.1145/1542275.1542349 |journal=Proceedings of the 23rd international conference on Supercomputing |series=ICS '09 |___location=New York, NY, USA |publisher=Association for Computing Machinery |pages=499–500 |doi=10.1145/1542275.1542349 |isbn=978-1-60558-498-0}}</ref>. For each new miss, there would be a new stream buffer allocated and it would operate in a similar way as described above.
* The ideal depth of the stream buffer is something that is subject to experimentation against various benchmarks<ref name=":1" /> and depends on the rest of the [[microarchitecture]] involved.<ref>{{Cite journal |last=Srinath |first=Santhosh |last2=Mutlu |first2=Onur |last3=Kim |first3=Hyesoon |last4=Patt |first4=Yale N. |date=February 2007-02 |title=Feedback Directed Prefetching: Improving the Performance and Bandwidth-Efficiency of Hardware Prefetchers |url=https://ieeexplore.ieee.org/document/4147648 |journal=2007 IEEE 13th International Symposium on High Performance Computer Architecture |pages=63–74 |doi=10.1109/HPCA.2007.346185}}</ref>.
 
=== Strided prefetching ===
This type of prefetching monitors the delta between the addresses of the memory accesses and looks for patterns within it.
 
==== Regular strides ====
In this pattern, consecutive memory accesses are made to blocks that are <math>s</math> addresses apart.<ref name=":2" /><ref>{{Cite journal |last=Kondguli |first=Sushant |last2=Huang |first2=Michael |date=November 2017 |title=T2: A Highly Accurate and Energy Efficient Stride Prefetcher |url=https://ieeexplore.ieee.org/document/8119237 |journal=2017 IEEE International Conference on Computer Design (ICCD) |pages=373–376 |doi=10.1109/ICCD.2017.64}}</ref> In this case, the prefetcher calculates the <math>s</math> and uses it to compute the memory address for prefetching. Eg: If the <math>s</math> is 4, the address to be prefetched would A+4.
 
==== Irregular strides ====
In this case, the delta between the addresses of consecutive memory accesses is variable but still follows a pattern. Some prefetchers designs<ref>{{Citation |last=Grannaes |first=Marius |title=Storage Efficient Hardware Prefetching using Delta-Correlating Prediction Tables |url=https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.229.3483 |access-date=2022-03-16 |last2=Jahre |first2=Magnus |last3=Natvig |first3=Lasse}}</ref><ref>{{Cite journal |last=Shevgoor |first=Manjunath |last2=Koladiya |first2=Sahil |last3=Balasubramonian |first3=Rajeev |last4=Wilkerson |first4=Chris |last5=Pugsley |first5=Seth H |last6=Chishti |first6=Zeshan |date=December 2015-12 |title=Efficiently prefetching complex address patterns |url=https://ieeexplore.ieee.org/document/7856594 |journal=2015 48th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO) |pages=141–152 |doi=10.1145/2830772.2830793}}</ref><ref>{{Cite journal |last=Kim |first=Jinchun |last2=Pugsley |first2=Seth H. |last3=Gratz |first3=Paul V. |last4=Reddy |first4=A.L. Narasimha |last5=Wilkerson |first5=Chris |last6=Chishti |first6=Zeshan |date=October 2016-10 |title=Path confidence based lookahead prefetching |url=https://ieeexplore.ieee.org/document/7783763 |journal=2016 49th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO) |pages=1–12 |doi=10.1109/MICRO.2016.7783763}}</ref> exploit this property to predict and prefetch for future accesses.
 
=== Temporal prefetching ===
This class of prefetchers look for memory access streams that repeat over time.<ref>{{Cite journal |last=Joseph |first=Doug |last2=Grunwald |first2=Dirk |date=1997-05-01 |title=Prefetching using Markov predictors |url=https://doi.org/10.1145/264107.264207 |journal=Proceedings of the 24th annual international symposium on Computer architecture |series=ISCA '97 |___location=New York, NY, USA |publisher=Association for Computing Machinery |pages=252–263 |doi=10.1145/264107.264207 |isbn=978-0-89791-901-2}}</ref><ref>{{Cite journal |last=Collins |first=J. |last2=Sair |first2=S. |last3=Calder |first3=B. |last4=Tullsen |first4=D.M. |date=November 2002-11 |title=Pointer cache assisted prefetching |url=https://ieeexplore.ieee.org/abstract/document/1176239?casa_token=upVmgMfy6mkAAAAA:SdJqjEeVmXED1yvQV_26Cp2gGHNcUNXHqpmodWWWapYvYLandAIY2DxTiMKRF-sP7OJVP6qtwKc |journal=35th Annual IEEE/ACM International Symposium on Microarchitecture, 2002. (MICRO-35). Proceedings. |pages=62–73 |doi=10.1109/MICRO.2002.1176239}}</ref>. Eg. In this stream of memory accesses: N, A, B, C, E, G, H, A, B, C, I, J, K, A, B, C, L, M, N, O, A, B, C, ....; the stream A,B,C is repeating over time. Other design variation have tried to provide more efficient, performant implementations.<ref>{{Cite journal |last=Jain |first=Akanksha |last2=Lin |first2=Calvin |date=2013-12-07 |title=Linearizing irregular memory accesses for improved correlated prefetching |url=https://doi.org/10.1145/2540708.2540730 |journal=Proceedings of the 46th Annual IEEE/ACM International Symposium on Microarchitecture |series=MICRO-46 |___location=New York, NY, USA |publisher=Association for Computing Machinery |pages=247–259 |doi=10.1145/2540708.2540730 |isbn=978-1-4503-2638-4}}</ref><ref>{{Cite web |title=Making Temporal Prefetchers Practical: The MISB Prefetcher - Research Articles - Arm Research - Arm Community |url=https://community.arm.com/arm-research/b/articles/posts/making-temporal-prefetchers-practical--the-misb-prefetcher |access-date=2022-03-16 |website=community.arm.com |language=en}}</ref>.
 
=== Collaborative prefetching ===
Computer applications generate a variety of access patterns. The processor and memory subsystem architectures used to execute these applications further disambiguate the memory access patterns they generate. Hence, the effectiveness and efficiency of prefetching schemes often depend the application and the architectures used to execute them.<ref>{{Cite journal |last=Kim |first=Jinchun |last2=Teran |first2=Elvira |last3=Gratz |first3=Paul V. |last4=Jiménez |first4=Daniel A. |last5=Pugsley |first5=Seth H. |last6=Wilkerson |first6=Chris |date=2017-05-12 |title=Kill the Program Counter: Reconstructing Program Behavior in the Processor Cache Hierarchy |url=https://dl.acm.org/doi/10.1145/3093336.3037701 |journal=ACM SIGPLAN Notices |language=en |volume=52 |issue=4 |pages=737–749 |doi=10.1145/3093336.3037701 |issn=0362-1340}}</ref>. Recent research<ref>{{Cite journal |last=Kondguli |first=Sushant |last2=Huang |first2=Michael |date=2018-06-02 |title=Division of labor: a more effective approach to prefetching |url=https://doi.org/10.1109/ISCA.2018.00018 |journal=Proceedings of the 45th Annual International Symposium on Computer Architecture |series=ISCA '18 |___location=Los Angeles, California |publisher=IEEE Press |pages=83–95 |doi=10.1109/ISCA.2018.00018 |isbn=978-1-5386-5984-7}}</ref><ref>{{Cite journal |last=Pakalapati |first=Samuel |last2=Panda |first2=Biswabandan |date=May 2020-05 |title=Bouquet of Instruction Pointers: Instruction Pointer Classifier-based Spatial Hardware Prefetching |url=https://ieeexplore.ieee.org/document/9138971 |journal=2020 ACM/IEEE 47th Annual International Symposium on Computer Architecture (ISCA) |pages=118–131 |doi=10.1109/ISCA45697.2020.00021}}</ref> has focussed on building collaborative mechanisms to synergistically use multiple prefetching schemes for better prefetching coverage and accuracy.
 
== Methods of software prefetching ==