pytorch
d8d9ecbf - Fix building with Werror (#83275)

Commit
3 years ago
Fix building with Werror (#83275) PR #82146 made `Block` non-copyable by adding a `unique_ptr` member, and used this hacky work-around to copy it anyway. However, it fails under -Werror with this message: ``` ../c10/cuda/CUDACachingAllocator.cpp:1411:51: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct c10::cuda::CUDACachingAllocator::{anonymous}::Block’ with no trivial copy-assignment [-Werror=class-memaccess] 1411 | std::memcpy(&key, &p.search_key, sizeof(Block)); ``` Instead, this constructs a new `Block` with all the relevant properties copied. Pull Request resolved: https://github.com/pytorch/pytorch/pull/83275 Approved by: https://github.com/malfet
Author
Committer
Parents
Loading