-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
[sym_shapes][perf] Optimize bound_sympy avoiding sympy equals #124211
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/124211
Note: Links to docs will display an error until the docs builds have been completed. ❌ 28 New Failures, 5 Unrelated FailuresAs of commit 1ab00e5 with merge base 42e22bb (): NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: 149f11b60ca49c364bd3ca120e32cd30921efcc1 Pull Request resolved: #124211
for r in ranges.keys(): | ||
if r.name == name: | ||
found = True | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so nuts that this is faster. cc @lezcano
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a possibility to have different symbols with different properties (like is_Integer) to have the same name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, a symbol is identified by its name in dynamo/inductor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Isuru noted, Symbols are compared by name + assumptions. That comparison should be fast, but I suppose it's possible there is some performance issue somewhere. It would be useful to have more precise timing information here.
Oh, this string thing! Crazy stuff! Will need to be debugged, sounds like a preexisting problem |
@IvanKobzarev has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@IvanKobzarev I did a simple microbenchmark to try to reproduce this problem but I didn't see as big an effect:
Is it possible to get printouts of the inputs into this expression on the slow run? |
Ok. Will try to repro it on the original run with printouts. |
This isn't blocking for this PR, but it's not obvious to me that we should be going out and rewriting all of our sympy symbol sets |
ranges_names = [r.name for r in ranges.keys()] | ||
for fs in expr.free_symbols: | ||
if fs.name not in ranges_names: | ||
unbounded_vars.add(fs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make range_names
a set and add range_names - expr.free_symbols
,
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
Stack from ghstack (oldest at bottom):
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10
Differential Revision: D56212479