Skip to content

Pair tage 2 taken#830

Open
Yakkhini wants to merge 30 commits into
xs-devfrom
pair-tage-2-taken
Open

Pair tage 2 taken#830
Yakkhini wants to merge 30 commits into
xs-devfrom
pair-tage-2-taken

Conversation

@Yakkhini
Copy link
Copy Markdown
Collaborator

@Yakkhini Yakkhini commented Apr 15, 2026

Summary by CodeRabbit

  • New Features

    • Added PairTAGE two-block branch predictor with configurable phase/second-block behavior and optional integration into the decoupled BPU.
    • Added side-effect-free BTB lookup paths to support safe, non-mutating prediction queries.
  • Improvements

    • Added prediction-metadata refresh hooks across BTB/TAGE predictors and extended fetch-target metadata for pair-aware predictions.
    • Improved const-correctness and expanded statistics for pair/second-block workflows.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 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

Adds a new two-block PairTAGE BTB/TAGE predictor and integrates it into DecoupledBPUWithBTB; introduces TimedBaseBTBPredictor::refreshPredictionMeta, side-effect-free BTB lookup APIs and const-correct helpers across BTB predictors, extends FetchTarget with PairTAGE fields, and adds FTQ const accessors.

Changes

Cohort / File(s) Summary
PairTAGE implementation
src/cpu/pred/btb/pairtage.hh, src/cpu/pred/btb/pairtage.cc
New TimedBaseBTBPredictor subclass implementing two-block entries, folded-history meta (TageMeta), phase gating, first/second-block prediction assembly, refreshPredictionMeta, training/update, allocation, history recoveries, and statistics.
Predictor wiring & build
src/cpu/pred/BranchPredictor.py, src/cpu/pred/SConscript
Adds PairTAGE SimObject/Params and exposes DecoupledBPUWithBTB.pairtage; registers pairtage source file in build.
Decoupled BPU integration & stats
src/cpu/pred/btb/decoupled_bpred.cc, src/cpu/pred/btb/decoupled_bpred.hh, src/cpu/pred/btb/decoupled_bpred_stats.cc
Integrates PairTAGE into tick/enqueue/squash flows, per-thread pairPhase/state, createFetchTarget overloads, second-block teacher/student flow, history update API changes, and extensive PairTAGE-specific stats.
No-side-effect lookup & meta refresh (BTB family)
src/cpu/pred/btb/abtb.{cc,hh}, mbtb.{cc,hh}, btb_tage.{cc,hh}, btb_ittage.{cc,hh}, btb_mgsc.{cc,hh}, btb_ubtb.{cc,hh}, microtage.{cc,hh}, ras.{cc,hh}
Adds const lookupNoSideEffect/processEntriesNoSideEffect variants and refreshPredictionMeta implementations to recompute FullBTBPrediction metadata without mutating predictor state or stats; tightens const-correctness of many helper methods.
Common BTB types & FetchTarget
src/cpu/pred/btb/common.hh
Adds PairPhase enum; expands FetchTarget with pairPhase, pairtageUsed, pairtageSecondBlock; increases predMetas capacity (8→12); initializes FullBTBPrediction defaults.
Timed base predictor hook
src/cpu/pred/btb/timed_base_pred.hh
Adds virtual refreshPredictionMeta(Addr, const boost::dynamic_bitset<>&, FullBTBPrediction&) hook (default no-op).
FTQ const accessors
src/cpu/pred/btb/ftq.hh
Adds const overloads for front, back, and get to return const FetchTarget&.

Sequence Diagram(s)

sequenceDiagram
    participant Fetch as Fetch Unit
    participant DBPU as DecoupledBPUWithBTB
    participant PT as PairTAGE
    participant FTQ as FetchTargetQueue
    participant Hist as History Tracker

    Fetch->>DBPU: request prediction(startPC, history)
    DBPU->>PT: putPCHistory(startPC, history)
    PT->>PT: TAGE lookup -> build first-block FullBTBPrediction
    PT-->>DBPU: first-block FullBTBPrediction (pairtageUsed, pairPhase)
    DBPU->>FTQ: enqueue first FetchTarget (pairPhase)

    alt PairTAGE enabled && phase allowed && second-block candidate
        DBPU->>PT: refreshPredictionMeta(secondStartPC, history, pred)
        PT->>PT: lookupNoSideEffect -> second-block prediction/meta
        PT-->>DBPU: second-block info (pairtageSecondBlock)
        DBPU->>FTQ: conditionally enqueue second FetchTarget
    end

    Note over DBPU,PT: On resolution
    DBPU->>PT: trainFromActualPred(firstFetchTarget, optionalSecondPred)
    PT->>Hist: specUpdateHist / recoverHist / doUpdateHist
Loading
sequenceDiagram
    participant Caller as DecoupledBPU
    participant Predictor as BTB Predictor
    participant NoSE as NoSideEffect Lookup
    participant Meta as FullBTBPrediction

    Caller->>Predictor: refreshPredictionMeta(startAddr, history, pred)
    Predictor->>NoSE: lookupNoSideEffect(...) / processEntriesNoSideEffect(...)
    NoSE->>NoSE: tag match, select entries (no MRU/LRU/stats changes)
    NoSE-->>Meta: populate hit_entries / per-PC preds
    Meta-->>Caller: refreshed prediction metadata snapshot
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Possibly related PRs

Suggested reviewers

  • jensen-yan
  • CJ362ff

"🐇
I hop on tags both even and odd,
Two blocks foretold, each stitch a nod.
I peek without a single side effect,
I learn when true and gently correct.
A rabbit's hop: predict, teach, connect."

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.39% 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 'Pair tage 2 taken' is vague and does not clearly convey the main change. It appears to reference PairTAGE but lacks specificity about what 'taken' means in this context, making it unclear to reviewers scanning commit history. Consider a more descriptive title that clearly indicates the main functionality being added or modified, such as 'Add PairTAGE predictor with two-block prediction' or 'Implement PairTAGE for dual-block branch prediction.'
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 pair-tage-2-taken

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.3051 -
This PR 2.3051 ➡️ 0.0000 (0.00%)

✅ Difftest smoke test passed!

1 similar comment
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 2.3051 ➡️ 0.0000 (0.00%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added the perf label Apr 16, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

@Yakkhini Yakkhini added perf and removed perf labels Apr 16, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

@Yakkhini Yakkhini added perf and removed perf labels Apr 16, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 1.9659 📉 -0.3392 (-14.72%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini force-pushed the pair-tage-2-taken branch from 105484a to becfce1 Compare April 21, 2026 08:24
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 2.3051 ➡️ 0.0000 (0.00%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini force-pushed the pair-tage-2-taken branch from 6b5465f to 59f9782 Compare April 22, 2026 14:29
@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 2.1343 📉 -0.1708 (-7.41%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added perf and removed perf labels Apr 22, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 2.2801 📉 -0.0250 (-1.08%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added perf and removed perf labels Apr 22, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3051 -
This PR 2.2875 📉 -0.0176 (-0.76%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini marked this pull request as ready for review April 23, 2026 04:30
@Yakkhini Yakkhini added perf and removed perf labels Apr 23, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

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

github-actions Bot commented May 7, 2026

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3029 📉 -0.0101 (-0.44%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added perf and removed perf labels May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🚀 Performance test triggered: gcc15-spec06-0.8c

@XiangShanRobot
Copy link
Copy Markdown

[Generated by GEM5 Performance Robot]
commit: c8c0c3e
workflow: On-Demand SPEC Test (Tier 1.5)

Ideal BTB Performance

Overall Score

PR Master Diff(%)
Score 21.59 21.54 +0.23 🟢

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

github-actions Bot commented May 7, 2026

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3368 📈 +0.0238 (+1.03%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added perf and removed perf labels May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🚀 Performance test triggered: gcc15-spec06-0.8c

@XiangShanRobot
Copy link
Copy Markdown

[Generated by GEM5 Performance Robot]
commit: 4126e7b
workflow: On-Demand SPEC Test (Tier 1.5)

Ideal BTB Performance

Overall Score

PR Master Diff(%)
Score 22.13 21.54 +2.74 🟢

[Generated by GEM5 Performance Robot]
commit: 4126e7b
workflow: On-Demand SPEC Test (Tier 1.5)

Ideal BTB Performance

Overall Score

PR Previous Commit Diff(%)
Score 22.13 21.59 +2.50 🟢

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3368 📈 +0.0238 (+1.03%)

✅ Difftest smoke test passed!

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3342 📈 +0.0212 (+0.92%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added perf and removed perf labels May 15, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

Change-Id: I9cb025867777ca70a66d2048282cfabf76b4bb99
@Yakkhini Yakkhini force-pushed the pair-tage-2-taken branch from 21b37aa to 3e56761 Compare May 15, 2026 08:58
@Yakkhini Yakkhini added perf and removed perf labels May 15, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

@github-actions
Copy link
Copy Markdown

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3391 📈 +0.0261 (+1.13%)

✅ Difftest smoke test passed!

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

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3391 📈 +0.0261 (+1.13%)

✅ Difftest smoke test passed!

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

🚀 Coremark Smoke Test Results

Branch IPC Change
Base (xs-dev) 2.3130 -
This PR 2.3511 📈 +0.0381 (+1.65%)

✅ Difftest smoke test passed!

@Yakkhini Yakkhini added perf and removed perf labels May 26, 2026
@github-actions
Copy link
Copy Markdown

🚀 Performance test triggered: gcc15-spec06-0.8c

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants