| 468 | } |
| 469 | |
| 470 | Result<uintptr_t> GetDeviceAddress(const uint8_t* cpu_data, |
| 471 | const std::shared_ptr<CudaContext>& ctx) { |
| 472 | ContextSaver context_saver(*ctx); |
| 473 | CUdeviceptr ptr; |
| 474 | // XXX should we use cuPointerGetAttribute(CU_POINTER_ATTRIBUTE_DEVICE_POINTER) |
| 475 | // instead? |
| 476 | CU_RETURN_NOT_OK("cuMemHostGetDevicePointer", |
| 477 | cuMemHostGetDevicePointer(&ptr, const_cast<uint8_t*>(cpu_data), 0)); |
| 478 | return static_cast<uintptr_t>(ptr); |
| 479 | } |
| 480 | |
| 481 | Result<uint8_t*> GetHostAddress(uintptr_t device_ptr) { |
| 482 | void* ptr; |
no outgoing calls
no test coverage detected