From 166ef6b622f216eecba94e57862bdc5e7c1ec2d0 Mon Sep 17 00:00:00 2001 From: jatang Date: Mon, 24 Oct 2022 11:27:56 -0400 Subject: [PATCH] SWDEV-293816 - Only dispatch Counter Aql packet when it is created successfully. Change-Id: Ic8a7374d19012754c6de5d483ec5d07a56661d1b --- rocclr/device/rocm/rocvirtual.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index d2a9aa880e..0f203c3492 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -3365,17 +3365,14 @@ void VirtualGPU::submitPerfCounter(amd::PerfCounterCommand& vcmd) { if (!profileRef->initialize()) { LogError("Failed to initialize performance counter"); vcmd.setStatus(CL_INVALID_OPERATION); - } - - // create the AQL packet for start profiling - if (profileRef->createStartPacket() == nullptr) { + } else if (profileRef->createStartPacket() == nullptr) { LogError("Failed to create AQL packet for start profiling"); vcmd.setStatus(CL_INVALID_OPERATION); + } else { + dispatchCounterAqlPacket(profileRef->prePacket(), counter->gfxVersion(), false, + profileRef->api()); } - dispatchCounterAqlPacket(profileRef->prePacket(), counter->gfxVersion(), false, - profileRef->api()); - profileRef->release(); } else if (vcmd.getState() == amd::PerfCounterCommand::End) { // Since all performance counters should use the same profile, use the 1st