Commit b130c22
Fix: re-guard dispatch_shape() do-while against empty core mask (#569)
Commit 9951499 refactored the two-phase dispatch helper but dropped
the guard that PR #566 (af3b1db) had introduced. When a multi-block
task drains all available cores mid-batch, the next task in the batch
entered the do-while unconditionally, calling cores.pop_first() on an
empty bitmask (returns -1) and passing -1 as core_offset to
dispatch_block(), causing OOB access.
Re-add the guard before dispatched_any = true in both a2a3 and a5:
when cores are exhausted, push_batch() re-enqueues the current and
remaining batch tasks atomically and breaks out of the for-loop.
The existing regression test (spmd_batch_dispatch_oob) covers this.
Co-authored-by: zhusy54 <zhusiyu1@hisilicon.com>1 parent 92155aa commit b130c22
2 files changed
Lines changed: 14 additions & 0 deletions
File tree
- src
- a2a3/runtime/tensormap_and_ringbuffer/aicpu
- a5/runtime/tensormap_and_ringbuffer/aicpu
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
1100 | 1107 | | |
1101 | 1108 | | |
1102 | 1109 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1081 | 1081 | | |
1082 | 1082 | | |
1083 | 1083 | | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
1084 | 1091 | | |
1085 | 1092 | | |
1086 | 1093 | | |
| |||
0 commit comments