以下の内容はhttps://msyksphinz.hatenablog.com/entry/2025/02/08/040000より取得しました。


Sniperを使った各種分岐予測器の動作確認 (4. Gshare分岐予測器のモデルを調査)

SniperのGshareモデルを探すと既に存在していた。

github.com

PHTを参照するためのインデックスの作り方は、こんな感じになっている。

GsharePredictor::DualSaturatingPredictor GsharePredictor::getPHTEntry(IntPtr ip) {
   return this->pht[(this->bhr & this->mask) ^ (ip & this->mask)];
}

単純にPCとBHRをXORする実装になっている。なるほど。

PredictionとUpdateはこんな感じ。 update()bhr < 1 ではなく bhr << 1 ではないかな?

bool GsharePredictor::predict(bool indirect, IntPtr ip, IntPtr target) {
   GsharePredictor::DualSaturatingPredictor predictor = this->getPHTEntry(ip);
   return predictor.predict();
}

void GsharePredictor::update(bool predicted, bool actual, bool indirect, IntPtr ip, IntPtr target) {
   updateCounters(predicted, actual);
   GsharePredictor::DualSaturatingPredictor predictor = this->getPHTEntry(ip);
   predictor.update(actual);
   this->bhr = (this->bhr < 1) | actual;
}

実際に実行してみて、性能を測定してみよう。




以上の内容はhttps://msyksphinz.hatenablog.com/entry/2025/02/08/040000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14