Skip to content

[inductor][subgraph] Plumbing to get ShapeAsConstantBuffer from subgraph to main graph output#147559

Closed
anijain2305 wants to merge 4 commits intogh/anijain2305/685/basefrom
gh/anijain2305/685/head
Closed

[inductor][subgraph] Plumbing to get ShapeAsConstantBuffer from subgraph to main graph output#147559
anijain2305 wants to merge 4 commits intogh/anijain2305/685/basefrom
gh/anijain2305/685/head

Conversation

@anijain2305
Copy link
Contributor

@anijain2305 anijain2305 commented Feb 20, 2025

Stack from ghstack (oldest at bottom):

I am unable to create a test case that fails without the next PR. The idea is to have a symint which is returned by the inner subgraph and then returned by the forward graph after partitioning.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov

@pytorch-bot
Copy link

pytorch-bot bot commented Feb 20, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit adb0901 with merge base 30375cb (image):

NEW FAILURE - The following job has failed:

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

@anijain2305 anijain2305 added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels Feb 20, 2025
@anijain2305 anijain2305 requested a review from eellison February 20, 2025 22:57
except NotImplementedError:
pass
if isinstance(x, StorageBox):
if isinstance(x.data, ShapeAsConstantBuffer):
Copy link
Contributor

Choose a reason for hiding this comment

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

do you know why we're mapping ShapeAsConstantBuffer with StorageBox ? that seems weird

Copy link
Contributor Author

@anijain2305 anijain2305 Feb 28, 2025

Choose a reason for hiding this comment

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

It happens here. I can prevent wrapping of symints here. Is that more intuitive?

return list(map(TensorBox.create, result))

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, updated.

desai0007 pushed a commit to desai0007/test-repo-pytorch that referenced this pull request Feb 26, 2025
…aph to main graph output

ghstack-source-id: 543f908
Pull Request resolved: pytorch/pytorch#147559
… from subgraph to main graph output"



I am unable to create a test case that fails without the next PR. The idea is to have a symint which is returned by the inner subgraph and then returned by the forward graph after partitioning.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
@anijain2305 anijain2305 requested a review from eellison February 28, 2025 00:16
… from subgraph to main graph output"



I am unable to create a test case that fails without the next PR. The idea is to have a symint which is returned by the inner subgraph and then returned by the forward graph after partitioning.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
… from subgraph to main graph output"



I am unable to create a test case that fails without the next PR. The idea is to have a symint which is returned by the inner subgraph and then returned by the forward graph after partitioning.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
@anijain2305
Copy link
Contributor Author

@eellison This should be ready now.

class TensorBox(MutableBox):
@staticmethod
def create(data): # type: ignore[no-untyped-def]
if isinstance(data, ShapeAsConstantBuffer):
Copy link
Contributor

Choose a reason for hiding this comment

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

do you know when we create these ? just curious

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 think in realize_input of ExternKernel. If that input happens to be output as well, then this PR is needed to make it work.

@anijain2305
Copy link
Contributor Author

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: Lint / lintrunner-noclang / linux-job

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

pytorchmergebot pushed a commit that referenced this pull request Mar 3, 2025
pytorchmergebot pushed a commit to min-jean-cho/pytorch that referenced this pull request Mar 5, 2025
jurgen-paul pushed a commit to jurgen-paul/pytorch.git.file that referenced this pull request Mar 19, 2025
…aph to main graph output

ghstack-source-id: 191c9ea
Pull Request resolved: pytorch/pytorch#147559
@github-actions github-actions bot deleted the gh/anijain2305/685/head branch April 2, 2025 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants