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