Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes SWDEV-483388 #74

Conversation

xinyazhang
Copy link

GPU memory copy should use the provided stream.

@@ -57,7 +57,7 @@ common::Status GPUDataTransfer::CopyTensorAsync(const Tensor& src, Tensor& dst,
HIP_CALL_THROW(hipMemcpyAsync(dst_data, src_data, bytes, hipMemcpyDeviceToDevice, static_cast<hipStream_t>(stream.GetHandle())));
} else {
// copy from other CPU memory to GPU, this is blocking
HIP_CALL_THROW(hipMemcpy(dst_data, src_data, bytes, hipMemcpyHostToDevice));
HIP_CALL_THROW(hipMemcpyWithStream(dst_data, src_data, bytes, hipMemcpyHostToDevice, static_cast<hipStream_t>(stream.GetHandle())));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix lint. Also, I thought we wanted to block in this case, but I suppose this allows only MIGraphX EP to block on stream now since this gpu_data_transfer isn't shared between both EPs.

@@ -1432,7 +1432,11 @@ Status MIGraphXExecutionProvider::Compile(const std::vector<FusedNodeAndGraph>&
std::vector<int64_t> ort_shape{res_lens.begin(), res_lens.end()};
auto output_tensor = ctx.GetOutput(i, ort_shape.data(), ort_shape.size());
void* output_data = output_tensor.GetTensorMutableRawData();
HIP_CALL_THROW(hipMemcpy(output_data, gpu_res.data(), res_shape.bytes(), hipMemcpyDeviceToDevice));
HIP_CALL_THROW(hipMemcpyWithStream(output_data,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With MIGraphX we perform the run_async as part of the eval() which streams execution. Were you seeing stale data somehow with this memcopy for networks with many outputs? Tried this with Bert and didn't see a change in perf but curious as to why this changed.

@TedThemistokleous TedThemistokleous merged commit d9f0ef8 into rocm6.3_internal_testing Nov 11, 2024
10 of 15 checks passed
@TedThemistokleous
Copy link

merging this as this was put in upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants