mirror of
https://github.com/immich-app/immich.git
synced 2025-01-19 18:26:46 +01:00
use OrtMutex
This commit is contained in:
parent
c6be55727f
commit
cbc3e4ef47
2 changed files with 11 additions and 25 deletions
|
@ -1,15 +1,14 @@
|
|||
From f1ba51901c8af0f426572e217c0db2e752e3e0de Mon Sep 17 00:00:00 2001
|
||||
From e267bc9bab8b3873dba57323ddcd9a9d09a1211e Mon Sep 17 00:00:00 2001
|
||||
From: mertalev <101130780+mertalev@users.noreply.github.com>
|
||||
Date: Thu, 19 Dec 2024 20:26:40 -0500
|
||||
Date: Fri, 20 Dec 2024 00:59:21 -0500
|
||||
Subject: [PATCH] fix: avoid race condition for rocm conv algo caching
|
||||
|
||||
---
|
||||
onnxruntime/core/providers/rocm/nn/conv.cc | 2 ++
|
||||
onnxruntime/core/providers/rocm/nn/conv_transpose.cc | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
onnxruntime/core/providers/rocm/nn/conv.cc | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/onnxruntime/core/providers/rocm/nn/conv.cc b/onnxruntime/core/providers/rocm/nn/conv.cc
|
||||
index f99885634b..c9b6c0e93b 100644
|
||||
index d7f47d07a8..ec438287ac 100644
|
||||
--- a/onnxruntime/core/providers/rocm/nn/conv.cc
|
||||
+++ b/onnxruntime/core/providers/rocm/nn/conv.cc
|
||||
@@ -278,6 +278,8 @@ Status Conv<T, NHWC>::UpdateState(OpKernelContext* context, bool bias_expected)
|
||||
|
@ -17,23 +16,10 @@ index f99885634b..c9b6c0e93b 100644
|
|||
}
|
||||
|
||||
+ // lock is needed to avoid race condition during algo search
|
||||
+ std::lock_guard<std::mutex> lock(s_.mutex);
|
||||
+ std::lock_guard<OrtMutex> lock(s_.mutex);
|
||||
if (!s_.cached_benchmark_fwd_results.contains(x_dims_miopen)) {
|
||||
miopenConvAlgoPerf_t perf;
|
||||
int algo_count = 1;
|
||||
diff --git a/onnxruntime/core/providers/rocm/nn/conv_transpose.cc b/onnxruntime/core/providers/rocm/nn/conv_transpose.cc
|
||||
index a6848e90b4..59426cf777 100644
|
||||
--- a/onnxruntime/core/providers/rocm/nn/conv_transpose.cc
|
||||
+++ b/onnxruntime/core/providers/rocm/nn/conv_transpose.cc
|
||||
@@ -127,6 +127,8 @@ Status ConvTranspose<T, NHWC>::DoConvTranspose(OpKernelContext* context, bool dy
|
||||
|
||||
y_data = reinterpret_cast<HipT*>(p.Y->MutableData<T>());
|
||||
|
||||
+ // lock is needed to avoid race condition during algo search
|
||||
+ std::lock_guard<std::mutex> lock(s_.mutex);
|
||||
if (!s_.cached_benchmark_bwd_results.contains(x_dims)) {
|
||||
IAllocatorUniquePtr<void> algo_search_workspace = GetScratchBuffer<void>(AlgoSearchWorkspaceSize, context->GetComputeStream());
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ WORKDIR /code
|
|||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends wget git python3.12-venv
|
||||
# Install same version as the Dockerfile provided by onnxruntime
|
||||
RUN wget https://github.com/Kitware/CMake/releases/download/v3.27.3/cmake-3.27.3-linux-x86_64.sh && \
|
||||
RUN wget -nv https://github.com/Kitware/CMake/releases/download/v3.27.3/cmake-3.27.3-linux-x86_64.sh && \
|
||||
chmod +x cmake-3.27.3-linux-x86_64.sh && \
|
||||
mkdir -p /code/cmake-3.27.3-linux-x86_64 && \
|
||||
./cmake-3.27.3-linux-x86_64.sh --skip-license --prefix=/code/cmake-3.27.3-linux-x86_64 && \
|
||||
|
@ -77,10 +77,10 @@ FROM prod-cpu AS prod-openvino
|
|||
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends -yqq ocl-icd-libopencl1 wget && \
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-core_1.0.17384.11_amd64.deb && \
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-opencl_1.0.17384.11_amd64.deb && \
|
||||
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-opencl-icd_24.31.30508.7_amd64.deb && \
|
||||
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/libigdgmm12_22.4.1_amd64.deb && \
|
||||
wget -nv https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-core_1.0.17384.11_amd64.deb && \
|
||||
wget -nv https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-opencl_1.0.17384.11_amd64.deb && \
|
||||
wget -nv https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-opencl-icd_24.31.30508.7_amd64.deb && \
|
||||
wget -nv https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/libigdgmm12_22.4.1_amd64.deb && \
|
||||
dpkg -i *.deb && \
|
||||
rm *.deb && \
|
||||
apt-get remove wget -yqq && \
|
||||
|
|
Loading…
Reference in a new issue