MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / FreeImpl

Method FreeImpl

paddle/phi/core/memory/allocation/cuda_managed_allocator.cc:37–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35bool CUDAManagedAllocator::IsAllocThreadSafe() const { return true; }
36
37void 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
48phi::Allocation* CUDAManagedAllocator::AllocateImpl(size_t size) {
49 std::call_once(once_flag_, [this] { platform::SetDeviceId(place_.device); });

Callers

nothing calls this directly

Calls 4

RecordedGpuFreeFunction · 0.85
placeMethod · 0.45
ptrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected