Skip to content

Conversation

andrasmatyassy
Copy link
Contributor

Fixes #137159

Happy to contribute to this project for the first time. If I missed any contribution guidelines, please let me know, I'm happy to adjust.

Copy link

pytorch-bot bot commented Oct 2, 2024

🔗 Helpful Links

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

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 e34366d with merge base 3192bde (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.

@pytorch-bot pytorch-bot bot added the release notes: fx release notes category label Oct 2, 2024
@janeyx99 janeyx99 requested a review from bobrenjc93 October 2, 2024 22:55
@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 2, 2024
@bobrenjc93 bobrenjc93 requested a review from ezyang October 23, 2024 16:44
if not is_debug:
if (
not is_debug
and os.getenv("TORCH_DISABLE_EXTENDED_DEBUG_INFO") is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you name this consistently with the other ones? Also, to make it discoverable, I'd tell users about it in the maybe_more_info string below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ezyang thank you for the review! I didn't find a clear pattern to the naming of environment variables, some start with TORCH, some with PYTORCH (some don't have torch in the name at all), some include the module name some not. Is there a pattern I'm missing?

Anyway, let me know what would be a consistent name and I'll happily adjust and add to the maybe_more_info string.

Copy link
Contributor

Choose a reason for hiding this comment

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

The envvar naming is indeed all over the place. But that is no excuse not to at least make them locally consistent. Specifically, the debug messages here refer to TORCHDYNAMO_EXTENDED_DEBUG_GUARD_ADDED and similar envvars, so something like TORCHDYNAMO_EXTENDED_ADVICE=0 feels consistent with what else we have

@ezyang ezyang changed the title Make logging depend on environment variable (#137159) Add TORCHDYNAMO_EXTENDED_ADVICE (#137159) Oct 28, 2024
if not is_debug:
if (
not is_debug
and os.getenv("TORCHDYNAMO_EXTENDED_ADVICE=0") is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

this is wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ezyang ah, it should be
and os.getenv("TORCHDYNAMO_EXTENDED_ADVICE=0") is None
right?

Or do you mean, that the naming is still incorrect?

Copy link
Contributor

Choose a reason for hiding this comment

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

don't pass =0 to the getenv. Grep for use of getenv in codebase, it will show the right pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ezyang
Got you. The current behavior is to show the extended info, so I would take that as default and use the following condition:
if not is_debug and os.getenv("TORCHDYNAMO_EXTENDED_ADVICE", "1") != "0"

To me it seems correct that there is extended info if TORCHDYNAMO_EXTENDED_ADVICE=1 and no extended info if TORCHDYNAMO_EXTENDED_ADVICE=0.

The user can then suppress the extended info by setting TORCHDYNAMO_EXTENDED_ADVICE=0. This will be noted in the maybe_more_info below.

Let me know if you agree, if so, I will make and commit the changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it defaults to 1. You may want to also handle empty string too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ezyang Thanks, I made the changes and committed them. I know that this is a PR for a small issue and I appreciate the support and time taken to review.

f'TORCHDYNAMO_EXTENDED_DEBUG_CREATE_SYMBOL="{sympy_expr}"'
f'TORCHDYNAMO_EXTENDED_DEBUG_CREATE_SYMBOL="{sympy_expr}" '
"or to suppress this message run with "
'TORCHDYNAMO_EXTENDED_ADVICE="0"'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit you don't need the quotes

@ezyang
Copy link
Contributor

ezyang commented Nov 1, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 1, 2024
@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

rahulsingh-intel pushed a commit to rahulsingh-intel/pytorch that referenced this pull request Nov 5, 2024
Fixes pytorch#137159

Happy to contribute to this project for the first time. If I missed any contribution guidelines, please let me know, I'm happy to adjust.
Pull Request resolved: pytorch#137196
Approved by: https://github.com/ezyang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: fx release notes category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Env var to shut up "for more info run with TORCHDYNAMO_EXTENDED_DEBUG_CREATE_SYMBOL"
5 participants