cpu-o3: Update numWays references to support per-table#797
cpu-o3: Update numWays references to support per-table#797
Conversation
Change-Id: Ieda3140c914857d771b53248b3670a2d97cef87c
📝 WalkthroughWalkthroughThis PR contains formatting and logic refinements to the BTBTAGE branch predictor. Parameter declarations are reformatted to single-line format in BranchPredictor.py, table capacity computation is updated to use indexed array access in btb_tage_ub.cc, and test utilities are updated to use direct array indexing instead of accessor functions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can customize the high-level summary generated by CodeRabbit.Configure the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/cpu/pred/btb/test/btb_tage.test.cc (1)
235-235: KeepgetNumWays()(or add explicit bounds asserts) for loop bounds in tests.Direct
tage->numWays[t]indexing drops the table-index bounds assertion provided bygetNumWays(t), so a misconfigurednumWaysvector can become undefined access instead of a clear test failure. Please either keepgetNumWays(t)here or addASSERT_LT(t, tage->numWays.size())before indexing.Also applies to: 264-264, 800-800, 816-816, 828-828, 834-834, 838-838, 858-858
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cpu/pred/btb/test/btb_tage.test.cc` at line 235, The test currently indexes tage->numWays[t] directly which bypasses the bounds check provided by getNumWays(t); change the loop to use tage->getNumWays(t) for bounds (or, if you prefer direct access, add an assertion like ASSERT_LT(t, tage->numWays.size()) before any indexing) so misconfigured numWays produces a clear test failure; update the occurrences around the loops that reference numWays (e.g., where you currently have for (unsigned way = 0; way < tage->numWays[t]; way++)) to use getNumWays(t) or add the explicit ASSERT_LT check.
🤖 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/btb/test/btb_tage.test.cc`:
- Line 235: The test currently indexes tage->numWays[t] directly which bypasses
the bounds check provided by getNumWays(t); change the loop to use
tage->getNumWays(t) for bounds (or, if you prefer direct access, add an
assertion like ASSERT_LT(t, tage->numWays.size()) before any indexing) so
misconfigured numWays produces a clear test failure; update the occurrences
around the loops that reference numWays (e.g., where you currently have for
(unsigned way = 0; way < tage->numWays[t]; way++)) to use getNumWays(t) or add
the explicit ASSERT_LT check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 66a36b4c-3a01-42a3-b5e5-50dcd5f684d7
📒 Files selected for processing (3)
src/cpu/pred/BranchPredictor.pysrc/cpu/pred/btb/btb_tage_ub.ccsrc/cpu/pred/btb/test/btb_tage.test.cc
Change-Id: Ieda3140c914857d771b53248b3670a2d97cef87c
Summary by CodeRabbit
Refactor
Tests