Skip to content

Conversation

@mikaylagawarecki
Copy link
Contributor

@mikaylagawarecki mikaylagawarecki commented Nov 17, 2025

This PR does change the semantics of the >> operator by using STD_TORCH_CHECK to throw the error instead of TORCH_CHECK. Jane (who is writing this message) thinks it is okay because it is the error case when an invalid MemoryFormat or Layout is getting passed into >>, so the UX benefits of TORCH_CHECK over STD_TORCH_CHECK there are not significant enough to warrant making a new copy of Layout and MemoryFormat's >> APIs.

Never mind! We shouldn't change TORCH_CHECK to STD_TORCH_CHECK for core usage ever, cuz the traceback info and c10::Error is very much desired!! So the solution is to not migrate the >>s. I pushed new commits to the stack to remove the >> code, but for reference, 8a30179 has all the code that I ended up deleting.

Stack from ghstack (oldest at bottom):

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 17, 2025

🔗 Helpful Links

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

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

⏳ 1 Pending, 1 Unrelated Failure

As of commit 32730de with merge base 1c04a43 (image):

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

// Specialization for c10::Layout => StableIValue
// Note that we call into the shim to translate between the user's
// Layout and libtorch's Layout, which can be different!
using c10::Layout;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for these two I don't error in the base case bcos per "BC" they should use the base case in 2.9 (wdyt of that haha)

Copy link
Contributor

@janeyx99 janeyx99 Nov 19, 2025

Choose a reason for hiding this comment

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

i agree~

Comment on lines 51 to 53
// Note: We can't use TORCH_CHECK here as it's not header-only
// Callers should ensure valid layout values
return stream << "Unknown";
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'll fix this and below

Copy link
Contributor

@janeyx99 janeyx99 Nov 19, 2025

Choose a reason for hiding this comment

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

Should be okay to just replace with STD_TORCH_CHECK

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually....since that changes semantics...maybe an alternative is to just not migrate the >> functions

Comment on lines 51 to 53
// Note: We can't use TORCH_CHECK here as it's not header-only
// Callers should ensure valid layout values
return stream << "Unknown";
Copy link
Contributor

@janeyx99 janeyx99 Nov 19, 2025

Choose a reason for hiding this comment

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

Should be okay to just replace with STD_TORCH_CHECK

@janeyx99 janeyx99 changed the title Move MemoryFormat/Layout to headeronly Move MemoryFormat/Layout to headeronly AND use STD_TORCH_CHECK Nov 19, 2025
janeyx99 added a commit that referenced this pull request Nov 19, 2025
ghstack-source-id: 9acfa60
Pull Request resolved: #168034
@janeyx99 janeyx99 changed the title Move MemoryFormat/Layout to headeronly AND use STD_TORCH_CHECK Move MemoryFormat/Layout to headeronly BUT use STD_TORCH_CHECK Nov 19, 2025
@janeyx99 janeyx99 changed the title Move MemoryFormat/Layout to headeronly BUT use STD_TORCH_CHECK Move MemoryFormat/Layout to headeronly Nov 19, 2025
~This PR does change the semantics of the >> operator by using STD_TORCH_CHECK to throw the error instead of TORCH_CHECK. Jane (who is writing this message) thinks it is okay because it is the error case when an invalid MemoryFormat or Layout is getting passed into >>, so the UX benefits of TORCH_CHECK over STD_TORCH_CHECK there are not significant enough to warrant making a new copy of Layout and MemoryFormat's >> APIs.~

Never mind! We shouldn't change TORCH_CHECK to STD_TORCH_CHECK for core usage ever, cuz the traceback info and c10::Error is very much desired!! So the solution is to not migrate the >>s. I pushed new commits to the stack to remove the >> code, but for reference, 8a30179 has all the code that I ended up deleting.




[ghstack-poisoned]
janeyx99 added a commit that referenced this pull request Nov 19, 2025
ghstack-source-id: 08ea1b1
Pull Request resolved: #168034
@janeyx99 janeyx99 marked this pull request as ready for review November 19, 2025 19:30
@janeyx99 janeyx99 added release notes: cpp release notes category topic: improvements topic category topic: new features topic category and removed topic: improvements topic category labels Nov 19, 2025
@janeyx99
Copy link
Contributor

@pytorchbot merge

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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / libtorch-linux-jammy-cuda12.8-py3.10-gcc11-debug / build

Details for Dev Infra team Raised by workflow job

@janeyx99
Copy link
Contributor

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: trunk / libtorch-linux-jammy-cuda12.8-py3.10-gcc11-debug / build

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

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: cpp release notes category topic: new features topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants