Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't presume pointers are mutually exclusive for device/host. (#6128)
A pointer can be usable on the device and host at the same time. We can't invert `is_dev_ptr()` to check that something is a host pointer. Here is the results of looking at the cudaPointerGetAttributes of different allocation types. As we can see things like cudaMallocManaged and cudaMallocHost allow the same pointer to be both host and device. ``` cudaPointerGetAttributes attributes malloc ptr is_dev_ptr -> 0 is_host_ptr -> 1 memory loc -> unregistered cudaPointerGetAttributes attributes cudaMalloc ptr is_dev_ptr -> 1 is_host_ptr -> 0 memory loc -> device cudaPointerGetAttributes attributes cudaMallocManaged cudaMemAttachGlobal ptr is_dev_ptr -> 1 is_host_ptr -> 1 memory loc -> managed cudaPointerGetAttributes attributes cudaMallocManaged cudaMemAttachHost ptr is_dev_ptr -> 1 is_host_ptr -> 1 memory loc -> managed cudaPointerGetAttributes attributes cudaMallocHost ptr is_dev_ptr -> 1 is_host_ptr -> 1 memory loc -> host ``` Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Dante Gama Dessavre (https://github.com/dantegd) - William Hicks (https://github.com/wphicks) - Divye Gala (https://github.com/divyegala) URL: #6128
- Loading branch information