From 2b3296a4efa8cb79d99059f7d6a2349fde292acc Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Tue, 7 Jun 2022 13:20:21 -0400 Subject: [PATCH] SWDEV-259998 - Change the location of RGP init calls Move StartLateDeviceInit() and FinishDeviceInit() calls in RGP server to avoid a timeout Change-Id: Ifd681859c7dc76259d7296aa8cc15305d563c9b2 [ROCm/clr commit: ecea224bcfda60523a3bc3bba039373f29bd8f2d] --- projects/clr/rocclr/device/pal/paldevice.cpp | 18 ++++++++++++++++++ projects/clr/rocclr/device/pal/palgpuopen.cpp | 11 ----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/projects/clr/rocclr/device/pal/paldevice.cpp b/projects/clr/rocclr/device/pal/paldevice.cpp index c0fe12595e..d8e38f55dd 100644 --- a/projects/clr/rocclr/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/device/pal/paldevice.cpp @@ -57,6 +57,14 @@ #include #include +#ifdef PAL_GPUOPEN_OCL +// gpuutil headers +#include "gpuUtil/palGpaSession.h" +#include "devDriverServer.h" +#include "protocols/rgpServer.h" +#include "protocols/driverControlServer.h" +#endif // PAL_GPUOPEN_OCL + namespace { //! Define the mapping from PAL asic revision enumeration values to the @@ -1289,6 +1297,16 @@ bool Device::init() { return false; } +#ifdef PAL_GPUOPEN_OCL + if ((platform_->GetDevDriverServer() != nullptr) && + (platform_->GetDevDriverServer()->GetDriverControlServer() != nullptr)) { + // Make sure the devdriver initialization is done after Pal platform creation + // to avoid a timeout in RGP server + platform_->GetDevDriverServer()->GetDriverControlServer()->StartLateDeviceInit(); + platform_->GetDevDriverServer()->GetDriverControlServer()->FinishDeviceInit(); + } +#endif // PAL_GPUOPEN_OCL + // Get the total number of active devices // Count up all the devices in the system. platform_->EnumerateDevices(&gNumDevices, &gDeviceList[0]); diff --git a/projects/clr/rocclr/device/pal/palgpuopen.cpp b/projects/clr/rocclr/device/pal/palgpuopen.cpp index 3187782674..f473bc2dbd 100644 --- a/projects/clr/rocclr/device/pal/palgpuopen.cpp +++ b/projects/clr/rocclr/device/pal/palgpuopen.cpp @@ -245,8 +245,6 @@ void RgpCaptureMgr::Finalize() { rgp_server_->DisableTraces(); } - dev_driver_server_->GetDriverControlServer()->StartLateDeviceInit(); - // Finalize the devmode manager dev_driver_server_->Finalize(); @@ -776,15 +774,6 @@ void RgpCaptureMgr::PostDeviceCreate() { auto* pDriverControlServer = dev_driver_server_->GetDriverControlServer(); assert(pDriverControlServer != nullptr); - - // If the driver hasn't been marked as fully initialized yet, mark it now. - // We consider the time after the logical device creation to be the fully initialized driver - // position. This is mainly because PAL is fully initialized at this point and we also know - // whether or not the debug vmid has been acquired. External tools use this information to - // decide when it's reasonable to make certain requests of the driver through protocol functions. - if (pDriverControlServer->IsDriverInitialized() == false) { - pDriverControlServer->FinishDeviceInit(); - } } // ================================================================================================