queued.cc (14013:aeb3ca1762bb) | queued.cc (14015:e709cec78417) |
---|---|
1/* 2 * Copyright (c) 2014-2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 82 unchanged lines hidden (view full) --- 91} 92 93QueuedPrefetcher::QueuedPrefetcher(const QueuedPrefetcherParams *p) 94 : BasePrefetcher(p), queueSize(p->queue_size), 95 missingTranslationQueueSize( 96 p->max_prefetch_requests_with_pending_translation), 97 latency(p->latency), queueSquash(p->queue_squash), 98 queueFilter(p->queue_filter), cacheSnoop(p->cache_snoop), | 1/* 2 * Copyright (c) 2014-2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 82 unchanged lines hidden (view full) --- 91} 92 93QueuedPrefetcher::QueuedPrefetcher(const QueuedPrefetcherParams *p) 94 : BasePrefetcher(p), queueSize(p->queue_size), 95 missingTranslationQueueSize( 96 p->max_prefetch_requests_with_pending_translation), 97 latency(p->latency), queueSquash(p->queue_squash), 98 queueFilter(p->queue_filter), cacheSnoop(p->cache_snoop), |
99 tagPrefetch(p->tag_prefetch) | 99 tagPrefetch(p->tag_prefetch), 100 throttleControlPct(p->throttle_control_percentage) |
100{ 101} 102 103QueuedPrefetcher::~QueuedPrefetcher() 104{ 105 // Delete the queued prefetch packets 106 for (DeferredPacket &p : pfq) { 107 delete p.pkt; 108 } 109} 110 | 101{ 102} 103 104QueuedPrefetcher::~QueuedPrefetcher() 105{ 106 // Delete the queued prefetch packets 107 for (DeferredPacket &p : pfq) { 108 delete p.pkt; 109 } 110} 111 |
112size_t 113QueuedPrefetcher::getMaxPermittedPrefetches(size_t total) const 114{ 115 /** 116 * Throttle generated prefetches based in the accuracy of the prefetcher. 117 * Accuracy is computed based in the ratio of useful prefetches with 118 * respect to the number of issued prefetches. 119 * 120 * The throttleControlPct controls how many of the candidate addresses 121 * generated by the prefetcher will be finally turned into prefetch 122 * requests 123 * - If set to 100, all candidates can be discarded (one request 124 * will always be allowed to be generated) 125 * - Setting it to 0 will disable the throttle control, so requests are 126 * created for all candidates 127 * - If set to 60, 40% of candidates will generate a request, and the 128 * remaining 60% will be generated depending on the current accuracy 129 */ 130 131 size_t max_pfs = total; 132 if (total > 0 && issuedPrefetches > 0) { 133 size_t throttle_pfs = (total * throttleControlPct) / 100; 134 size_t min_pfs = (total - throttle_pfs) == 0 ? 135 1 : (total - throttle_pfs); 136 max_pfs = min_pfs + (total - min_pfs) * 137 usefulPrefetches / issuedPrefetches; 138 } 139 return max_pfs; 140} 141 |
|
111void 112QueuedPrefetcher::notify(const PacketPtr &pkt, const PrefetchInfo &pfi) 113{ 114 Addr blk_addr = blockAddress(pfi.getAddr()); 115 bool is_secure = pfi.isSecure(); 116 117 // Squash queued prefetches if demand miss to same line 118 if (queueSquash) { --- 8 unchanged lines hidden (view full) --- 127 } 128 } 129 } 130 131 // Calculate prefetches given this access 132 std::vector<AddrPriority> addresses; 133 calculatePrefetch(pfi, addresses); 134 | 142void 143QueuedPrefetcher::notify(const PacketPtr &pkt, const PrefetchInfo &pfi) 144{ 145 Addr blk_addr = blockAddress(pfi.getAddr()); 146 bool is_secure = pfi.isSecure(); 147 148 // Squash queued prefetches if demand miss to same line 149 if (queueSquash) { --- 8 unchanged lines hidden (view full) --- 158 } 159 } 160 } 161 162 // Calculate prefetches given this access 163 std::vector<AddrPriority> addresses; 164 calculatePrefetch(pfi, addresses); 165 |
166 // Get the maximu number of prefetches that we are allowed to generate 167 size_t max_pfs = getMaxPermittedPrefetches(addresses.size()); 168 |
|
135 // Queue up generated prefetches | 169 // Queue up generated prefetches |
170 size_t num_pfs = 0; |
|
136 for (AddrPriority& addr_prio : addresses) { 137 138 // Block align prefetch address 139 addr_prio.first = blockAddress(addr_prio.first); 140 141 if (!samePage(addr_prio.first, pfi.getAddr())) { 142 pfSpanPage += 1; 143 } 144 145 bool can_cross_page = (tlb != nullptr); 146 if (can_cross_page || samePage(addr_prio.first, pfi.getAddr())) { 147 PrefetchInfo new_pfi(pfi,addr_prio.first); 148 pfIdentified++; 149 DPRINTF(HWPrefetch, "Found a pf candidate addr: %#x, " 150 "inserting into prefetch queue.\n", new_pfi.getAddr()); 151 // Create and insert the request 152 insert(pkt, new_pfi, addr_prio.second); | 171 for (AddrPriority& addr_prio : addresses) { 172 173 // Block align prefetch address 174 addr_prio.first = blockAddress(addr_prio.first); 175 176 if (!samePage(addr_prio.first, pfi.getAddr())) { 177 pfSpanPage += 1; 178 } 179 180 bool can_cross_page = (tlb != nullptr); 181 if (can_cross_page || samePage(addr_prio.first, pfi.getAddr())) { 182 PrefetchInfo new_pfi(pfi,addr_prio.first); 183 pfIdentified++; 184 DPRINTF(HWPrefetch, "Found a pf candidate addr: %#x, " 185 "inserting into prefetch queue.\n", new_pfi.getAddr()); 186 // Create and insert the request 187 insert(pkt, new_pfi, addr_prio.second); |
188 num_pfs += 1; 189 if (num_pfs == max_pfs) { 190 break; 191 } |
|
153 } else { 154 DPRINTF(HWPrefetch, "Ignoring page crossing prefetch.\n"); 155 } 156 } 157} 158 159PacketPtr 160QueuedPrefetcher::getPacket() --- 295 unchanged lines hidden --- | 192 } else { 193 DPRINTF(HWPrefetch, "Ignoring page crossing prefetch.\n"); 194 } 195 } 196} 197 198PacketPtr 199QueuedPrefetcher::getPacket() --- 295 unchanged lines hidden --- |