From ac927dd94e86971bc788c48f05b342a2bc68ebc8 Mon Sep 17 00:00:00 2001 From: Anusha GodavarthySurya Date: Mon, 25 Nov 2024 11:08:09 +0000 Subject: [PATCH] SWDEV-489084 - Update max streams for graph Change-Id: I6d0992b2e80ebf3184911593a4f3574327b2e9c3 [ROCm/clr commit: fb7ad8361caca6a46579c9bc933bea32e8d6d561] --- projects/clr/hipamd/src/hip_graph_internal.cpp | 4 ++-- projects/clr/hipamd/src/hip_graph_internal.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph_internal.cpp b/projects/clr/hipamd/src/hip_graph_internal.cpp index 42851cc1fb..e858b444be 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.cpp +++ b/projects/clr/hipamd/src/hip_graph_internal.cpp @@ -247,7 +247,7 @@ void Graph::ScheduleOneNode(Node node, int stream_id) { if (node->stream_id_ == -1) { // Assign active stream to the current node node->stream_id_ = stream_id; - max_streams_ = std::max(max_streams_, stream_id); + max_streams_ = std::max(max_streams_, (stream_id + 1)); // Update the dependencies if a signal is required for (auto dep: node->GetDependencies()) { @@ -414,7 +414,7 @@ hipError_t GraphExec::Init() { status = CreateStreams(parallelLists_.size() - 1 + min_num_streams); } else { // create extra stream to avoid queue collision with the default execution stream - status = CreateStreams(clonedGraph_->max_streams_ + 1); + status = CreateStreams(clonedGraph_->max_streams_); } if (status != hipSuccess) { return status; diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index fac8b61e81..682fb2776c 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -488,7 +488,7 @@ struct Graph { std::unordered_map graphUserObj_; unsigned int id_; static int nextID; - int max_streams_ = 0; //!< Maximum number of extra streams used in the graph launch + int max_streams_ = 0; //!< Maximum number of streams used in the graph launch uint32_t memalloc_nodes_ = 0; //!< Count of unreleased Memalloc nodes std::vector roots_; //!< Root nodes, used in parallel launches std::vector leafs_; //!< The list of leaf nodes on every parallel stream