Skip to content

Commit

Permalink
fix variable reference
Browse files Browse the repository at this point in the history
  • Loading branch information
mertalev committed Jan 5, 2025
1 parent d564d69 commit 062b80e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions machine-learning/0001-fix-rocm-conv-thread-safety.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 60e2603045f220d560ed92e03c8804a806f5a325 Mon Sep 17 00:00:00 2001
From b78fa4d8950a9a3935a703f04f51b5cdb6ecd680 Mon Sep 17 00:00:00 2001
From: mertalev <[email protected]>
Date: Fri, 20 Dec 2024 00:59:21 -0500
Subject: [PATCH] fix: avoid race condition for rocm conv algo caching
Subject: [PATCH 1/1] fix: avoid race condition for rocm conv algo caching

---
onnxruntime/core/providers/rocm/nn/conv.cc | 8 ++++----
Expand Down Expand Up @@ -44,15 +44,15 @@ index d7f47d07a8..98b6b69212 100644
s_.workspace_bytes = perf.memory;
} else {
diff --git a/onnxruntime/core/providers/rocm/nn/conv.h b/onnxruntime/core/providers/rocm/nn/conv.h
index bc9846203e..0b07ee3f08 100644
index bc9846203e..875e20e433 100644
--- a/onnxruntime/core/providers/rocm/nn/conv.h
+++ b/onnxruntime/core/providers/rocm/nn/conv.h
@@ -43,6 +43,10 @@ struct vector_hash {
}
};

+inline std::size_t HashConvAlgoKey(const TensorShapeVector& x_dims, const TensorShapeVector& w_dims) {
+ return std::hash<vector_hash>()(values.x_dims) ^ std::hash<vector_hash>()(values.w_dims);
+ return std::hash<vector_hash>()(x_dims) ^ std::hash<vector_hash>()(w_dims);
+}
+
template <typename Key, typename T,
Expand Down Expand Up @@ -110,7 +110,7 @@ index bc9846203e..0b07ee3f08 100644
// Some properties needed to support asymmetric padded Conv nodes
bool post_slicing_required;
diff --git a/onnxruntime/core/providers/rocm/nn/conv_transpose.cc b/onnxruntime/core/providers/rocm/nn/conv_transpose.cc
index 7447113fdf..495aafa200 100644
index 7447113fdf..dea9bf2a05 100644
--- a/onnxruntime/core/providers/rocm/nn/conv_transpose.cc
+++ b/onnxruntime/core/providers/rocm/nn/conv_transpose.cc
@@ -76,7 +76,6 @@ Status ConvTranspose<T, NHWC>::DoConvTranspose(OpKernelContext* context, bool dy
Expand Down
2 changes: 2 additions & 0 deletions machine-learning/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN mkdir /opt/armnn && \

# Warning: 26.3Gb of disk space required to pull this image
# https://github.com/microsoft/onnxruntime/blob/main/dockerfiles/Dockerfile.rocm
# 6.2 or later fails to build as of writing
FROM rocm/dev-ubuntu-22.04:6.1.2-complete AS builder-rocm

WORKDIR /code
Expand All @@ -32,6 +33,7 @@ RUN wget -nv https://github.com/Kitware/CMake/releases/download/v3.27.3/cmake-3.
ENV PATH /code/cmake-3.27.3-linux-x86_64/bin:${PATH}

# Prepare onnxruntime repository & build onnxruntime
# 1.20.1 fails to build as of writing
RUN git clone --single-branch --branch v1.19.2 --recursive "https://github.com/Microsoft/onnxruntime" onnxruntime
WORKDIR /code/onnxruntime
# Fix for multi-threading based on comments in https://github.com/microsoft/onnxruntime/pull/19567
Expand Down

0 comments on commit 062b80e

Please sign in to comment.