Skip to content

Refs/heads/tage his align#838

Open
CJ362ff wants to merge 3 commits into
xs-devfrom
tage-his-align
Open

Refs/heads/tage his align#838
CJ362ff wants to merge 3 commits into
xs-devfrom
tage-his-align

Conversation

@CJ362ff
Copy link
Copy Markdown
Contributor

@CJ362ff CJ362ff commented Apr 17, 2026

Summary by CodeRabbit

  • Improvements
    • Expanded branch predictor table capacities to enhance prediction accuracy and overall system performance.

Cao Jiaming added 3 commits April 15, 2026 14:56
Change-Id: Ibdc04adc47e861a8dc8e21ed1778936ffd8aafd9
Change-Id: I7762670a17886602d611ca69a3ac81fc15ef0b14
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

The BTBTAGE branch predictor's table allocation sizes are doubled from 2048 to 4096 entries per table across all eight tables, using a more compact notation for the parameter definition.

Changes

Cohort / File(s) Summary
BTBTAGE Table Size Configuration
src/cpu/pred/BranchPredictor.py
Doubled BTBTAGE tableSizes parameter from eight 2048-entry tables to eight 4096-entry tables using compact [4096] * 8 notation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested labels

perf, align-kmhv3

Suggested reviewers

  • jensen-yan
  • Yakkhini

Poem

🐰 Eight tables now stretch wide and deep,
From twenty-forty-eight they leap,
To four thousand entries strong,
The TAGE predictor sings its song! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Refs/heads/tage his align' is unclear and appears to be a Git reference rather than a meaningful description of the actual change: increasing BTBTAGE table sizes from 2048 to 4096. Replace with a descriptive title that explains the main change, such as 'Increase BTBTAGE table allocation sizes from 2048 to 4096 entries'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tage-his-align

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@XiangShanRobot
Copy link
Copy Markdown

[Generated by GEM5 Performance Robot]
commit: 08d634d
workflow: gem5 Align BTB Performance Test(0.3c)

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.82 18.71 +0.63 🟢

[Generated by GEM5 Performance Robot]
commit: 08d634d
workflow: gem5 Align BTB Performance Test(0.3c)

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.82 18.71 +0.62 🟢

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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`:
- Line 1047: The inline comment that hardcodes "since tableIndexBits = log(2048)
= 11, RTL is 10" is now stale because tableSizes was changed to
VectorParam.Unsigned([4096] * 8); update that comment in btb_tage.cc to reflect
ceilLog2(4096) = 12 (e.g., "since tableIndexBits = log(4096) = 12, RTL is 11")
or remove the hardcoded numeric remark entirely and instead reference the
computed value (ceilLog2(tableSizes[i])) so the comment remains accurate when
tableSizes changes; look for references to tableSizes and
ceilLog2(tableSizes[i]) to place the corrected comment near the
indexFoldedHist/pcShift logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4cffecdd-de2c-4405-b424-fecdb46afb34

📥 Commits

Reviewing files that changed from the base of the PR and between 6a7b769 and 08d634d.

📒 Files selected for processing (1)
  • src/cpu/pred/BranchPredictor.py

updateOnRead = Param.Bool(False, "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([4096] * 8, "the TAGE T0~Tn length")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -nP -C2 '\b2048\b' src/cpu/pred/btb/btb_tage.cc src/cpu/pred/btb/btb_tage.hh
rg -nP -C2 'tableIndexBits|log\(2048\)' src/cpu/pred/btb/btb_tage.cc

Repository: OpenXiangShan/GEM5

Length of output: 1725


🏁 Script executed:

# Search for all references to 2048 in the codebase, not just btb_tage.cc
rg '\b2048\b' --type-list | head -20

# Then search all files
rg '\b2048\b' src/cpu/pred/

Repository: OpenXiangShan/GEM5

Length of output: 1934


🏁 Script executed:

# Check for checkpoint/restore related code for table dimensions
rg -i 'checkpoint|restore|serialize' src/cpu/pred/btb/ -l

# Look for table dimension references in potential checkpoint code
rg 'tableSizes|tableIndexBits' src/cpu/pred/btb/ -B2 -A2

Repository: OpenXiangShan/GEM5

Length of output: 15543


🏁 Script executed:

# Search for any RTL specifications or documentation
find . -type f \( -name "*.md" -o -name "*.txt" -o -name "*.rst" \) -exec grep -l "RTL\|4096\|2048" {} \; | head -10

# Check if there are any test files related to table sizes
find . -type f -name "*test*" -o -name "*spec*" | grep -i pred | head -10

Repository: OpenXiangShan/GEM5

Length of output: 1866


🏁 Script executed:

# Search for checkpoint/restore code related to BTB/TAGE
rg -i 'checkpoint|save|restore|serializ' src/cpu/pred/btb/ -l

# Look at those files for tableSizes references
rg 'tableSizes' src/cpu/pred/btb/*.cc src/cpu/pred/btb/*.hh | head -30

Repository: OpenXiangShan/GEM5

Length of output: 2333


🏁 Script executed:

# Check for RTL specifications or hardware docs
find . -type f \( -name "*.md" -o -name "*.txt" -o -name "*.rst" \) -path "*btb*" -o -path "*tage*" | xargs grep -l "RTL\|4096\|hardware" 2>/dev/null | head -10

# Look at the btb_tage.md documentation
cat src/cpu/pred/btb/docs/btb_tage.md | head -100

Repository: OpenXiangShan/GEM5

Length of output: 4395


🏁 Script executed:

# Check for any version history or migration notes
rg '4096|tableSizes.*=.*\[' src/cpu/pred/BranchPredictor.py -B2 -A2

Repository: OpenXiangShan/GEM5

Length of output: 2825


Update stale comment in btb_tage.cc:878 to reflect the new table size.

The comment // since tableIndexBits = log(2048) = 11, RTL is 10 at line 878 of btb_tage.cc now references an outdated value. With tableSizes changed to [4096] * 8, tableIndexBits will be ceilLog2(4096) = 12. Update the comment to reflect this (e.g., log(4096) = 12) or remove the hardcoded reference to maintain accuracy.

The C++ code correctly adapts downstream—tableIndexBits is computed dynamically via ceilLog2(tableSizes[i]) during initialization and propagates through indexFoldedHist width and pcShift calculations without further changes needed.

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

In `@src/cpu/pred/BranchPredictor.py` at line 1047, The inline comment that
hardcodes "since tableIndexBits = log(2048) = 11, RTL is 10" is now stale
because tableSizes was changed to VectorParam.Unsigned([4096] * 8); update that
comment in btb_tage.cc to reflect ceilLog2(4096) = 12 (e.g., "since
tableIndexBits = log(4096) = 12, RTL is 11") or remove the hardcoded numeric
remark entirely and instead reference the computed value
(ceilLog2(tableSizes[i])) so the comment remains accurate when tableSizes
changes; look for references to tableSizes and ceilLog2(tableSizes[i]) to place
the corrected comment near the indexFoldedHist/pcShift logic.

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 2.3152 📈 +0.0101 (+0.44%)

✅ Difftest smoke test passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants