@@ -109,7 +109,7 @@ BTBMGSC::initStorage()
109109 pWeightTable.resize (weightTableSize);
110110 biasWeightTable.resize (weightTableSize);
111111
112- // perception weightTable init
112+ // perceptron weightTable init
113113 auto allocWeightTable = [&](std::vector<std::vector<int16_t >> &table,unsigned numEntries) -> uint64_t {
114114 assert (isPowerOf2 (numEntries));
115115 // if (!isPowerOf2(numEntries)) {
@@ -172,7 +172,7 @@ BTBMGSC::BTBMGSC()
172172 enablePTable(true ),
173173 enableBiasTable(true ),
174174 enablePCThreshold(false ),
175- enablePerceptionPred (false ),
175+ enablePerceptronPred (false ),
176176 mgscStats()
177177{
178178 // Test-only small config: keep tables tiny and deterministic for fast unit tests.
@@ -224,7 +224,7 @@ BTBMGSC::BTBMGSC(const Params &p)
224224 enablePTable(p.enablePTable),
225225 enableBiasTable(p.enableBiasTable),
226226 enablePCThreshold(p.enablePCThreshold),
227- enablePerceptionPred (p.enablePerceptionPred ),
227+ enablePerceptronPred (p.enablePerceptronPred ),
228228 mgscStats(this )
229229{
230230 DPRINTF (MGSC, " BTBMGSC constructor\n " );
@@ -445,18 +445,20 @@ BTBMGSC::generateSinglePrediction(const BTBEntry &btb_entry, const Addr &startPC
445445 int total_sum = bw_scaled_percsum + l_scaled_percsum + i_scaled_percsum + g_scaled_percsum + p_scaled_percsum +
446446 bias_scaled_percsum;
447447
448- // genertate perception prediction
449- int percep_sum = enablePerceptionPred ? calculatePercepSum (btb_entry.pc ) : 0 ;
448+ // genertate perceptron prediction
449+ int percep_sum =calculatePercepSum (btb_entry.pc );
450450 int percep_index = getPercepIndex (btb_entry.pc ,gbhr);
451451 // Find thresholds
452452 // pc-indexed threshold table (only if enabled)
453453 int p_update_thres = enablePCThreshold ? findThreshold (pUpdateThreshold, btb_entry.pc ) : 0 ;
454454
455455 int total_thres = (updateThreshold / 8 ) + p_update_thres;
456456 int percep_thres = percepThres;
457+ total_thres = enablePerceptronPred ? percep_thres : total_thres;
458+ total_sum = enablePerceptronPred ? percep_sum : total_sum;
457459
458460 bool use_sc_pred = forceUseSC; // Force use SC if configured
459- bool use_percep_pred = false ;
461+ bool use_percep_pred = enablePerceptronPred ;
460462 bool percep_taken = percep_sum>=0 ;
461463 if (!use_sc_pred) {
462464 if (tage_info.tage_pred_conf_high ) {
@@ -479,13 +481,13 @@ BTBMGSC::generateSinglePrediction(const BTBEntry &btb_entry, const Addr &startPC
479481 }
480482 }
481483 }
482- if (abs (percep_sum) > percep_thres){
483- use_percep_pred = true ;
484- }
484+ // if (abs(percep_sum) > percep_thres){
485+ // use_percep_pred = true;
486+ // }
485487
486488 // Final prediction, total_sum >= 0 means taken if use_sc_pred
487- bool taken = use_sc_pred ? (use_percep_pred? percep_sum>=0 : total_sum >= 0 ) : tage_info.tage_pred_taken ;
488-
489+ // bool taken = use_sc_pred ? (use_percep_pred? percep_sum>=0 : total_sum >= 0) : tage_info.tage_pred_taken;
490+ bool taken = use_sc_pred ? total_sum >= 0 : tage_info. tage_pred_taken ;
489491 // DPRINTF(MGSC, "global tag_index: %d, global_percsum: %d, total_sum: %d\n", gIndex[0], g_percsum, total_sum);
490492 // DPRINTF(MGSC, "local tag_index: %d, local_percsum: %d, total_sum: %d\n", lIndex[0], l_percsum, total_sum);
491493 // DPRINTF(MGSC, "path tag_index: %d, path_percsum: %d, total_sum: %d\n", pIndex[0], p_percsum, total_sum);
@@ -671,7 +673,7 @@ BTBMGSC::updateWeightTable(std::vector<int16_t> &weightTable, Addr tableIndex, A
671673}
672674
673675/* *
674- * Update perception weight table */
676+ * Update perceptron weight table */
675677void
676678BTBMGSC::updatePercepTable (std::vector<std::vector<int16_t >> &weightTable, int percep_sum,bool percep_taken,
677679 Addr pc,bool actual_taken,std::vector<bool > pred_gbhr)
@@ -959,7 +961,7 @@ BTBMGSC::updateSinglePredictor(const BTBEntry &entry, bool actual_taken, const M
959961 updateWeightTable (biasWeightTable, weightTableIdx, entry.pc , pred.bias_weight_scale_diff ,
960962 (pred.bias_percsum >= 0 ) == actual_taken);
961963
962- // Update perception table
964+ // Update perceptron table
963965 auto pred_gbhr = pred.pred_gbhr ;
964966 updatePercepTable (percepWeightTable,percep_sum,percep_taken,entry.pc ,actual_taken,meta_gbhr);
965967
@@ -1552,12 +1554,12 @@ BTBMGSC::MgscStats::MgscStats(statistics::Group *parent)
15521554 ADD_STAT(predMiss, statistics::units::Count::get(), "number of sc prediction miss"),
15531555 ADD_STAT(scPredCorrect, statistics::units::Count::get(), "number of sc prediction correct"),
15541556 ADD_STAT(scPredWrong, statistics::units::Count::get(), "number of sc prediction wrong"),
1555- ADD_STAT(percepPredCorrect, statistics::units::Count::get(), "number of perception prediction correct") ,
1556- ADD_STAT(percepPredWrong, statistics::units::Count::get(), "number of perception prediction wrong") ,
1557- ADD_STAT(usePercepPred, statistics::units::Count::get(), "number of mgsc use perception prediction") ,
1558- ADD_STAT(percepHighConf,statistics::units::Count::get(), "number of perception sum above threshold"),
1557+ ADD_STAT(percepPredCorrect, statistics::units::Count::get(), "number of perceptron prediction correct") ,
1558+ ADD_STAT(percepPredWrong, statistics::units::Count::get(), "number of perceptron prediction wrong") ,
1559+ ADD_STAT(usePercepPred, statistics::units::Count::get(), "number of mgsc use perceptron prediction") ,
1560+ ADD_STAT(percepHighConf,statistics::units::Count::get(), "number of perceptron sum above threshold"),
15591561 ADD_STAT(percepHighConfCorrect,statistics::units::Count::get(),
1560- "number of correct perception prediction above threshold"),
1562+ "number of correct perceptron prediction above threshold"),
15611563 ADD_STAT(scPredMissTaken, statistics::units::Count::get(), "number of sc prediction miss taken"),
15621564 ADD_STAT(scPredMissNotTaken, statistics::units::Count::get(), "number of sc prediction miss not taken"),
15631565 ADD_STAT(scPredCorrectTageWrong, statistics::units::Count::get(),
0 commit comments