Commit c055892
Minor speedup for model lowering: Skip redundant run_decompositions when no ops match decomp table (#18496)
Summary:
Pull Request resolved: #18496
Adds an early-exit check to _gen_edge_manager_for_partitioners: before
calling program.run_decompositions(table), scan the graph for ops that
appear in the decomposition table. If none are found, skip the call
entirely.
Each run_decompositions call performs a full re-export of the program
via make_fx(), re-tracing every node through FakeTensor dispatch.
On the EDGE_DO_NOT_DECOMP path this function is called up to 3 times;
the early-exit eliminates at least one redundant call where the previous
pass already decomposed all matching ops.
The check recursively walks control flow submodules (cond/map/scan) to
avoid incorrectly skipping when decomposable ops are nested.
## Benchmark
Model: small CNN feature extractor (~50K params, 9 conv layers with
LayerNorm, targeting Ethos-U55 via the ARM/TOSA lowering pipeline).
Graph: ~1200 nodes.
lower() before: 82 s
lower() after: 71 s
Delta: -11 s (-13 %)
Differential Revision: D964899031 parent 7014d2e commit c055892
1 file changed
Lines changed: 36 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1091 | 1091 | | |
1092 | 1092 | | |
1093 | 1093 | | |
1094 | | - | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1095 | 1121 | | |
1096 | 1122 | | |
1097 | 1123 | | |
| |||
1126 | 1152 | | |
1127 | 1153 | | |
1128 | 1154 | | |
1129 | | - | |
| 1155 | + | |
| 1156 | + | |
1130 | 1157 | | |
1131 | 1158 | | |
1132 | 1159 | | |
| |||
1146 | 1173 | | |
1147 | 1174 | | |
1148 | 1175 | | |
1149 | | - | |
| 1176 | + | |
| 1177 | + | |
1150 | 1178 | | |
1151 | 1179 | | |
1152 | 1180 | | |
| |||
1160 | 1188 | | |
1161 | 1189 | | |
1162 | 1190 | | |
1163 | | - | |
| 1191 | + | |
| 1192 | + | |
1164 | 1193 | | |
1165 | 1194 | | |
1166 | 1195 | | |
| |||
1173 | 1202 | | |
1174 | 1203 | | |
1175 | 1204 | | |
1176 | | - | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1177 | 1208 | | |
1178 | 1209 | | |
1179 | 1210 | | |
| |||
0 commit comments