Commit df3c066
committed
opencl: do not take the vectorized f16 mrow GEMV path on an unaligned row stride
The multi-row f16 decode GEMV casts the src0 row pointer to half4 (8-byte) and, in
the register-blocked h8 variants, to half8 (16-byte). The dispatch gate only requires
ne00 % 4 == 0, which constrains the number of elements in a row -- not the byte stride
between rows. nb01/nb02/nb03 and the view offset of a permuted or strided src0 are
unconstrained, so a row can land 2-byte aligned and the vector load is then undefined
behaviour.
Same class as the f16/bf16 GEMV row-stride bug and the cvt.cl private-vector punning:
Adreno is byte-addressable and tolerates the misaligned load, so it is invisible on the
hardware this kernel currently runs on (the path is skipped on Intel today). Guard it
rather than wait for the device that does not tolerate it.
kernel_mul_mat_f16_f32_mrow now checks its own row pointer and falls back to the scalar
loop, which has no alignment requirement. The register-blocked and half8 variants have
no scalar path, so the host only selects them when the offset and every row stride are
8- (half4) or 16-byte (half8) aligned, and otherwise falls back to the base kernel.
No functional or performance change on any shape dispatched today: every mrow shape in
test-backend-ops is aligned (probed: a8=1/a16=1 on all 56 dispatches), so the guard is a
no-op there. MUL_MAT 925/0 on the Adreno X2-90, unchanged.1 parent a2547d8 commit df3c066
2 files changed
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20530 | 20530 | | |
20531 | 20531 | | |
20532 | 20532 | | |
| 20533 | + | |
| 20534 | + | |
| 20535 | + | |
| 20536 | + | |
| 20537 | + | |
| 20538 | + | |
| 20539 | + | |
| 20540 | + | |
| 20541 | + | |
| 20542 | + | |
| 20543 | + | |
20533 | 20544 | | |
20534 | 20545 | | |
20535 | 20546 | | |
20536 | 20547 | | |
20537 | | - | |
| 20548 | + | |
20538 | 20549 | | |
20539 | | - | |
| 20550 | + | |
20540 | 20551 | | |
20541 | | - | |
| 20552 | + | |
20542 | 20553 | | |
20543 | | - | |
| 20554 | + | |
20544 | 20555 | | |
20545 | 20556 | | |
20546 | 20557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | | - | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
0 commit comments