Fix late-coming issues. (#1724)

Implementation for hipMemcpyWithStream.


[ROCm/clr commit: 150e690a3a]
This commit is contained in:
Alex Voicu
2019-12-23 15:41:24 +02:00
committed by Maneesh Gupta
parent 36b23663e0
commit 1f762e3970
8 changed files with 473 additions and 155 deletions
+10 -8
View File
@@ -1619,16 +1619,18 @@ hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, dim3 block, grid_
lp->group_dim.y = block.y;
lp->group_dim.z = block.z;
lp->barrier_bit = barrier_bit_queue_default;
lp->launch_fence = -1;
if (!lockAcquired) {
auto crit = stream->lockopen_preKernelCommand();
lp->av = &(crit->_av);
} else {
// this stream is already locked (e.g., call from hipExtLaunchMultiKernelMultiDevice)
lp->av = &(stream->criticalData()._av);
}
if (!lockAcquired) stream->lockopen_preKernelCommand();
auto &crit = stream->criticalData();
lp->av = &(crit._av);
lp->cf = nullptr;
auto acq = (HCC_OPT_FLUSH && !crit._last_op_was_a_copy) ?
HSA_FENCE_SCOPE_AGENT : HSA_FENCE_SCOPE_SYSTEM;
auto rel = HCC_OPT_FLUSH ?
HSA_FENCE_SCOPE_AGENT : HSA_FENCE_SCOPE_SYSTEM;
lp->launch_fence = (acq << HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE) |
(rel << HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE);
crit._last_op_was_a_copy = false;
ihipPrintKernelLaunch(kernelNameStr, lp, stream);
return (stream);