Repository navigation
Commit 18c4954
authored
fix: clear scoreboard callbacks for all register files on flush (#295)
# fix: clear scoreboard callbacks for all register files on flush
## Summary
This PR fixes incomplete scoreboard callback cleanup during instruction
flush in `IssueQueue` and addresses minor code quality issues in `LSU`.
## Problem
In `IssueQueue::flushInst_()`, when an instruction is flushed from the
issue queue, only callbacks for the **INTEGER register file** are
cleared:
```cpp
scoreboard_views_[core_types::RegFile::RF_INTEGER]->clearCallbacks(
inst_ptr->getUniqueID());
```
However, `handleOperandIssueCheck_()` registers callbacks for **all
register file types** (INTEGER, FLOAT, VECTOR):
```cpp
for (auto reg_file = 0; reg_file < core_types::RegFile::N_REGFILES; ++reg_file)
{
// ... registers callbacks for each register file type
scoreboard_views_[reg_file]->registerReadyCallback(...);
}
```
### Impact
When floating-point or vector instructions are flushed, their scoreboard
callbacks remain registered. This could potentially cause:
- Stale callbacks firing for already-flushed instructions
- Incorrect instruction scheduling behavior
- Memory leaks from dangling callback references
## Solution
### IssueQueue.cpp
Replace single register file callback clear with loop over all register
files, matching how callbacks are registered:
**Before:**
```cpp
scoreboard_views_[core_types::RegFile::RF_INTEGER]->clearCallbacks(
inst_ptr->getUniqueID());
```
**After:**
```cpp
// Clear scoreboard callbacks for all register file types
for (uint32_t rf = 0; rf < core_types::N_REGFILES; ++rf)
{
scoreboard_views_[rf]->clearCallbacks(inst_ptr->getUniqueID());
}
```
This change is consistent with the pattern already used in `LSU.cpp`
lines 1421-1426:
```cpp
std::vector<core_types::RegFile> reg_files = {core_types::RF_INTEGER, core_types::RF_FLOAT};
for (const auto rf : reg_files)
{
scoreboard_views_[rf]->clearCallbacks(inst_ptr->getUniqueID());
}
```
### LSU.cpp
- Fixed typo: `readdy` → `ready` in log message (line 266)
- Removed duplicate semicolon in `store_buffer_.erase()` call (line 290)
## Testing
Existing regression tests pass. The IssueQueue flush callback bug
primarily manifests in scenarios with floating-point/vector instruction
flushes, which are not fully covered by current tests.1 parent 76d1a46 commit 18c4954
2 files changed
Lines changed: 46 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | 111 | | |
113 | | - | |
| 112 | + | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
| 224 | + | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
289 | 291 | | |
290 | | - | |
| 292 | + | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
294 | | - | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
| |||
508 | 509 | | |
509 | 510 | | |
510 | 511 | | |
511 | | - | |
| 512 | + | |
| 513 | + | |
512 | 514 | | |
513 | 515 | | |
514 | 516 | | |
| |||
946 | 948 | | |
947 | 949 | | |
948 | 950 | | |
949 | | - | |
| 951 | + | |
950 | 952 | | |
951 | 953 | | |
952 | 954 | | |
953 | 955 | | |
954 | 956 | | |
955 | | - | |
| 957 | + | |
| 958 | + | |
956 | 959 | | |
957 | 960 | | |
958 | 961 | | |
| |||
964 | 967 | | |
965 | 968 | | |
966 | 969 | | |
967 | | - | |
968 | | - | |
| 970 | + | |
| 971 | + | |
969 | 972 | | |
970 | 973 | | |
971 | 974 | | |
972 | 975 | | |
973 | | - | |
| 976 | + | |
| 977 | + | |
974 | 978 | | |
975 | 979 | | |
976 | 980 | | |
977 | 981 | | |
978 | 982 | | |
979 | 983 | | |
980 | | - | |
| 984 | + | |
981 | 985 | | |
982 | 986 | | |
983 | 987 | | |
984 | 988 | | |
985 | 989 | | |
986 | | - | |
| 990 | + | |
| 991 | + | |
987 | 992 | | |
988 | 993 | | |
989 | 994 | | |
990 | | - | |
| 995 | + | |
| 996 | + | |
991 | 997 | | |
992 | 998 | | |
993 | 999 | | |
| |||
1000 | 1006 | | |
1001 | 1007 | | |
1002 | 1008 | | |
1003 | | - | |
| 1009 | + | |
| 1010 | + | |
1004 | 1011 | | |
1005 | 1012 | | |
1006 | 1013 | | |
| |||
1009 | 1016 | | |
1010 | 1017 | | |
1011 | 1018 | | |
1012 | | - | |
1013 | | - | |
| 1019 | + | |
1014 | 1020 | | |
1015 | | - | |
| 1021 | + | |
| 1022 | + | |
1016 | 1023 | | |
1017 | 1024 | | |
1018 | 1025 | | |
| |||
1495 | 1502 | | |
1496 | 1503 | | |
1497 | 1504 | | |
1498 | | - | |
| 1505 | + | |
| 1506 | + | |
1499 | 1507 | | |
1500 | | - | |
| 1508 | + | |
| 1509 | + | |
1501 | 1510 | | |
1502 | 1511 | | |
1503 | 1512 | | |
1504 | 1513 | | |
1505 | | - | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
1506 | 1517 | | |
1507 | 1518 | | |
1508 | 1519 | | |
| |||
0 commit comments