Skip to content

Tage way tuning align#803

Open
CJ362ff wants to merge 11 commits intoxs-devfrom
tage-way-tuning-align
Open

Tage way tuning align#803
CJ362ff wants to merge 11 commits intoxs-devfrom
tage-way-tuning-align

Conversation

@CJ362ff
Copy link
Copy Markdown
Contributor

@CJ362ff CJ362ff commented Mar 19, 2026

Summary by CodeRabbit

  • Refactor

    • Updated branch predictor defaults to increase capacity and vary associativity across internal tables for improved coverage.
  • Performance

    • Expect improved prediction accuracy and reduced misprediction penalties from the retuned predictor defaults.

Cao Jiaming added 2 commits March 19, 2026 17:44
Change-Id: I7ecf06a54cd1183e3200549ee79cb14ff1920636
Change-Id: If809499441e415303b9fec9705de69bab83390a1
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

BTBTAGE default per-table configuration in src/cpu/pred/BranchPredictor.py changed: tableSizes updated to [2048, 2048, 8192, 2048, 2048, 8192, 8192, 2048] and numWays updated to [2, 2, 4, 4, 4, 2, 2, 2]. No other logic or control flow modified.

Changes

Cohort / File(s) Summary
Branch Predictor Configuration
src/cpu/pred/BranchPredictor.py
Updated BTBTAGE.tableSizes default from eight 2048 entries to [2048, 2048, 8192, 2048, 2048, 8192, 8192, 2048]. Updated BTBTAGE.numWays default from [2]*8 to [2, 2, 4, 4, 4, 2, 2, 2]. No other parameters or code paths changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

align-kmhv3, perf

Suggested reviewers

  • jensen-yan
  • Yakkhini

Poem

🐰 I hopped through rows of bits tonight,
Tuned tables wide to get predictions right.
Ways and sizes set with care,
I hide my guesses in each lair.
Hop, nibble, cache—silent delight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and lacks clarity about the specific changes; 'align' is non-descriptive and does not convey meaningful information about what is being tuned or aligned. Revise the title to be more specific and descriptive, such as 'Tune BTBTAGE table sizes and associativity for improved performance' or 'Increase BTBTAGE table sizes and ways for tables T2, T4-T6'.
✅ 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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tage-way-tuning-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.

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2655 📉 -0.0010 (-0.05%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.28 18.25 +0.13 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.28 18.30 -0.10 🔴

Change-Id: I65bbdac579a8804658788c94de1a69f747ac59d2
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2579 📉 -0.0086 (-0.38%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.27 18.25 +0.09 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.27 18.28 -0.05 🔴

Change-Id: Id2cda6131f2d6f09993aca591506c3d515b9b15e
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`:
- 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8bdbac9 and c113f1c.

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

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2975 📈 +0.0310 (+1.37%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.56 18.25 +1.68 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.56 18.27 +1.59 🟢

Change-Id: I9f60824f734da0061ae1609d250a0dae22d24fd6
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.

🧹 Nitpick comments (1)
src/cpu/pred/BranchPredictor.py (1)

1047-1055: LGTM — heterogeneous BTBTAGE configuration looks intentional and performance-validated.

The new configuration increases total capacity from ~32K to ~123K entries (~3.75x) with per-table tuning:

  • Tables T2, T5, T6 scaled to 8192 sets (13-bit index) vs. 2048 (11-bit) for others
  • Associativity varies: T3 at 8 ways, T0/T2/T4/T6 at 4 ways, T1/T5/T7 at 2 ways

The C++ constructor already handles heterogeneous tableSizes and numWays correctly (calculates tableIndexBits[i] per-table via ceilLog2(tableSizes[i])).

Optional: Consider adding a brief inline comment documenting the tuning rationale (e.g., RTL alignment, memory budget target) for future maintainability.

,

🤖 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, Add a short inline
comment above the heterogeneous BTB/TAGE configuration (near tableSizes,
TTagBitSizes, TTagPcShifts, histLengths, numWays) explaining the tuning
rationale (e.g., which tables were enlarged to 8192 sets, associativity choices
like T3=8 ways, and the target memory/capacity/RTL alignment trade-offs) so
future readers understand why these specific sizes/ways were chosen; keep the
comment concise (1–2 sentences) and place it adjacent to the existing parameter
block for maintainability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/cpu/pred/BranchPredictor.py`:
- Around line 1047-1055: Add a short inline comment above the heterogeneous
BTB/TAGE configuration (near tableSizes, TTagBitSizes, TTagPcShifts,
histLengths, numWays) explaining the tuning rationale (e.g., which tables were
enlarged to 8192 sets, associativity choices like T3=8 ways, and the target
memory/capacity/RTL alignment trade-offs) so future readers understand why these
specific sizes/ways were chosen; keep the comment concise (1–2 sentences) and
place it adjacent to the existing parameter block for maintainability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 622f1e29-5ea9-49e9-a9ff-b8c6ccd4b251

📥 Commits

Reviewing files that changed from the base of the PR and between c113f1c and ac20e3f.

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

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2700 📈 +0.0035 (+0.15%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.47 18.25 +1.16 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.47 18.56 -0.51 🔴

Change-Id: Ib7ef90c0e9b136aaf96a787a303a2b52819aa6e5
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2653 📉 -0.0012 (-0.06%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.45 18.25 +1.09 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.45 18.47 -0.08 🔴

Change-Id: I42c0e9c23582ef5c5cc4d7970c6679637076a727
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2987 📈 +0.0322 (+1.42%)

✅ Difftest smoke test passed!

Change-Id: Ibc7b47fdb35d501dacf20c28d52ce25e8a15da70
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.3043 📈 +0.0378 (+1.67%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.51 18.25 +1.42 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.51 18.44 +0.38 🟢

Change-Id: I7076f353aa472dc6303438d690b988e6d458d2c9
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2676 📈 +0.0011 (+0.05%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.21 18.25 -0.23 🔴

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.21 18.51 -1.63 🔴

Cao Jiaming added 2 commits April 2, 2026 17:15
Change-Id: Ie34c43f5b3917b34ac578d3ca3d06bf7a71f9cb4
Change-Id: I462095d6e59782a1865d9fec4d4b5ed892005c58
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2839 📈 +0.0174 (+0.77%)

✅ Difftest smoke test passed!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2665 -
This PR 2.2847 📈 +0.0182 (+0.80%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.33 18.25 +0.43 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.33 18.21 +0.67 🟢

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