From 526be01a395412707834c90ee5d2d5397c99bad4 Mon Sep 17 00:00:00 2001 From: Aganlengzi Date: Mon, 11 Jul 2022 16:05:58 +0800 Subject: [PATCH] [CustomDevice]support fast_eager_deletion_mode (#44211) --- paddle/fluid/imperative/tracer.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/imperative/tracer.cc b/paddle/fluid/imperative/tracer.cc index 4c99bfc248..07eb9ae6a8 100644 --- a/paddle/fluid/imperative/tracer.cc +++ b/paddle/fluid/imperative/tracer.cc @@ -161,8 +161,14 @@ paddle::framework::GarbageCollector* Tracer::MutableGarbageCollectorIfNotExists( #endif } else if (platform::is_custom_place(place)) { #if defined(PADDLE_WITH_CUSTOM_DEVICE) - gc.reset(new framework::CustomDefaultStreamGarbageCollector(place, 0)); - VLOG(10) << "Created GarbageCollector at " << place; + if (framework::IsFastEagerDeletionModeEnabled()) { + gc.reset( + new framework::CustomDeviceUnsafeFastGarbageCollector(place, 0)); + VLOG(10) << "Created UnsafeFastGarbageCollector at " << place; + } else { + gc.reset(new framework::CustomDefaultStreamGarbageCollector(place, 0)); + VLOG(10) << "Created GarbageCollector at " << place; + } #else PADDLE_THROW(platform::errors::PermissionDenied( "Paddle can't use CustomDevice since it's not compiled with " -- GitLab