Skip to content

Commit

Permalink
Merge pull request #34 from ROCm/rocm-jaxlib-v0.4.30-qa-d2hmem-stream…
Browse files Browse the repository at this point in the history
…-copy

Let the other stream wait for the main stream before issuing memcpy d2h
  • Loading branch information
i-chaochen authored Aug 8, 2024
2 parents 973f86b + b1ac447 commit 62b0e7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xla/service/gpu/runtime/copy_thunk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,13 @@ absl::Status DeviceToHostCopyThunk::ExecuteOnStream(
TF_ASSIGN_OR_RETURN(
se::Stream * stream,
GetStreamForExecution(Thunk::execution_stream_id(), params));
TF_RETURN_IF_ERROR(stream->WaitFor(params.stream));
TF_RETURN_IF_ERROR(stream->Memcpy(cpu_dst, source_data, size_bytes()));
if (stream == params.stream) {
VLOG(2) << "Memcpy D2H from the main stream";
return absl::OkStatus();
}
VLOG(2) << "Memcpy D2H from the other stream";
VLOG(2) << "Memcpy D2H from the stream " << Thunk::execution_stream_id();
se::StreamExecutor* executor = params.stream->parent();
TF_ASSIGN_OR_RETURN(auto event, executor->CreateEvent());
// Record memcpy operation completion.
Expand Down

0 comments on commit 62b0e7b

Please sign in to comment.