Skip to content

Conversation

@larryliu0820
Copy link
Contributor

Validate that the data pointer location matches the requested device_type.
This prevents silent data corruption when tensors are created with
mismatched data pointer and device type.

Changes:

  • Add cudaPointerGetAttributes check to verify data pointer location
  • Error out if CPU data is provided but CUDA device is requested
  • Error out if CUDA data is provided but CPU device is requested
  • Add unit tests for device type mismatch scenarios

[ghstack-poisoned]
[ghstack-poisoned]
@larryliu0820
Copy link
Contributor Author

larryliu0820 commented Dec 19, 2025

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 19, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 11 Pending, 1 Unrelated Failure

As of commit 73efe12 with merge base 227ff2e (image):

NEW FAILURE - The following job has failed:

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.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 19, 2025
Base automatically changed from gh/larryliu0820/82/head to main December 19, 2025 22:37
[ghstack-poisoned]
larryliu0820 added a commit that referenced this pull request Dec 22, 2025
Validate that the data pointer location matches the requested device_type.
This prevents silent data corruption when tensors are created with
mismatched data pointer and device type.

Changes:
- Add cudaPointerGetAttributes check to verify data pointer location
- Error out if CPU data is provided but CUDA device is requested
- Error out if CUDA data is provided but CPU device is requested
- Add unit tests for device type mismatch scenarios

ghstack-source-id: 7c05d4d
ghstack-comment-id: 3676248526
Pull-Request: #16344
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

[ghstack-poisoned]
larryliu0820 added a commit that referenced this pull request Dec 22, 2025
Validate that the data pointer location matches the requested device_type.
This prevents silent data corruption when tensors are created with
mismatched data pointer and device type.

Changes:
- Add cudaPointerGetAttributes check to verify data pointer location
- Error out if CPU data is provided but CUDA device is requested
- Error out if CUDA data is provided but CPU device is requested
- Add unit tests for device type mismatch scenarios

ghstack-source-id: dcd2f99
ghstack-comment-id: 3676248526
Pull-Request: #16344
[ghstack-poisoned]
[ghstack-poisoned]
Copy link
Contributor

@Gasoonjia Gasoonjia left a comment

Choose a reason for hiding this comment

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

Thanks for adding the support and the tests!

[ghstack-poisoned]
[ghstack-poisoned]
@larryliu0820 larryliu0820 merged commit 0f5a252 into main Dec 23, 2025
162 of 164 checks passed
@larryliu0820 larryliu0820 deleted the gh/larryliu0820/83/head branch December 23, 2025 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants