Commit 97f1cc9
committed
Fix silently incorrect CPU matmul for a stride-zero broadcast batch
The baseline CPU backend folded a batched matmul with a broadcast lhs into a
single gemm over (1, m, b * n, k). That fold is not valid: rhs is batch-major,
so its batches are not adjacent columns, and dst_rs stays n while each merged
row is b * n wide. The gemm wrote over itself, leaving only (m - 1) * n + b * n
elements written and the rest at their zero-initialised value.
Drop the fold. The per-batch loop below already handles a_skip == 0 by feeding
the same lhs to every step, which is the correct broadcast semantics.
Fixes #37441 parent ddf1b87 commit 97f1cc9
2 files changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1485 | 1485 | | |
1486 | 1486 | | |
1487 | 1487 | | |
| 1488 | + | |
| 1489 | + | |
1488 | 1490 | | |
1489 | 1491 | | |
1490 | 1492 | | |
1491 | | - | |
1492 | | - | |
1493 | 1493 | | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
1494 | 1499 | | |
1495 | 1500 | | |
1496 | 1501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
85 | 109 | | |
86 | 110 | | |
87 | 111 | | |
| |||
238 | 262 | | |
239 | 263 | | |
240 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
241 | 271 | | |
242 | 272 | | |
243 | 273 | | |
| |||
0 commit comments