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

[symbolic shapes] if symbol not in var_ranges default to unknown range #127681

Closed
wants to merge 1 commit into from

Conversation

ColinPeppler
Copy link
Contributor

@ColinPeppler ColinPeppler commented Jun 1, 2024

Copy link

pytorch-bot bot commented Jun 1, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit a4564f4 with merge base 2e77916 (image):

UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

)
return expr
except KeyError as e:
log.warn(str(e))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use 'log.warning("", exc_info=True)'

@ColinPeppler ColinPeppler changed the title [inductor] skip index propagation if there's a keyerror [symbolic shapes] if symbol not in var_to_range default to unknown range Jun 1, 2024
ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

Copy link
Collaborator

@lezcano lezcano left a comment

Choose a reason for hiding this comment

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

I would really like to understand #127677 (comment), as this is just a hint that there's another bug lurking underneath.

@ColinPeppler
Copy link
Contributor Author

@lezcano
I'd love to take a look, but I also need to urgently resolve an error happening internally. Can we slap a bandaid now and I'll return to this ASAP?

Copy link
Collaborator

@lezcano lezcano left a comment

Choose a reason for hiding this comment

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

Sure, let's land this as a hotfix and leave the other issue open.

vr = self.var_to_range[k]
except KeyError:
log.warning(f"{k} is not in var_to_range, defaulting to unknown range.")
vr = ValueRanges(-sys.maxsize, sys.maxsize)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use self._default_unspecified_value_range() then, as this one has an off-by-one error.

@ColinPeppler
Copy link
Contributor Author

sounds good, assigned myself to the issue

ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

@ColinPeppler ColinPeppler requested a review from lezcano June 1, 2024 17:06
@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jun 1, 2024
ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

ColinPeppler added a commit to ColinPeppler/pytorch that referenced this pull request Jun 1, 2024
…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

…nge (pytorch#127681)

Summary:

Issue: pytorch#127677

Test Plan:
ci

---

Differential Revision: D58048558
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58048558

@ColinPeppler ColinPeppler changed the title [symbolic shapes] if symbol not in var_to_range default to unknown range [symbolic shapes] if symbol not in var_ranges default to unknown range Jun 2, 2024
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge -f 'Landed internally'

(Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally)

@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 the wiki.

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

Advanced Debugging
Check the merge workflow status
here

@bhack
Copy link
Contributor

bhack commented Jun 5, 2024

With recently nighlty I've just got many of this warning.

W0605 11:48:51.002000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.002000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.013000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.013000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.324000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.324000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.334000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:51.334000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:52.669000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:52.800000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:54.093000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:54.093000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:54.152000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:54.152000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:54.734000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:54.869000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:56.124000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:56.124000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:56.189000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z1 is not in var_ranges, defaulting to unknown range.
W0605 11:48:56.189000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:57.112000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] q0 is not in var_ranges, defaulting to unknown range.
W0605 11:48:57.240000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] z0 is not in var_ranges, defaulting to unknown range.
W0605 11:49:03.713000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] y1 is not in var_ranges, defaulting to unknown range.
W0605 11:49:03.713000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] y0 is not in var_ranges, defaulting to unknown range.
W0605 11:49:03.725000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] y1 is not in var_ranges, defaulting to unknown range.
W0605 11:49:03.725000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] y0 is not in var_ranges, defaulting to unknown range.
W0605 11:49:04.647000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x0 is not in var_ranges, defaulting to unknown range.
W0605 11:49:05.445000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x2 is not in var_ranges, defaulting to unknown range.
W0605 11:49:05.445000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x1 is not in var_ranges, defaulting to unknown range.
W0605 11:49:05.923000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x0 is not in var_ranges, defaulting to unknown range.
W0605 11:49:06.703000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x2 is not in var_ranges, defaulting to unknown range.
W0605 11:49:06.703000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x1 is not in var_ranges, defaulting to unknown range.
W0605 11:49:07.186000 134494347568960 torch/fx/experimental/symbolic_shapes.py:4417] [0/0] x0 is not in var_ranges, defaulting to unknown range.

Is there any user action item on these?

@lezcano
Copy link
Collaborator

lezcano commented Jun 5, 2024

@ColinPeppler will look into how to properly fix #127677

petrex pushed a commit to petrex/pytorch that referenced this pull request Jun 5, 2024
pytorch#127681)

Purpose of this PR is to get around this error: pytorch#127677

Differential Revision: D58048558

Pull Request resolved: pytorch#127681
Approved by: https://github.com/lezcano
@ColinPeppler
Copy link
Contributor Author

@bhack those warnings would've led to failures. And if you have a minimal repro, pls share in #127677 then I can check with the fix.

@bhack
Copy link
Contributor

bhack commented Jun 6, 2024

@ColinPeppler The code is quite large to isolate a minimal standalone to run. I have the full env in another ticket if you want.
If the full env is too much for you do you need somethin from https://pytorch.org/docs/stable/torch.compiler_troubleshooting.html ?

@lezcano
Copy link
Collaborator

lezcano commented Jun 6, 2024

Could you try to isolate a smaller repro by putting breakpoints on this warnign and seeing the code that calls it @bhack and doing some manual binary search in the resulting fx graph?

@bhack
Copy link
Contributor

bhack commented Jun 6, 2024

@lezcano A first isolation it is at #127677 (comment)

try:
vr = var_ranges[k]
except KeyError:
log.warning("%s is not in var_ranges, defaulting to unknown range.", k)
Copy link
Collaborator

Choose a reason for hiding this comment

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

May I know why it is a warning here? Would it always warn on unbacked symbols? The cpp template uses some unbacked symbols to build IR nodes for codegen which would always get warning here.

{%- set tile_X = kernel.slice_nd(X, [("m_start", "m_end"), ("k_start", "k_end")]) %}

@lezcano
Copy link
Collaborator

lezcano commented Jun 8, 2024

@ColinPeppler this is annoying too many people. Can you send a patch that removes the warning, or send a fix altogether?

@ColinPeppler
Copy link
Contributor Author

sorry if I can't post a fix by end-of-today, I will remove the warning.

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

7 participants