#include <BPred.h>
Onikiri::BPredに対する継承グラフ
Public メソッド | |
BEGIN_PARAM_PATH (GetParamPath()) BEGIN_PARAM_PATH(GetResultPath()) BPred() | |
virtual void | ChangeSimulationMode (SimulationMode mode) |
void | Commit (OpIterator op) |
void | Finished (OpIterator op) |
void | Initialize (InitPhase phase) |
bool | IsPerfect () const |
PC | Predict (OpIterator op, PC predIndexPC) |
virtual | ~BPred () |
Static Public 変数 | |
static HookPoint< BPred > | s_branchPredictionMissHook |
Protected メソッド | |
void | RecoveryFromBPredMiss (OpIterator branch) |
Protected 変数 | |
BTB * | m_btb |
OpExtraStateTable< BTBPredict > | m_btbPredTable |
Core * | m_core |
DirPredIF * | m_dirPred |
ForwardEmulator * | m_fwdEmulator |
SimulationMode | m_mode |
bool | m_perfect |
PhysicalResourceArray< RAS > | m_ras |
std::vector< Statistics > | m_statistics |
Statistics | m_totalStatistics |
構成 | |
struct | Statistics |
BPred::~BPred | ( | ) | [virtual] |
Onikiri::BPred::BEGIN_PARAM_PATH | ( | GetParamPath() | ) |
virtual void Onikiri::BPred::ChangeSimulationMode | ( | SimulationMode | mode | ) | [inline, virtual] |
void BPred::Commit | ( | OpIterator | op | ) |
参照先 Onikiri::BTBPredict::hit・Onikiri::OpClass::IsBranch()・Onikiri::OpClass::IsConditionalBranch()・m_btb・m_btbPredTable・m_dirPred・m_mode・m_perfect・m_statistics・m_totalStatistics・Onikiri::BPred::Statistics::numHit・Onikiri::BPred::Statistics::numMiss・Onikiri::BranchTypeUtility::OpClassToBranchType()・Onikiri::DirPredIF::Retired()・Onikiri::PhysicalResourceNode::SM_SIMULATION・Onikiri::BTB::Update().
参照元 Onikiri::Fetcher::Commit()・Onikiri::InorderSystem::Run().
00222 { 00223 if( m_perfect && m_mode != SM_SIMULATION ){ 00224 return; 00225 } 00226 00227 const OpClass& opClass = op->GetOpClass(); 00228 if( !opClass.IsBranch() ) 00229 return; 00230 00231 bool conditional = opClass.IsConditionalBranch(); 00232 00233 if( !m_perfect ){ 00234 // BTBXV 00235 const BTBPredict& predict = m_btbPredTable[op]; 00236 m_btb->Update( op, predict ); 00237 00238 // \^CAm 00239 // i\BTBqbg 00240 if( conditional && predict.hit ){ 00241 m_dirPred->Retired( op ); 00242 } 00243 } 00244 00245 // qbg 00246 PC pcTaken = op->GetTakenPC(); 00247 PC pcPred = op->GetPredPC(); 00248 PC pcNext = NextPC( op->GetPC() ); 00249 bool taken = conditional ? op->GetTaken() : true; 00250 PC pcResult = taken ? pcTaken : pcNext; 00251 00252 BranchTypeUtility util; 00253 BranchType type = util.OpClassToBranchType( opClass ); 00254 if( pcPred == pcResult ){ 00255 m_statistics[type].numHit++; 00256 m_totalStatistics.numHit++; 00257 } 00258 else{ 00259 m_statistics[type].numMiss++; 00260 m_totalStatistics.numMiss++; 00261 } 00262 00263 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
void BPred::Finished | ( | OpIterator | op | ) |
参照先 Onikiri::DirPredIF::Finished()・Onikiri::OpClass::IsBranch()・Onikiri::OpClass::IsConditionalBranch()・m_btbPredTable・m_dirPred・m_perfect・RecoveryFromBPredMiss().
参照元 Onikiri::Fetcher::Finished()・Onikiri::InorderSystem::Run().
00198 { 00199 if( m_perfect ){ 00200 return; 00201 } 00202 00203 const OpClass& opClass = op->GetOpClass(); 00204 00205 // 00206 if( !opClass.IsBranch() ) { 00207 return; 00208 } 00209 00210 // Detect branch miss prediction and recovery if prediction is incorrect. 00211 RecoveryFromBPredMiss( op ); 00212 00213 // \タsm 00214 // i\BTBqbg 00215 if( opClass.IsConditionalBranch() && m_btbPredTable[op].hit ){ 00216 m_dirPred->Finished( op ); 00217 } 00218 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
void BPred::Initialize | ( | InitPhase | phase | ) |
参照先 Onikiri::PhysicalResourceNode::CheckNodeInitialized()・Onikiri::Core::GetOpArray()・Onikiri::PhysicalResourceNode::INIT_POST_CONNECTION・Onikiri::PhysicalResourceNode::INIT_PRE_CONNECTION・Onikiri::ForwardEmulator::IsEnabled()・Onikiri::ParamExchange::LoadParam()・m_btb・m_btbPredTable・m_core・m_dirPred・m_fwdEmulator・m_ras・THROW_RUNTIME_ERROR.
00102 { 00103 if( phase == INIT_PRE_CONNECTION ){ 00104 LoadParam(); 00105 } 00106 else if( phase == INIT_POST_CONNECTION ){ 00107 00108 // oZbg`FbN 00109 CheckNodeInitialized( "dirPred", m_dirPred ); 00110 CheckNodeInitialized( "btb", m_btb ); 00111 CheckNodeInitialized( "ras", m_ras ); 00112 CheckNodeInitialized( "core", m_core ); 00113 CheckNodeInitialized( "forwardEmulator", m_fwdEmulator ); 00114 00115 if( !m_fwdEmulator->IsEnabled() ){ 00116 THROW_RUNTIME_ERROR( 00117 "A perfect memory dependency predictor requires that a forawrd emulator is enabled." 00118 ); 00119 } 00120 00121 m_btbPredTable.Resize( *m_core->GetOpArray() ); 00122 } 00123 }
関数の呼び出しグラフ:
bool Onikiri::BPred::IsPerfect | ( | ) | const [inline] |
PC BPred::Predict | ( | OpIterator | op, | |
PC | predIndexPC | |||
) |
参照先 ASSERT・Onikiri::BT_CALL・Onikiri::BT_CONDITIONAL・Onikiri::BT_CONDITIONAL_RETURN・Onikiri::BT_END・Onikiri::BT_NON・Onikiri::BT_RETURN・Onikiri::BT_UNCONDITIONAL・Onikiri::BTBPredict::dirPredict・Onikiri::ForwardEmulator::GetExecutionResult()・Onikiri::OpStateIF::GetPC()・Onikiri::OpStateIF::GetTaken()・Onikiri::OpStateIF::GetTakenPC()・Onikiri::BTBPredict::hit・m_btb・m_btbPredTable・m_dirPred・m_fwdEmulator・m_mode・m_perfect・m_ras・Onikiri::DirPredIF::Predict()・Onikiri::BTB::Predict()・Onikiri::PhysicalResourceNode::SM_SIMULATION・Onikiri::BTBPredict::target・THROW_RUNTIME_ERROR・Onikiri::BTBPredict::type.
参照元 Onikiri::Fetcher::PredictNextPCBody()・Onikiri::InorderSystem::Run().
00129 { 00130 if( m_perfect && m_mode == SM_SIMULATION ){ 00131 // Forward emulator can work in a simulation mode only. 00132 const OpStateIF* result = m_fwdEmulator->GetExecutionResult( op ); 00133 if( !result ){ 00134 THROW_RUNTIME_ERROR( "Pre-executed result cannot be retrieved from a forward emulator." ); 00135 } 00136 return 00137 result->GetTaken() ? result->GetTakenPC() : NextPC( result->GetPC() ); 00138 } 00139 00140 00141 SimPC pc = op->GetPC(); 00142 BTBPredict btbPred = m_btb->Predict(predIndexPC); 00143 bool btbHit = btbPred.hit; 00144 00145 m_btbPredTable[op] = btbPred; 00146 00147 // BTBqbgC\iXVjs 00148 if(!btbHit) 00149 return pc.Next(); 00150 00151 00152 PC branchTarget = btbPred.target; 00153 00154 // 00155 bool predTaken = btbPred.dirPredict ? m_dirPred->Predict(op, predIndexPC) : true; 00156 00157 switch(btbPred.type){ 00158 case BT_NON: 00159 ASSERT(0, "BT_NON is invalid."); 00160 return pc.Next(); 00161 00162 case BT_CONDITIONAL: 00163 // taken / not taken \APC 00164 // not taken \CopPC 00165 return predTaken ? branchTarget : pc.Next(); 00166 00167 case BT_UNCONDITIONAL: 00168 // BTB \ 00169 return branchTarget; 00170 00171 case BT_CALL: 00172 // call RAS push ABTB \ 00173 // (CNgPushs 00174 m_ras[op->GetLocalTID()]->Push(pc); 00175 return branchTarget; 00176 00177 case BT_RETURN: 00178 // return RAS \ 00179 return m_ras[op->GetLocalTID()]->Pop(); 00180 00181 case BT_CONDITIONAL_RETURN: 00182 // t^[DirPredTakenPop 00183 // not taken PC 00184 return predTaken ? m_ras[op->GetLocalTID()]->Pop() : pc.Next(); 00185 00186 case BT_END: 00187 break; 00188 } 00189 00190 // B 00191 THROW_RUNTIME_ERROR("reached end of Bpred::Predict\n"); 00192 00193 return pc.Next(); // warning 00194 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
void BPred::RecoveryFromBPredMiss | ( | OpIterator | branch | ) | [protected] |
参照先 Onikiri::DS_BRANCH_PREDICTION_MISS・Onikiri::Dumper::Dump()・Onikiri::g_dumper・HOOK_SECTION_OP・IsPerfect()・m_mode・Onikiri::Recoverer::RecoverBPredMiss()・s_branchPredictionMissHook・Onikiri::PhysicalResourceNode::SM_SIMULATION.
参照元 Finished().
00267 { 00268 // Recovery is not necessary when the simulator is in an in-order mode. 00269 if( m_mode != PhysicalResourceNode::SM_SIMULATION ){ 00270 return; 00271 } 00272 00273 // If a perfect mode is enabled, prediction results are always correct and 00274 // there is not nothing to do. 00275 if( IsPerfect() ){ 00276 return; 00277 } 00278 00279 if( branch->GetPredPC() != branch->GetNextPC() ) { 00280 // A branch prediction result is incorrect and recovery from an incorrect path. 00281 g_dumper.Dump( DS_BRANCH_PREDICTION_MISS, branch ); 00282 HOOK_SECTION_OP( s_branchPredictionMissHook, branch ) 00283 { 00284 Recoverer* recoverer = branch->GetThread()->GetRecoverer(); 00285 recoverer->RecoverBPredMiss( branch ); 00286 } 00287 } 00288 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
BTB* Onikiri::BPred::m_btb [protected] |
OpExtraStateTable<BTBPredict> Onikiri::BPred::m_btbPredTable [protected] |
Core* Onikiri::BPred::m_core [protected] |
DirPredIF* Onikiri::BPred::m_dirPred [protected] |
ForwardEmulator* Onikiri::BPred::m_fwdEmulator [protected] |
SimulationMode Onikiri::BPred::m_mode [protected] |
bool Onikiri::BPred::m_perfect [protected] |
PhysicalResourceArray<RAS> Onikiri::BPred::m_ras [protected] |
std::vector<Statistics> Onikiri::BPred::m_statistics [protected] |
Statistics Onikiri::BPred::m_totalStatistics [protected] |
HookPoint< BPred > Onikiri::BPred::s_branchPredictionMissHook [static] |