From d7bac9b567919e09b17a7c9f97e9286e637fcba6 Mon Sep 17 00:00:00 2001 From: Alex Xie Date: Tue, 5 Apr 2022 16:11:07 -0400 Subject: [PATCH] SWDEV-330240 - HLK pnp with IO stress test fail This code change is to improve error handling. This code change does not fix issue itself. Before this code change, hostcallBuffer_ point is initialized in the end of create() function. If create function fails and returns early, hostcallBuffer_ point is not initialized. This non-initialized point can cause access violation when object is destructed. This code change put the initialization of the pointer in the constructor. Change-Id: I7fb6e764eb0547196dca03db237e49d3ff0fd06a [ROCm/clr commit: 5528812aa90100722740c8c0b516c408db78f31e] --- projects/clr/rocclr/device/pal/palvirtual.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/clr/rocclr/device/pal/palvirtual.cpp b/projects/clr/rocclr/device/pal/palvirtual.cpp index 02a5339d39..b2078cca29 100644 --- a/projects/clr/rocclr/device/pal/palvirtual.cpp +++ b/projects/clr/rocclr/device/pal/palvirtual.cpp @@ -878,6 +878,9 @@ VirtualGPU::VirtualGPU(Device& device) queues_[MainEngine] = nullptr; queues_[SdmaEngine] = nullptr; + + // The hostcall buffer for this vqueue is initialized on demand. + hostcallBuffer_ = nullptr; } bool VirtualGPU::create(bool profiling, uint deviceQueueSize, uint rtCUs, @@ -1035,9 +1038,6 @@ bool VirtualGPU::create(bool profiling, uint deviceQueueSize, uint rtCUs, &dbg_vmid); } - // The hostcall buffer for this vqueue is initialized on demand. - hostcallBuffer_ = nullptr; - return true; }