Add device type validation in aoti_torch_create_tensor_from_blob_v2#16344
Add device type validation in aoti_torch_create_tensor_from_blob_v2#16344larryliu0820 merged 8 commits intomainfrom
Conversation
🔗 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 FailureAs of commit 73efe12 with merge base 227ff2e ( 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. |
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
This PR needs a
|
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
Gasoonjia
left a comment
There was a problem hiding this comment.
Thanks for adding the support and the tests!
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: