Skip to content

[codex] Refactor BTB branch and prediction payloads#895

Draft
jensen-yan wants to merge 9 commits into
xs-devfrom
bpu-branch-entry-refactor-align
Draft

[codex] Refactor BTB branch and prediction payloads#895
jensen-yan wants to merge 9 commits into
xs-devfrom
bpu-branch-entry-refactor-align

Conversation

@jensen-yan

Copy link
Copy Markdown
Collaborator

Summary

  • separate branch slot data from BTB entry storage metadata
  • extract BTB prediction-result and final-prediction selection helpers
  • move final prediction attribution into explicit metadata
  • group fetch prediction payload in a FetchPredictionSnapshot

Motivation

This is a readability/refactor patch to reduce coupling in the BTB BPU top-level data flow. The intent is to make branch-slot, BTB-entry, prediction-result, and FTQ/update payload ownership easier to reason about and easier to unit test.

Scope and impact

This is intended to be behavior-preserving. There is no intended performance impact; the branch is pushed as a slash-free *-align branch so the 0.3c perf workflow can check that.

Validation

  • scons build/RISCV/cpu/pred/btb/test/final_prediction_selector.test.debug build/RISCV/cpu/pred/btb/test/prediction_result.test.debug build/RISCV/cpu/pred/btb/test/history_manager.test.debug build/RISCV/cpu/pred/btb/test/uras.test.debug build/RISCV/cpu/pred/btb/test/btb.test.debug build/RISCV/cpu/pred/btb/test/abtb.test.debug build/RISCV/cpu/pred/btb/test/tage.test.debug build/RISCV/cpu/pred/btb/test/mgsc.test.debug --unit-test -j100
  • ./build/RISCV/cpu/pred/btb/test/final_prediction_selector.test.debug
  • ./build/RISCV/cpu/pred/btb/test/prediction_result.test.debug
  • ./build/RISCV/cpu/pred/btb/test/history_manager.test.debug
  • ./build/RISCV/cpu/pred/btb/test/uras.test.debug
  • ./build/RISCV/cpu/pred/btb/test/btb.test.debug
  • ./build/RISCV/cpu/pred/btb/test/abtb.test.debug
  • ./build/RISCV/cpu/pred/btb/test/tage.test.debug
  • ./build/RISCV/cpu/pred/btb/test/mgsc.test.debug
  • scons build/RISCV/gem5.opt --gold-linker -j100

Change-Id: Ie2a5d8ebd48298791cfb26eed696a145f517b5ec
Change-Id: If060f1964f06a55d4d34fab5a01e997ce5be52d1
Change-Id: I7f4128020c9f77b61edf81f57f73d835e1334cf0
Change-Id: I27f852de6b10e2d85879a86e0b5ae18defe4f942
Change-Id: Ie759c4745549b8f0cbbd032a8331eeeb51706fe7
Change-Id: I7b69933354ade9823869af465e57ef1b28a7715a
Change-Id: I66ed64d763a10dc7e74b9a76dbb4e9283095b280
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f02826f1-f9ce-4e9c-b716-7fad7f0205ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bpu-branch-entry-refactor-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

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2906 -
This PR 2.2875 📉 -0.0030 (-0.13%)

✅ Difftest smoke test passed!

Change-Id: I42b6fd72b3d8759ad7a2d4cfdefac4ba0d7c3aa9
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2906 -
This PR 2.2875 📉 -0.0030 (-0.13%)

✅ Difftest smoke test passed!

Change-Id: Ief7c4c5682910c45682b5572150d7553ca03f993
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.2906 -
This PR 2.2875 📉 -0.0030 (-0.13%)

✅ Difftest smoke test passed!

@XiangShanRobot

Copy link
Copy Markdown

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

Align BTB Performance

Overall Score

PR Master Diff(%)
Score 18.91 18.90 +0.04 🟢

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

Align BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 18.91 18.91 0.00

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