Skip to content

Commit

Permalink
SWDEV-263678 - fix rocHPCG mgpu perf drop
Browse files Browse the repository at this point in the history
Change-Id: I33269fe4f6165d1ed172b19033ab9fcb92f338c3
  • Loading branch information
satyanveshd authored and adilad committed Feb 16, 2021
1 parent c34d43d commit c3eb5cc
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions rocclr/hip_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,31 @@ hipError_t ihipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKin
}
} else {
amd::HostQueue* pQueue = &queue;
if (((srcMemory->getContext().devices()[0] == dstMemory->getContext().devices()[0]) ||
(srcMemory->getContext().devices().size() != 1) ||
(dstMemory->getContext().devices().size() != 1)) &&
if ((srcMemory->getContext().devices()[0] == dstMemory->getContext().devices()[0]) &&
(queueDevice != srcMemory->getContext().devices()[0])) {
pQueue = hip::getNullStream(srcMemory->getContext());
amd::Command* cmd = queue.getLastQueuedCommand(true);
if (cmd != nullptr) {
waitList.push_back(cmd);
}
} else if (srcMemory->getContext().devices()[0] != dstMemory->getContext().devices()[0]) {
// Scenarios such as DtoH where dst is pinned memory
if ((queueDevice != srcMemory->getContext().devices()[0]) &&
(dstMemory->getContext().devices().size() != 1)) {
pQueue = hip::getNullStream(srcMemory->getContext());
amd::Command* cmd = queue.getLastQueuedCommand(true);
if (cmd != nullptr) {
waitList.push_back(cmd);
}
// Scenarios such as HtoD where src is pinned memory
} else if ((queueDevice != dstMemory->getContext().devices()[0]) &&
(srcMemory->getContext().devices().size() != 1)) {
pQueue = hip::getNullStream(dstMemory->getContext());
amd::Command* cmd = queue.getLastQueuedCommand(true);
if (cmd != nullptr) {
waitList.push_back(cmd);
}
}
}
command = new amd::CopyMemoryCommand(*pQueue, CL_COMMAND_COPY_BUFFER, waitList,
*srcMemory->asBuffer(), *dstMemory->asBuffer(), sOffset, dOffset, sizeBytes);
Expand Down

0 comments on commit c3eb5cc

Please sign in to comment.