未验证 提交 6d70761e 编写于 作者: R risemeup1 提交者: GitHub

fix gcc12 error: mismatched-new-delete error in custom_device.cc (#47466)

上级 b1d74f11
......@@ -359,8 +359,7 @@ class CustomDevice : public DeviceInterface {
}
} else {
if (!pimpl_->memory_copy_p2p) {
std::unique_ptr<uint8_t> tmp(
reinterpret_cast<uint8_t*>(new uint8_t[size]));
std::unique_ptr<uint8_t[]> tmp(new uint8_t[size]);
MemoryCopyD2H(src_dev_id, tmp.get(), src, size);
MemoryCopyH2D(dst_dev_id, dst, tmp.get(), size);
} else {
......@@ -452,8 +451,7 @@ class CustomDevice : public DeviceInterface {
PADDLE_ENFORCE_CUSTOM_DEVICE_SUCCESS(
pimpl_->device_memory_set(device, ptr, value, size));
} else {
std::unique_ptr<uint8_t> tmp(
reinterpret_cast<uint8_t*>(new uint8_t[size]));
std::unique_ptr<uint8_t[]> tmp(new uint8_t[size]);
memset(tmp.get(), value, size);
MemoryCopyH2D(dev_id, ptr, tmp.get(), size);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册