Repository navigation
Commit 1e937f2
[ET-VK] Fix out-of-range broadcast size calculation for 0-dim tensors
calculate_broadcasted_output_size() guards its loop with
`i >= -out_sizes.size()`. That is size_t arithmetic: when both operands are
0-dimensional the bound evaluates to 0, `i` promotes to a huge unsigned value,
the guard stays true, and the body runs `out_sizes.at(size() - 1)` on an empty
vector, throwing std::out_of_range.
Any binary op whose output is 0-dimensional therefore aborts at graph build.
Whisper hits it in the log-mel normalisation, which makes its whole encode
method unloadable on Vulkan.
Hold the bound in a signed local so the loop is skipped when the output is
0-dimensional. Non-empty cases are unchanged: the previous unsigned wraparound
happened to compare correctly for them.1 parent 74f553e commit 1e937f2
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | | - | |
24 | | - | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1080 | 1080 | | |
1081 | 1081 | | |
1082 | 1082 | | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
1083 | 1097 | | |
1084 | 1098 | | |
1085 | 1099 | | |
| |||
0 commit comments