Skip to content

Mgsc4 align#740

Open
jensen-yan wants to merge 3 commits intoxs-devfrom
mgsc4-align
Open

Mgsc4 align#740
jensen-yan wants to merge 3 commits intoxs-devfrom
mgsc4-align

Conversation

@jensen-yan
Copy link
Collaborator

@jensen-yan jensen-yan commented Jan 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Resolved branch prediction gate logic issues to prevent negative threshold values from disabling confidence gates and negatively impacting prediction accuracy.
  • Configuration

    • Enhanced configuration options for branch predictors in decoupled processor system architectures.
  • Performance

    • Improved precision of branch prediction threshold counters by increasing their width for more accurate tracking and calculations.

✏️ Tip: You can customize this high-level summary in your review settings.

Change-Id: Ifd14d575e4d45744a2582d42d903904f4f77d1d6
from max 1024 to max 4096

Change-Id: Ic303d37dabcf4d4ee37dc8f8093cb65ad83de32a
Change-Id: I9aa1d222463d6411b7481d3c93e7fd4fec17a039
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Enabled MGSC for BTB path in KMHV3 configuration, increased MGSC update threshold counter width from 12 to 14 bits, and added clamping logic to prevent negative threshold values from affecting prediction gates during single prediction generation and global threshold updates.

Changes

Cohort / File(s) Summary
Configuration Updates
configs/example/kmhv3.py
Enabled mgsc.enabled flag for DecoupledBPUWithBTB configuration from False to True
Parameter Width Adjustment
src/cpu/pred/BranchPredictor.py
Increased updateThresholdWidth parameter in BTBMGSC class from 12 to 14 bits
Threshold Validation Logic
src/cpu/pred/btb/btb_mgsc.cc
Added clamping to ensure total_thres remains non-negative in generateSinglePrediction; corrected negative updateThreshold values to zero in updateGlobalThreshold

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly Related PRs

  • Add kmhv3 #609 — Modifies KMHV3 branch-predictor configuration and makes MGSC-related changes in predictor code
  • Resolve align #621 — Modifies the same mgsc.enabled flag in kmhv3.py for DecoupledBPUWithBTB (takes opposite approach)
  • Test align #612 — Updates kmhv3.py branch-predictor configuration with MGSC enablement under KMHV3

Suggested Reviewers

  • tastynoob
  • Yakkhini

Poem

🐰 In thresholds once too loose we'd roam,
Now clamped to zero, safe at home,
14 bits now guide the way,
MGSC gates shine bright today!

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Mgsc4 align' is vague and does not clearly describe the specific changes made in the pull request, which involve enabling MGSC and adjusting threshold parameters across multiple files. Consider using a more descriptive title that summarizes the main changes, such as 'Enable MGSC and adjust threshold parameters for branch prediction' or 'Update MGSC configuration and threshold clamping logic'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.1727 -
This PR 2.2186 📈 +0.0459 (+2.11%)

✅ Difftest smoke test passed!

@XiangShanRobot
Copy link

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 17.88 17.56 +1.85 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 17.88 17.88 +0.03 🟢

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