From c6440a73b79abe9e0e5ecdb199ea85fe51274ada Mon Sep 17 00:00:00 2001 From: "Di Xu (SWE)" Date: Tue, 30 Dec 2025 11:41:27 -0800 Subject: [PATCH] Fix dynamic shape missing Symbol errors (#16390) Summary: Handle edge case of the range constraints of mixed Symbol + int where the replacement does not have the key. E.g. {s11: VR[2, 32], s11 + 2048: VR[2050, 2080]} The replacements only have key "s11" due to "s11 + 2048" is merged to s11. This is needed to the StaticAttention attention class that the attention mask append the dynamic seq_len at the last dimension. Dynamic shapes and mixed symbol are required for the CoreML enumerated shapes as the precursor for ET enabled CoreML enumerated shape Reviewed By: kimishpatel Differential Revision: D89754133 --- exir/program/_program.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exir/program/_program.py b/exir/program/_program.py index c5100394aa3..fa46fc7080d 100644 --- a/exir/program/_program.py +++ b/exir/program/_program.py @@ -149,9 +149,7 @@ def get_shape_env(gm): if shape_env is None: return {} range_constraints = { - k: v - for k, v in shape_env.var_to_range.items() - if k not in shape_env.replacements + shape_env.replacements.get(k, k): v for k, v in shape_env.var_to_range.items() } # Only when we have an unbacked symint, and it's used as constructor inputs, # runtime_var_to_range will make a difference compated to var_to_range.