Repository navigation
Commit e9025a9
Vulkan: size texture-vs-buffer choice by the bound, not the trace hint
filter_invalid_reprs() decides whether a tensor can live in a texture by
comparing required_image_extents(tensor_val.shape) against the device limits.
For a symbolic dimension that comparison resolves at the dim's *hint* -- the
size of the example the model happened to be traced with -- rather than the
maximum its exported range allows.
So a model traced with a small example picks a texture that is only valid at
that size, and silently produces wrong results once it runs larger. Nothing
raises.
Repro: the Supertonic TTS text encoder, dynamic T in [8, 512], always executed
at T=512 on a Galaxy S26 Ultra (Adreno 840). Only the trace-time example length
differs; the edge graphs are identical (552 nodes, same ops, same literal args,
same symbolic shapes):
traced at T= 64 cosine 0.537966 .pte 18147970 bytes
traced at T=128 cosine 0.537966 .pte 18147970 bytes (identical file)
traced at T=192 cosine 0.999414 .pte 18149890 bytes
traced at T=512 cosine 0.999414 .pte 18149890 bytes (identical file)
The emitted binaries cluster exactly on the correctness boundary, which is what
identifies this as a lowering decision rather than a bad kernel. With this
change the T=64 export emits the 18149890-byte artifact and scores 0.999414.
Evaluating the bound instead also covers the unbounded case: a dim with no
finite upper bound cannot be shown to fit any texture, so it falls back to
buffer storage.
Measured on Supertonic (CPU reference reproduced by the XNNPACK delegate at
cosine 1.000000):
text_encoder 0.406303 -> 0.999414
vector_estimator 0.994432 -> 0.999994
vocoder 0.016757 -> 0.9999771 parent 6a03b0b commit e9025a9
1 file changed
Lines changed: 37 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1184 | 1211 | | |
1185 | 1212 | | |
1186 | 1213 | | |
| |||
1198 | 1225 | | |
1199 | 1226 | | |
1200 | 1227 | | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1201 | 1232 | | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1206 | 1239 | | |
1207 | 1240 | | |
1208 | 1241 | | |
| |||
0 commit comments