Skip to content

Skip rebuilding FX forward after post-lowering and before adjacency split. - #4599

Draft
micwill755 wants to merge 1 commit into
lazy-graph-printingfrom
skip-conversion-recompile
Draft

Skip rebuilding FX forward after post-lowering and before adjacency split.#4599
micwill755 wants to merge 1 commit into
lazy-graph-printingfrom
skip-conversion-recompile

Conversation

@micwill755

@micwill755 micwill755 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Skip gm.recompile() in the post-lowering flush (default recompile=False) and in fast_partition before split(). Conversion (TRTInterpreter) and the adjacency splitter walk graph.nodes and do not call gm.forward().
  • Keep DCE + lint. Callers that execute the module as Python pass post_lowering(..., recompile=True) (converter harness, LLM static-cache). split() still rebuilds forward() when it constructs _run_on_acc_* / _run_on_gpu_* GraphModules.
  • Klein (3364-node lowered graph): prelude reprint was 36 ms; after skip, fast_partition wall is 118 ms (was ~155–171 ms). split() still reprints the full ACC child twice (~37 ms each) plus an expensive 9-node wrapper reprint (~36 ms).

PR 8 of the compile-startup stack; based on #4598.

Test plan

  • tests/py/dynamo/lowering/test_skip_conversion_recompile.py (post_lowering does not recompile; DCE still runs; Interpreter still correct; recompile=True rebuilds forward; fast_partition does not recompile the input module)
  • tests/py/dynamo/models/test_lowering_cache.py (roundtrip still executes after explicit recompile of the in-memory module)
  • tests/py/dynamo/partitioning/test_000_fast_partitioning.py
  • Klein lowered graph: prelude recompile 36 ms; fast_partition wall 118 ms after skip

Stack created with GitHub Stacks CLIGive Feedback 💬

@meta-cla meta-cla Bot added the cla signed label Aug 26, 2026
@github-actions github-actions Bot added component: tests Issues re: Tests component: lowering Issues re: The lowering / preprocessing passes component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Aug 26, 2026
@github-actions
github-actions Bot requested a review from zewenli98 August 26, 2026 22:41
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from d976ba1 to 17b63ed Compare September 1, 2026 18:30
…plit.

TRTInterpreter and AccNodesFinder walk graph.nodes; split still rebuilds forward when it constructs the runtime GraphModules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant