diff --git a/projects/clr/rocclr/runtime/device/pal/palvirtual.cpp b/projects/clr/rocclr/runtime/device/pal/palvirtual.cpp index 4aa483cbe1..383c96c42e 100644 --- a/projects/clr/rocclr/runtime/device/pal/palvirtual.cpp +++ b/projects/clr/rocclr/runtime/device/pal/palvirtual.cpp @@ -738,13 +738,15 @@ bool VirtualGPU::create(bool profiling, uint deviceQueueSize, uint rtCUs, amd::CommandQueue::Priority priority) { device::BlitManager::Setup blitSetup; + // Resize the list of device resources always, + // because destructor calls eraseResourceList() even if create() failed + dev().resizeResoureList(index()); + if (index() >= GPU_MAX_COMMAND_QUEUES) { // Cap the maximum number of concurrent Virtual GPUs return false; } - dev().resizeResoureList(index()); - // Virtual GPU will have profiling enabled state_.profiling_ = profiling;