Fix how we handle host memory in CUDA getDeviceFromPtr
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76902
According to the [CUDA Toolkit documentation](https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__UNIFIED.html#group__CUDART__UNIFIED_1gd89830e17d399c064a2f3c3fa8bb4390) `cudaPointerGetAttributes()` function introduces a backwards-incompatible behavior with v11.0 and later. For host memory pointers that are not registered with any CUDA device, instead of returning an error, it now returns success, but sets `attr::type` to `cudaMemoryTypeUnregistered`. A side effect of this change can be seen in #74114.
This PR adds an additional check to `at::cuda::getDeviceFromPtr()` to address this subtle change.
Differential Revision: [D36171315](https://our.internmc.facebook.com/intern/diff/D36171315/)
Approved by: https://github.com/ezyang