From a3632b00a47a6d655ad71e7709ddeca159443398 Mon Sep 17 00:00:00 2001 From: Xinya Zhang Date: Mon, 11 Nov 2024 13:55:35 -0600 Subject: [PATCH] Fixes SWDEV-483388 (#74) * Fix SWDEV-483388: mistakenly invoke hipMemcpy when ORT_ENABLE_STREAM=True * Fix another hipMemcpy * Remove MIGRAPHX_STREAM_SYNC guard which does not exists in current version. --- onnxruntime/core/providers/migraphx/gpu_data_transfer.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/onnxruntime/core/providers/migraphx/gpu_data_transfer.cc b/onnxruntime/core/providers/migraphx/gpu_data_transfer.cc index 77c5e18a5878e..a643f6b208f94 100644 --- a/onnxruntime/core/providers/migraphx/gpu_data_transfer.cc +++ b/onnxruntime/core/providers/migraphx/gpu_data_transfer.cc @@ -67,6 +67,9 @@ common::Status GPUDataTransfer::CopyTensorAsync(const Tensor& src, Tensor& dst, } else if (src_device.Type() == OrtDevice::GPU) { // copying between GPU, this is non-blocking HIP_CALL_THROW(hipMemcpyAsync(dst_data, src_data, bytes, hipMemcpyDeviceToDevice, static_cast(stream.GetHandle()))); + } else { + // copy from other CPU memory to GPU, this is blocking + HIP_CALL_THROW(hipMemcpyWithStream(dst_data, src_data, bytes, hipMemcpyHostToDevice, static_cast(stream.GetHandle()))); } } else if (src_device.Type() == OrtDevice::GPU) { // If dest are not pinned, the memory copy will be performed synchronously.