From d6974ef636f7243ed9fdead9e737b43a1204b1f8 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 14 Sep 2021 18:21:00 -0700 Subject: [PATCH] mem: Add a page_bytes parameter to the classic prefetcher. This parameter is used to figure out if two addresses are on the same or different pages, and could be used to find what page they were on and the page offset, although it doesn't look like the later two are actually used. This value could possibly come from the TLB parameter attached to the prefetcher, but making it explicit makes these more symmetric with the Ruby prefetcher, and reduces the complexity of the TLB implementation. Change-Id: I6921943c49af19971b84225ecfd1127304363426 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50352 Tested-by: kokoro Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/mem/cache/prefetch/Prefetcher.py | 2 ++ src/mem/cache/prefetch/base.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mem/cache/prefetch/Prefetcher.py b/src/mem/cache/prefetch/Prefetcher.py index 5346937a95..62b5841f44 100644 --- a/src/mem/cache/prefetch/Prefetcher.py +++ b/src/mem/cache/prefetch/Prefetcher.py @@ -81,6 +81,8 @@ class BasePrefetcher(ClockedObject): "Notify the hardware prefetcher on hit on prefetched lines") use_virtual_addresses = Param.Bool(False, "Use virtual addresses for prefetching") + page_bytes = Param.MemorySize('4KiB', + "Size of pages for virtual addresses") def __init__(self, **kwargs): super(BasePrefetcher, self).__init__(**kwargs) diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc index 06d2b91050..cb4c1e8118 100644 --- a/src/mem/cache/prefetch/base.cc +++ b/src/mem/cache/prefetch/base.cc @@ -98,7 +98,7 @@ Base::Base(const BasePrefetcherParams &p) lBlkSize(floorLog2(blkSize)), onMiss(p.on_miss), onRead(p.on_read), onWrite(p.on_write), onData(p.on_data), onInst(p.on_inst), requestorId(p.sys->getRequestorId(this)), - pageBytes(p.sys->getPageBytes()), + pageBytes(p.page_bytes), prefetchOnAccess(p.prefetch_on_access), prefetchOnPfHit(p.prefetch_on_pf_hit), useVirtualAddresses(p.use_virtual_addresses),