Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cpu/pred/BranchPredictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,15 +1044,15 @@ class BTBTAGE(TimedBaseBTBPredictor):
enableSC = Param.Bool(False, "Enable SC or not") # TODO: BTBTAGE doesn't support SC
updateOnRead = Param.Bool(True, "Enable update on read, no need to save tage meta in FTQ")
numPredictors = Param.Unsigned(8, "Number of TAGE predictors")
tableSizes = VectorParam.Unsigned([2048, 2048, 2048, 2048, 2048, 2048, 2048,2048],"the TAGE T0~Tn length")
tableSizes = VectorParam.Unsigned([8192] * 8, "the TAGE T0~Tn length")
TTagBitSizes = VectorParam.Unsigned([13] * 8, "the T0~Tn entry's tag bit size")
TTagPcShifts = VectorParam.Unsigned([1] * 8, "when the T0~Tn entry's tag generating, PC right shift")
blockSize = 32 # tage index function uses 32B aligned block address

histLengths = VectorParam.Unsigned([4, 9, 17, 29, 56, 109, 211,397],"the BTB TAGE T0~Tn history length")
maxHistLen = Param.Unsigned(970, "The length of history passed from DBP")
numTablesToAlloc = Param.Unsigned(1,"The number of table to allocated each time")
numWays = VectorParam.Unsigned([2] * 8,"the T0~Tn number of ways per set")
numWays = VectorParam.Unsigned([8] * 8, "the T0~Tn number of ways per set")
Comment on lines +1047 to +1055
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that BTBTAGE capacity is derived as tableSizes * numWays,
# and locate the default consumers of BTBTAGE().
# Expected:
# - btb_tage.cc shows outer resize by tableSizes[i] and inner resize by way count.
# - BranchPredictor.py shows BTBTAGEUpperBound inheriting BTBTAGE and
#   DecoupledBPUWithBTB constructing BTBTAGE() directly.

rg -n -C2 'tageTable\[i\]\.resize\(tableSizes\[i\]\)|tageTable\[i\]\[j\]\.resize\(ways\)|getNumWays\(|class BTBTAGEUpperBound|Param\.BTBTAGE\(BTBTAGE\(\)' \
  src/cpu/pred/btb/btb_tage.cc src/cpu/pred/BranchPredictor.py

Repository: OpenXiangShan/GEM5

Length of output: 3100


Verify this doesn't unintentionally increase BTBTAGE capacity by 16x.

Line 1047 sets the number of indices (tableSizes: [8192] * 8), and line 1055 sets the associativity (numWays: [8] * 8). In src/cpu/pred/btb/btb_tage.cc:116-119, these are multiplied during allocation: each table now allocates 8192 × 8 = 65,536 entries instead of the previous 2048 × 2 = 4,096 entries—a 16x increase per table.

This base class change propagates to all default BTBTAGE() instantiations, including DecoupledBPUWithBTB (line 1202) and BTBTAGEUpperBound (line 1063). If the intended target is an 8-way 8K-entry configuration, reduce tableSizes to [1024] * 8. Otherwise, isolate this geometry into a dedicated subclass instead of modifying the base default.

🧰 Tools
🪛 Ruff (0.15.6)

[error] 1047-1047: VectorParam may be undefined, or defined from star imports

(F405)


[error] 1048-1048: VectorParam may be undefined, or defined from star imports

(F405)


[error] 1049-1049: VectorParam may be undefined, or defined from star imports

(F405)


[error] 1052-1052: VectorParam may be undefined, or defined from star imports

(F405)


[error] 1053-1053: Param may be undefined, or defined from star imports

(F405)


[error] 1054-1054: Param may be undefined, or defined from star imports

(F405)


[error] 1055-1055: VectorParam may be undefined, or defined from star imports

(F405)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cpu/pred/BranchPredictor.py` around lines 1047 - 1055, The change to the
base params (tableSizes and numWays in BranchPredictor.py) unintentionally
increases BTBTAGE capacity; either restore conservative defaults on the base
class or isolate the larger geometry into a dedicated subclass: if your intent
is an 8-way ×8K-entry BTBTAGE, set tableSizes = VectorParam.Unsigned([1024] * 8,
...) while keeping numWays = VectorParam.Unsigned([8] * 8, ...); otherwise
revert tableSizes and numWays in the base BranchPredictor default to the
previous smaller values (or create a new BTBTAGE-specific subclass used by
BTBTAGE(), DecoupledBPUWithBTB and BTBTAGEUpperBound that overrides
tableSizes/numWays) so the global default does not inflate all BTB instances.

maxBranchPositions = Param.Unsigned(32, "Maximum branch positions per 64-byte block")
useAltOnNaSize = Param.Unsigned(128, "Size of the useAltOnNa table")
useAltOnNaWidth = Param.Unsigned(7, "Width of the useAltOnNa table")
Expand Down
Loading