-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Fix conversion of values in libtorch agnostic tests #155115
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
Fix conversion of values in libtorch agnostic tests #155115
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/155115
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 5e7fe14 with merge base ab65581 ( 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. |
485e25c
to
6283f59
Compare
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
60964d5
to
c78ce6c
Compare
Could you please take a look at this PR again? I'm looking at docker build failure separately, it is not relevant to this change. |
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
c78ce6c
to
7a41f76
Compare
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
7a41f76
to
c2e5e2c
Compare
Due to different byteorder, when copying data, it has to be put into last bytes to ensure that int32_t converted to int64_t keeps same value. Same has to be done when it's converted back. This change fixes test TestLibtorchAgnosticCPU::test_my_ones_like_cpu from cpp_extensions/libtorch_agnostic_extension/test/test_libtorch_agnostic.py on s390x.
…agnostic test on s390x
c2e5e2c
to
5e7fe14
Compare
Could you please take a look at this change again? |
@pytorchbot merge |
Merge startedYour 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 |
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.
@huydhn can you give details on why this is needed and why this is ok to do?
@albanD This is one of the PR to support s390x that @AlekseiNikiforovIBM brought up on Slack, and then to our OH few weeks ago as there wasn't any progress on the PR. I stamped it after searching the code base and saw similar usage https://github.com/search?q=repo%3Apytorch%2Fpytorch%20__BYTE_ORDER__&type=code. I thought that it was safe because the codepath for FYI, there is another more complex one that is still open #151447 |
I am confused why this PR is needed to begin with since both sides have the same endianess? |
There was a test failure in Let's say number was 305419896 (0x12345678). Originally value was put into first 4 bytes of So, with this change we actually put it as |
Due to different byteorder,
when copying data, it has to be put into last bytes to ensure that int32_t converted to int64_t keeps same value. Same has to be done when it's converted back.
This change fixes test
TestLibtorchAgnosticCPU::test_my_ones_like_cpu
from
cpp_extensions/libtorch_agnostic_extension/test/test_libtorch_agnostic.py on s390x.