| 35 | bool CUDAManagedAllocator::IsAllocThreadSafe() const { return true; } |
| 36 | |
| 37 | void CUDAManagedAllocator::FreeImpl(phi::Allocation* allocation) { |
| 38 | PADDLE_ENFORCE_EQ( |
| 39 | allocation->place(), |
| 40 | place_, |
| 41 | common::errors::PermissionDenied( |
| 42 | "GPU memory is freed in incorrect device. This may be a bug")); |
| 43 | platform::RecordedGpuFree( |
| 44 | allocation->ptr(), allocation->size(), place_.device); |
| 45 | delete allocation; |
| 46 | } |
| 47 | |
| 48 | phi::Allocation* CUDAManagedAllocator::AllocateImpl(size_t size) { |
| 49 | std::call_once(once_flag_, [this] { platform::SetDeviceId(place_.device); }); |
nothing calls this directly
no test coverage detected