未验证 提交 a1bdc652 编写于 作者: W wanghuancoder 提交者: GitHub

for xpu multi thread bug test (#48373)

* for xpu multi thread bug test
上级 c6de4342
...@@ -169,12 +169,19 @@ void MemcpySyncD2D(void* dst, ...@@ -169,12 +169,19 @@ void MemcpySyncD2D(void* dst,
const phi::XPUContext& dev_ctx) { const phi::XPUContext& dev_ctx) {
int dev_id = GetXPUCurrentDeviceId(); int dev_id = GetXPUCurrentDeviceId();
if (dst_place.device == dev_id && src_place.device == dev_id) { if (dst_place.device == dev_id && src_place.device == dev_id) {
PADDLE_ENFORCE_XDNN_SUCCESS( dev_ctx.Wait();
baidu::xpu::api::copy(dev_ctx.x_context(), char* tmp = new char[count];
static_cast<const int8_t*>(src), PADDLE_ENFORCE_XPU_SUCCESS(
static_cast<int8_t*>(dst), xpu_memcpy(tmp, src, count, XPUMemcpyKind::XPU_DEVICE_TO_HOST));
count), PADDLE_ENFORCE_XPU_SUCCESS(
"copy "); xpu_memcpy(dst, tmp, count, XPUMemcpyKind::XPU_HOST_TO_DEVICE));
delete[] tmp;
// PADDLE_ENFORCE_XDNN_SUCCESS(
// baidu::xpu::api::copy(dev_ctx.x_context(),
// static_cast<const int8_t*>(src),
// static_cast<int8_t*>(dst),
// count),
// "copy ");
} else { } else {
PADDLE_ENFORCE_XPU_SUCCESS( PADDLE_ENFORCE_XPU_SUCCESS(
xpu_memcpy_peer(dst_place.device, dst, src_place.device, src, count)); xpu_memcpy_peer(dst_place.device, dst, src_place.device, src, count));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册