From ad4925aef90bf27b6203a4b72bd84a0f8d7ab2b4 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Tue, 3 Mar 2020 23:33:31 +0100 Subject: [PATCH] Do not use direct submission in internal and low priority contexts Change-Id: Ifac52dd36737151ea4d84bec95750e1716cafa9a Signed-off-by: Zbigniew Zdanowicz --- .../windows/wddm_device_command_stream.inl | 14 ++- .../command_queue/blit_enqueue_tests.cpp | 6 +- .../command_queue/command_queue_tests.cpp | 3 +- .../aub_command_stream_receiver_1_tests.cpp | 23 ++-- .../aub_command_stream_receiver_2_tests.cpp | 34 ++++-- .../command_stream/aub_file_stream_tests.cpp | 30 +++-- ...and_stream_receiver_flush_task_3_tests.cpp | 3 +- ...stream_receiver_flush_task_gmock_tests.cpp | 9 +- .../command_stream_receiver_hw_tests.cpp | 6 +- .../command_stream_receiver_tests.cpp | 8 +- ...nd_stream_receiver_with_aub_dump_tests.cpp | 5 +- .../tbx_command_stream_tests.cpp | 38 +++--- .../fixtures/memory_allocator_fixture.h | 4 +- .../fixtures/memory_manager_fixture.cpp | 4 +- ..._command_stream_receiver_tests_gen12lp.inl | 8 +- .../test/unit_test/mem_obj/buffer_tests.cpp | 6 +- .../mem_obj/mem_obj_destruction_tests.cpp | 10 +- .../memory_manager/host_ptr_manager_tests.cpp | 3 +- .../memory_manager/memory_manager_tests.cpp | 22 ++-- .../memory_manager/surface_tests.cpp | 4 +- opencl/test/unit_test/mocks/mock_aub_csr.h | 3 +- opencl/test/unit_test/mocks/mock_os_context.h | 6 +- .../linux/drm_command_stream_fixture.h | 3 +- .../linux/drm_command_stream_tests.cpp | 3 +- .../os_interface/linux/drm_tests.cpp | 16 +-- .../os_interface/os_context_tests.cpp | 13 ++- .../windows/device_command_stream_tests.cpp | 110 +++++++++++++++++- .../windows/gl/gl_os_sharing_tests.cpp | 6 +- .../windows/os_context_win_tests.cpp | 10 +- .../windows/os_interface_win_tests.cpp | 4 +- .../os_interface/windows/wddm23_tests.cpp | 10 +- .../os_interface/windows/wddm_fixture.h | 6 +- .../windows/wddm_memory_manager_tests.cpp | 29 +++-- .../windows/wddm_memory_manager_tests.h | 5 +- .../wddm_residency_controller_tests.cpp | 18 ++- shared/source/device/device.cpp | 3 +- shared/source/device/root_device.cpp | 2 +- .../direct_submission_hw.inl | 36 +++--- .../direct_submission_properties.h | 3 + .../dispatchers/render_dispatcher.inl | 18 +-- .../source/memory_manager/memory_manager.cpp | 7 +- shared/source/memory_manager/memory_manager.h | 3 +- .../os_interface/linux/os_context_linux.cpp | 15 ++- .../os_interface/linux/os_context_linux.h | 3 +- shared/source/os_interface/os_context.h | 16 ++- .../os_interface/windows/os_context_win.cpp | 15 ++- .../os_interface/windows/os_context_win.h | 3 +- .../direct_submission_tests.cpp | 3 +- .../linux/drm_direct_submission_tests.cpp | 3 +- .../windows/wddm_direct_submission_tests.cpp | 3 +- .../windows/wddm_preemption_tests.cpp | 2 +- 51 files changed, 432 insertions(+), 185 deletions(-) diff --git a/opencl/source/os_interface/windows/wddm_device_command_stream.inl b/opencl/source/os_interface/windows/wddm_device_command_stream.inl index 8b6cdbe0c3..bc9c9110a9 100644 --- a/opencl/source/os_interface/windows/wddm_device_command_stream.inl +++ b/opencl/source/os_interface/windows/wddm_device_command_stream.inl @@ -161,7 +161,19 @@ bool WddmCommandStreamReceiver::initDirectSubmission(Device &device, auto contextEngineType = osContext.getEngineType(); const DirectSubmissionProperties &directSubmissionProperty = device.getHardwareInfo().capabilityTable.directSubmissionEngines.data[contextEngineType]; - if (directSubmissionProperty.engineSupported) { + + bool startDirect = true; + if (osContext.isLowPriority()) { + startDirect = directSubmissionProperty.useLowPriority; + } + if (osContext.isInternalEngine()) { + startDirect = directSubmissionProperty.useInternal; + } + if (osContext.isRootDevice()) { + startDirect = directSubmissionProperty.useRootDevice; + } + + if (directSubmissionProperty.engineSupported && startDirect) { if (contextEngineType == ENGINE_TYPE_BCS) { directSubmission = std::make_unique>(device, std::make_unique>(), diff --git a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp index 51e38808a1..90e595d2cf 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp @@ -23,7 +23,8 @@ struct BlitAuxTranslationTests : public ::testing::Test { class BcsMockContext : public MockContext { public: BcsMockContext(ClDevice *device) : MockContext(device) { - bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); + bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false)); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex())); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); @@ -63,7 +64,8 @@ struct BlitAuxTranslationTests : public ::testing::Test { if (createBcsEngine) { auto &engine = device->getEngine(HwHelperHw::lowPriorityEngineType, true); - bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); + bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false)); engine.osContext = bcsOsContext.get(); engine.commandStreamReceiver->setupContext(*bcsOsContext); } diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index 31fc04e095..f4d594cc54 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -235,7 +235,8 @@ HWTEST_F(CommandQueueWithSubDevicesTest, givenDeviceWithSubDevicesSupportingBlit auto subDevice = device->getDeviceById(0); if (createBcsEngine) { auto &engine = subDevice->getEngine(HwHelperHw::lowPriorityEngineType, true); - bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); + bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false)); engine.osContext = bcsOsContext.get(); engine.commandStreamReceiver->setupContext(*bcsOsContext); } diff --git a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp index 721c74ae2a..34f3eb54dd 100644 --- a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_1_tests.cpp @@ -173,7 +173,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithAubMana HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateHardwareContext) { uint32_t deviceIndex = 3; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -190,7 +190,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH } HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) { - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -256,7 +256,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl auto &hwInfo = pDevice->getHardwareInfo(); auto engineInstance = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; - MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false, false, false); auto aubCsr1 = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); auto aubCsr2 = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); @@ -823,7 +823,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess } HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenCreateMultipleHardwareContexts) { - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); aubCsr->setupContext(osContext); @@ -1175,7 +1175,8 @@ using HardwareContextContainerTests = ::testing::Test; TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupportedThenInitialzeHwContextsWithValidIndexes) { MockAubManager aubManager; - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); HardwareContextController hwContextControler(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextControler.hardwareContexts.size()); @@ -1188,7 +1189,8 @@ TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupported TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCalledOnHwContextControllerThenSubmitIsCalled) { MockAubManager aubManager; - MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); @@ -1206,7 +1208,8 @@ TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCall TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalledThenWholeMemoryBanksArePassed) { MockAubManager aubManager; - MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); @@ -1220,7 +1223,8 @@ TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalle TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) { MockAubManager aubManager; - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); @@ -1260,7 +1264,8 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) { MockAubManager aubManager; - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); diff --git a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp index 5d9317b1f7..614cfb396b 100644 --- a/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -460,7 +460,8 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; - MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, + false, false, false); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw("", true, *executionEnvironment, 0)); aubCsr->setupContext(osContext); @@ -493,7 +494,9 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh executionEnvironment->memoryManager.reset(memoryManager); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw("", true, *executionEnvironment, 0)); - auto osContext = memoryManager->createAndRegisterOsContext(aubCsr.get(), getChosenEngineType(**platformDevices), 0, PreemptionMode::Disabled, false); + auto osContext = memoryManager->createAndRegisterOsContext(aubCsr.get(), getChosenEngineType(**platformDevices), 0, + PreemptionMode::Disabled, + false, false, false); aubCsr->setupContext(*osContext); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -707,7 +710,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineI MockExecutionEnvironment executionEnvironment(platformDevices[0]); auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo(); auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; - MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, + false, false, false); executionEnvironment.initializeMemoryManager(); auto aubCsr = std::make_unique>("", true, executionEnvironment, 0); @@ -875,7 +879,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -897,7 +902,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenBcsEngineWhenDumpAllocationCalledTh DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -924,7 +930,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -945,7 +952,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA DebugManagerStateRestore dbgRestore; MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -968,7 +976,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -992,7 +1001,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1017,7 +1027,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1041,7 +1052,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); aubCsr.latestSentTaskCount = 1; diff --git a/opencl/test/unit_test/command_stream/aub_file_stream_tests.cpp b/opencl/test/unit_test/command_stream/aub_file_stream_tests.cpp index 8e3aeff7f3..630249a513 100644 --- a/opencl/test/unit_test/command_stream/aub_file_stream_tests.cpp +++ b/opencl/test/unit_test/command_stream/aub_file_stream_tests.cpp @@ -299,7 +299,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCallingAddAubComme HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenCallingAddAubCommentThenCallAddCommentOnAubManager) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockAubManager = static_cast(aubCsr.aubManager); ASSERT_NE(nullptr, mockAubManager); @@ -380,7 +381,8 @@ HWTEST_F(AubFileStreamTests, givenNoNewTaskSinceLastPollWhenDeletingAubCsrThenDo HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenCallPollForCompletion) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -394,7 +396,8 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenDontCallPollForCompletion) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -493,7 +496,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS AubSubCaptureCommon aubSubCaptureCommon; auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -520,7 +524,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS AubSubCaptureCommon aubSubCaptureCommon; auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -571,7 +576,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -595,7 +601,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -615,7 +622,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -627,7 +635,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -639,7 +648,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp index c0723e5f21..1fc6a51db0 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp @@ -1635,7 +1635,8 @@ class MockCsrWithFailingFlush : public CommandStreamReceiverHw { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenWaitForCompletionWithTimeoutIsCalledWhenFlushBatchedSubmissionsReturnsFailureThenItIsPropagated) { MockCsrWithFailingFlush mockCsr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); - MockOsContext osContext(0, 8, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 8, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); mockCsr.setupContext(osContext); mockCsr.latestSentTaskCount = 0; auto cmdBuffer = std::make_unique(*pDevice); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp index f227139473..dda32d1d96 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp @@ -273,7 +273,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr->requiredScratchSize = 0x200000; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false); mockCsr->setupContext(osContext); mockCsr->programVFEState(commandStream, flags, 10); @@ -294,7 +295,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr->requiredScratchSize = 0x200000; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false); mockCsr->setupContext(osContext); mockCsr->programVFEState(commandStream, flags, 10); @@ -313,7 +315,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr->requiredScratchSize = 0x200000; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false); mockCsr->setupContext(osContext); mockCsr->programVFEState(commandStream, flags, 10); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp index 5c4549baa3..dab04a61c1 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp @@ -312,7 +312,8 @@ struct BcsTests : public CommandStreamReceiverHwTest { auto contextId = engine->osContext->getContextId(); delete engine->osContext; - engine->osContext = OsContext::create(nullptr, contextId, 0, aub_stream::EngineType::ENGINE_BCS, PreemptionMode::Disabled, false); + engine->osContext = OsContext::create(nullptr, contextId, 0, aub_stream::EngineType::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false); engine->osContext->incRefInternal(); csr.setupContext(*engine->osContext); @@ -637,7 +638,8 @@ HWTEST_F(BcsTests, givenInputAllocationsWhenBlitDispatchedThenMakeAllAllocations HWTEST_F(BcsTests, givenFenceAllocationIsRequiredWhenBlitDispatchedThenMakeAllAllocationsResident) { RAIIHwHelperFactory> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; - auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); + auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false)); auto bcsCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp index 2bd323d1e1..93082d0063 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp @@ -716,7 +716,9 @@ HWTEST_F(SimulatedCommandStreamReceiverTest, givenCsrWithOsContextWhenGetDeviceI executionEnvironment.prepareRootDeviceEnvironments(1); executionEnvironment.initializeMemoryManager(); MockSimulatedCsrHw csr(executionEnvironment, 0); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b11, PreemptionMode::Disabled, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, + 0b11, PreemptionMode::Disabled, + false, false, false); csr.setupContext(*osContext); EXPECT_EQ(1u, csr.getDeviceIndex()); @@ -727,7 +729,9 @@ HWTEST_F(SimulatedCommandStreamReceiverTest, givenOsContextWithNoDeviceBitfieldW executionEnvironment.prepareRootDeviceEnvironments(1); executionEnvironment.initializeMemoryManager(); MockSimulatedCsrHw csr(executionEnvironment, 0); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b00, PreemptionMode::Disabled, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, + 0b00, PreemptionMode::Disabled, + false, false, false); csr.setupContext(*osContext); EXPECT_EQ(0u, csr.getDeviceIndex()); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_with_aub_dump_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_with_aub_dump_tests.cpp index 5a03342d7b..6e106ba9d3 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_with_aub_dump_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_with_aub_dump_tests.cpp @@ -124,7 +124,8 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParammemoryManager->createAndRegisterOsContext(csrWithAubDump, getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1, - PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo), false); + PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo), + false, false, false); csrWithAubDump->setupContext(*osContext); } @@ -149,7 +150,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); csrWithAubDump.setupContext(osContext); EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext()); diff --git a/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp b/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp index a28141ed7c..3bf4a1ba2b 100644 --- a/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp +++ b/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp @@ -372,7 +372,7 @@ HWTEST_F(TbxCommandStreamTests, givenDbgDeviceIdFlagIsSetWhenTbxCsrIsCreatedThen HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingMakeSurfacePackNonResidentThenOnlyResidentAllocationsAddedAllocationsForDownload) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); EXPECT_EQ(0u, tbxCsr.allocationsForDownload.size()); @@ -403,7 +403,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForTaskCountWithKm }; MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); uint32_t tag = 0u; tbxCsr.setupContext(osContext); tbxCsr.setTagAllocation(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{false, sizeof(tag)}, &tag)); @@ -455,7 +455,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenItIsCreatedWith HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -482,7 +482,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl DebugManager.flags.CsrDispatchMode.set(static_cast(DispatchMode::BatchedDispatch)); MockTbxCsr tbxCsr(*pDevice->executionEnvironment); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -500,7 +500,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -518,7 +518,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -530,7 +530,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenDownloadAllocationIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -555,7 +555,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) { auto hwInfo = pDevice->getHardwareInfo(); MockOsContext osContext(0, 1, HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0], - PreemptionMode::Disabled, false); + PreemptionMode::Disabled, false, false, false); std::string fileName = ""; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(&hwInfo, false, fileName, CommandStreamReceiverType::CSR_TBX); @@ -657,7 +657,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThe HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsDisabledThenPauseShouldBeTurnedOn) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -680,7 +680,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenPauseShouldBeTurnedOff) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -704,7 +704,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenCallPollForCompletionAndDisableSubCapture) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -728,7 +728,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureGetsActivatedThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -753,7 +753,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureRemainsActiveThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -819,7 +819,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithoutDu HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureIsInactiveThenDontForceDumpingAllocationsTbxNonWritable) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -842,7 +842,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureGetsActivatedThenForceDumpingAllocationsTbxNonWritable) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -867,7 +867,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureRemainsActivatedThenDontForceDumpingAllocationsTbxNonWritable) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -892,7 +892,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA HWTEST_F(TbxCommandStreamTests, givenTbxCsrInNonSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledThenReturnStatusInactive) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment}; - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr.setupContext(osContext); MultiDispatchInfo dispatchInfo; @@ -913,11 +913,11 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenDispatchBlitEnqueueThenProcessCor MockTbxCsr tbxCsr1{*pDevice->executionEnvironment}; tbxCsr1.initializeTagAllocation(); - MockOsContext osContext0(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext0(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); tbxCsr0.setupContext(osContext0); EngineControl engineControl0{&tbxCsr0, &osContext0}; - MockOsContext osContext1(1, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); + MockOsContext osContext1(1, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); tbxCsr1.setupContext(osContext0); EngineControl engineControl1{&tbxCsr1, &osContext1}; diff --git a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h b/opencl/test/unit_test/fixtures/memory_allocator_fixture.h index 9044ff0bd9..b6cc6fb2a1 100644 --- a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h +++ b/opencl/test/unit_test/fixtures/memory_allocator_fixture.h @@ -31,7 +31,9 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { csr = &device->getGpgpuCommandStreamReceiver(); auto &hwInfo = device->getHardwareInfo(); auto engineType = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; - auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); csr->setupContext(*osContext); } diff --git a/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp b/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp index eab43d91a3..dfcf7e277f 100644 --- a/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp +++ b/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp @@ -25,7 +25,9 @@ void MemoryManagerWithCsrFixture::SetUp() { csr->tagAddress = ¤tGpuTag; auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo(); auto engine = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; - auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), engine, 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), engine, 1, + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), + false, false, false); csr->setupContext(*osContext); } diff --git a/opencl/test/unit_test/gen12lp/aub_command_stream_receiver_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/aub_command_stream_receiver_tests_gen12lp.inl index 96f3e78ddf..8e105fa379 100644 --- a/opencl/test/unit_test/gen12lp/aub_command_stream_receiver_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/aub_command_stream_receiver_tests_gen12lp.inl @@ -23,8 +23,8 @@ using Gen12LPAubCommandStreamReceiverTests = Test; GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetGUCWorkQueueItemHeaderIsCalledThenAppropriateValueDependingOnEngineTypeIsReturned) { std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())); - MockOsContext rcsOsContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); - MockOsContext ccsOsContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false); + MockOsContext rcsOsContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext ccsOsContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false, false, false); aubCsr->setupContext(ccsOsContext); uint32_t headerCCS = aubCsr->getGUCWorkQueueItemHeader(); @@ -45,7 +45,7 @@ GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenGraphicsAlloctionWhenGe } GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenCCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) { - MockOsContext osContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false, false, false); AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); aubCsr.setupContext(osContext); @@ -58,7 +58,7 @@ GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenCCSEnabledWhenEngineMmi } GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenRCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) { - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); aubCsr.setupContext(osContext); diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index ec8cccf3f8..d4e0b17c23 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -655,7 +655,8 @@ struct BcsBufferTests : public ::testing::Test { class BcsMockContext : public MockContext { public: BcsMockContext(ClDevice *device) : MockContext(device) { - bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); + bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false)); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex())); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); @@ -717,7 +718,8 @@ struct BcsBufferTests : public ::testing::Test { if (createBcsEngine) { auto &engine = device->getEngine(HwHelperHw::lowPriorityEngineType, true); - bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); + bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, + false, false, false)); engine.osContext = bcsOsContext.get(); engine.commandStreamReceiver->setupContext(*bcsOsContext); } diff --git a/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp b/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp index f83b62a5e1..ad0829d46a 100644 --- a/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp +++ b/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp @@ -331,7 +331,10 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh } auto mockCsr = new ::testing::NiceMock>(*mockDevice.executionEnvironment); - auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, aub_stream::ENGINE_RCS, {}, PreemptionMode::Disabled, false); + auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, + aub_stream::ENGINE_RCS, {}, + PreemptionMode::Disabled, + false, false, false); mockDevice.engines[0].osContext = osContext; mockDevice.resetCommandStreamReceiver(mockCsr); @@ -367,7 +370,10 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait } auto mockCsr = new ::testing::NiceMock>(*mockDevice.executionEnvironment); - auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, aub_stream::ENGINE_RCS, {}, PreemptionMode::Disabled, false); + auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, + aub_stream::ENGINE_RCS, {}, + PreemptionMode::Disabled, + false, false, false); mockDevice.engines[0].osContext = osContext; mockDevice.resetCommandStreamReceiver(mockCsr); diff --git a/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp b/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp index 96d1abea31..0e7a575af4 100644 --- a/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp @@ -867,7 +867,8 @@ HWTEST_F(HostPtrAllocationTest, givenOverlappingFragmentsWhenCheckIsCalledThenWa uint32_t csr1GpuTag = taskCountNotReady; csr0->tagAddress = &csr0GpuTag; csr1->tagAddress = &csr1GpuTag; - auto osContext = memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::EngineType::ENGINE_RCS, 0, PreemptionMode::Disabled, true); + auto osContext = memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::EngineType::ENGINE_RCS, 0, PreemptionMode::Disabled, + true, false, false); csr1->setupContext(*osContext); void *cpuPtr = reinterpret_cast(0x100004); diff --git a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp index 46d667e414..efebadfb54 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -200,7 +200,8 @@ TEST_F(MemoryAllocatorTest, allocateGraphics) { memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); ASSERT_NE(nullptr, allocation); @@ -1410,7 +1411,8 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) { memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto tagAddress = csr->getTagAddress(); @@ -1661,7 +1663,8 @@ TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCo std::unique_ptr csr(createCommandStream(executionEnvironment, 0u)); memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); EXPECT_EQ(1u, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount()); } @@ -1689,7 +1692,8 @@ TEST(ResidencyDataTest, givenDeviceBitfieldWhenCreatingOsContextThenSetValidValu PreemptionMode preemptionMode = PreemptionMode::MidThread; memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - deviceBitfield, preemptionMode, false); + deviceBitfield, preemptionMode, + false, false, false); EXPECT_EQ(2u, memoryManager->registeredEngines[0].osContext->getNumSupportedDevices()); EXPECT_EQ(deviceBitfield, memoryManager->registeredEngines[0].osContext->getDeviceBitfield()); EXPECT_EQ(preemptionMode, memoryManager->registeredEngines[0].osContext->getPreemptionMode()); @@ -1703,10 +1707,12 @@ TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegisteredFromHigherToLower std::unique_ptr csr1(createCommandStream(executionEnvironment, 1u)); memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); memoryManager->createAndRegisterOsContext(csr1.get(), HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[1], - 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); EXPECT_EQ(2u, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount()); EXPECT_EQ(1, memoryManager->registeredEngines[1].osContext->getRefInternalCount()); @@ -1726,10 +1732,10 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt MockOsContext osContext(0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); MockOsContext osContext2(1u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[1], - PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); auto lastFenceValue = 45llu; auto lastFenceValue2 = 23llu; diff --git a/opencl/test/unit_test/memory_manager/surface_tests.cpp b/opencl/test/unit_test/memory_manager/surface_tests.cpp index 5790c70c74..a15f94d7d3 100644 --- a/opencl/test/unit_test/memory_manager/surface_tests.cpp +++ b/opencl/test/unit_test/memory_manager/surface_tests.cpp @@ -66,7 +66,9 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves auto csr = std::make_unique>(execStamp, *executionEnvironment, 0); auto hwInfo = *platformDevices[0]; auto engine = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; - auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr.get(), engine, 1, PreemptionHelper::getDefaultPreemptionMode(hwInfo), false); + auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr.get(), engine, 1, + PreemptionHelper::getDefaultPreemptionMode(hwInfo), + false, false, false); csr->setupContext(*osContext); Surface *surface = createSurface::Create(this->data, diff --git a/opencl/test/unit_test/mocks/mock_aub_csr.h b/opencl/test/unit_test/mocks/mock_aub_csr.h index 9d338da1b7..b0d12d6d7e 100644 --- a/opencl/test/unit_test/mocks/mock_aub_csr.h +++ b/opencl/test/unit_test/mocks/mock_aub_csr.h @@ -193,7 +193,8 @@ std::unique_ptr getEnvironment(bool createTagAllocation auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), getChosenEngineType(*platformDevices[0]), 1, - PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); commandStreamReceiver->setupContext(*osContext); std::unique_ptr aubExecutionEnvironment(new AubExecutionEnvironment); diff --git a/opencl/test/unit_test/mocks/mock_os_context.h b/opencl/test/unit_test/mocks/mock_os_context.h index 6ea3356f5a..77425e6c17 100644 --- a/opencl/test/unit_test/mocks/mock_os_context.h +++ b/opencl/test/unit_test/mocks/mock_os_context.h @@ -12,7 +12,9 @@ namespace NEO { class MockOsContext : public OsContext { public: MockOsContext(uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority) {} + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) + : OsContext(contextId, deviceBitfield, engineType, preemptionMode, + lowPriority, internalEngine, rootDevice) {} }; } // namespace NEO diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h b/opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h index 16fcb3e4c8..63e8425a90 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h @@ -37,7 +37,8 @@ class DrmCommandStreamTest : public ::testing::Test { auto hwInfo = executionEnvironment.getHardwareInfo(); osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), + false, false, false); csr = new DrmCommandStreamReceiver(executionEnvironment, 0, gemCloseWorkerMode::gemCloseWorkerActive); ASSERT_NE(nullptr, csr); diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp index 4bd68c6843..739aea377e 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp @@ -213,7 +213,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdT osContext = std::make_unique(*mock, 1, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], - PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); csr->setupContext(*osContext); auto &cs = csr->getCS(); diff --git a/opencl/test/unit_test/os_interface/linux/drm_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_tests.cpp index bb67e370ae..5d9e43a1a2 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_tests.cpp @@ -178,7 +178,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) { drmMock.StoredCtxId = drmContextId1; - OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); EXPECT_EQ(1u, osContext1.getDrmContextIds().size()); EXPECT_EQ(drmContextId1, osContext1.getDrmContextIds()[0]); @@ -186,7 +186,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) { drmMock.StoredCtxId = drmContextId2; - OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); EXPECT_EQ(1u, osContext2.getDrmContextIds().size()); EXPECT_EQ(drmContextId2, osContext2.getDrmContextIds()[0]); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); @@ -209,14 +209,14 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI drmMock.StoredRetValForPersistant = -1; drmMock.checkNonPersistentContextsSupport(); ++expectedCount; - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount); } { drmMock.StoredRetValForPersistant = 0; drmMock.checkNonPersistentContextsSupport(); ++expectedCount; - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); ++expectedCount; EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount); } @@ -227,17 +227,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext drmMock.StoredCtxId = 123; drmMock.preemptionSupported = false; - OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); - OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true); + OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); drmMock.preemptionSupported = true; - OsContextLinux osContext3(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContextLinux osContext3(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); - OsContextLinux osContext4(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true); + OsContextLinux osContext4(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id); EXPECT_EQ(static_cast(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param); diff --git a/opencl/test/unit_test/os_interface/os_context_tests.cpp b/opencl/test/unit_test/os_interface/os_context_tests.cpp index 52f4293cfe..d2ba7538e8 100644 --- a/opencl/test/unit_test/os_interface/os_context_tests.cpp +++ b/opencl/test/unit_test/os_interface/os_context_tests.cpp @@ -12,7 +12,18 @@ using namespace NEO; TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) { - OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); EXPECT_TRUE(osContext->isInitialized()); + EXPECT_FALSE(osContext->isLowPriority()); + EXPECT_FALSE(osContext->isInternalEngine()); + EXPECT_FALSE(osContext->isRootDevice()); + delete osContext; +} + +TEST(OSContext, givenLowPriorityRootDeviceInternalAreTrueWhenCreatingDefaultOsContextThenExpectGettersTrue) { + OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, true, true); + EXPECT_TRUE(osContext->isLowPriority()); + EXPECT_TRUE(osContext->isInternalEngine()); + EXPECT_TRUE(osContext->isRootDevice()); delete osContext; } diff --git a/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp index 7ed3a5f244..2c1c497b09 100644 --- a/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp @@ -67,7 +67,8 @@ class WddmCommandStreamFixture { executionEnvironment->memoryManager.reset(memoryManager); wddm = static_cast(executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->getWddm()); osContext.reset(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), - 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false)); + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, false, false)); csr = new WddmCommandStreamReceiver(*executionEnvironment, 0); device.reset(MockDevice::create(executionEnvironment, 0u)); @@ -249,7 +250,8 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf executionEnvironment->memoryManager.reset(new MemoryManagerCreate(false, false, *executionEnvironment)); csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), + false, false, false); csr->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -274,7 +276,8 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn executionEnvironment->memoryManager.reset(new MemoryManagerCreate(false, false, *executionEnvironment)); csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), + false, false, false); csr->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -964,7 +967,8 @@ TEST_F(WddmCommandStreamTest, whenDirectSubmissionEnabledOnBcsThenExpectFeatureA DebugManager.flags.EnableDirectSubmission.set(1); osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, false)); + 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, + false, false, false)); auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = true; @@ -978,7 +982,8 @@ TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupport DebugManager.flags.EnableDirectSubmission.set(1); osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, false)); + 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, + false, false, false)); auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = false; @@ -987,3 +992,98 @@ TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupport EXPECT_TRUE(ret); EXPECT_FALSE(csr->isDirectSubmissionEnabled()); } + +TEST_F(WddmCommandStreamTest, givenLowPriorityContextWhenDirectSubmissionDisabledOnLowPriorityThenExpectFeatureNotAvailable) { + DebugManager.flags.EnableDirectSubmission.set(1); + + osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + true, false, false)); + + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useLowPriority = false; + + bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); + EXPECT_TRUE(ret); + EXPECT_FALSE(csr->isDirectSubmissionEnabled()); +} + +TEST_F(WddmCommandStreamTest, givenLowPriorityContextWhenDirectSubmissionEnabledOnLowPriorityThenExpectFeatureAvailable) { + DebugManager.flags.EnableDirectSubmission.set(1); + + osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + true, false, false)); + + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useLowPriority = true; + bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); + EXPECT_TRUE(ret); + EXPECT_TRUE(csr->isDirectSubmissionEnabled()); +} + +TEST_F(WddmCommandStreamTest, givenInternalContextWhenDirectSubmissionDisabledOnInternalThenExpectFeatureNotAvailable) { + DebugManager.flags.EnableDirectSubmission.set(1); + + osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, true, false)); + + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useInternal = false; + + bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); + EXPECT_TRUE(ret); + EXPECT_FALSE(csr->isDirectSubmissionEnabled()); +} + +TEST_F(WddmCommandStreamTest, givenInternalContextWhenDirectSubmissionEnabledOnInternalThenExpectFeatureAvailable) { + DebugManager.flags.EnableDirectSubmission.set(1); + + osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, true, false)); + + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useInternal = true; + + bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); + EXPECT_TRUE(ret); + EXPECT_TRUE(csr->isDirectSubmissionEnabled()); +} + +TEST_F(WddmCommandStreamTest, givenRootDeviceContextWhenDirectSubmissionDisabledOnRootDeviceThenExpectFeatureNotAvailable) { + DebugManager.flags.EnableDirectSubmission.set(1); + + osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, false, true)); + + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useRootDevice = false; + + bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); + EXPECT_TRUE(ret); + EXPECT_FALSE(csr->isDirectSubmissionEnabled()); +} + +TEST_F(WddmCommandStreamTest, givenRootDeviceContextWhenDirectSubmissionEnabledOnRootDeviceThenExpectFeatureAvailable) { + DebugManager.flags.EnableDirectSubmission.set(1); + + osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), + 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, false, true)); + + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; + hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useRootDevice = true; + + bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); + EXPECT_TRUE(ret); + EXPECT_TRUE(csr->isDirectSubmissionEnabled()); +} diff --git a/opencl/test/unit_test/os_interface/windows/gl/gl_os_sharing_tests.cpp b/opencl/test/unit_test/os_interface/windows/gl/gl_os_sharing_tests.cpp index 3a55856631..b7186c3751 100644 --- a/opencl/test/unit_test/os_interface/windows/gl/gl_os_sharing_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/gl/gl_os_sharing_tests.cpp @@ -333,7 +333,8 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(); OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, - HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); + HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], + preemptionMode, false, false, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.serverSynchronizationObject = 0x5cU; @@ -393,7 +394,8 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(); OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, - HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); + HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], + preemptionMode, false, false, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.submissionSynchronizationObject = 0x7cU; diff --git a/opencl/test/unit_test/os_interface/windows/os_context_win_tests.cpp b/opencl/test/unit_test/os_interface/windows/os_context_win_tests.cpp index cd3487c50f..c64bc26ca3 100644 --- a/opencl/test/unit_test/os_interface/windows/os_context_win_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/os_context_win_tests.cpp @@ -26,28 +26,28 @@ struct OsContextWinTest : public WddmTestWithMockGdiDll { }; TEST_F(OsContextWinTest, givenWddm20WhenCreatingOsContextThenOsContextIsInitialized) { - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); EXPECT_TRUE(osContext->isInitialized()); } TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmContextFailThenOsContextIsNotInitialized) { wddm->device = INVALID_HANDLE; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); EXPECT_FALSE(osContext->isInitialized()); } TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmMonitorFenceFailThenOsContextIsNotInitialized) { *getCreateSynchronizationObject2FailCallFcn() = true; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); EXPECT_FALSE(osContext->isInitialized()); } TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackFailThenOsContextIsNotInitialized) { *getRegisterTrimNotificationFailCallFcn() = true; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); EXPECT_FALSE(osContext->isInitialized()); } @@ -56,6 +56,6 @@ TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackIsDisabledThenOsCont DebugManager.flags.DoNotRegisterTrimCallback.set(true); *getRegisterTrimNotificationFailCallFcn() = true; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); EXPECT_TRUE(osContext->isInitialized()); } diff --git a/opencl/test/unit_test/os_interface/windows/os_interface_win_tests.cpp b/opencl/test/unit_test/os_interface/windows/os_interface_win_tests.cpp index 25d5f8431e..ae3687299d 100644 --- a/opencl/test/unit_test/os_interface/windows/os_interface_win_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/os_interface_win_tests.cpp @@ -33,7 +33,9 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(); EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called); - auto osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); + auto osContext = std::make_unique(*wddm, 0u, 1, + HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], + preemptionMode, false, false, false); EXPECT_TRUE(osContext->isInitialized()); EXPECT_EQ(osContext->getWddm(), wddm); EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called); diff --git a/opencl/test/unit_test/os_interface/windows/wddm23_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm23_tests.cpp index 4344914719..2222e7e9cd 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm23_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm23_tests.cpp @@ -42,7 +42,9 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture { wddmMockInterface = static_cast(wddm->wddmInterface.release()); wddm->init(); wddm->wddmInterface.reset(wddmMockInterface); - osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); + osContext = std::make_unique(*wddm, 0u, 1, + HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], + preemptionMode, false, false, false); } void TearDown() override { @@ -75,8 +77,10 @@ TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) { TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) { auto defaultEngine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0]; - OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled, false); - OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch, false); + OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled, + false, false, false); + OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch, + false, false, false); wddm->wddmInterface->createHwQueue(osContextWithoutPreemption); EXPECT_EQ(0u, getCreateHwQueueDataFcn()->Flags.DisableGpuTimeout); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_fixture.h b/opencl/test/unit_test/os_interface/windows/wddm_fixture.h index 4b94d3e8b7..fba6f152b2 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_fixture.h +++ b/opencl/test/unit_test/os_interface/windows/wddm_fixture.h @@ -43,7 +43,8 @@ struct WddmFixture : ::testing::Test { wddm->init(); auto hwInfo = rootDeviceEnvironemnt->getHardwareInfo(); auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, engine, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, engine, preemptionMode, + false, false, false); mockTemporaryResources = static_cast(wddm->temporaryResources.get()); } @@ -79,7 +80,8 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture { auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engine, preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engine, preemptionMode, + false, false, false); } void TearDown() override { diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index 9ad175f578..583a11cfcf 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -75,7 +75,9 @@ TEST(WddmMemoryManager, NonAssignable) { TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { MockWddmAllocation allocation; - MockOsContext osContext(1u, 1, aub_stream::ENGINE_RCS, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + MockOsContext osContext(1u, 1, aub_stream::ENGINE_RCS, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), + false, false, false); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); @@ -354,7 +356,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1], - 2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + 2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); auto allocation = static_cast(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER})); @@ -384,7 +386,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1], - 2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + 2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); auto allocation = static_cast(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER})); @@ -1446,9 +1448,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenC std::unique_ptr csr(createCommandStream(*executionEnvironment, 0u)); std::unique_ptr csr1(createCommandStream(*executionEnvironment, 1u)); std::unique_ptr csr2(createCommandStream(*executionEnvironment, 2u)); - memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); + memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); + memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); } @@ -1465,9 +1470,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithE std::unique_ptr csr(createCommandStream(*executionEnvironment, 0u)); std::unique_ptr csr1(createCommandStream(*executionEnvironment, 1u)); std::unique_ptr csr2(createCommandStream(*executionEnvironment, 2u)); - memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); + memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); + memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false); auto osContext = static_cast(memoryManager->getRegisteredEngines()[1].osContext); osContext->getResidencyController().setMemoryBudgetExhausted(); EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted()); @@ -1715,7 +1723,8 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setWddm(wddm); executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique(wddm); executionEnvironment.memoryManager = std::make_unique(executionEnvironment); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, preemptionMode, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, preemptionMode, + false, false, false); csr->setupContext(*osContext); auto tagAllocator = csr->getEventPerfCountAllocator(100); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h index d0c481cb52..0793c137dd 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h @@ -67,7 +67,7 @@ class MockWddmMemoryManagerFixture { auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], - 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); osContext->incRefInternal(); mockTemporaryResources = reinterpret_cast(wddm->getTemporaryResourcesContainer()); @@ -120,7 +120,8 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture csr.reset(createCommandStream(*executionEnvironment, 0u)); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode, false); + HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], + 1, preemptionMode, false, false, false); osContext->incRefInternal(); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp index d7ebccc908..9660c4ed8f 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp @@ -56,8 +56,10 @@ class MockWddmResidencyController : public WddmResidencyController { class MockOsContextWin : public OsContextWin { public: MockOsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) - : OsContextWin(wddm, contextId, deviceBitfield, engineType, preemptionMode, lowPriority), + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) + : OsContextWin(wddm, contextId, deviceBitfield, engineType, preemptionMode, + lowPriority, internalEngine, rootDevice), mockResidencyController(wddm, contextId) {} WddmResidencyController &getResidencyController() override { return mockResidencyController; }; @@ -73,7 +75,8 @@ struct WddmResidencyControllerTest : ::testing::Test { rootDeviceEnvironment = std::make_unique(*executionEnvironment); wddm = std::unique_ptr(static_cast(Wddm::createWddm(nullptr, *rootDeviceEnvironment))); wddm->init(); - mockOsContextWin = std::make_unique(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + mockOsContextWin = std::make_unique(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, + PreemptionMode::Disabled, false, false, false); wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin); residencyController = &mockOsContextWin->mockResidencyController; } @@ -96,7 +99,8 @@ struct WddmResidencyControllerWithGdiTest : ::testing::Test { wddm->resetGdi(gdi); wddm->init(); - mockOsContextWin = std::make_unique(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); + mockOsContextWin = std::make_unique(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, + false, false, false); wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin); residencyController = &mockOsContextWin->mockResidencyController; residencyController->registerCallback(); @@ -129,7 +133,8 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT csr.reset(createCommandStream(*executionEnvironment, 0u)); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode, false); + HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode, + false, false, false); osContext->incRefInternal(); residencyController = &static_cast(osContext)->getResidencyController(); @@ -167,7 +172,8 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], - 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); + 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), + false, false, false); osContext->incRefInternal(); diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index caffbba666..f884f65d2a 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -124,7 +124,8 @@ bool Device::createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engine bool lowPriority = (deviceCsrIndex == HwHelper::lowPriorityGpgpuEngineIndex); auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), engineType, - getDeviceBitfield(), preemptionMode, lowPriority); + getDeviceBitfield(), preemptionMode, + lowPriority, internalUsage, false); commandStreamReceiver->setupContext(*osContext); if (!commandStreamReceiver->initializeTagAllocation()) { diff --git a/shared/source/device/root_device.cpp b/shared/source/device/root_device.cpp index 4b920c337f..e15ab1c6c0 100644 --- a/shared/source/device/root_device.cpp +++ b/shared/source/device/root_device.cpp @@ -98,7 +98,7 @@ void RootDevice::initializeRootCommandStreamReceiver() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); auto osContext = getMemoryManager()->createAndRegisterOsContext(rootCommandStreamReceiver.get(), defaultEngineType, - getDeviceBitfield(), preemptionMode, false); + getDeviceBitfield(), preemptionMode, false, false, true); rootCommandStreamReceiver->setupContext(*osContext); rootCommandStreamReceiver->initializeTagAllocation(); diff --git a/shared/source/direct_submission/direct_submission_hw.inl b/shared/source/direct_submission/direct_submission_hw.inl index 1f9882ec05..d3c3689dff 100644 --- a/shared/source/direct_submission/direct_submission_hw.inl +++ b/shared/source/direct_submission/direct_submission_hw.inl @@ -89,7 +89,7 @@ bool DirectSubmissionHw::allocateResources() { } template -void DirectSubmissionHw::cpuCachelineFlush(void *ptr, size_t size) { +inline void DirectSubmissionHw::cpuCachelineFlush(void *ptr, size_t size) { if (disableCpuCacheFlush) { return; } @@ -156,7 +156,7 @@ bool DirectSubmissionHw::stopRingBuffer() { } template -void *DirectSubmissionHw::dispatchSemaphoreSection(uint32_t value) { +inline void *DirectSubmissionHw::dispatchSemaphoreSection(uint32_t value) { using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; @@ -172,13 +172,13 @@ void *DirectSubmissionHw::dispatchSemaphoreSection(uint32_t value) { } template -size_t DirectSubmissionHw::getSizeSemaphoreSection() { +inline size_t DirectSubmissionHw::getSizeSemaphoreSection() { size_t semaphoreSize = EncodeSempahore::getSizeMiSemaphoreWait(); return (semaphoreSize + prefetchSize); } template -void DirectSubmissionHw::dispatchStartSection(uint64_t gpuStartAddress) { +inline void DirectSubmissionHw::dispatchStartSection(uint64_t gpuStartAddress) { using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; auto bbufferStart = ringCommandStream.getSpaceForCmd(); *bbufferStart = GfxFamily::cmdInitBatchBufferStart; @@ -188,14 +188,14 @@ void DirectSubmissionHw::dispatchStartSection(uint64_t gpuStartAddres } template -size_t DirectSubmissionHw::getSizeStartSection() { +inline size_t DirectSubmissionHw::getSizeStartSection() { using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; size_t size = sizeof(MI_BATCH_BUFFER_START); return size; } template -void DirectSubmissionHw::dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress) { +inline void DirectSubmissionHw::dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress) { using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; auto bbufferStart = ringCommandStream.getSpaceForCmd(); @@ -206,38 +206,38 @@ void DirectSubmissionHw::dispatchSwitchRingBufferSection(uint64_t nex } template -size_t DirectSubmissionHw::getSizeSwitchRingBufferSection() { +inline size_t DirectSubmissionHw::getSizeSwitchRingBufferSection() { using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; return sizeof(MI_BATCH_BUFFER_START); } template -void *DirectSubmissionHw::dispatchFlushSection() { +inline void *DirectSubmissionHw::dispatchFlushSection() { void *currentPosition = ringCommandStream.getSpace(0); cmdDispatcher->dispatchCacheFlush(ringCommandStream, *hwInfo); return currentPosition; } template -size_t DirectSubmissionHw::getSizeFlushSection() { +inline size_t DirectSubmissionHw::getSizeFlushSection() { return cmdDispatcher->getSizeCacheFlush(*hwInfo); } template -void *DirectSubmissionHw::dispatchTagUpdateSection(uint64_t address, uint64_t value) { +inline void *DirectSubmissionHw::dispatchTagUpdateSection(uint64_t address, uint64_t value) { void *currentPosition = ringCommandStream.getSpace(0); cmdDispatcher->dispatchMonitorFence(ringCommandStream, address, value, *hwInfo); return currentPosition; } template -size_t DirectSubmissionHw::getSizeTagUpdateSection() { +inline size_t DirectSubmissionHw::getSizeTagUpdateSection() { size_t size = cmdDispatcher->getSizeMonitorFence(*hwInfo); return size; } template -void DirectSubmissionHw::dispatchEndingSection() { +inline void DirectSubmissionHw::dispatchEndingSection() { using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END; auto bbufferEnd = ringCommandStream.getSpaceForCmd(); @@ -245,13 +245,13 @@ void DirectSubmissionHw::dispatchEndingSection() { } template -size_t DirectSubmissionHw::getSizeEndingSection() { +inline size_t DirectSubmissionHw::getSizeEndingSection() { using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END; return sizeof(MI_BATCH_BUFFER_END); } template -size_t DirectSubmissionHw::getSizeDispatch() { +inline size_t DirectSubmissionHw::getSizeDispatch() { return getSizeStartSection() + getSizeFlushSection() + getSizeTagUpdateSection() + @@ -259,13 +259,13 @@ size_t DirectSubmissionHw::getSizeDispatch() { } template -size_t DirectSubmissionHw::getSizeEnd() { +inline size_t DirectSubmissionHw::getSizeEnd() { return getSizeEndingSection() + getSizeFlushSection(); } template -uint64_t DirectSubmissionHw::getCommandBufferPositionGpuAddress(void *position) { +inline uint64_t DirectSubmissionHw::getCommandBufferPositionGpuAddress(void *position) { void *currentBase = ringCommandStream.getCpuBase(); size_t offset = ptrDiff(position, currentBase); @@ -325,7 +325,7 @@ bool DirectSubmissionHw::dispatchCommandBuffer(BatchBuffer &batchBuff } template -void DirectSubmissionHw::setReturnAddress(void *returnCmd, uint64_t returnAddress) { +inline void DirectSubmissionHw::setReturnAddress(void *returnCmd, uint64_t returnAddress) { using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; MI_BATCH_BUFFER_START *returnBBStart = static_cast(returnCmd); @@ -333,7 +333,7 @@ void DirectSubmissionHw::setReturnAddress(void *returnCmd, uint64_t r } template -GraphicsAllocation *DirectSubmissionHw::switchRingBuffersAllocations() { +inline GraphicsAllocation *DirectSubmissionHw::switchRingBuffersAllocations() { GraphicsAllocation *nextAllocation = nullptr; if (currentRingBuffer == RingBufferUse::FirstBuffer) { nextAllocation = ringBuffer2; diff --git a/shared/source/direct_submission/direct_submission_properties.h b/shared/source/direct_submission/direct_submission_properties.h index 1fc59c759b..8a45deec1b 100644 --- a/shared/source/direct_submission/direct_submission_properties.h +++ b/shared/source/direct_submission/direct_submission_properties.h @@ -15,6 +15,9 @@ namespace NEO { struct DirectSubmissionProperties { bool engineSupported = false; bool submitOnInit = false; + bool useInternal = false; + bool useLowPriority = false; + bool useRootDevice = false; }; using EngineDirectSubmissionInitVec = std::vector>; diff --git a/shared/source/direct_submission/dispatchers/render_dispatcher.inl b/shared/source/direct_submission/dispatchers/render_dispatcher.inl index 2da1cf40f2..0da4a17493 100644 --- a/shared/source/direct_submission/dispatchers/render_dispatcher.inl +++ b/shared/source/direct_submission/dispatchers/render_dispatcher.inl @@ -13,21 +13,21 @@ namespace NEO { template -void RenderDispatcher::dispatchPreemption(LinearStream &cmdBuffer) { +inline void RenderDispatcher::dispatchPreemption(LinearStream &cmdBuffer) { PreemptionHelper::programCmdStream(cmdBuffer, PreemptionMode::MidBatch, PreemptionMode::Disabled, nullptr); } template -size_t RenderDispatcher::getSizePreemption() { +inline size_t RenderDispatcher::getSizePreemption() { size_t size = PreemptionHelper::getRequiredCmdStreamSize(PreemptionMode::MidBatch, PreemptionMode::Disabled); return size; } template -void RenderDispatcher::dispatchMonitorFence(LinearStream &cmdBuffer, - uint64_t gpuAddress, - uint64_t immediateData, - const HardwareInfo &hwInfo) { +inline void RenderDispatcher::dispatchMonitorFence(LinearStream &cmdBuffer, + uint64_t gpuAddress, + uint64_t immediateData, + const HardwareInfo &hwInfo) { using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION; MemorySynchronizationCommands::obtainPipeControlAndProgramPostSyncOperation( cmdBuffer, @@ -39,18 +39,18 @@ void RenderDispatcher::dispatchMonitorFence(LinearStream &cmdBuffer, } template -size_t RenderDispatcher::getSizeMonitorFence(const HardwareInfo &hwInfo) { +inline size_t RenderDispatcher::getSizeMonitorFence(const HardwareInfo &hwInfo) { size_t size = MemorySynchronizationCommands::getSizeForPipeControlWithPostSyncOperation(hwInfo); return size; } template -void RenderDispatcher::dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) { +inline void RenderDispatcher::dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) { MemorySynchronizationCommands::addFullCacheFlush(cmdBuffer); } template -size_t RenderDispatcher::getSizeCacheFlush(const HardwareInfo &hwInfo) { +inline size_t RenderDispatcher::getSizeCacheFlush(const HardwareInfo &hwInfo) { size_t size = MemorySynchronizationCommands::getSizeForFullCacheFlush(); return size; } diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 50f5e0dce0..0baec4832e 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -200,9 +200,12 @@ bool MemoryManager::isMemoryBudgetExhausted() const { } OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType, - DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority) { + DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) { auto contextId = ++latestContextId; - auto osContext = OsContext::create(peekExecutionEnvironment().rootDeviceEnvironments[commandStreamReceiver->getRootDeviceIndex()]->osInterface.get(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); + auto osContext = OsContext::create(peekExecutionEnvironment().rootDeviceEnvironments[commandStreamReceiver->getRootDeviceIndex()]->osInterface.get(), + contextId, deviceBitfield, engineType, preemptionMode, + lowPriority, internalEngine, rootDevice); UNRECOVERABLE_IF(!osContext->isInitialized()); osContext->incRefInternal(); diff --git a/shared/source/memory_manager/memory_manager.h b/shared/source/memory_manager/memory_manager.h index acb01bb50f..0844832400 100644 --- a/shared/source/memory_manager/memory_manager.h +++ b/shared/source/memory_manager/memory_manager.h @@ -147,7 +147,8 @@ class MemoryManager { const ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; } OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType, - DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority); + DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice); uint32_t getRegisteredEnginesCount() const { return static_cast(registeredEngines.size()); } EngineControlContainer &getRegisteredEngines(); EngineControl *getRegisteredEngineForCsr(CommandStreamReceiver *commandStreamReceiver); diff --git a/shared/source/os_interface/linux/os_context_linux.cpp b/shared/source/os_interface/linux/os_context_linux.cpp index 118091b5bc..97fbcca9bd 100644 --- a/shared/source/os_interface/linux/os_context_linux.cpp +++ b/shared/source/os_interface/linux/os_context_linux.cpp @@ -14,16 +14,21 @@ namespace NEO { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) { + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) { if (osInterface) { - return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); + return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, + lowPriority, internalEngine, rootDevice); } - return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority); + return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, + lowPriority, internalEngine, rootDevice); } OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), drm(drm) { + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) + : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice), + drm(drm) { for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) { if (deviceBitfield.test(deviceIndex)) { auto drmContextId = drm.createDrmContext(); diff --git a/shared/source/os_interface/linux/os_context_linux.h b/shared/source/os_interface/linux/os_context_linux.h index 6a75d13664..81b4f49655 100644 --- a/shared/source/os_interface/linux/os_context_linux.h +++ b/shared/source/os_interface/linux/os_context_linux.h @@ -19,7 +19,8 @@ class OsContextLinux : public OsContext { OsContextLinux() = delete; ~OsContextLinux() override; OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice); unsigned int getEngineFlag() const { return engineFlag; } const std::vector &getDrmContextIds() const { return drmContextIds; } diff --git a/shared/source/os_interface/os_context.h b/shared/source/os_interface/os_context.h index ba103e7bac..d071fbafb7 100644 --- a/shared/source/os_interface/os_context.h +++ b/shared/source/os_interface/os_context.h @@ -22,29 +22,37 @@ class OsContext : public ReferenceTrackedObject { OsContext() = delete; static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice); uint32_t getContextId() const { return contextId; } uint32_t getNumSupportedDevices() const { return numSupportedDevices; } DeviceBitfield getDeviceBitfield() const { return deviceBitfield; } PreemptionMode getPreemptionMode() const { return preemptionMode; } aub_stream::EngineType &getEngineType() { return engineType; } bool isLowPriority() const { return lowPriority; } + bool isInternalEngine() const { return internalEngine; } + bool isRootDevice() const { return rootDevice; } virtual bool isInitialized() const { return true; } protected: - OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) + OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) : contextId(contextId), deviceBitfield(deviceBitfield), preemptionMode(preemptionMode), numSupportedDevices(static_cast(deviceBitfield.count())), engineType(engineType), - lowPriority(lowPriority) {} + lowPriority(lowPriority), + internalEngine(internalEngine), + rootDevice(rootDevice) {} const uint32_t contextId; const DeviceBitfield deviceBitfield; const PreemptionMode preemptionMode; const uint32_t numSupportedDevices; aub_stream::EngineType engineType = aub_stream::ENGINE_RCS; - const bool lowPriority; + const bool lowPriority = false; + const bool internalEngine = false; + const bool rootDevice = false; }; } // namespace NEO diff --git a/shared/source/os_interface/windows/os_context_win.cpp b/shared/source/os_interface/windows/os_context_win.cpp index f742fdbf25..dd956337f5 100644 --- a/shared/source/os_interface/windows/os_context_win.cpp +++ b/shared/source/os_interface/windows/os_context_win.cpp @@ -14,16 +14,21 @@ namespace NEO { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) { + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) { if (osInterface) { - return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); + return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode, + lowPriority, internalEngine, rootDevice); } - return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority); + return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice); } OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), wddm(wddm), residencyController(wddm, contextId) { + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice) + : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice), + wddm(wddm), + residencyController(wddm, contextId) { auto wddmInterface = wddm.getWddmInterface(); if (!wddm.createContext(*this)) { diff --git a/shared/source/os_interface/windows/os_context_win.h b/shared/source/os_interface/windows/os_context_win.h index 33eff4f518..7ca4809bf7 100644 --- a/shared/source/os_interface/windows/os_context_win.h +++ b/shared/source/os_interface/windows/os_context_win.h @@ -26,7 +26,8 @@ class OsContextWin : public OsContext { ~OsContextWin() override; OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); + aub_stream::EngineType engineType, PreemptionMode preemptionMode, + bool lowPriority, bool internalEngine, bool rootDevice); D3DKMT_HANDLE getWddmContextHandle() const { return wddmContextHandle; } void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; } diff --git a/shared/test/unit_test/direct_submission/direct_submission_tests.cpp b/shared/test/unit_test/direct_submission/direct_submission_tests.cpp index 601b55b2f8..87ea05efb5 100644 --- a/shared/test/unit_test/direct_submission/direct_submission_tests.cpp +++ b/shared/test/unit_test/direct_submission/direct_submission_tests.cpp @@ -31,7 +31,8 @@ struct DirectSubmissionFixture : public DeviceFixture { void SetUp() { DeviceFixture::SetUp(); - osContext.reset(OsContext::create(nullptr, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false)); + osContext.reset(OsContext::create(nullptr, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, false, false)); } std::unique_ptr osContext; diff --git a/shared/test/unit_test/direct_submission/linux/drm_direct_submission_tests.cpp b/shared/test/unit_test/direct_submission/linux/drm_direct_submission_tests.cpp index dfd1968d7b..950c13cdfb 100644 --- a/shared/test/unit_test/direct_submission/linux/drm_direct_submission_tests.cpp +++ b/shared/test/unit_test/direct_submission/linux/drm_direct_submission_tests.cpp @@ -19,7 +19,8 @@ struct DrmDirectSubmissionFixture : public DeviceFixture { void SetUp() { DeviceFixture::SetUp(); - osContext = std::make_unique(drmMock, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false); + osContext = std::make_unique(drmMock, 0u, 0u, aub_stream::ENGINE_RCS, + PreemptionMode::ThreadGroup, false, false, false); } void TearDown() { diff --git a/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp b/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp index 8b2994f0e9..0d57350107 100644 --- a/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp +++ b/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp @@ -21,7 +21,8 @@ struct WddmDirectSubmissionFixture : public WddmFixture { wddm->wddmInterface.reset(new WddmMockInterface20(*wddm)); wddmMockInterface = static_cast(wddm->wddmInterface.get()); - osContext = std::make_unique(*wddm, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false); + osContext = std::make_unique(*wddm, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, + false, false, false); device.reset(MockDevice::create(executionEnvironment, 0u)); device->setPreemptionMode(PreemptionMode::ThreadGroup); } diff --git a/shared/test/unit_test/os_interface/windows/wddm_preemption_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_preemption_tests.cpp index 5efabb3ec6..12a8796074 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_preemption_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_preemption_tests.cpp @@ -43,7 +43,7 @@ class WddmPreemptionTests : public Test { wddm->init(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; - osContext = std::make_unique(*wddm, 0u, 1, engine, preemptionMode, false); + osContext = std::make_unique(*wddm, 0u, 1, engine, preemptionMode, false, false, false); } DebugManagerStateRestore *dbgRestorer = nullptr;