KEMBAR78
Fix issue in optimized_add issue: make_optimized should be called on non args only by laithsakka · Pull Request #150955 · pytorch/pytorch · GitHub
Skip to content

Conversation

@laithsakka
Copy link
Contributor

@laithsakka laithsakka commented Apr 9, 2025

Stack from ghstack (oldest at bottom):

PR #149665 did a change to the optimized_add that is causing an issue internally.
In general make_optimized should be only be called with valid new_args, new_args can become None
when elements already exists also, we should break out of the loop in that case.

Note that I also only maintained the optimized summation when both lhs and rhs lengths are <=2.
This is ok because the optimization is based on the inductive property of adding one symbol at a time.
the [2]+[2] here is serving as base case ( i feel we can also remove it ) .

Note that keeping it for all sizes while correct, I am not sure if tis as efficient (we will do N log(n) insertions).
there is no current justification for that.

cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Apr 9, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 4ed26cf with merge base 1a56609 (image):
💚 Looks good so far! There are no failures yet. 💚

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

laithsakka added a commit that referenced this pull request Apr 9, 2025
ghstack-source-id: a6a916a
Pull Request resolved: #150955
@pytorch-bot pytorch-bot bot added ciflow/inductor release notes: fx release notes category labels Apr 9, 2025
@laithsakka laithsakka requested a review from bobrenjc93 April 9, 2025 20:23
@laithsakka laithsakka changed the title fix optimized add issue Fix optimized add issue, make_optimized should be called on non args only Apr 9, 2025
…n non args only "


PR 
#149665
added a change to the optimized add this causing an issue internally. 
In general make_optimized should be only called with non no args. 

cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Apr 9, 2025
ghstack-source-id: 18a07ad
Pull Request resolved: #150955
Copy link
Contributor

@Mingming-Ding Mingming-Ding left a comment

Choose a reason for hiding this comment

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

LGTM

…n non args only "


PR 
#149665
added a change to the optimized add this causing an issue internally. 
In general make_optimized should be only called with valid new_args. 

cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Apr 9, 2025
ghstack-source-id: 0a3bbb4
Pull Request resolved: #150955
@laithsakka laithsakka changed the title Fix optimized add issue, make_optimized should be called on non args only Fix issue in optimized_add issue: make_optimized should be called on non args only Apr 9, 2025
… called on non args only "


PR #149665 did a change to the optimized_add that is causing an issue internally. 
In general make_optimized should be only be called with valid new_args,  new_args can become None
when elements already exists also, we should break out of the loop in that case.

Note that I also only maintained the optimized summation when both lhs and rhs lengths are <=2.
This is ok because the optimization is based on the inductive property of adding one symbol at a time.
the [2]+[2] here is serving as base case ( i feel we can also remove it ) .

Note that keeping it for all sizes while correct, I am not sure if tis as efficient (we will do N log(n) insertions).
there is no current justification for that. 

cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Apr 9, 2025
ghstack-source-id: c29c1f7
Pull Request resolved: #150955
@bobrenjc93
Copy link
Contributor

@pytorchbot merge

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

timocafe pushed a commit to timocafe/pytorch that referenced this pull request Apr 16, 2025
…non args only (pytorch#150955)

PR pytorch#149665 did a change to the optimized_add that is causing an issue internally.
In general make_optimized should be only be called with valid new_args,  new_args can become None
when elements already exists also, we should break out of the loop in that case.

Note that I also only maintained the optimized summation when both lhs and rhs lengths are <=2.
This is ok because the optimization is based on the inductive property of adding one symbol at a time.
the [2]+[2] here is serving as base case ( i feel we can also remove it ) .

Note that keeping it for all sizes while correct, I am not sure if tis as efficient (we will do N log(n) insertions).
there is no current justification for that.

Pull Request resolved: pytorch#150955
Approved by: https://github.com/Mingming-Ding, https://github.com/atalman, https://github.com/bobrenjc93
amathewc pushed a commit to amathewc/pytorch that referenced this pull request Apr 17, 2025
…non args only (pytorch#150955)

PR pytorch#149665 did a change to the optimized_add that is causing an issue internally.
In general make_optimized should be only be called with valid new_args,  new_args can become None
when elements already exists also, we should break out of the loop in that case.

Note that I also only maintained the optimized summation when both lhs and rhs lengths are <=2.
This is ok because the optimization is based on the inductive property of adding one symbol at a time.
the [2]+[2] here is serving as base case ( i feel we can also remove it ) .

Note that keeping it for all sizes while correct, I am not sure if tis as efficient (we will do N log(n) insertions).
there is no current justification for that.

Pull Request resolved: pytorch#150955
Approved by: https://github.com/Mingming-Ding, https://github.com/atalman, https://github.com/bobrenjc93
@github-actions github-actions bot deleted the gh/laithsakka/142/head branch May 16, 2025 02:18
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 fx Merged release notes: fx release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants