From 264f20ea00597d003891c7f5cac7c8d959571f1e Mon Sep 17 00:00:00 2001 From: Maciej Dziuban Date: Mon, 8 Mar 2021 18:50:32 +0000 Subject: [PATCH] Pass EngineTypeUsage to OsContext creation Signed-off-by: Maciej Dziuban Related-To: NEO-5610 --- .../unit_tests/sources/kernel/test_kernel.cpp | 3 +- .../command_queue/blit_enqueue_tests.cpp | 6 +- .../command_queue/command_queue_tests.cpp | 3 +- .../aub_command_stream_receiver_1_tests.cpp | 31 ++++---- .../aub_command_stream_receiver_2_tests.cpp | 45 +++++------- .../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_2_tests.cpp | 6 +- .../command_stream_receiver_hw_fixture.h | 7 +- .../command_stream_receiver_tests.cpp | 70 +++++++++---------- ...nd_stream_receiver_with_aub_dump_tests.cpp | 12 ++-- .../tbx_command_stream_tests.cpp | 54 +++++++------- .../fixtures/memory_allocator_fixture.h | 4 +- .../fixtures/memory_manager_fixture.cpp | 6 +- ..._command_stream_receiver_tests_gen12lp.inl | 8 +-- .../helpers/timestamp_packet_tests.cpp | 4 +- .../unit_test/mem_obj/buffer_bcs_tests.cpp | 6 +- .../mem_obj/mem_obj_destruction_tests.cpp | 8 +-- .../memory_manager/host_ptr_manager_tests.cpp | 7 +- ...nager_allocate_in_preferred_pool_tests.inl | 4 +- .../memory_manager/memory_manager_tests.cpp | 36 +++++----- .../memory_manager/surface_tests.cpp | 6 +- opencl/test/unit_test/mocks/mock_aub_csr.h | 5 +- opencl/test/unit_test/mocks/mock_os_context.h | 7 +- .../linux/drm_buffer_object_tests.cpp | 10 +-- .../linux/drm_command_stream_fixture.h | 4 +- .../linux/drm_command_stream_tests.cpp | 8 +-- .../os_interface/linux/drm_tests.cpp | 40 +++++------ .../os_interface/os_context_tests.cpp | 20 ++++-- .../performance_counters_tests.cpp | 4 +- .../windows/device_command_stream_tests.cpp | 20 +++--- .../windows/os_context_win_tests.cpp | 14 ++-- .../windows/os_interface_win_tests.cpp | 6 +- .../os_interface/windows/wddm23_tests.cpp | 10 +-- .../os_interface/windows/wddm_fixture.h | 8 +-- .../windows/wddm_memory_manager_tests.cpp | 39 +++++------ .../windows/wddm_memory_manager_tests.h | 10 +-- .../wddm_residency_controller_tests.cpp | 21 +++--- .../gl/windows/gl_os_sharing_tests.cpp | 10 +-- shared/source/device/device.cpp | 8 ++- shared/source/device/root_device.cpp | 7 +- .../source/memory_manager/memory_manager.cpp | 11 +-- shared/source/memory_manager/memory_manager.h | 8 ++- .../os_interface/linux/os_context_linux.cpp | 20 +++--- .../os_interface/linux/os_context_linux.h | 3 +- shared/source/os_interface/os_context.h | 19 +++-- .../os_interface/windows/os_context_win.cpp | 15 ++-- .../os_interface/windows/os_context_win.h | 5 +- .../fixtures/direct_submission_fixture.h | 3 +- .../linux/drm_direct_submission_tests.cpp | 4 +- .../windows/wddm_direct_submission_tests.cpp | 3 +- .../windows/wddm_preemption_tests.cpp | 4 +- 53 files changed, 334 insertions(+), 380 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp index a64f97d0cc..9493ea2ff9 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp @@ -973,8 +973,7 @@ struct KernelIsaTests : Test { if (createBcsEngine) { auto &engine = device->getNEODevice()->getEngine(0); - bcsOsContext.reset(OsContext::create(nullptr, 0, device->getNEODevice()->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + bcsOsContext.reset(OsContext::create(nullptr, 0, device->getNEODevice()->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); engine.osContext = bcsOsContext.get(); engine.commandStreamReceiver->setupContext(*bcsOsContext); } 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 762b9c406e..183345981a 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp @@ -36,8 +36,7 @@ struct BlitEnqueueTests : 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, false, false)); + bcsOsContext.reset(OsContext::create(nullptr, 0, 0, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield())); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); @@ -90,8 +89,7 @@ struct BlitEnqueueTests : public ::testing::Test { if (createBcsEngine) { auto &engine = device->getEngine(getChosenEngineType(device->getHardwareInfo()), true, false); - bcsOsContext.reset(OsContext::create(nullptr, 1, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + bcsOsContext.reset(OsContext::create(nullptr, 1, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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 97821ce2b0..04bb10a64f 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -256,8 +256,7 @@ HWTEST_P(CommandQueueWithBlitOperationsTests, givenDeviceWithSubDevicesSupportin auto subDevice = device->getDeviceById(0); if (createBcsEngine) { auto &engine = subDevice->getEngine(getChosenEngineType(subDevice->getHardwareInfo()), true, false); - bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + bcsOsContext.reset(OsContext::create(nullptr, 1, 0, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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 08864cbe44..5de6cd52cb 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 @@ -175,7 +175,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithAubMana HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateHardwareContext) { uint32_t deviceIndex = 3; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, 8, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); auto gmmHelper = pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(); @@ -193,7 +193,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH } HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) { - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, PreemptionMode::Disabled, false); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); auto gmmHelper = pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(); @@ -261,7 +261,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl auto &hwInfo = pDevice->getHardwareInfo(); auto engineInstance = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; - MockOsContext osContext(0, 1, engineInstance.first, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); auto aubCsr1 = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); auto aubCsr2 = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); @@ -818,7 +818,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess } HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenCreateMultipleHardwareContexts) { - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(1, 0b11, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); aubCsr->setupContext(osContext); @@ -1268,9 +1268,10 @@ HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithC std::unique_ptr> aubCsr(new MockAubCsr("", false, *executionEnvironment, rootDeviceIndex, deviceBitfield)); aubCsr->aubManager = &aubManager; auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(aubCsr.get(), - getChosenEngineType(hwInfo), deviceBitfield, + EngineTypeUsage{getChosenEngineType(hwInfo), EngineUsage::Regular}, + deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(hwInfo), - false, false, false); + false); aubCsr->setupContext(*osContext); aubCsr->writeMemoryWithAubManager(*allocation); @@ -1293,8 +1294,7 @@ using HardwareContextContainerTests = ::testing::Test; TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupportedThenInitialzeHwContextsWithValidIndexes) { MockAubManager aubManager; - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(1, 0b11, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); HardwareContextController hwContextControler(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextControler.hardwareContexts.size()); @@ -1307,8 +1307,7 @@ TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupported TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCalledOnHwContextControllerThenSubmitIsCalled) { MockAubManager aubManager; - MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(1, 0b1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); @@ -1326,8 +1325,7 @@ TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCall TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalledThenWholeMemoryBanksArePassed) { MockAubManager aubManager; - MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(1, 0b1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); @@ -1342,8 +1340,7 @@ TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalle TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) { MockAubManager aubManager; - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(1, 0b11, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); @@ -1385,8 +1382,7 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa TEST_F(HardwareContextContainerTests, givenHwContextWhenWriteMMIOIsCalledThenUseFirstContext) { MockAubManager aubManager; - MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(1, 0b1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); @@ -1401,8 +1397,7 @@ TEST_F(HardwareContextContainerTests, givenHwContextWhenWriteMMIOIsCalledThenUse TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) { MockAubManager aubManager; - MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(1, 0b11, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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 ef308fc258..68e9729852 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 @@ -505,8 +505,7 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; UltDeviceFactory deviceFactory{1, 0}; DeviceBitfield deviceBitfield(1); - MockOsContext osContext(0, deviceBitfield, engineInstance.first, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, deviceBitfield, engineInstance, PreemptionMode::Disabled, false); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw("", true, *executionEnvironment, 0, deviceBitfield)); aubCsr->setupContext(osContext); @@ -540,9 +539,8 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh executionEnvironment->memoryManager.reset(memoryManager); DeviceBitfield deviceBitfield(1); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw("", true, *executionEnvironment, 0, deviceBitfield)); - auto osContext = memoryManager->createAndRegisterOsContext(aubCsr.get(), getChosenEngineType(*defaultHwInfo), deviceBitfield, - PreemptionMode::Disabled, - false, false, false); + auto osContext = memoryManager->createAndRegisterOsContext(aubCsr.get(), EngineTypeUsage{getChosenEngineType(*defaultHwInfo), EngineUsage::Regular}, deviceBitfield, + PreemptionMode::Disabled, false); aubCsr->setupContext(*osContext); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{aubCsr->getRootDeviceIndex(), MemoryConstants::pageSize}); @@ -757,8 +755,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineI auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo(); auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; DeviceBitfield deviceBitfield(1); - MockOsContext osContext(0, deviceBitfield, engineInstance.first, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, deviceBitfield, engineInstance, PreemptionMode::Disabled, false); executionEnvironment.initializeMemoryManager(); auto aubCsr = std::make_unique>("", true, executionEnvironment, 0, deviceBitfield); @@ -922,8 +919,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenPhysica HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithoutHardwareContextControllerWhenCallingWriteMMIOThenDontRedirectToHardwareContextController) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(nullptr, aubCsr.hardwareContextController); aubCsr.writeMMIO(0x11111111, 0x22222222); @@ -933,8 +929,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithoutHard HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithHardwareContextControllerWhenCallingWriteMMIOThenRedirectToHardwareContextController) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); EXPECT_NE(nullptr, aubCsr.hardwareContextController); @@ -950,8 +945,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -973,8 +967,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenBcsEngineWhenDumpAllocationCalledTh DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1002,8 +995,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1024,8 +1016,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA DebugManagerStateRestore dbgRestore; MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1048,8 +1039,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1073,8 +1063,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1099,8 +1088,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1168,7 +1156,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenDumpAllocatio DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1196,8 +1184,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); aubCsr.latestSentTaskCount = 1; @@ -1220,7 +1207,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); 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 50bbab9897..5efdd296e3 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 @@ -300,8 +300,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCallingAddAubComme HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenCallingAddAubCommentThenCallAddCommentOnAubManager) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockAubManager = static_cast(aubCsr.aubManager); ASSERT_NE(nullptr, mockAubManager); @@ -382,8 +381,7 @@ HWTEST_F(AubFileStreamTests, givenNoNewTaskSinceLastPollWhenDeletingAubCsrThenDo HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenCallPollForCompletion) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -397,8 +395,7 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenDontCallPollForCompletion) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -494,8 +491,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS AubSubCaptureCommon aubSubCaptureCommon; auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -519,8 +515,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS AubSubCaptureCommon aubSubCaptureCommon; auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon); MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -580,8 +575,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryCompre HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -606,8 +600,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -628,8 +621,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -641,8 +633,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -654,8 +645,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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 0c1dad31de..1b2252bf29 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 @@ -1745,8 +1745,7 @@ class MockCsrWithFailingFlush : public CommandStreamReceiverHw { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenWaitForCompletionWithTimeoutIsCalledWhenFlushBatchedSubmissionsReturnsFailureThenItIsPropagated) { MockCsrWithFailingFlush mockCsr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); - MockOsContext osContext(0, 8, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 8, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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 15d3b50533..c26a121a77 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 @@ -270,8 +270,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch bool stateBaseAddressDirty; bool vfeStateDirty; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 8, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); mockCsr->setupContext(osContext); mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 0u, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty); @@ -292,8 +291,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch bool stateBaseAddressDirty; bool vfeStateDirty; - MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false); + MockOsContext osContext(0, 8, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); mockCsr->setupContext(osContext); mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 0u, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty); @@ -316,8 +314,7 @@ 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, false, false); + MockOsContext osContext(0, 8, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); mockCsr->setupContext(osContext); mockCsr->programVFEState(commandStream, flags, 10); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp index 56bf4a4e0c..3bd9f42ba4 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp @@ -315,8 +315,7 @@ HWTEST_F(BcsTests, givenMultipleBlitPropertiesWhenDispatchingThenProgramCommands } HWTEST_F(BcsTests, givenProfilingEnabledWhenBlitBufferThenCommandBufferIsConstructedProperly) { - auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, 0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, 0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); auto bcsCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); @@ -409,8 +408,7 @@ HWTEST_F(BcsTests, givenInputAllocationsWhenBlitDispatchedThenMakeAllAllocations HWTEST_F(BcsTests, givenFenceAllocationIsRequiredWhenBlitDispatchedThenMakeAllAllocationsResident) { RAIIHwHelperFactory> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; - auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, 0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, 0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); auto bcsCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_fixture.h b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_fixture.h index f05228f894..8a13aa39a9 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_fixture.h +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,8 +19,7 @@ struct BcsTests : public Test { auto contextId = engine->osContext->getContextId(); delete engine->osContext; - engine->osContext = OsContext::create(nullptr, contextId, pDevice->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false); + engine->osContext = OsContext::create(nullptr, contextId, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); engine->osContext->incRefInternal(); csr.setupContext(*engine->osContext); @@ -42,4 +41,4 @@ struct BcsTests : public Test { TimestampPacketContainer timestampPacketContainer; CsrDependencies csrDependencies; std::unique_ptr context; -}; \ No newline at end of file +}; 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 62b5cd7d46..09a117b7ad 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 @@ -327,8 +327,8 @@ HWTEST_F(CommandStreamReceiverTest, whenDirectSubmissionDisabledThenExpectNoFeat DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment()); CommandStreamReceiverHw csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); bool ret = csr.initDirectSubmission(*pDevice, *osContext.get()); EXPECT_TRUE(ret); @@ -368,8 +368,8 @@ using InitDirectSubmissionTest = Test; HWTEST_F(InitDirectSubmissionTest, whenDirectSubmissionEnabledOnRcsThenExpectFeatureAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; @@ -386,8 +386,8 @@ HWTEST_F(InitDirectSubmissionTest, whenDirectSubmissionEnabledOnRcsThenExpectFea HWTEST_F(InitDirectSubmissionTest, givenDirectSubmissionEnabledWhenPlatformNotSupportsRcsThenExpectFeatureNotAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = false; @@ -403,8 +403,8 @@ HWTEST_F(InitDirectSubmissionTest, givenDirectSubmissionEnabledWhenPlatformNotSu HWTEST_F(InitDirectSubmissionTest, whenDirectSubmissionEnabledOnBcsThenExpectFeatureAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -422,8 +422,8 @@ HWTEST_F(InitDirectSubmissionTest, whenDirectSubmissionEnabledOnBcsThenExpectFea HWTEST_F(InitDirectSubmissionTest, givenDirectSubmissionEnabledWhenPlatformNotSupportsBcsThenExpectFeatureNotAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -441,8 +441,8 @@ HWTEST_F(InitDirectSubmissionTest, givenDirectSubmissionEnabledWhenPlatformNotSu HWTEST_F(InitDirectSubmissionTest, givenLowPriorityContextWhenDirectSubmissionDisabledOnLowPriorityThenExpectFeatureNotAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - true, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -460,8 +460,8 @@ HWTEST_F(InitDirectSubmissionTest, givenLowPriorityContextWhenDirectSubmissionDi HWTEST_F(InitDirectSubmissionTest, givenLowPriorityContextWhenDirectSubmissionEnabledOnLowPriorityThenExpectFeatureAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - true, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, PreemptionMode::ThreadGroup, + false)); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; @@ -477,8 +477,8 @@ HWTEST_F(InitDirectSubmissionTest, givenLowPriorityContextWhenDirectSubmissionEn HWTEST_F(InitDirectSubmissionTest, givenInternalContextWhenDirectSubmissionDisabledOnInternalThenExpectFeatureNotAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, true, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Internal}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -496,8 +496,8 @@ HWTEST_F(InitDirectSubmissionTest, givenInternalContextWhenDirectSubmissionDisab HWTEST_F(InitDirectSubmissionTest, givenInternalContextWhenDirectSubmissionEnabledOnInternalThenExpectFeatureAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, true, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Internal}, PreemptionMode::ThreadGroup, + false)); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; @@ -514,8 +514,8 @@ HWTEST_F(InitDirectSubmissionTest, givenInternalContextWhenDirectSubmissionEnabl HWTEST_F(InitDirectSubmissionTest, givenRootDeviceContextWhenDirectSubmissionDisabledOnRootDeviceThenExpectFeatureNotAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, true)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + true)); osContext->setDefaultContext(true); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -533,8 +533,8 @@ HWTEST_F(InitDirectSubmissionTest, givenRootDeviceContextWhenDirectSubmissionDis HWTEST_F(InitDirectSubmissionTest, givenRootDeviceContextWhenDirectSubmissionEnabledOnRootDeviceThenExpectFeatureAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, true)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + true)); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true; @@ -551,8 +551,8 @@ HWTEST_F(InitDirectSubmissionTest, givenRootDeviceContextWhenDirectSubmissionEna HWTEST_F(InitDirectSubmissionTest, givenNonDefaultContextWhenDirectSubmissionDisabledOnNonDefaultThenExpectFeatureNotAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(false); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -570,8 +570,8 @@ HWTEST_F(InitDirectSubmissionTest, givenNonDefaultContextWhenDirectSubmissionDis HWTEST_F(InitDirectSubmissionTest, givenNonDefaultContextContextWhenDirectSubmissionEnabledOnNonDefaultContextThenExpectFeatureAvailable) { auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(false); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -591,8 +591,8 @@ HWTEST_F(InitDirectSubmissionTest, GivenBlitterOverrideEnabledWhenBlitterIsNonDe auto csr = std::make_unique>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()); std::unique_ptr osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(false); auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo(); @@ -872,9 +872,9 @@ TEST(CommandStreamReceiverSimpleTest, givenPrintfTagAllocationAddressFlagEnabled DebugManager.flags.PrintTagAllocationAddress.set(true); DeviceBitfield deviceBitfield(1); auto osContext = std::unique_ptr(OsContext::create(nullptr, 0, deviceBitfield, - aub_stream::EngineType::ENGINE_BCS, + EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, - false, false, false)); + false)); MockExecutionEnvironment executionEnvironment; executionEnvironment.prepareRootDeviceEnvironments(1); @@ -1323,9 +1323,8 @@ HWTEST_F(SimulatedCommandStreamReceiverTest, givenCsrWithOsContextWhenGetDeviceI executionEnvironment.initializeMemoryManager(); DeviceBitfield deviceBitfield(0b11); MockSimulatedCsrHw csr(executionEnvironment, 0, deviceBitfield); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, - deviceBitfield, PreemptionMode::Disabled, - false, false, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, EngineTypeUsage{aub_stream::EngineType::ENGINE_RCS, EngineUsage::Regular}, + deviceBitfield, PreemptionMode::Disabled, false); csr.setupContext(*osContext); EXPECT_EQ(1u, csr.getDeviceIndex()); @@ -1337,9 +1336,8 @@ HWTEST_F(SimulatedCommandStreamReceiverTest, givenOsContextWithNoDeviceBitfieldW executionEnvironment.initializeMemoryManager(); DeviceBitfield deviceBitfield(0b00); MockSimulatedCsrHw csr(executionEnvironment, 0, deviceBitfield); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, - deviceBitfield, PreemptionMode::Disabled, - false, false, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, EngineTypeUsage{aub_stream::EngineType::ENGINE_RCS, EngineUsage::Regular}, + deviceBitfield, PreemptionMode::Disabled, 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 d478415845..1120d7a26b 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 @@ -130,10 +130,10 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParammemoryManager->createAndRegisterOsContext(csrWithAubDump, - getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), + EngineTypeUsage{getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), EngineUsage::Regular}, deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo), - false, false, false); + false); csrWithAubDump->setupContext(*osContext); } @@ -157,8 +157,8 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett CommandStreamReceiverWithAUBDump> csrWithAubDump("aubfile", *executionEnvironment, 0, deviceBitfield); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); - MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); + MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); csrWithAubDump.setupContext(osContext); EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext()); @@ -284,8 +284,8 @@ struct CommandStreamReceiverTagTests : public ::testing::Test { bool isTimestampPacketNodeReleasable(Args &&...args) { CsrT csr(std::forward(args)...); auto hwInfo = csr.peekExecutionEnvironment().rootDeviceEnvironments[0]->getHardwareInfo(); - MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); + MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); csr.setupContext(osContext); auto allocator = csr.getTimestampPacketAllocator(); 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 dde6b6853b..551db1d6dc 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 @@ -322,7 +322,7 @@ HWTEST_F(TbxCommandStreamTests, givenDbgDeviceIdFlagIsSetWhenTbxCsrIsCreatedThen HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingMakeSurfacePackNonResidentThenOnlyResidentAllocationsAddedAllocationsForDownload) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); EXPECT_EQ(0u, tbxCsr.allocationsForDownload.size()); @@ -343,7 +343,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingMakeSurfacePackNonResi HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForTaskCountWithKmdNotifyFallbackThenTagAllocationAndScheduledAllocationsAreDownloaded) { MockTbxCsrRegisterDownloadedAllocations tbxCsr{*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); tbxCsr.initializeTagAllocation(); @@ -369,7 +369,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForTaskCountWithKm HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForCompletionWithTimeoutThenFlushIsCalledAndTagAllocationAndScheduledAllocationsAreDownloaded) { MockTbxCsrRegisterDownloadedAllocations tbxCsr{*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); tbxCsr.initializeTagAllocation(); @@ -396,7 +396,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForCompletionWithT HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenDownloadAllocatoinsCalledThenTagAndScheduledAllocationsAreDownloadedAndRemovedFromContainer) { MockTbxCsrRegisterDownloadedAllocations tbxCsr{*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); tbxCsr.initializeTagAllocation(); @@ -441,7 +441,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenItIsCreatedWith HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -468,7 +468,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl DebugManager.flags.CsrDispatchMode.set(static_cast(DispatchMode::BatchedDispatch)); MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, pDevice->getDeviceBitfield()}); @@ -486,7 +486,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -504,7 +504,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -516,7 +516,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenDownloadAllocationIsCalledThenItShouldCallTheExpectedHwContextFunctions) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -541,8 +541,8 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) { auto hwInfo = pDevice->getHardwareInfo(); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0].first, - PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0], + PreemptionMode::Disabled, false); std::string fileName = ""; MockAubManager *mockManager = new MockAubManager(); auto gmmHelper = pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(); @@ -646,7 +646,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThe HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsDisabledThenPauseShouldBeTurnedOn) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -669,7 +669,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenPauseShouldBeTurnedOff) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -693,7 +693,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenCallPollForCompletionAndDisableSubCapture) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -717,7 +717,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureGetsActivatedThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -742,7 +742,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureRemainsActiveThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -808,7 +808,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithoutDu HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureIsInactiveThenDontForceDumpingAllocationsTbxNonWritable) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -831,7 +831,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureGetsActivatedThenForceDumpingAllocationsTbxNonWritable) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -857,7 +857,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureRemainsActivatedThenDontForceDumpingAllocationsTbxNonWritable) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); AubSubCaptureCommon aubSubCaptureCommon; @@ -883,7 +883,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA HWTEST_F(TbxCommandStreamTests, givenTbxCsrInNonSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledThenReturnStatusInactive) { MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); MultiDispatchInfo dispatchInfo; @@ -904,11 +904,11 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenDispatchBlitEnqueueThenProcessCor MockTbxCsr tbxCsr1{*pDevice->executionEnvironment, pDevice->getDeviceBitfield()}; tbxCsr1.initializeTagAllocation(); - MockOsContext osContext0(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext0(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr0.setupContext(osContext0); EngineControl engineControl0{&tbxCsr0, &osContext0}; - MockOsContext osContext1(1, pDevice->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext1(1, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr1.setupContext(osContext0); EngineControl engineControl1{&tbxCsr1, &osContext1}; @@ -926,7 +926,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenDispatchBlitEnqueueThenProcessCor HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalledButBcsIsUsedThenGraphicsAllocationShouldNotBeDumped) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -942,7 +942,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWritableWhenDumpAllocationIsCalledButDumpFormatIsNotSpecifiedThenGraphicsAllocationShouldNotBeDumped) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -964,7 +964,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWritableWhenDumpAllocatio DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -986,7 +986,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1058,7 +1058,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle DebugManager.flags.AUBDumpBufferFormat.set("BIN"); MockTbxCsr tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()); - MockOsContext osContext(0, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + MockOsContext osContext(0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); diff --git a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h b/opencl/test/unit_test/fixtures/memory_allocator_fixture.h index 1aa4d30ca6..7d8c05b486 100644 --- a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h +++ b/opencl/test/unit_test/fixtures/memory_allocator_fixture.h @@ -31,9 +31,9 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { csr = &device->getGpgpuCommandStreamReceiver(); auto &hwInfo = device->getHardwareInfo(); auto engineType = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0].first; - auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, + auto osContext = memoryManager->createAndRegisterOsContext(csr, EngineTypeUsage{engineType, EngineUsage::Regular}, 1, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, 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 3bd85374d3..cd990f93a5 100644 --- a/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp +++ b/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,9 +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.first, 1, + auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineTypeUsage{engine.first, EngineUsage::Regular}, 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, 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 4e8f79444f..cb447cad65 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(), pDevice->getDeviceBitfield())); - 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); + MockOsContext rcsOsContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); + MockOsContext ccsOsContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_CCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_CCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); 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, false, false); + MockOsContext osContext(0, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); aubCsr.setupContext(osContext); diff --git a/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp b/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp index c5d9f3bdc0..b049cee70e 100644 --- a/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp +++ b/opencl/test/unit_test/helpers/timestamp_packet_tests.cpp @@ -893,8 +893,8 @@ HWTEST_F(TimestampPacketTests, givenMultipleDevicesOnCsrWhenIncrementingCpuDepen UltClDeviceFactory factory{2, 4}; - auto osContext0 = std::unique_ptr(OsContext::create(nullptr, 0, osContext0DeviceBitfiled, aub_stream::EngineType::ENGINE_RCS, PreemptionMode::Disabled, false, false, false)); - auto osContext1 = std::unique_ptr(OsContext::create(nullptr, 1, osContext1DeviceBitfiled, aub_stream::EngineType::ENGINE_RCS, PreemptionMode::Disabled, false, false, false)); + auto osContext0 = std::unique_ptr(OsContext::create(nullptr, 0, osContext0DeviceBitfiled, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); + auto osContext1 = std::unique_ptr(OsContext::create(nullptr, 1, osContext1DeviceBitfiled, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); EXPECT_EQ(2u, osContext0->getNumSupportedDevices()); EXPECT_EQ(3u, osContext1->getNumSupportedDevices()); diff --git a/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp index 5c34ce3034..959fa3d0fa 100644 --- a/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp @@ -33,8 +33,7 @@ struct BcsBufferTests : public ::testing::Test { class BcsMockContext : public MockContext { public: BcsMockContext(ClDevice *device) : MockContext(device) { - bcsOsContext.reset(OsContext::create(nullptr, 0, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + bcsOsContext.reset(OsContext::create(nullptr, 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_CCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield())); bcsCsr->setupContext(*bcsOsContext); bcsCsr->initializeTagAllocation(); @@ -105,8 +104,7 @@ struct BcsBufferTests : public ::testing::Test { if (createBcsEngine) { auto &engine = device->getEngine(getChosenEngineType(device->getHardwareInfo()), true, false); - bcsOsContext.reset(OsContext::create(nullptr, 1, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::Disabled, - false, false, false)); + bcsOsContext.reset(OsContext::create(nullptr, 1, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, 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 99ed111eb9..db47634c0e 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 @@ -488,9 +488,9 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh auto mockCsr = new ::testing::NiceMock>(*mockDevice.executionEnvironment, 1); auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, - aub_stream::ENGINE_RCS, 1, + EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 1, PreemptionMode::Disabled, - false, false, false); + false); mockDevice.engines[0].osContext = osContext; mockDevice.resetCommandStreamReceiver(mockCsr); @@ -527,9 +527,9 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait auto mockCsr = new ::testing::NiceMock>(*mockDevice.executionEnvironment, 1); auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, - aub_stream::ENGINE_RCS, 1, + EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 1, PreemptionMode::Disabled, - false, 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 b6a9093345..42b07f991c 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -919,8 +919,7 @@ 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, false, false); + auto osContext = memoryManager->createAndRegisterOsContext(csr1.get(), EngineTypeUsage{aub_stream::EngineType::ENGINE_RCS, EngineUsage::LowPriority}, 0, PreemptionMode::Disabled, false); csr1->setupContext(*osContext); void *cpuPtr = reinterpret_cast(0x100004); @@ -1120,4 +1119,4 @@ TEST(HostPtrEntryKeyTest, givenTwoSameHostPtrEntryKeysWithSameRootDeviceIndexWhe EXPECT_FALSE(key0 < key1); EXPECT_FALSE(key1 < key0); -} \ No newline at end of file +} diff --git a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl b/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl index dbc58665df..fbbb96a50f 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl +++ b/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl @@ -902,8 +902,8 @@ TEST(MemoryManagerTest, givenPropertiesWithOsContextWhenGetAllocationDataIsCalle AllocationProperties properties{0, 1, GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, mockDeviceBitfield}; MockOsContext osContext(0u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, - PreemptionMode::Disabled, false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], + PreemptionMode::Disabled, false); properties.osContext = &osContext; 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 655836b868..29b30f1e87 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -227,9 +227,9 @@ TEST_F(MemoryAllocatorTest, WhenAllocatingGraphicsMemoryThenAllocationHasCorrect unsigned int alignment = 4096; memoryManager->createAndRegisterOsContext(csr, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], 1, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize}); ASSERT_NE(nullptr, allocation); @@ -1452,10 +1452,10 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenGpuAddressIsSetThenAllocatio std::unique_ptr csr(createCommandStream(executionEnvironment, 0u, deviceBitfield)); executionEnvironment.memoryManager.reset(memoryManager); auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); MockAllocationProperties properties = {0, MemoryConstants::pageSize}; properties.osContext = osContext; @@ -1658,9 +1658,9 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) { memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], 1, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize}); auto tagAddress = csr->getTagAddress(); @@ -1917,9 +1917,9 @@ TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCo DeviceBitfield deviceBitfield(1); std::unique_ptr csr(createCommandStream(executionEnvironment, 0u, deviceBitfield)); memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); EXPECT_EQ(1u, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount()); } @@ -1946,9 +1946,9 @@ TEST(ResidencyDataTest, givenDeviceBitfieldWhenCreatingOsContextThenSetValidValu std::unique_ptr csr(createCommandStream(executionEnvironment, 0u, deviceBitfield)); PreemptionMode preemptionMode = PreemptionMode::MidThread; memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], deviceBitfield, preemptionMode, - false, 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()); @@ -1962,13 +1962,13 @@ TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegisteredFromHigherToLower std::unique_ptr csr(createCommandStream(executionEnvironment, 0u, deviceBitfield)); std::unique_ptr csr1(createCommandStream(executionEnvironment, 1u, deviceBitfield)); memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); memoryManager->createAndRegisterOsContext(csr1.get(), - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[1].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[1], deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); EXPECT_EQ(2u, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount()); EXPECT_EQ(1, memoryManager->registeredEngines[1].osContext->getRefInternalCount()); @@ -1988,11 +1988,11 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt MockResidencyData residency(MemoryManager::maxOsContextCount); MockOsContext osContext(0u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); MockOsContext osContext2(1u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[1].first, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[1], + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), 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 cf856d6cf2..02ac8e453a 100644 --- a/opencl/test/unit_test/memory_manager/surface_tests.cpp +++ b/opencl/test/unit_test/memory_manager/surface_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -67,10 +67,10 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves DeviceBitfield deviceBitfield(1); auto csr = std::make_unique>(execStamp, *executionEnvironment, 0, deviceBitfield); auto hwInfo = *defaultHwInfo; - auto engine = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0].first; + auto engine = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr.get(), engine, deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(hwInfo), - false, 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 2ba93dc124..fcd6b906fa 100644 --- a/opencl/test/unit_test/mocks/mock_aub_csr.h +++ b/opencl/test/unit_test/mocks/mock_aub_csr.h @@ -196,9 +196,10 @@ std::unique_ptr getEnvironment(bool createTagAllocation auto commandStreamReceiver = std::make_unique("", standalone, *executionEnvironment, rootDeviceIndex, deviceBitfield); auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), - getChosenEngineType(*defaultHwInfo), deviceBitfield, + EngineTypeUsage{getChosenEngineType(*defaultHwInfo), EngineUsage::Regular}, + deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); commandStreamReceiver->setupContext(*osContext); if (createTagAllocation) { diff --git a/opencl/test/unit_test/mocks/mock_os_context.h b/opencl/test/unit_test/mocks/mock_os_context.h index 9835f73dc9..39ca089cc6 100644 --- a/opencl/test/unit_test/mocks/mock_os_context.h +++ b/opencl/test/unit_test/mocks/mock_os_context.h @@ -16,9 +16,8 @@ class MockOsContext : public OsContext { using OsContext::getDeviceBitfield; MockOsContext(uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode, - lowPriority, internalEngine, rootDevice) {} + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, + bool rootDevice) + : OsContext(contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice) {} }; } // namespace NEO diff --git a/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp index ed8f157cde..13721a53d2 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp @@ -54,7 +54,7 @@ class DrmBufferObjectFixture { void SetUp() { this->mock = std::make_unique(); ASSERT_NE(nullptr, this->mock); - osContext.reset(new OsContextLinux(*this->mock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false)); + osContext.reset(new OsContextLinux(*this->mock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false)); this->mock->reset(); bo = new TestedBufferObject(this->mock.get()); ASSERT_NE(nullptr, bo); @@ -233,7 +233,7 @@ TEST_F(DrmBufferObjectTest, whenPrintExecutionBufferIsSetToTrueThenMessageFoundI TEST(DrmBufferObjectSimpleTest, givenInvalidBoWhenValidateHostptrIsCalledThenErrorIsReturned) { std::unique_ptr buff(new uint32_t[256]); std::unique_ptr mock(new DrmMockCustom); - OsContextLinux osContext(*mock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(*mock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); ASSERT_NE(nullptr, mock.get()); std::unique_ptr bo(new TestedBufferObject(mock.get())); ASSERT_NE(nullptr, bo.get()); @@ -256,7 +256,7 @@ TEST(DrmBufferObjectSimpleTest, givenInvalidBoWhenValidateHostptrIsCalledThenErr TEST(DrmBufferObjectSimpleTest, givenInvalidBoWhenPinIsCalledThenErrorIsReturned) { std::unique_ptr buff(new uint32_t[256]); std::unique_ptr mock(new DrmMockCustom); - OsContextLinux osContext(*mock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(*mock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); ASSERT_NE(nullptr, mock.get()); std::unique_ptr bo(new TestedBufferObject(mock.get())); ASSERT_NE(nullptr, bo.get()); @@ -287,7 +287,7 @@ TEST(DrmBufferObjectSimpleTest, givenArrayOfBosWhenPinnedThenAllBosArePinned) { std::unique_ptr buff(new uint32_t[256]); std::unique_ptr mock(new DrmMockCustom); ASSERT_NE(nullptr, mock.get()); - OsContextLinux osContext(*mock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(*mock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); std::unique_ptr bo(new TestedBufferObject(mock.get())); ASSERT_NE(nullptr, bo.get()); @@ -320,7 +320,7 @@ TEST(DrmBufferObjectSimpleTest, givenArrayOfBosWhenValidatedThenAllBosArePinned) std::unique_ptr buff(new uint32_t[256]); std::unique_ptr mock(new DrmMockCustom); ASSERT_NE(nullptr, mock.get()); - OsContextLinux osContext(*mock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(*mock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); std::unique_ptr bo(new TestedBufferObject(mock.get())); ASSERT_NE(nullptr, bo.get()); 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 47b0fafb95..b80b5110cb 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 @@ -39,9 +39,9 @@ class DrmCommandStreamTest : public ::testing::Test { auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo(); mock->createVirtualMemoryAddressSpace(HwHelper::getSubDevicesCount(hwInfo)); - osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, + osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, false, false); + false); csr = new DrmCommandStreamReceiver(executionEnvironment, 0, 1, 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 6e8e5bfb71..3cea401365 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 @@ -232,9 +232,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdT .RetiresOnSaturation(); osContext = std::make_unique(*mock, 1, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); csr->setupContext(*osContext); auto &cs = csr->getCS(); @@ -1338,8 +1338,8 @@ struct DrmCommandStreamBlitterDirectSubmissionTest : public DrmCommandStreamDire DrmCommandStreamDirectSubmissionTest::SetUpT(); osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); csr->initDirectSubmission(*device.get(), *osContext.get()); } 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 9808dac6c6..f75be88ef2 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_tests.cpp @@ -138,14 +138,14 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]); { - OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext1(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(1u, osContext1.getDrmContextIds().size()); EXPECT_EQ(drmMock.receivedCreateContextId, osContext1.getDrmContextIds()[0]); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); { - OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext2(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(1u, osContext2.getDrmContextIds().size()); EXPECT_EQ(drmMock.receivedCreateContextId, osContext2.getDrmContextIds()[0]); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); @@ -162,7 +162,7 @@ TEST(DrmTest, whenCreatingDrmContextWithVirtualMemoryAddressSpaceThenProperVmIdI ASSERT_EQ(1u, drmMock.virtualMemoryIds.size()); - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(drmMock.receivedContextParamRequest.value, drmMock.getVirtualMemoryAddressSpace(0u)); } @@ -175,7 +175,7 @@ TEST(DrmTest, whenCreatingDrmContextWithNoVirtualMemoryAddressSpaceThenProperCon ASSERT_EQ(0u, drmMock.virtualMemoryIds.size()); - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedCreateContextId); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); @@ -191,14 +191,14 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI drmMock.StoredRetValForPersistant = -1; drmMock.checkNonPersistentContextsSupport(); expectedCount += 2; - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount); } { drmMock.StoredRetValForPersistant = 0; drmMock.checkNonPersistentContextsSupport(); ++expectedCount; - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); expectedCount += 2; EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount); } @@ -210,17 +210,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]); drmMock.preemptionSupported = false; - 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); + OsContextLinux osContext1(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); + OsContextLinux osContext2(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, PreemptionMode::Disabled, false); EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount); drmMock.preemptionSupported = true; - OsContextLinux osContext3(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext3(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(3u, drmMock.receivedContextParamRequestCount); - OsContextLinux osContext4(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false); + OsContextLinux osContext4(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, PreemptionMode::Disabled, false); EXPECT_EQ(5u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(drmMock.receivedCreateContextId, drmMock.receivedContextParamRequest.ctx_id); EXPECT_EQ(static_cast(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param); @@ -233,21 +233,21 @@ TEST(DrmTest, givenDirectSubmissionEnabledOnBlitterWhenCreateBcsEngineThenLowPri executionEnvironment->prepareRootDeviceEnvironments(1); DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]); - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); DebugManagerStateRestore restorer; DebugManager.flags.EnableDirectSubmission.set(1); DebugManager.flags.DirectSubmissionOverrideBlitterSupport.set(1); - OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext2(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(3u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(drmMock.receivedCreateContextId, drmMock.receivedContextParamRequest.ctx_id); EXPECT_EQ(static_cast(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param); EXPECT_EQ(static_cast(-1023), drmMock.receivedContextParamRequest.value); EXPECT_EQ(0u, drmMock.receivedContextParamRequest.size); - OsContextLinux osContext3(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext3(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(4u, drmMock.receivedContextParamRequestCount); } @@ -436,7 +436,7 @@ TEST(DrmTest, givenDrmWhenCreatingOsContextThenCreateDrmContextWithVmId) { auto executionEnvironment = std::make_unique(); executionEnvironment->prepareRootDeviceEnvironments(1); DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]); - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(SysCalls::vmId, drmMock.getVirtualMemoryAddressSpace(0)); @@ -451,10 +451,10 @@ TEST(DrmTest, givenDrmWithPerContextVMRequiredWhenCreatingOsContextsThenImplicit DrmMock drmMock(rootEnv); EXPECT_TRUE(drmMock.requirePerContextVM); - OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext1(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedCreateContextId); - OsContextLinux osContext2(drmMock, 5u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext2(drmMock, 5u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedCreateContextId); } @@ -467,7 +467,7 @@ TEST(DrmTest, givenDrmWithPerContextVMRequiredWhenCreatingOsContextsThenImplicit drmMock.StoredRetValForVmId = 20; - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedCreateContextId); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); @@ -485,7 +485,7 @@ TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedA drmMock.StoredRetValForVmId = 1; - OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedCreateContextId); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); @@ -504,7 +504,7 @@ TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextTh DrmMockNonFailing drmMock(*executionEnvironment->rootDeviceEnvironments[0]); drmMock.contextDebugSupported = true; - OsContextLinux osContext(drmMock, 5u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContextLinux osContext(drmMock, 5u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); // drmMock returns ctxId == 0 EXPECT_EQ(0u, drmMock.passedContextDebugId); @@ -521,7 +521,7 @@ TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextFo DrmMockNonFailing drmMock(*executionEnvironment->rootDeviceEnvironments[0]); drmMock.contextDebugSupported = true; - OsContextLinux osContext(drmMock, 5u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, true, false); + OsContextLinux osContext(drmMock, 5u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Internal}, PreemptionMode::Disabled, false); EXPECT_EQ(static_cast(-1), drmMock.passedContextDebugId); } 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 6eaf94c5f9..0d88e5d05f 100644 --- a/opencl/test/unit_test/os_interface/os_context_tests.cpp +++ b/opencl/test/unit_test/os_interface/os_context_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Intel Corporation + * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,7 +12,7 @@ using namespace NEO; TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) { - OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContext *osContext = OsContext::create(nullptr, 0, 0, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_TRUE(osContext->isInitialized()); EXPECT_FALSE(osContext->isLowPriority()); EXPECT_FALSE(osContext->isInternalEngine()); @@ -20,16 +20,24 @@ TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) { 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()); +TEST(OSContext, givenInternalAndRootDeviceAreTrueWhenCreatingDefaultOsContextThenExpectGettersTrue) { + OsContext *osContext = OsContext::create(nullptr, 0, 0, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Internal}, PreemptionMode::Disabled, true); + EXPECT_FALSE(osContext->isLowPriority()); EXPECT_TRUE(osContext->isInternalEngine()); EXPECT_TRUE(osContext->isRootDevice()); delete osContext; } +TEST(OSContext, givenLowPriorityAndRootDeviceAreTrueWhenCreatingDefaultOsContextThenExpectGettersTrue) { + OsContext *osContext = OsContext::create(nullptr, 0, 0, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, PreemptionMode::Disabled, true); + EXPECT_TRUE(osContext->isLowPriority()); + EXPECT_FALSE(osContext->isInternalEngine()); + EXPECT_TRUE(osContext->isRootDevice()); + delete osContext; +} + TEST(OSContext, givenOsContextCreatedDefaultIsFalseWhenSettingTrueThenFlagTrueReturned) { - OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false); + OsContext *osContext = OsContext::create(nullptr, 0, 0, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); EXPECT_FALSE(osContext->isDefaultContext()); osContext->setDefaultContext(true); EXPECT_TRUE(osContext->isDefaultContext()); diff --git a/opencl/test/unit_test/os_interface/performance_counters_tests.cpp b/opencl/test/unit_test/os_interface/performance_counters_tests.cpp index 757dc9af71..a8d764bb39 100644 --- a/opencl/test/unit_test/os_interface/performance_counters_tests.cpp +++ b/opencl/test/unit_test/os_interface/performance_counters_tests.cpp @@ -213,8 +213,8 @@ struct PerformanceCountersMetricsLibraryTest : public PerformanceCountersMetrics void SetUp() override { PerformanceCountersMetricsLibraryFixture::SetUp(); auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); - osContext = std::make_unique(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, - PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); + osContext = std::make_unique(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); queue->getGpgpuCommandStreamReceiver().setupContext(*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 3b63445334..ebaa31b1ee 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 @@ -73,8 +73,8 @@ class WddmCommandStreamFixture { wddm = static_cast(executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->getWddm()); device.reset(MockDevice::create(executionEnvironment, 0u)); osContext.reset(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); csr = new WddmCommandStreamReceiver(*executionEnvironment, 0, device->getDeviceBitfield()); @@ -301,9 +301,9 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf auto csr = std::make_unique>(*executionEnvironment, 0, 1); 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].first, + OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, false, false); + false); csr->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize}); @@ -327,9 +327,9 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn auto csr = std::make_unique>(*executionEnvironment, 0, 1); 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].first, + OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, false, false); + false); csr->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize}); @@ -1018,8 +1018,8 @@ TEST_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnRcsWhenFlushi std::unique_ptr osContext; osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); osContext->setDefaultContext(true); csr->callParentInitDirectSubmission = false; bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); @@ -1056,8 +1056,8 @@ TEST_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnBcsWhenFlushi std::unique_ptr osContext; osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), - 0, device->getDeviceBitfield(), aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, - false, false, false)); + 0, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false)); csr->callParentInitDirectSubmission = false; csr->initBlitterDirectSubmission = true; bool ret = csr->initDirectSubmission(*device.get(), *osContext.get()); 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 603fe77054..c56cd136fa 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 @@ -16,38 +16,38 @@ struct OsContextWinTest : public WddmTestWithMockGdiDll { void SetUp() override { WddmTestWithMockGdiDll::SetUp(); preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo); - engineType = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first; + engineTypeUsage = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0]; init(); } PreemptionMode preemptionMode; - aub_stream::EngineType engineType; + EngineTypeUsage engineTypeUsage; }; TEST_F(OsContextWinTest, givenWddm20WhenCreatingOsContextThenOsContextIsInitialized) { - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineTypeUsage, preemptionMode, 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, false, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineTypeUsage, preemptionMode, false); EXPECT_FALSE(osContext->isInitialized()); } TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmMonitorFenceFailThenOsContextIsNotInitialized) { *getCreateSynchronizationObject2FailCallFcn() = true; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineTypeUsage, preemptionMode, false); EXPECT_FALSE(osContext->isInitialized()); } TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackFailThenOsContextIsNotInitialized) { *getRegisterTrimNotificationFailCallFcn() = true; - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineTypeUsage, preemptionMode, 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, false, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engineTypeUsage, preemptionMode, 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 731f4ac3fe..c5636fe456 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,8 +32,8 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit wddm->init(); EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called); auto osContext = std::make_unique(*wddm, 0u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, - preemptionMode, false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], + preemptionMode, 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 6e5cbb4831..0982114b7f 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm23_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm23_tests.cpp @@ -46,8 +46,8 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture { wddm->init(); wddm->wddmInterface.reset(wddmMockInterface); osContext = std::make_unique(*wddm, 0u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, - preemptionMode, false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], + preemptionMode, false); } void TearDown() override { @@ -78,11 +78,11 @@ TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) { } TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) { - auto defaultEngine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first; + auto defaultEngine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0]; OsContextWin osContextWithoutPreemption(*wddm, 0u, 1, defaultEngine, PreemptionMode::Disabled, - false, false, false); + false); OsContextWin osContextWithPreemption(*wddm, 0u, 1, defaultEngine, PreemptionMode::MidBatch, - false, 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 db317db543..4773a648bd 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_fixture.h +++ b/opencl/test/unit_test/os_interface/windows/wddm_fixture.h @@ -46,9 +46,9 @@ struct WddmFixture : public Test { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo); wddm->init(); auto hwInfo = rootDeviceEnvironemnt->getHardwareInfo(); - auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first; + auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, engine, preemptionMode, - false, false, false); + false); mockTemporaryResources = static_cast(wddm->temporaryResources.get()); } @@ -82,9 +82,9 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture, public MockExecutionEnv wddm->wddmInterface.reset(wddmMockInterface); auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); - auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first; + auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, engine, preemptionMode, - false, 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 e8168e4412..584aeb2108 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 @@ -80,9 +80,9 @@ TEST(WddmMemoryManager, WhenWddmMemoryManagerIsCreatedThenItIsNonAssignable) { TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { MockWddmAllocation allocation; - MockOsContext osContext(1u, 1, aub_stream::ENGINE_RCS, + MockOsContext osContext(1u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), - false, false, false); + false); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); @@ -386,9 +386,9 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique(wddm2); auto hwInfo = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); - memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1].first, + memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1], deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, false, false); + false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); auto allocation = static_cast(memoryManager->allocateGraphicsMemoryWithProperties({0u, 32, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield})); @@ -420,9 +420,9 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique(wddm2); auto hwInfo = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); - memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1].first, + memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1], deviceBitfield, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, false, false); + false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); auto allocation = static_cast(memoryManager->allocateGraphicsMemoryWithProperties({0u, 32, GraphicsAllocation::AllocationType::BUFFER, mockDeviceBitfield})); @@ -1642,12 +1642,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenC std::unique_ptr csr(createCommandStream(*executionEnvironment, 0u, 1)); std::unique_ptr csr1(createCommandStream(*executionEnvironment, 1u, 2)); std::unique_ptr csr2(createCommandStream(*executionEnvironment, 2u, 3)); - memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); - memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); - memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); + memoryManager->createAndRegisterOsContext(csr.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 1, + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); + memoryManager->createAndRegisterOsContext(csr1.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 2, + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); + memoryManager->createAndRegisterOsContext(csr2.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 3, + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); } @@ -1666,12 +1666,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithE std::unique_ptr csr(createCommandStream(*executionEnvironment, 0u, 1)); std::unique_ptr csr1(createCommandStream(*executionEnvironment, 1u, 2)); std::unique_ptr csr2(createCommandStream(*executionEnvironment, 2u, 3)); - memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); - memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); - memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, - PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false, false, false); + memoryManager->createAndRegisterOsContext(csr.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 1, + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); + memoryManager->createAndRegisterOsContext(csr1.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 2, + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); + memoryManager->createAndRegisterOsContext(csr2.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 3, + PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), false); auto osContext = static_cast(memoryManager->getRegisteredEngines()[1].osContext); osContext->getResidencyController().setMemoryBudgetExhausted(); EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted()); @@ -1917,8 +1917,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen 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, false, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, 1, preemptionMode, 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 cfdd0f1edf..bbb58f2178 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -68,8 +68,8 @@ class MockWddmMemoryManagerFixture { csr.reset(createCommandStream(*executionEnvironment, 0u, 1)); auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, - 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false); + HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); osContext->incRefInternal(); mockTemporaryResources = reinterpret_cast(wddm->getTemporaryResourcesContainer()); @@ -120,8 +120,8 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture csr.reset(createCommandStream(*executionEnvironment, 0u, 1)); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, - 1, preemptionMode, false, false, false); + HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], + 1, preemptionMode, 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 cfabac19d5..1427168ff7 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 @@ -62,10 +62,8 @@ 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, bool internalEngine, bool rootDevice) - : OsContextWin(wddm, contextId, deviceBitfield, engineType, preemptionMode, - lowPriority, internalEngine, rootDevice), + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice) + : OsContextWin(wddm, contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice), mockResidencyController(wddm, contextId) {} WddmResidencyController &getResidencyController() override { return mockResidencyController; }; @@ -81,8 +79,8 @@ struct WddmResidencyControllerTest : ::testing::Test { rootDeviceEnvironment = std::make_unique(*executionEnvironment); wddm = static_cast(Wddm::createWddm(nullptr, *rootDeviceEnvironment)); wddm->init(); - mockOsContextWin = std::make_unique(*wddm, osContextId, 1, aub_stream::ENGINE_RCS, - PreemptionMode::Disabled, false, false, false); + mockOsContextWin = std::make_unique(*wddm, osContextId, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, + PreemptionMode::Disabled, false); wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin); residencyController = &mockOsContextWin->mockResidencyController; } @@ -105,8 +103,7 @@ struct WddmResidencyControllerWithGdiTest : ::testing::Test { wddm->resetGdi(gdi); wddm->init(); - mockOsContextWin = std::make_unique(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, - false, false, false); + mockOsContextWin = std::make_unique(*wddm, osContextId, 0, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false); wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin); residencyController = &mockOsContextWin->mockResidencyController; residencyController->registerCallback(); @@ -137,8 +134,8 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT csr.reset(createCommandStream(*executionEnvironment, 0u, 1)); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, 1, preemptionMode, - false, false, false); + HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode, + false); osContext->incRefInternal(); residencyController = &static_cast(osContext)->getResidencyController(); @@ -173,9 +170,9 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { csr.reset(createCommandStream(*executionEnvironment, 0u, 1)); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); osContext = memoryManager->createAndRegisterOsContext(csr.get(), - HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first, + HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), - false, false, false); + false); osContext->incRefInternal(); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp index fdf0539498..6d7a2f70f1 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -343,8 +343,8 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo); wddm->init(); OsContextWin osContext(*wddm, 0u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, - preemptionMode, false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], + preemptionMode, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.serverSynchronizationObject = 0x5cU; @@ -404,8 +404,8 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo); wddm->init(); OsContextWin osContext(*wddm, 0u, 1, - HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0].first, - preemptionMode, false, false, false); + HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0], + preemptionMode, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.submissionSynchronizationObject = 0x7cU; diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 0413ec954d..a9225e1490 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -163,9 +163,11 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa } bool lowPriority = (engineTypeUsage.second == EngineUsage::LowPriority); - auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), engineType, - getDeviceBitfield(), preemptionMode, - lowPriority, internalUsage, false); + auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), + engineTypeUsage, + getDeviceBitfield(), + preemptionMode, + false); commandStreamReceiver->setupContext(*osContext); if (!commandStreamReceiver->initializeTagAllocation()) { diff --git a/shared/source/device/root_device.cpp b/shared/source/device/root_device.cpp index fcb05f5249..4c570dd144 100644 --- a/shared/source/device/root_device.cpp +++ b/shared/source/device/root_device.cpp @@ -124,8 +124,11 @@ void RootDevice::initializeRootCommandStreamReceiver() { auto defaultEngineType = getChosenEngineType(hwInfo); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); - auto osContext = getMemoryManager()->createAndRegisterOsContext(rootCommandStreamReceiver.get(), defaultEngineType, - getDeviceBitfield(), preemptionMode, false, false, true); + auto osContext = getMemoryManager()->createAndRegisterOsContext(rootCommandStreamReceiver.get(), + EngineTypeUsage{defaultEngineType, EngineUsage::Regular}, + getDeviceBitfield(), + preemptionMode, + true); rootCommandStreamReceiver->setupContext(*osContext); rootCommandStreamReceiver->initializeTagAllocation(); diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 814b4fab0a..fd934393f6 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -246,13 +246,14 @@ bool MemoryManager::isMemoryBudgetExhausted() const { return false; } -OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType, - DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) { +OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, + EngineTypeUsage typeUsage, + DeviceBitfield deviceBitfield, + PreemptionMode preemptionMode, + bool rootDevice) { auto contextId = ++latestContextId; auto osContext = OsContext::create(peekExecutionEnvironment().rootDeviceEnvironments[commandStreamReceiver->getRootDeviceIndex()]->osInterface.get(), - contextId, deviceBitfield, engineType, preemptionMode, - lowPriority, internalEngine, rootDevice); + contextId, deviceBitfield, typeUsage, preemptionMode, 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 0e890ec437..40c0ebd55d 100644 --- a/shared/source/memory_manager/memory_manager.h +++ b/shared/source/memory_manager/memory_manager.h @@ -167,9 +167,11 @@ class MemoryManager { const ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; } - OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType, - DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice); + OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, + EngineTypeUsage typeUsage, + DeviceBitfield deviceBitfield, + PreemptionMode preemptionMode, + 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 2500baf9c6..1912314c52 100644 --- a/shared/source/os_interface/linux/os_context_linux.cpp +++ b/shared/source/os_interface/linux/os_context_linux.cpp @@ -18,25 +18,21 @@ namespace NEO { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) { + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice) { if (osInterface) { - return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, - lowPriority, internalEngine, rootDevice); + return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice); } - return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, - lowPriority, internalEngine, rootDevice); + return new OsContext(contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice); } OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice), + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice) + : OsContext(contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice), drm(drm) { auto hwInfo = drm.getRootDeviceEnvironment().getHardwareInfo(); auto defaultEngineType = getChosenEngineType(*hwInfo); - if (engineType == defaultEngineType && !lowPriority && !internalEngine) { + if (engineType == defaultEngineType && !isLowPriority() && !isInternalEngine()) { this->setDefaultContext(true); } @@ -51,11 +47,11 @@ OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield devi drm.setNonPersistentContext(drmContextId); } - if (drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled() && !internalEngine) { + if (drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled() && !isInternalEngine()) { drm.setContextDebugFlag(drmContextId); } - if ((drm.isPreemptionSupported() && lowPriority) || + if ((drm.isPreemptionSupported() && isLowPriority()) || (this->isDirectSubmissionActive() && EngineHelpers::isBcs(engineType))) { drm.setLowPriorityContextParam(drmContextId); } diff --git a/shared/source/os_interface/linux/os_context_linux.h b/shared/source/os_interface/linux/os_context_linux.h index 6bebad42ce..2f04edcbd4 100644 --- a/shared/source/os_interface/linux/os_context_linux.h +++ b/shared/source/os_interface/linux/os_context_linux.h @@ -19,8 +19,7 @@ class OsContextLinux : public OsContext { OsContextLinux() = delete; ~OsContextLinux() override; OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice); + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, 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 0a0ca14670..0d9e1f2fa5 100644 --- a/shared/source/os_interface/os_context.h +++ b/shared/source/os_interface/os_context.h @@ -8,6 +8,7 @@ #pragma once #include "shared/source/command_stream/preemption_mode.h" #include "shared/source/helpers/common_types.h" +#include "shared/source/helpers/engine_node_helper.h" #include "shared/source/utilities/reference_tracked_object.h" #include "engine_node.h" @@ -25,15 +26,14 @@ class OsContext : public ReferenceTrackedObject { OsContext() = delete; static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice); + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, 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 isLowPriority() const { return engineUsage == EngineUsage::LowPriority; } + bool isInternalEngine() const { return engineUsage == EngineUsage::Internal; } bool isRootDevice() const { return rootDevice; } virtual bool isInitialized() const { return true; } bool isDefaultContext() const { return defaultContext; } @@ -48,15 +48,13 @@ class OsContext : public ReferenceTrackedObject { bool &startInContext); protected: - OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) + OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice) : contextId(contextId), deviceBitfield(deviceBitfield), preemptionMode(preemptionMode), numSupportedDevices(static_cast(deviceBitfield.count())), - engineType(engineType), - lowPriority(lowPriority), - internalEngine(internalEngine), + engineType(typeUsage.first), + engineUsage(typeUsage.second), rootDevice(rootDevice) {} const uint32_t contextId; @@ -64,8 +62,7 @@ class OsContext : public ReferenceTrackedObject { const PreemptionMode preemptionMode; const uint32_t numSupportedDevices; aub_stream::EngineType engineType = aub_stream::ENGINE_RCS; - const bool lowPriority = false; - const bool internalEngine = false; + const EngineUsage engineUsage; const bool rootDevice = false; bool defaultContext = false; bool directSubmissionActive = false; diff --git a/shared/source/os_interface/windows/os_context_win.cpp b/shared/source/os_interface/windows/os_context_win.cpp index dd956337f5..14d6055d53 100644 --- a/shared/source/os_interface/windows/os_context_win.cpp +++ b/shared/source/os_interface/windows/os_context_win.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,19 +14,16 @@ namespace NEO { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) { + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice) { if (osInterface) { - return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode, - lowPriority, internalEngine, rootDevice); + return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice); } - return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice); + return new OsContext(contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice); } OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice), + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice) + : OsContext(contextId, deviceBitfield, typeUsage, preemptionMode, rootDevice), wddm(wddm), residencyController(wddm, contextId) { diff --git a/shared/source/os_interface/windows/os_context_win.h b/shared/source/os_interface/windows/os_context_win.h index 7ca4809bf7..4097d2496b 100644 --- a/shared/source/os_interface/windows/os_context_win.h +++ b/shared/source/os_interface/windows/os_context_win.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,8 +26,7 @@ class OsContextWin : public OsContext { ~OsContextWin() override; OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - aub_stream::EngineType engineType, PreemptionMode preemptionMode, - bool lowPriority, bool internalEngine, bool rootDevice); + EngineTypeUsage typeUsage, PreemptionMode preemptionMode, bool rootDevice); D3DKMT_HANDLE getWddmContextHandle() const { return wddmContextHandle; } void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; } diff --git a/shared/test/common/fixtures/direct_submission_fixture.h b/shared/test/common/fixtures/direct_submission_fixture.h index 58c5752c6b..6c17b5cb60 100644 --- a/shared/test/common/fixtures/direct_submission_fixture.h +++ b/shared/test/common/fixtures/direct_submission_fixture.h @@ -21,8 +21,7 @@ struct DirectSubmissionFixture : public DeviceFixture { DeviceFixture::SetUp(); DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment()); - osContext.reset(OsContext::create(nullptr, 0u, pDevice->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false)); + osContext.reset(OsContext::create(nullptr, 0u, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, 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 71922722be..6640f8139b 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 @@ -28,8 +28,8 @@ struct DrmDirectSubmissionTest : public DrmMemoryManagerBasic { executionEnvironment); device.reset(MockDevice::create(&executionEnvironment, 0u)); osContext = std::make_unique(*executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getDrm(), - 0u, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false); + 0u, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, + false); } void TearDown() override { 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 1fc928706f..1ab18b80d0 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 @@ -29,8 +29,7 @@ struct WddmDirectSubmissionFixture : public WddmFixture { executionEnvironment->memoryManager.reset(new WddmMemoryManager{*executionEnvironment}); device.reset(MockDevice::create(executionEnvironment.get(), 0u)); - osContext = std::make_unique(*wddm, 0u, device->getDeviceBitfield(), aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, - false, false, false); + osContext = std::make_unique(*wddm, 0u, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, false); 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 9d455572ad..93dfed6289 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,8 +43,8 @@ class WddmPreemptionTests : public Test { wddm->init(); hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); ASSERT_NE(nullptr, hwInfo); - auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0].first; - osContext = std::make_unique(*wddm, 0u, 1, engine, preemptionMode, false, false, false); + auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; + osContext = std::make_unique(*wddm, 0u, 1, engine, preemptionMode, false); } DebugManagerStateRestore *dbgRestorer = nullptr;