| 478 | } |
| 479 | |
| 480 | Result<uintptr_t> GetDeviceAddress(const uint8_t* cpu_data, |
| 481 | const std::shared_ptr<CudaContext>& ctx) { |
| 482 | ContextSaver context_saver(*ctx); |
| 483 | CUdeviceptr ptr; |
| 484 | // XXX should we use cuPointerGetAttribute(CU_POINTER_ATTRIBUTE_DEVICE_POINTER) |
| 485 | // instead? |
| 486 | CU_RETURN_NOT_OK("cuMemHostGetDevicePointer", |
| 487 | cuMemHostGetDevicePointer(&ptr, const_cast<uint8_t*>(cpu_data), 0)); |
| 488 | return static_cast<uintptr_t>(ptr); |
| 489 | } |
| 490 | |
| 491 | Result<uint8_t*> GetHostAddress(uintptr_t device_ptr) { |
| 492 | void* ptr; |
no outgoing calls
no test coverage detected