@@ -795,19 +795,6 @@ Error GenericDeviceTy::unloadBinary(DeviceImageTy *Image) {
795795 if (auto Err = callGlobalDestructors (Plugin, *Image))
796796 return Err;
797797
798- if (OMPX_DebugKind.get () & uint32_t (DeviceDebugKind::AllocationTracker)) {
799- GenericGlobalHandlerTy &GHandler = Plugin.getGlobalHandler ();
800- DeviceMemoryPoolTrackingTy ImageDeviceMemoryPoolTracking = {0 , 0 , ~0U , 0 };
801- GlobalTy TrackerGlobal (" __omp_rtl_device_memory_pool_tracker" ,
802- sizeof (DeviceMemoryPoolTrackingTy),
803- &ImageDeviceMemoryPoolTracking);
804- if (auto Err =
805- GHandler.readGlobalFromDevice (*this , *Image, TrackerGlobal)) {
806- consumeError (std::move (Err));
807- }
808- DeviceMemoryPoolTracking.combine (ImageDeviceMemoryPoolTracking);
809- }
810-
811798 GenericGlobalHandlerTy &Handler = Plugin.getGlobalHandler ();
812799 auto ProfOrErr = Handler.readProfilingGlobals (*this , *Image);
813800 if (!ProfOrErr)
@@ -833,22 +820,6 @@ Error GenericDeviceTy::deinit(GenericPluginTy &Plugin) {
833820 return Err;
834821 LoadedImages.clear ();
835822
836- if (OMPX_DebugKind.get () & uint32_t (DeviceDebugKind::AllocationTracker)) {
837- // TODO: Write this by default into a file.
838- printf (" \n\n |-----------------------\n "
839- " | Device memory tracker:\n "
840- " |-----------------------\n "
841- " | #Allocations: %lu\n "
842- " | Byes allocated: %lu\n "
843- " | Minimal allocation: %lu\n "
844- " | Maximal allocation: %lu\n "
845- " |-----------------------\n\n\n " ,
846- DeviceMemoryPoolTracking.NumAllocations ,
847- DeviceMemoryPoolTracking.AllocationTotal ,
848- DeviceMemoryPoolTracking.AllocationMin ,
849- DeviceMemoryPoolTracking.AllocationMax );
850- }
851-
852823 // Delete the memory manager before deinitializing the device. Otherwise,
853824 // we may delete device allocations after the device is deinitialized.
854825 if (MemoryManager)
@@ -901,18 +872,6 @@ Expected<DeviceImageTy *> GenericDeviceTy::loadBinary(GenericPluginTy &Plugin,
901872 // Add the image to list.
902873 LoadedImages.push_back (Image);
903874
904- // Setup the global device memory pool if needed.
905- if (!Plugin.getRecordReplay ().isReplaying () &&
906- shouldSetupDeviceMemoryPool ()) {
907- uint64_t HeapSize;
908- auto SizeOrErr = getDeviceHeapSize (HeapSize);
909- if (SizeOrErr) {
910- REPORT (" No global device memory pool due to error: %s\n " ,
911- toString (std::move (SizeOrErr)).data ());
912- } else if (auto Err = setupDeviceMemoryPool (Plugin, *Image, HeapSize))
913- return std::move (Err);
914- }
915-
916875 if (auto Err = setupRPCServer (Plugin, *Image))
917876 return std::move (Err);
918877
@@ -936,51 +895,6 @@ Expected<DeviceImageTy *> GenericDeviceTy::loadBinary(GenericPluginTy &Plugin,
936895 return Image;
937896}
938897
939- Error GenericDeviceTy::setupDeviceMemoryPool (GenericPluginTy &Plugin,
940- DeviceImageTy &Image,
941- uint64_t PoolSize) {
942- // Free the old pool, if any.
943- if (DeviceMemoryPool.Ptr ) {
944- if (auto Err = dataDelete (DeviceMemoryPool.Ptr ,
945- TargetAllocTy::TARGET_ALLOC_DEVICE))
946- return Err;
947- }
948-
949- DeviceMemoryPool.Size = PoolSize;
950- auto AllocOrErr = dataAlloc (PoolSize, /* HostPtr=*/ nullptr ,
951- TargetAllocTy::TARGET_ALLOC_DEVICE);
952- if (AllocOrErr) {
953- DeviceMemoryPool.Ptr = *AllocOrErr;
954- } else {
955- auto Err = AllocOrErr.takeError ();
956- REPORT (" Failure to allocate device memory for global memory pool: %s\n " ,
957- toString (std::move (Err)).data ());
958- DeviceMemoryPool.Ptr = nullptr ;
959- DeviceMemoryPool.Size = 0 ;
960- }
961-
962- // Create the metainfo of the device environment global.
963- GenericGlobalHandlerTy &GHandler = Plugin.getGlobalHandler ();
964- if (!GHandler.isSymbolInImage (*this , Image,
965- " __omp_rtl_device_memory_pool_tracker" )) {
966- DP (" Skip the memory pool as there is no tracker symbol in the image." );
967- return Error::success ();
968- }
969-
970- GlobalTy TrackerGlobal (" __omp_rtl_device_memory_pool_tracker" ,
971- sizeof (DeviceMemoryPoolTrackingTy),
972- &DeviceMemoryPoolTracking);
973- if (auto Err = GHandler.writeGlobalToDevice (*this , Image, TrackerGlobal))
974- return Err;
975-
976- // Create the metainfo of the device environment global.
977- GlobalTy DevEnvGlobal (" __omp_rtl_device_memory_pool" ,
978- sizeof (DeviceMemoryPoolTy), &DeviceMemoryPool);
979-
980- // Write device environment values to the device.
981- return GHandler.writeGlobalToDevice (*this , Image, DevEnvGlobal);
982- }
983-
984898Error GenericDeviceTy::setupRPCServer (GenericPluginTy &Plugin,
985899 DeviceImageTy &Image) {
986900 // The plugin either does not need an RPC server or it is unavailable.
0 commit comments