Skip to content

always save expr in sympy_expr_tracker#164113

Closed
bobrenjc93 wants to merge 5 commits intogh/bobrenjc93/610/basefrom
gh/bobrenjc93/610/head
Closed

always save expr in sympy_expr_tracker#164113
bobrenjc93 wants to merge 5 commits intogh/bobrenjc93/610/basefrom
gh/bobrenjc93/610/head

Conversation

@bobrenjc93
Copy link
Contributor

@bobrenjc93 bobrenjc93 commented Sep 29, 2025

Stack from ghstack (oldest at bottom):

In certain cases, such as with tensor subclasses like dtensor, symnodes are created in create_aot_state and stored within the dtensor spec. However, since create_aot_state runs without proxy tensor tracing enabled, no thunked proxy is created at this stage. As a result, when execution reaches aot_stage1_graph_capture, errors occur in our new internal training library, for example:

RuntimeError: 202048*s81 (140026802016016) is not tracked with proxy for <torch.fx.experimental.proxy_tensor.PythonKeyTracer object at 0x7f5a505fce20>
Adding TORCHDYNAMO_VERBOSE=1 doesn't seem to give me more information.

This PR modifies the code so that we can now use sympy_expr_tracker to map symnodes created outside of proxy-traced contexts to their corresponding thunked proxies when operating in traced contexts.

I'm still not certain if this is the right long term fix, but this at least unblocks the internal high priority workstream that is blocked on this issue.

cc @ezyang @EikanWang @jgong5 @wenzhe-nrv

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 29, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/164113

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit f0cb236 with merge base dfda239 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

cc ezyang EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
In certain cases, such as with tensor subclasses like dtensor, symnodes are created in create_aot_state and stored within the dtensor spec. However, since create_aot_state runs without proxy tensor tracing enabled, no thunked proxy is created at this stage. As a result, when execution reaches aot_stage1_graph_capture, errors occur in our new internal training library, for example:

```
RuntimeError: 202048*s81 (140026802016016) is not tracked with proxy for <torch.fx.experimental.proxy_tensor.PythonKeyTracer object at 0x7f5a505fce20>
Adding TORCHDYNAMO_VERBOSE=1 doesn't seem to give me more information.
```

This PR modifies the code so that we can now use sympy_expr_tracker to map symnodes created outside of proxy-traced contexts to their corresponding thunked proxies when operating in traced contexts.

I'm still not certain if this is the right long term fix, but this at least unblocks the internal high priority workstream that is blocked on this issue.

cc ezyang EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
@pytorch-bot pytorch-bot bot added the oncall: distributed Add this issue/PR to distributed oncall triage queue label Sep 30, 2025
In certain cases, such as with tensor subclasses like dtensor, symnodes are created in create_aot_state and stored within the dtensor spec. However, since create_aot_state runs without proxy tensor tracing enabled, no thunked proxy is created at this stage. As a result, when execution reaches aot_stage1_graph_capture, errors occur in our new internal training library, for example:

```
RuntimeError: 202048*s81 (140026802016016) is not tracked with proxy for <torch.fx.experimental.proxy_tensor.PythonKeyTracer object at 0x7f5a505fce20>
Adding TORCHDYNAMO_VERBOSE=1 doesn't seem to give me more information.
```

This PR modifies the code so that we can now use sympy_expr_tracker to map symnodes created outside of proxy-traced contexts to their corresponding thunked proxies when operating in traced contexts.

I'm still not certain if this is the right long term fix, but this at least unblocks the internal high priority workstream that is blocked on this issue.

cc ezyang EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 30, 2025
ghstack-source-id: a82e7d8
Pull Request resolved: #164113
@pytorchmergebot
Copy link
Collaborator

Starting merge as part of PR stack under #164210

In certain cases, such as with tensor subclasses like dtensor, symnodes are created in create_aot_state and stored within the dtensor spec. However, since create_aot_state runs without proxy tensor tracing enabled, no thunked proxy is created at this stage. As a result, when execution reaches aot_stage1_graph_capture, errors occur in our new internal training library, for example:

```
RuntimeError: 202048*s81 (140026802016016) is not tracked with proxy for <torch.fx.experimental.proxy_tensor.PythonKeyTracer object at 0x7f5a505fce20>
Adding TORCHDYNAMO_VERBOSE=1 doesn't seem to give me more information.
```

This PR modifies the code so that we can now use sympy_expr_tracker to map symnodes created outside of proxy-traced contexts to their corresponding thunked proxies when operating in traced contexts.

I'm still not certain if this is the right long term fix, but this at least unblocks the internal high priority workstream that is blocked on this issue.

cc ezyang EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
@bobrenjc93 bobrenjc93 closed this Oct 1, 2025
@github-actions github-actions bot deleted the gh/bobrenjc93/610/head branch November 1, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor fx oncall: distributed Add this issue/PR to distributed oncall triage queue release notes: fx release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants