SWDEV-489084 - Avoid using queue colliding with the graph launch stream
Change-Id: I3ecaf8836c8e0883441275139041c702aba0937e
This commit is contained in:
committed by
Anusha Godavarthy Surya
parent
019abdc3bd
commit
06e6561eb5
@@ -413,7 +413,8 @@ hipError_t GraphExec::Init() {
|
||||
}
|
||||
status = CreateStreams(parallelLists_.size() - 1 + min_num_streams);
|
||||
} else {
|
||||
status = CreateStreams(clonedGraph_->max_streams_);
|
||||
// create extra stream to avoid queue collision with the default execution stream
|
||||
status = CreateStreams(clonedGraph_->max_streams_ + 1);
|
||||
}
|
||||
if (status != hipSuccess) {
|
||||
return status;
|
||||
@@ -638,20 +639,24 @@ hipError_t EnqueueGraphWithSingleList(std::vector<hip::Node>& topoOrder, hip::St
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void Graph::UpdateStreams(
|
||||
hip::Stream* launch_stream,
|
||||
const std::vector<hip::Stream*>& parallel_streams) {
|
||||
void Graph::UpdateStreams(hip::Stream* launch_stream,
|
||||
const std::vector<hip::Stream*>& parallel_streams) {
|
||||
// Allocate array for parallel streams, based on the graph scheduling + current stream
|
||||
streams_.resize(parallel_streams.size() + 1);
|
||||
|
||||
// We create extra stream to avoid collision
|
||||
streams_.resize(parallel_streams.size());
|
||||
// Current stream is the default in the assignment
|
||||
streams_[0] = launch_stream;
|
||||
// Assign the streams in the array of all streams
|
||||
for (uint32_t i = 0; i < parallel_streams.size(); ++i) {
|
||||
streams_[i + 1] = parallel_streams[i];
|
||||
// Avoid stream that has collision with launch stream
|
||||
for (uint32_t i = 1, j = 0; i < streams_.size(); j++) {
|
||||
assert(j != parallel_streams.size());
|
||||
if (launch_stream->getQueueID() != parallel_streams[j]->getQueueID()) {
|
||||
streams_[i++] = parallel_streams[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
bool Graph::RunOneNode(Node node, bool wait) {
|
||||
if (node->launch_id_ == -1) {
|
||||
|
||||
Reference in New Issue
Block a user