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

Method WorkLoop

tensorflow/stream_executor/host/host_stream.cc:60–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58bool HostStream::WorkAvailable() { return !work_queue_.empty(); }
59
60void HostStream::WorkLoop() {
61 // Set denormal and rounding behavior to match the default TF ThreadPool
62 // behavior.
63 // TODO(phawkins, jlebar): it's not clear this is the best place to set this.
64 tensorflow::port::ScopedFlushDenormal flush;
65 tensorflow::port::ScopedSetRound round(FE_TONEAREST);
66 while (true) {
67 std::function<void()> fn;
68 {
69 absl::MutexLock lock(&mu_);
70 mu_.Await(absl::Condition(this, &HostStream::WorkAvailable));
71 fn = std::move(work_queue_.front());
72 work_queue_.pop();
73 }
74 if (!fn) {
75 return;
76 }
77 fn();
78 }
79}
80
81void HostStream::BlockUntilDone() {
82 absl::Notification done;

Callers

nothing calls this directly

Calls 5

ConditionClass · 0.85
fnFunction · 0.50
AwaitMethod · 0.45
frontMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected