Conversation
Change-Id: I7ecf06a54cd1183e3200549ee79cb14ff1920636
Change-Id: If809499441e415303b9fec9705de69bab83390a1
📝 WalkthroughWalkthroughUpdated BTBTAGE defaults in the branch predictor: each of the eight TAGE table sizes increased from 2048 to 8192 entries, and each table's associativity (numWays) increased from 2 to 8. No other logic or parameters changed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Coremark Smoke Test Results
✅ Difftest smoke test passed! |
|
[Generated by GEM5 Performance Robot] Align BTB PerformanceOverall Score
[Generated by GEM5 Performance Robot] Align BTB PerformanceOverall Score
|
Change-Id: I65bbdac579a8804658788c94de1a69f747ac59d2
🚀 Coremark Smoke Test Results
✅ Difftest smoke test passed! |
|
[Generated by GEM5 Performance Robot] Align BTB PerformanceOverall Score
[Generated by GEM5 Performance Robot] Align BTB PerformanceOverall Score
|
Change-Id: Id2cda6131f2d6f09993aca591506c3d515b9b15e
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cpu/pred/BranchPredictor.py`:
- Around line 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.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cbe60c45-94ab-46c6-8211-546c8550797c
📒 Files selected for processing (1)
src/cpu/pred/BranchPredictor.py
| 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") |
There was a problem hiding this comment.
🧩 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.pyRepository: 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.
🚀 Coremark Smoke Test Results
✅ Difftest smoke test passed! |
|
[Generated by GEM5 Performance Robot] Align BTB PerformanceOverall Score
[Generated by GEM5 Performance Robot] Align BTB PerformanceOverall Score
|
Summary by CodeRabbit
Refactor
Performance