#include <StridePrefetcher.h>
Onikiri::StridePrefetcherに対する継承グラフ
Public メソッド | |
BEGIN_PARAM_PATH (GetResultPath()) PARAM_ENTRY("@NumPrefetchingStream" | |
BEGIN_PARAM_PATH (GetParamPath()) PARAM_ENTRY("@Distance" | |
virtual void | Initialize (InitPhase phase) |
virtual void | OnCacheAccess (Cache *cache, const CacheAccess &access, bool hit) |
PARAM_ENTRY ("@NumAvgPrefetchStreamLength", m_numAvgPrefetchStreamLength) | |
PARAM_ENTRY ("@StreamTableSize", m_streamTableSize) | |
PARAM_ENTRY ("@Degree", m_degree) | |
StridePrefetcher () | |
~StridePrefetcher () | |
Public 変数 | |
m_distance | |
m_numPrefetchingStream | |
構成 | |
struct | Stream |
StridePrefetcher.h の 45 行で定義されています。
StridePrefetcher::StridePrefetcher | ( | ) |
StridePrefetcher.cpp の 75 行で定義されています。
00076 { 00077 m_distance = 0; 00078 m_degree = 0; 00079 m_streamTableSize = 0; 00080 00081 m_numPrefetchingStream = 0; 00082 m_numAvgPrefetchStreamLength = 0.0; 00083 }
StridePrefetcher::~StridePrefetcher | ( | ) |
StridePrefetcher.cpp の 86 行で定義されています。
参照先 Onikiri::PrefetcherBase::m_numPrefetch・Onikiri::PhysicalResourceNode::ReleaseParam().
00087 { 00088 if( m_numPrefetchingStream ){ 00089 m_numAvgPrefetchStreamLength = 00090 (double)m_numPrefetch / (double)m_numPrefetchingStream; 00091 } 00092 00093 ReleaseParam(); 00094 }
関数の呼び出しグラフ:
Onikiri::StridePrefetcher::BEGIN_PARAM_PATH | ( | GetResultPath() | ) |
Onikiri::PrefetcherBaseを再定義しています。
Onikiri::StridePrefetcher::BEGIN_PARAM_PATH | ( | GetParamPath() | ) |
Onikiri::PrefetcherBaseを再定義しています。
void StridePrefetcher::Initialize | ( | InitPhase | phase | ) | [virtual] |
Onikiri::PrefetcherBaseを再定義しています。
StridePrefetcher.cpp の 98 行で定義されています。
参照先 shttl::table< type, replacer >::construct()・Onikiri::PhysicalResourceNode::INIT_POST_CONNECTION・Onikiri::PhysicalResourceNode::INIT_PRE_CONNECTION・Onikiri::PrefetcherBase::Initialize()・Onikiri::ParamExchange::LoadParam().
00099 { 00100 PrefetcherBase::Initialize( phase ); 00101 00102 if(phase == INIT_PRE_CONNECTION){ 00103 00104 LoadParam(); 00105 m_streamTable.construct( m_streamTableSize ); 00106 } 00107 else if(phase == INIT_POST_CONNECTION){ 00108 00109 } 00110 }
関数の呼び出しグラフ:
void StridePrefetcher::OnCacheAccess | ( | Cache * | cache, | |
const CacheAccess & | access, | |||
bool | hit | |||
) | [virtual] |
Onikiri::PrefetcherBaseを実装しています。
StridePrefetcher.cpp の 114 行で定義されています。
参照先 Onikiri::Addr::address・Onikiri::g_env・Onikiri::PrefetcherBase::IncrementPrefetchNum()・Onikiri::OpIterator::IsNull()・Onikiri::PrefetcherBase::m_enabled・Onikiri::PrefetcherBase::m_lineSize・Onikiri::CacheAccess::op・Onikiri::CacheAccess::OT_PREFETCH・Onikiri::PrefetcherBase::Prefetch()・Onikiri::Environment::Print()・shttl::table< type, replacer >::replacement_target()・shttl::table< type, replacer >::size()・Onikiri::Addr::ToString()・shttl::table< type, replacer >::touch().
00118 { 00119 if( !m_enabled ){ 00120 return; 00121 } 00122 00123 OpIterator op = access.op; 00124 if( op.IsNull() ){ 00125 return; 00126 } 00127 00128 Addr pc = op->GetPC(); 00129 Addr missAddr = op->GetMemAccess().address;//access.address; 00130 //missAddr.address = MaskLineOffset( missAddr.address ); 00131 00132 #ifdef STRIDE_PREFETCHER_DEBUG 00133 g_env.Print( 00134 String( "access\t" ) + 00135 "pc: " + pc.ToString() + 00136 " addr: " + missAddr.ToString() + 00137 ( hit ? " hit" : " miss" ) + 00138 "\n" 00139 ); 00140 #endif 00141 00142 00143 // bool streamHit = false; 00144 00145 for( size_t i = 0; i < m_streamTable.size(); i++ ){ 00146 Stream* stream = &m_streamTable[i]; 00147 if( stream->status == SS_INVALID ) 00148 continue; 00149 00150 if( stream->pc != pc ) 00151 continue; 00152 00153 m_streamTable.touch( i ); 00154 // streamHit = true; 00155 stream->count++; 00156 00157 #ifdef STRIDE_PREFETCHER_DEBUG 00158 g_env.Print( String( " stream\t" ) + stream->ToString() + "\n" ); 00159 #endif 00160 00161 if( stream->addr.address + stream->stride == missAddr.address ){ 00162 00163 if( stream->confidence.above_threshold() ){ 00164 00165 for( int d = 0; d < m_degree; d++ ){ 00166 CacheAccess prefetch; 00167 prefetch.op = op; 00168 prefetch.type = CacheAccess::OT_PREFETCH; 00169 00170 // Prefetch 'end' point of a window. 00171 prefetch.address = missAddr; 00172 prefetch.address.address += 00173 stream->stride * (m_distance + d); 00174 00175 PrefetcherBase::Prefetch( prefetch ); 00176 //m_prefetchTarget->Read( prefetch, NULL ); 00177 00178 #ifdef STRIDE_PREFETCHER_DEBUG 00179 g_env.Print( 00180 String( " prefetch\t" ) + 00181 prefetch.address.ToString() + 00182 "\n" 00183 ); 00184 #endif 00185 } 00186 00187 IncrementPrefetchNum(); 00188 if( stream->status != SS_PREFETCHING ){ 00189 m_numPrefetchingStream++; 00190 } 00191 stream->status = SS_PREFETCHING; 00192 } 00193 00194 stream->confidence.inc(); 00195 stream->streamLength++; 00196 } 00197 else{ 00198 stream->confidence.dec(); 00199 } 00200 00201 stream->stride = 00202 (s64)missAddr.address - (s64)stream->addr.address; 00203 stream->addr.address = missAddr.address; 00204 00205 if( stream->stride == 0 ){ 00206 stream->status = SS_INVALID; 00207 } 00208 return; 00209 } 00210 00211 if( hit ) 00212 return; 00213 00214 // Allocate a new stride stream. 00215 Stream stream; 00216 stream.Reset(); 00217 stream.pc = pc; 00218 stream.addr = missAddr; 00219 stream.orig = missAddr; 00220 stream.stride = m_lineSize; 00221 stream.status = SS_ALLOCATED; 00222 00223 int target = (int)m_streamTable.replacement_target(); 00224 m_streamTable[ target ] = stream; 00225 m_streamTable.touch( target ); 00226 00227 #ifdef STRIDE_PREFETCHER_DEBUG 00228 g_env.Print( 00229 String( " alloc\t" ) + 00230 missAddr.ToString() + " " + 00231 stream.ToString() + "\n" 00232 ); 00233 #endif 00234 00235 // m_numAllocatedStream++; 00236 }
関数の呼び出しグラフ:
Onikiri::StridePrefetcher::PARAM_ENTRY | ( | "@NumAvgPrefetchStreamLength" | , | |
m_numAvgPrefetchStreamLength | ||||
) |
Onikiri::StridePrefetcher::PARAM_ENTRY | ( | "@StreamTableSize" | , | |
m_streamTableSize | ||||
) |
Onikiri::StridePrefetcher::PARAM_ENTRY | ( | "@Degree" | , | |
m_degree | ||||
) |
Onikiri::StridePrefetcher::m_distance |
StridePrefetcher.h の 133 行で定義されています。
Onikiri::StridePrefetcher::m_numPrefetchingStream |
StridePrefetcher.h の 138 行で定義されています。