Skip to content

Commit

Permalink
fix gcc12 error: mismatched-new-delete error in custom_device.cc (#47466
Browse files Browse the repository at this point in the history
)
  • Loading branch information
risemeup1 authored Feb 6, 2023
1 parent b1d74f1 commit 6d70761
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions paddle/phi/backends/custom/custom_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6d70761

Please sign in to comment.