mem-cache: Optimize strided prefetcher address generation
This commit optimizes the address generation logic in the strided prefetcher by introducing the following changes (d is the degree of the prefetcher) * Evaluate the fixed prefetch_stride only once (and not d-times) * Replace 2d multiplications (d * prefetch_stride and distance * prefetch_stride) with additions by updating the new base prefetch address while looping Change-Id: I3ec0c642bc9ec7635b0d38308797e99b645304bb Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
committed by
Richard Cooper
parent
a5fece3b91
commit
1d5be8d9e5
18
src/mem/cache/prefetch/stride.cc
vendored
18
src/mem/cache/prefetch/stride.cc
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Inria
|
||||
* Copyright (c) 2012-2013, 2015, 2022 Arm Limited
|
||||
* Copyright (c) 2012-2013, 2015, 2022-2023 Arm Limited
|
||||
* All rights reserved
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
@@ -169,16 +169,16 @@ Stride::calculatePrefetch(const PrefetchInfo &pfi,
|
||||
return;
|
||||
}
|
||||
|
||||
// Round strides up to atleast 1 cacheline
|
||||
int prefetch_stride = new_stride;
|
||||
if (abs(new_stride) < blkSize) {
|
||||
prefetch_stride = (new_stride < 0) ? -blkSize : blkSize;
|
||||
}
|
||||
|
||||
Addr new_addr = pf_addr + distance * prefetch_stride;
|
||||
// Generate up to degree prefetches
|
||||
for (int d = 1; d <= degree; d++) {
|
||||
// Round strides up to atleast 1 cacheline
|
||||
int prefetch_stride = new_stride;
|
||||
if (abs(new_stride) < blkSize) {
|
||||
prefetch_stride = (new_stride < 0) ? -blkSize : blkSize;
|
||||
}
|
||||
|
||||
Addr new_addr = pf_addr + distance * prefetch_stride
|
||||
+ d * prefetch_stride;
|
||||
new_addr += prefetch_stride;
|
||||
addresses.push_back(AddrPriority(new_addr, 0));
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user