Commit 6817eda
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 a94c7c3 commit 6817eda
1 file changed
Lines changed: 36 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1100 | 1100 | | |
1101 | 1101 | | |
1102 | 1102 | | |
1103 | | - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1104 | 1130 | | |
1105 | 1131 | | |
1106 | 1132 | | |
| |||
1135 | 1161 | | |
1136 | 1162 | | |
1137 | 1163 | | |
1138 | | - | |
| 1164 | + | |
| 1165 | + | |
1139 | 1166 | | |
1140 | 1167 | | |
1141 | 1168 | | |
| |||
1155 | 1182 | | |
1156 | 1183 | | |
1157 | 1184 | | |
1158 | | - | |
| 1185 | + | |
| 1186 | + | |
1159 | 1187 | | |
1160 | 1188 | | |
1161 | 1189 | | |
| |||
1169 | 1197 | | |
1170 | 1198 | | |
1171 | 1199 | | |
1172 | | - | |
| 1200 | + | |
| 1201 | + | |
1173 | 1202 | | |
1174 | 1203 | | |
1175 | 1204 | | |
| |||
1182 | 1211 | | |
1183 | 1212 | | |
1184 | 1213 | | |
1185 | | - | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
1186 | 1217 | | |
1187 | 1218 | | |
1188 | 1219 | | |
| |||
0 commit comments