| 350 | } |
| 351 | |
| 352 | std::shared_ptr<XrtRecvTensorFuture> XrtTfContext::RecvTensor( |
| 353 | const XrtTensorHandle& tensor, DataType dtype, bool host_memory) { |
| 354 | auto response = std::make_shared<XrtRecvTensorFuture>(); |
| 355 | |
| 356 | int device_id = tensor.device_id(); |
| 357 | |
| 358 | std::string wire_id = XrtGetUniqueWireID(); |
| 359 | EnqueueSend(this, tensor, dtype, /*recv_device_id=*/-1, wire_id, |
| 360 | /*host_memory=*/host_memory, /*future=*/response); |
| 361 | |
| 362 | const DeviceAttributes& device = devices().at(device_id); |
| 363 | RecvTensorRequest request; |
| 364 | request.set_step_id(rendezvous_id_); |
| 365 | request.set_rendezvous_key(GetRendezvousKey(device.name(), |
| 366 | GetReceiverDevice(this, -1), |
| 367 | device.incarnation(), wire_id)); |
| 368 | request.set_request_id(GetUniqueRequestId()); |
| 369 | // TODO(phawkins): verify uniqueness of request ID. Random IDs won't collide |
| 370 | // with high probability, but we should probably add code to guard against |
| 371 | // collisions nonetheless. |
| 372 | |
| 373 | eager_client_->RecvTensorAsync( |
| 374 | &request, &response->value_, |
| 375 | [response, wire_id](Status status) { |
| 376 | VLOG(10) << "RecvTensor complete for " << wire_id; |
| 377 | response->Notify(status); |
| 378 | }, |
| 379 | &response->call_options_); |
| 380 | return response; |
| 381 | } |
| 382 | |
| 383 | Status XrtTfContext::RegisterFunction(const FunctionDef& def) { |
| 384 | eager::RegisterFunctionRequest request; |