@@ -5,7 +5,7 @@ date: 2026-02-27
55tags : [dynamic_shapes, unbacked, torch.export, compile_time, symbolic_shapes]
66---
77
8- ![ Compile time reduction] ( /devlogs /images/2026-02-27-compile-time-header.jpg)
8+ ![ Compile time reduction] ( . /images/2026-02-27-compile-time-header.jpg)
99
1010> ** TL;DR** – A regression report revealed that
1111> exporting a model with many unbacked (data-dependent) symbols took
@@ -20,7 +20,7 @@ A report indicated a severe slowdown when exporting a model that heavily
2020uses data-dependent operations (i.e., unbacked symbolic shapes). Profiling
2121showed that most of the time was spent inside the symbolic shape system.
2222
23- ![ Profiling hotspot: SymNode.expr takes significant trace time] ( /devlogs /images/2026-02-27-compile-time-fig1.png)
23+ ![ Profiling hotspot: SymNode.expr takes significant trace time] ( . /images/2026-02-27-compile-time-fig1.png)
2424
2525At the time of investigation, ` torch.export ` did not support profiling
2626out of the box, which made root-cause analysis difficult. After
@@ -77,7 +77,7 @@ became a significant cost.
7777A per-SymNode cache was added that is invalidated only when replacements
7878change (tracked via a version counter). ** 9% improvement.**
7979
80- ![ Profiling hotspot: SymNode.expr takes significant trace time] ( /devlogs /images/2026-02-27-compile-time-fig1.png)
80+ ![ Profiling hotspot: SymNode.expr takes significant trace time] ( . /images/2026-02-27-compile-time-fig1.png)
8181
8282
8383### 4. Optimize ` _smart_symbol_sort ` hint access ([ PR #174655 ] ( https://github.com/pytorch/pytorch/pull/174655 ) )
@@ -96,7 +96,7 @@ side is an unbacked symbol and the other is a constant triggered expensive
9696sympy evaluation. Since unbacked symbols have no assumptions, there's
9797nothing to simplify. Using ` evaluate=False ` skips this unnecessary work.
9898** 15% improvement.**
99- ![ cost of sympy_eq] ( /devlogs /images/2026-02-27-compile-time-fig2.png)
99+ ![ cost of sympy_eq] ( . /images/2026-02-27-compile-time-fig2.png)
100100
101101### 6. Avoid redundant ` compute_hint() ` calls during expression construction ([ PR #174664 ] ( https://github.com/pytorch/pytorch/pull/174664 ) )
102102
@@ -105,7 +105,7 @@ When `SymNode` operations produce results with unavailable hints, passing
105105for no reason — it will fail. A sentinel value now explicitly indicates
106106"hint unavailable, don't recompute." ** 7% improvement.**
107107
108- ![ compute hint overhead] ( /devlogs /images/2026-02-27-compile-time-fig3.png)
108+ ![ compute hint overhead] ( . /images/2026-02-27-compile-time-fig3.png)
109109
110110### 7. Skip static eval for unbounded unbacked symbols ([ PR #174652 ] ( https://github.com/pytorch/pytorch/pull/174652 ) )
111111
@@ -121,7 +121,7 @@ range `[0, ∞]` will be fast due to the earlier optimization.
121121performing redundant computations. Using ` _from_args ` directly with
122122` is_commutative=True ` saves ** 5% improvement.**
123123
124- ![ Cumulative improvement: 264s → 87s] ( /devlogs /images/2026-02-27-compile-time-fig4.png)
124+ ![ Cumulative improvement: 264s → 87s] ( . /images/2026-02-27-compile-time-fig4.png)
125125
126126## Process takeaways
127127
0 commit comments