Commit 194bb19
committed
XNNPACK: Fix cat qparams for quantized ViT token paths
Bug: Cat annotation always used the first input as the shared qparam
source. In DeiT Tiny, the first input to token concatenation is the
class-token path:
cls_token -> expand -> cat
The patch-token path is a later cat input:
conv -> flatten -> transpose -> cat
The conv output has annotated activation qparams, and flatten/transpose
are qparam-preserving view/layout ops. They should carry the same
qparams with SharedQuantizationSpec. Anchoring cat qparams on the
class-token path can leave the patch-token static transpose with
different input/output qparams. XNNPACK rejects this during runtime
initialization because static transpose only reorders bytes.
Fix: Choose the first cat input that traces through qparam-preserving
ops to annotated output qparams, falling back to the first input
otherwise. Also propagate shared qparams through reshape and transpose
so static transpose nodes keep identical input and output qparams.
Add a quantized XNNPACK regression covering conv, flatten, transpose,
cat, and add.
Change-Id: I86fafd584c1cb561bd2d4444ea70c1a1b0650066
Signed-off-by: Måns Nilsson <mans.nilsson@arm.com>1 parent e88fd04 commit 194bb19
2 files changed
Lines changed: 101 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
995 | 1000 | | |
996 | 1001 | | |
997 | 1002 | | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
998 | 1045 | | |
999 | 1046 | | |
1000 | 1047 | | |
| |||
1014 | 1061 | | |
1015 | 1062 | | |
1016 | 1063 | | |
| 1064 | + | |
1017 | 1065 | | |
1018 | 1066 | | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
| 1067 | + | |
| 1068 | + | |
1022 | 1069 | | |
1023 | | - | |
1024 | | - | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1025 | 1074 | | |
1026 | | - | |
| 1075 | + | |
1027 | 1076 | | |
1028 | | - | |
| 1077 | + | |
1029 | 1078 | | |
1030 | 1079 | | |
1031 | 1080 | | |
| |||
1045 | 1094 | | |
1046 | 1095 | | |
1047 | 1096 | | |
| 1097 | + | |
1048 | 1098 | | |
1049 | 1099 | | |
1050 | 1100 | | |
1051 | 1101 | | |
1052 | 1102 | | |
1053 | 1103 | | |
| 1104 | + | |
1054 | 1105 | | |
1055 | 1106 | | |
1056 | 1107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
202 | 245 | | |
203 | 246 | | |
204 | 247 | | |
| |||
0 commit comments