Commit f1d2775
committed
Arm backend: Avoid repeated recompiles in constant fusion
Remove the per-fusion graph recompile from FuseConstantArgsPass.
On an internal VGF quant export test, this reduced
FuseConstantArgsPass time from 64.8s to 5.2s by avoiding recompiles
after each fused op.
The pass makes fusion decisions from the mutable FX graph.
Creating a constant placeholder and calling replace_all_uses_with
updates downstream node inputs immediately, so chained constant ops
are still visible in the same scan.
For a chain such as const -> B -> A, FX topological order
visits B before A because A consumes B. Fusing B updates A's
input node immediately, so A is fusable when the scan reaches it.
If A is visited before B in a valid graph, B cannot be an input
to A, so fusing B later cannot make A newly fusable.
A final explicit recompile is not needed before super().call(...).
That call interprets the updated graph and returns a freshly traced
GraphModule, so the pass does not execute stale generated forward
code after the rewrite.
Add a regression test for chained constant folding without per-fusion
recompiles.
Change-Id: I65b62f23d90e663e09fcaa8f34e09ebd10eb1935
Signed-off-by: Yufeng Shi <yufeng.shi@arm.com>1 parent 8e653a6 commit f1d2775
2 files changed
Lines changed: 61 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
283 | 344 | | |
284 | 345 | | |
285 | 346 | | |
| |||
0 commit comments