Skip to content

[standalone_compile] Fix single Tensor outputs from split_module#157803

Closed
zou3519 wants to merge 2 commits intogh/zou3519/1186/basefrom
gh/zou3519/1186/head
Closed

[standalone_compile] Fix single Tensor outputs from split_module#157803
zou3519 wants to merge 2 commits intogh/zou3519/1186/basefrom
gh/zou3519/1186/head

Conversation

@zou3519
Copy link
Copy Markdown
Contributor

@zou3519 zou3519 commented Jul 8, 2025

Stack from ghstack (oldest at bottom):

We assumed that the output in an FX graph would always just be a
list[Tensor], even in the single tensor return case.
It is possible for the output to be a single Tensor. This can happen
by calling torch.fx.split_module on the module.

Test Plan:

  • new test

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

We assumed that the output in an FX graph would always just be a
list[Tensor], even in the single tensor return case.
It is possible for the output to be a single Tensor. This can happen
by calling torch.fx.split_module on the module.

Test Plan:
- new test

[ghstack-poisoned]
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Jul 8, 2025

🔗 Helpful Links

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

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 281ca0c with merge base 0f9c1b3 (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.

…module"

We assumed that the output in an FX graph would always just be a
list[Tensor], even in the single tensor return case.
It is possible for the output to be a single Tensor. This can happen
by calling torch.fx.split_module on the module.

Test Plan:
- new test

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

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Jul 8, 2025
We assumed that the output in an FX graph would always just be a
list[Tensor], even in the single tensor return case.
It is possible for the output to be a single Tensor. This can happen
by calling torch.fx.split_module on the module.

Test Plan:
- new test

ghstack-source-id: 679910a
Pull Request resolved: #157803
@zou3519 zou3519 requested review from jamesjwu and oulgen July 9, 2025 21:16
Copy link
Copy Markdown
Contributor

@oulgen oulgen left a comment

Choose a reason for hiding this comment

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

while i'm ok with this, should we not just fix split_module to always return a list?

@zou3519
Copy link
Copy Markdown
Contributor Author

zou3519 commented Jul 9, 2025

while i'm ok with this, should we not just fix split_module to always return a list?

this may be BC-breaking -- split_module has been a public API since 2021 and things (third-party implementations of pipeline parallelism and cudagraph splitting) use it

@zou3519 zou3519 added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 9, 2025
@zou3519
Copy link
Copy Markdown
Contributor Author

zou3519 commented Jul 10, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Copy Markdown
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

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