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

Method GetHandle

tensorflow/stream_executor/rocm/rocm_dnn.cc:477–485  ·  view source on GitHub ↗

Creates a MIOpenHandle instance for stream. MIOpen API calls using the same handle instance need to be serialized across threads. This is guaranteed by MIOpenHandle instances locking the mutex owned by this class. Most MIOpen APIs taking a handle perform work on a HIP stream. The MIOpenHandle instance acquires the executor's ROCm context and sets MIOpen to use the provided stream. The stream ar

Source from the content-addressed store, hash-verified

475 // therefore a bad idea (performance wise) to call any MIOpen APIs that
476 // enqueue work in the stream.
477 MIOpenHandle GetHandle(GpuExecutor* executor, Stream* stream) {
478 auto lock = absl::make_unique<absl::MutexLock>(&mutex_);
479 mutex_.AssertHeld();
480 gpu::ScopedActivateExecutorContext context(executor);
481 hipStream_t hip_stream = stream ? AsGpuStreamValue(stream) : nullptr;
482 auto status = wrap::miopenSetStream(handle_, hip_stream);
483 CHECK_EQ(status, miopenStatusSuccess) << "Failed to set MIOpen stream.";
484 return MIOpenHandle(std::move(context), std::move(lock), handle_);
485 }
486
487 private:
488 // Guards the enqueueing of MIOpen operations via the handle_ below.

Callers 15

DoRnnForwardImplMethod · 0.45
DoRnnBackwardImplMethod · 0.45
createRnnDescriptorMethod · 0.45
DoConvolveMethod · 0.45
DoBiasAddMethod · 0.45
DoPoolForwardMethod · 0.45
DoPoolBackwardMethod · 0.45

Calls 2

AsGpuStreamValueFunction · 0.85
MIOpenHandleClass · 0.85

Tested by

no test coverage detected