Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid circular imports in tracing_state_functions#150325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@justinchuby
Copy link
Collaborator

@justinchubyjustinchuby commentedMar 31, 2025
edited
Loading

tracing_state_functions references some torch functions from submodules liketorch.onnx.is_in_onnx_export that could trigger module initialization & circular imports. I turned the mapping into a function so that the dictionary is not initialized at torch import.

(discovered in#149646)

cc@voznesenskym@penguinwu@EikanWang@jgong5@Guobing-Chen@XiaobingSuper@zhuhaozhe@blzheng@wenzhe-nrv@jiayisunx@chenyang78@kadeng@chauhang@amjames

@pytorch-bot
Copy link

pytorch-botbot commentedMar 31, 2025
edited
Loading

🔗 Helpful Links

🧪 See artifacts and rendered test results athud.pytorch.org/pr/150325

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

❌ 8 New Failures, 2 Pending, 1 Unrelated Failure

As of commitecd03fd with merge base4447352 (image):

NEW FAILURES - The following jobs have failed:

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.

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This pull request aims to avoid circular imports in tracing_state_functions by converting a statically defined mapping into a function.

  • The mapping for tracing state functions is now returned through a function.
  • The decorator now calls the function to unpack the mapping keys dynamically.
Comments suppressed due to low confidence (1)

torch/_dynamo/variables/torch.py:171

  • [nitpick] Consider renaming 'tracing_state_functions' to 'get_tracing_state_functions' to more clearly indicate that it returns a mapping. Optionally, if the mapping is static, memoizing the result could avoid repeated instantiation.
def tracing_state_functions():

@justinchubyjustinchuby changed the titleAvoid circular imports in tracing_state_functionsRemove torch.onnx.is_in_onnx_export from tracing_state_functionsMar 31, 2025
@justinchubyjustinchuby changed the titleRemove torch.onnx.is_in_onnx_export from tracing_state_functionsRemovetorch.onnx.is_in_onnx_export fromtracing_state_functionsMar 31, 2025
@justinchubyjustinchuby changed the titleRemovetorch.onnx.is_in_onnx_export fromtracing_state_functionsAvoid circular imports in tracing_state_functionsMar 31, 2025
@justinchuby
Copy link
CollaboratorAuthor

@pytorchbot rebase

pytorch-bot[bot] reacted with thumbs up emoji

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job ontorefs/remotes/origin/viable/strict. Check the current statushere

@pytorchmergebot
Copy link
Collaborator

Successfully rebasedjustinchu/tracing-funcs ontorefs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, viagit checkout justinchu/tracing-funcs && git pull --rebase)

@zou3519zou3519 added the triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module labelApr 2, 2025
torch.compiler.is_exporting:True,
torch.nn.modules.activation._is_make_fx_tracing:False,
}
deftracing_state_functions():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you toss an lru_cache(None) on this?

justinchuby reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Done, please take a look

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@justinchuby
Copy link
CollaboratorAuthor

@pytorchbot rebase

pytorch-bot[bot] reacted with thumbs up emoji

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job ontorefs/remotes/origin/viable/strict. Check the current statushere

@pytorchmergebot
Copy link
Collaborator

Successfully rebasedjustinchu/tracing-funcs ontorefs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, viagit checkout justinchu/tracing-funcs && git pull --rebase)

@justinchuby
Copy link
CollaboratorAuthor

@pytorchbot merge -i

pytorch-bot[bot] reacted with thumbs up emoji

@pytorch-botpytorch-botbot added the ciflow/trunkTrigger trunk jobs on your pull request labelApr 9, 2025
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 7 checks:inductor / linux-jammy-cpu-py3.9-gcc11-inductor / test (cpu_inductor_torchbench, 1, 2, linux.8xlarge.amx),inductor / linux-jammy-cpu-py3.9-gcc11-inductor / test (cpu_inductor_torchbench, 2, 2, linux.8xlarge.amx),inductor / linux-jammy-cpu-py3.9-gcc11-inductor / test (dynamic_cpu_inductor_torchbench, 1, 2, linux.8xlarge.amx),inductor / linux-jammy-cpu-py3.9-gcc11-inductor / test (dynamic_cpu_inductor_torchbench, 2, 2, linux.8xlarge.amx),inductor / linux-jammy-cpu-py3.9-gcc11-inductor / test (inductor_torchbench_cpu_smoketest_perf, 1, 1, linux.24xl.spr-metal),inductor / cuda12.6-py3.10-gcc9-sm86 / test (inductor_torchbench, 1, 2, linux.g5.4xlarge.nvidia.gpu),inductor / cuda12.6-py3.10-gcc9-sm86 / test (inductor_torchbench, 2, 2, linux.g5.4xlarge.nvidia.gpu)

Learn more about merging in thewiki.

Questions? Feedback? Please reach out to thePyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are:linux-binary-manywheel / manywheel-py3_9-cuda12_6-test / test

Details for Dev Infra teamRaised byworkflow job

@justinchuby
Copy link
CollaboratorAuthor

@pytorchbot merge -f "unrelated failures in cuda build"

pytorch-bot[bot] reacted with thumbs up emoji

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag,bypassing any CI checks (ETA: 1-5 minutes). Please use-f as last resort and instead consider-i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in thewiki.

Questions? Feedback? Please reach out to thePyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

timocafe pushed a commit to timocafe/pytorch that referenced this pull requestApr 16, 2025
tracing_state_functions references some torch functions from submodules like `torch.onnx.is_in_onnx_export` that could trigger module initialization & circular imports. I turned the mapping into a function so that the dictionary is not initialized at torch import.(discovered inpytorch#149646)Pull Requestresolved:pytorch#150325Approved by:https://github.com/zou3519
amathewc pushed a commit to amathewc/pytorch that referenced this pull requestApr 17, 2025
tracing_state_functions references some torch functions from submodules like `torch.onnx.is_in_onnx_export` that could trigger module initialization & circular imports. I turned the mapping into a function so that the dictionary is not initialized at torch import.(discovered inpytorch#149646)Pull Requestresolved:pytorch#150325Approved by:https://github.com/zou3519
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@zou3519zou3519zou3519 approved these changes

@malfetmalfetAwaiting requested review from malfet

Assignees

No one assigned

Labels

ciflow/inductorciflow/trunkTrigger trunk jobs on your pull requestMergedmodule: dynamoopen sourcetopic: not user facingtopic categorytriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@justinchuby@pytorchmergebot@zou3519@pytorchbot

[8]ページ先頭

©2009-2025 Movatter.jp