Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly reset stderr/stdout in precompilation #125289

Closed
wants to merge 2 commits into from

Conversation

eellison
Copy link
Contributor

@eellison eellison commented May 1, 2024

Stack from ghstack (oldest at bottom):

I was seeing a weird bug where after running max-autotune my stdout would be misdirected. other people have not been able to repro this.

cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire

Copy link

pytorch-bot bot commented May 1, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 3752a7c with merge base 1bcbc91 (image):
💚 Looks good so far! There are no failures yet. 💚

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

eellison added a commit that referenced this pull request May 1, 2024
ghstack-source-id: d6c17386d1d58d722fb3931d75db22d81f88e74a
Pull Request resolved: #125289
@ezyang ezyang changed the title explicitly reset stderr/stdout in precopmilation explicitly reset stderr/stdout in precompilation May 1, 2024
@eellison eellison added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels May 1, 2024
original_stdout = sys.stdout
original_stderr = sys.stderr

@contextmanager
Copy link
Contributor

@mlazos mlazos May 1, 2024

Choose a reason for hiding this comment

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

do we know why thread pool executor is even playing with these things? or is that code outside of our control

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't figured out yet. I added code which would error when stdout is reassigned but it didnt fire. All of the uses of stdout in torch/_inductor/ are unrelated. I also printed out all of the "bad" sys.stdout on exit. The StringIO objects do not match any of the same StringIO objects we construct inside torch inductor. Sometimes the bad objects are TextIOWrapper which we dont construct inside torch/_inductor

torch/_inductor/select_algorithm.py Outdated Show resolved Hide resolved
torch/_inductor/select_algorithm.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mlazos mlazos left a comment

Choose a reason for hiding this comment

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

Approved, but please file an isssue with the repro so people will know about this if they hit something similar

I was seeing a weird bug where after running max-autotune my stdout would be misdirected. other people have not been able to repro this.

cc ezyang msaroufim bdhirsh anijain2305 chauhang voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 ColinPeppler amjames desertfire

[ghstack-poisoned]
eellison added a commit that referenced this pull request May 1, 2024
ghstack-source-id: 1b3b75df68cc86a1b3e9272f783031d22aabcf90
Pull Request resolved: #125289
@eellison
Copy link
Contributor Author

eellison commented May 1, 2024

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorch-bot bot pushed a commit that referenced this pull request May 3, 2024
I was seeing a weird bug where after running max-autotune my stdout would be misdirected. other people have not been able to repro this.

Pull Request resolved: #125289
Approved by: https://github.com/shunting314, https://github.com/mlazos
pytorchmergebot pushed a commit that referenced this pull request May 3, 2024
… cpython bug (#125446)

Fix for #125374. We dont have CI for this specific versions, but I verified locally. THere is a cpython bug from 3.11.0->3.11.7 where the ast parsing state is global, and errors with multiple threads. when dust settles a little around the new process based compilation we can look into migrating.

Pull Request resolved: #125446
Approved by: https://github.com/Chillee
ghstack dependencies: #125289
@github-actions github-actions bot deleted the gh/eellison/638/head branch June 4, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants