static
| 467 | |
| 468 | // static |
| 469 | void GPUUtil::CopyGPUTensorToSameGPU(Device* gpu_device, |
| 470 | const DeviceContext* device_context, |
| 471 | const Tensor* src_gpu_tensor, |
| 472 | Tensor* dst_gpu_tensor, |
| 473 | StatusCallback done) { |
| 474 | VLOG(1) << "CopyGPUTensorToSameGPU"; |
| 475 | const DeviceBase::GpuDeviceInfo* dev_info = nullptr; |
| 476 | se::Stream* send_stream = nullptr; |
| 477 | Status s = PrepareCopy(gpu_device, device_context, *src_gpu_tensor, |
| 478 | dst_gpu_tensor, &dev_info, &send_stream); |
| 479 | if (!s.ok()) { |
| 480 | done(s); |
| 481 | return; |
| 482 | } |
| 483 | |
| 484 | const int64 total_bytes = src_gpu_tensor->TotalBytes(); |
| 485 | if (total_bytes > 0) { |
| 486 | void* src_ptr = GetBase(src_gpu_tensor); |
| 487 | DeviceMemoryBase gpu_src_ptr(src_ptr, total_bytes); |
| 488 | void* dst_ptr = GetBase(dst_gpu_tensor); |
| 489 | DeviceMemoryBase gpu_dst_ptr(dst_ptr, total_bytes); |
| 490 | send_stream->ThenMemcpy(&gpu_dst_ptr, gpu_src_ptr, total_bytes); |
| 491 | } |
| 492 | |
| 493 | done(Status::OK()); |
| 494 | } |
| 495 | |
| 496 | } // namespace tensorflow |
nothing calls this directly
no test coverage detected