Fix debug surface allocation in multi-queue scenarios

Related-To: NEO-5078

Change-Id: Ife48e703f348340cd8f89dd76f8affce0641adac
Signed-off-by: Konstanty Misiak <konstanty.misiak@intel.com>
This commit is contained in:
Konstanty Misiak
2020-09-16 10:50:06 +02:00
committed by sys_ocldev
parent 1f240862ce
commit dcc5316d88
2 changed files with 18 additions and 1 deletions

View File

@ -74,7 +74,7 @@ class CommandQueueHw : public CommandQueue {
getGpgpuCommandStreamReceiver().enableNTo1SubmissionModel();
}
if (device->getDevice().getDebugger()) {
if (device->getDevice().getDebugger() && !getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation()) {
getGpgpuCommandStreamReceiver().allocateDebugSurface(SipKernel::maxDbgSurfaceSize);
}

View File

@ -6,6 +6,7 @@
*/
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/mocks/mock_os_library.h"
#include "shared/test/unit_test/utilities/base_object_utils.h"
#include "opencl/source/built_ins/builtins_dispatch_builder.h"
@ -23,6 +24,7 @@
#include "opencl/test/unit_test/mocks/mock_csr.h"
#include "opencl/test/unit_test/mocks/mock_event.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/mocks/mock_source_level_debugger.h"
#include "test.h"
using namespace NEO;
@ -78,6 +80,21 @@ struct OOQueueHwTest : public ClDeviceFixture,
}
};
HWTEST_F(CommandQueueHwTest, WhenConstructingTwoCommandQueuesThenOnlyOneDebugSurfaceIsAllocated) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary));
auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u));
MockCommandQueueHw<FamilyType> mockCmdQueueHw1(context, device.get(), nullptr);
auto dbgSurface = device->getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation();
EXPECT_NE(dbgSurface, nullptr);
MockCommandQueueHw<FamilyType> mockCmdQueueHw2(context, device.get(), nullptr);
EXPECT_EQ(dbgSurface, device->getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation());
}
HWTEST_F(CommandQueueHwTest, WhenEnqueuingBlockedMapUnmapOperationThenVirtualEventIsCreated) {
CommandQueueHw<FamilyType> *pHwQ = reinterpret_cast<CommandQueueHw<FamilyType> *>(pCmdQ);