MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BlockHostUntilReady

Method BlockHostUntilReady

tensorflow/compiler/xla/python/local_client.cc:526–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526Status PyLocalBuffer::BlockHostUntilReady() {
527 tensorflow::profiler::TraceMe traceme("PyLocalBuffer::BlockHostUntilReady");
528 std::shared_ptr<SharedDeviceBuffer> device_buffer = DeviceBuffer();
529 if (!device_buffer) {
530 return InvalidArgument("BlockHostUntilReady() called on invalid buffer.");
531 }
532
533 // This code waits at least until the buffer is ready, but it may wait longer
534 // if there are other device to host transfers scheduled. If this proves to
535 // be an issue, we could either use a separate stream for this purpose, or
536 // poll for the buffer definition events.
537 se::Stream* stream =
538 client_->device_state(device_->local_device_state()->device_ordinal())
539 .GetDeviceToHostStream();
540 WaitForBufferDefinitionEventsOnStream(*device_buffer, stream);
541 return stream->BlockHostUntilDone();
542}
543
544static std::shared_ptr<Device> LookupDevice(const PyLocalClient& client,
545 int device_id) {

Callers 3

PyLocalBufferGetBufferFunction · 0.45
PYBIND11_MODULEFunction · 0.45

Calls 6

InvalidArgumentFunction · 0.85
GetDeviceToHostStreamMethod · 0.80
local_device_stateMethod · 0.80
device_ordinalMethod · 0.45
BlockHostUntilDoneMethod · 0.45

Tested by

no test coverage detected