diff --git a/runtime/command_stream/command_stream_receiver_simulated_common_hw.h b/runtime/command_stream/command_stream_receiver_simulated_common_hw.h index e3407c7676..f91ce3d6a0 100644 --- a/runtime/command_stream/command_stream_receiver_simulated_common_hw.h +++ b/runtime/command_stream/command_stream_receiver_simulated_common_hw.h @@ -41,7 +41,7 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw::getMemoryBankForGtt( } template -const AubMemDump::LrcaHelper &CommandStreamReceiverSimulatedCommonHw::getCsTraits(EngineInstanceT engineInstance) { - return *AUBFamilyMapper::csTraits[engineInstance.type]; +const AubMemDump::LrcaHelper &CommandStreamReceiverSimulatedCommonHw::getCsTraits(EngineType engineType) { + return *AUBFamilyMapper::csTraits[engineType]; } template void CommandStreamReceiverSimulatedCommonHw::initEngineMMIO() { - auto mmioList = AUBFamilyMapper::perEngineMMIO[osContext->getEngineType().type]; + auto mmioList = AUBFamilyMapper::perEngineMMIO[osContext->getEngineType()]; DEBUG_BREAK_IF(!mmioList); for (auto &mmioPair : *mmioList) { diff --git a/runtime/command_stream/definitions/engine_node.h b/runtime/command_stream/definitions/engine_node.h index c0aac20443..1c2fe93fd2 100644 --- a/runtime/command_stream/definitions/engine_node.h +++ b/runtime/command_stream/definitions/engine_node.h @@ -23,16 +23,6 @@ constexpr uint32_t lowPriorityGpgpuEngineIndex = 1; constexpr uint32_t numGpgpuEngineInstances = 2; } // namespace EngineInstanceConstants -struct EngineInstanceT { - constexpr EngineInstanceT(EngineType type) : type(type), id(0) {} - constexpr EngineInstanceT(EngineType type, int id) : type(type), id(id) {} - - EngineType type; - int id; -}; - -constexpr EngineInstanceT lowPriorityGpgpuEngine{ENGINE_RCS, 1}; - constexpr uint32_t maxOsContextCount = EngineInstanceConstants::numGpgpuEngineInstances; constexpr uint32_t maxHandleCount = 1u; } // namespace OCLRT diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index ed456b619e..ae70332474 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -184,7 +184,7 @@ bool Device::createEngines(const HardwareInfo *pHwInfo) { return false; } - if (gpgpuEngines[deviceCsrIndex].type == defaultEngineType && gpgpuEngines[deviceCsrIndex].id == 0) { + if (gpgpuEngines[deviceCsrIndex] == defaultEngineType && !lowPriority) { defaultEngineIndex = deviceCsrIndex; } diff --git a/runtime/helpers/hardware_context_controller.cpp b/runtime/helpers/hardware_context_controller.cpp index 5defbfb0fa..d059dcec5c 100644 --- a/runtime/helpers/hardware_context_controller.cpp +++ b/runtime/helpers/hardware_context_controller.cpp @@ -16,7 +16,7 @@ HardwareContextController::HardwareContextController(aub_stream::AubManager &aub auto deviceBitfield = osContext.getDeviceBitfield(); for (uint32_t deviceIndex = 0; deviceIndex < deviceBitfield.size(); deviceIndex++) { if (deviceBitfield.test(deviceIndex)) { - hardwareContexts.emplace_back(aubManager.createHardwareContext(deviceIndex, osContext.getEngineType().type, flags)); + hardwareContexts.emplace_back(aubManager.createHardwareContext(deviceIndex, osContext.getEngineType(), flags)); } } } diff --git a/runtime/helpers/hw_helper.h b/runtime/helpers/hw_helper.h index 2b7e90ecd7..ed3e570c75 100644 --- a/runtime/helpers/hw_helper.h +++ b/runtime/helpers/hw_helper.h @@ -38,7 +38,7 @@ class HwHelper { virtual uint32_t getConfigureAddressSpaceMode() = 0; virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const = 0; virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0; - virtual const AubMemDump::LrcaHelper &getCsTraits(EngineInstanceT engineInstance) const = 0; + virtual const AubMemDump::LrcaHelper &getCsTraits(EngineType engineType) const = 0; virtual bool supportsYTiling() const = 0; virtual bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo) const = 0; static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo); @@ -57,7 +57,7 @@ class HwHelper { uint32_t surfaceType, bool forceNonAuxMode) = 0; virtual size_t getScratchSpaceOffsetFor64bit() = 0; - virtual const std::vector getGpgpuEngineInstances() const = 0; + virtual const std::vector getGpgpuEngineInstances() const = 0; virtual bool getEnableLocalMemory(const HardwareInfo &hwInfo) const = 0; protected: @@ -99,7 +99,7 @@ class HwHelperHw : public HwHelper { return sizeof(RENDER_SURFACE_STATE); } - const AubMemDump::LrcaHelper &getCsTraits(EngineInstanceT engineInstance) const override; + const AubMemDump::LrcaHelper &getCsTraits(EngineType engineType) const override; size_t getMaxBarrierRegisterPerSlice() const override; @@ -140,7 +140,7 @@ class HwHelperHw : public HwHelper { size_t getScratchSpaceOffsetFor64bit() override; - const std::vector getGpgpuEngineInstances() const override; + const std::vector getGpgpuEngineInstances() const override; bool getEnableLocalMemory(const HardwareInfo &hwInfo) const override; diff --git a/runtime/helpers/hw_helper_common.inl b/runtime/helpers/hw_helper_common.inl index 2d1f4e4e87..4687629e81 100644 --- a/runtime/helpers/hw_helper_common.inl +++ b/runtime/helpers/hw_helper_common.inl @@ -77,8 +77,8 @@ size_t HwHelperHw::getMaxBarrierRegisterPerSlice() const { } template -const AubMemDump::LrcaHelper &HwHelperHw::getCsTraits(EngineInstanceT engineInstance) const { - return *AUBFamilyMapper::csTraits[engineInstance.type]; +const AubMemDump::LrcaHelper &HwHelperHw::getCsTraits(EngineType engineType) const { + return *AUBFamilyMapper::csTraits[engineType]; } template @@ -168,10 +168,10 @@ size_t HwHelperHw::getScratchSpaceOffsetFor64bit() { } template -const std::vector HwHelperHw::getGpgpuEngineInstances() const { - constexpr std::array gpgpuEngineInstances = {{{ENGINE_RCS, 0}, - lowPriorityGpgpuEngine}}; - return std::vector(gpgpuEngineInstances.begin(), gpgpuEngineInstances.end()); +const std::vector HwHelperHw::getGpgpuEngineInstances() const { + constexpr std::array gpgpuEngineInstances = {{ENGINE_RCS, + ENGINE_RCS}}; // low priority + return std::vector(gpgpuEngineInstances.begin(), gpgpuEngineInstances.end()); } template diff --git a/runtime/memory_manager/memory_manager.cpp b/runtime/memory_manager/memory_manager.cpp index cfe2ce44ea..ea8cd98116 100644 --- a/runtime/memory_manager/memory_manager.cpp +++ b/runtime/memory_manager/memory_manager.cpp @@ -187,7 +187,7 @@ bool MemoryManager::isMemoryBudgetExhausted() const { return false; } -OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, EngineInstanceT engineType, +OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, EngineType engineType, DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority) { auto contextId = ++latestContextId; auto osContext = OsContext::create(executionEnvironment.osInterface.get(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); diff --git a/runtime/memory_manager/memory_manager.h b/runtime/memory_manager/memory_manager.h index f711612ae7..c29322f426 100644 --- a/runtime/memory_manager/memory_manager.h +++ b/runtime/memory_manager/memory_manager.h @@ -174,7 +174,7 @@ class MemoryManager { ::alignedFree(ptr); } - OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, EngineInstanceT engineType, + OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, EngineType engineType, DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority); uint32_t getRegisteredEnginesCount() const { return static_cast(registeredEngines.size()); } CommandStreamReceiver *getDefaultCommandStreamReceiver(uint32_t deviceId) const; diff --git a/runtime/os_interface/linux/os_context_linux.cpp b/runtime/os_interface/linux/os_context_linux.cpp index 19b48598ff..c161e27eb4 100644 --- a/runtime/os_interface/linux/os_context_linux.cpp +++ b/runtime/os_interface/linux/os_context_linux.cpp @@ -15,7 +15,7 @@ namespace OCLRT { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) { + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) { if (osInterface) { return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); } @@ -23,10 +23,10 @@ OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, Devic } OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), drm(drm) { - engineFlag = DrmEngineMapper::engineNodeMap(engineType.type); + engineFlag = DrmEngineMapper::engineNodeMap(engineType); this->drmContextId = drm.createDrmContext(); if (drm.isPreemptionSupported() && lowPriority) { drm.setLowPriorityContextParam(this->drmContextId); diff --git a/runtime/os_interface/linux/os_context_linux.h b/runtime/os_interface/linux/os_context_linux.h index 501d3be233..d35d139c01 100644 --- a/runtime/os_interface/linux/os_context_linux.h +++ b/runtime/os_interface/linux/os_context_linux.h @@ -15,7 +15,7 @@ class OsContextLinux : public OsContext { OsContextLinux() = delete; ~OsContextLinux() override; OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority); + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); unsigned int getEngineFlag() const { return engineFlag; } uint32_t getDrmContextId() const { return drmContextId; } diff --git a/runtime/os_interface/os_context.h b/runtime/os_interface/os_context.h index e416162a44..a7d94ff07e 100644 --- a/runtime/os_interface/os_context.h +++ b/runtime/os_interface/os_context.h @@ -22,16 +22,16 @@ class OsContext : public ReferenceTrackedObject { OsContext() = delete; static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority); + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); uint32_t getContextId() const { return contextId; } uint32_t getNumSupportedDevices() const { return numSupportedDevices; } DeviceBitfield getDeviceBitfield() const { return deviceBitfield; } PreemptionMode getPreemptionMode() const { return preemptionMode; } - EngineInstanceT &getEngineType() { return engineType; } + EngineType &getEngineType() { return engineType; } bool isLowPriority() const { return lowPriority; } protected: - OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) : contextId(contextId), deviceBitfield(deviceBitfield), preemptionMode(preemptionMode), @@ -43,7 +43,7 @@ class OsContext : public ReferenceTrackedObject { const DeviceBitfield deviceBitfield; const PreemptionMode preemptionMode; const uint32_t numSupportedDevices; - EngineInstanceT engineType = {EngineType::ENGINE_RCS, 0}; + EngineType engineType = EngineType::ENGINE_RCS; const bool lowPriority; }; } // namespace OCLRT diff --git a/runtime/os_interface/windows/os_context_win.cpp b/runtime/os_interface/windows/os_context_win.cpp index 45dd713c4c..3bd03e81b4 100644 --- a/runtime/os_interface/windows/os_context_win.cpp +++ b/runtime/os_interface/windows/os_context_win.cpp @@ -14,7 +14,7 @@ namespace OCLRT { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) { + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) { if (osInterface) { return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); } @@ -22,7 +22,7 @@ OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, Devic } OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), wddm(wddm), residencyController(wddm, contextId) { UNRECOVERABLE_IF(!wddm.isInitialized()); diff --git a/runtime/os_interface/windows/os_context_win.h b/runtime/os_interface/windows/os_context_win.h index 4eb3423ef9..2350013307 100644 --- a/runtime/os_interface/windows/os_context_win.h +++ b/runtime/os_interface/windows/os_context_win.h @@ -18,7 +18,7 @@ class OsContextWin : public OsContext { ~OsContextWin() override; OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority); + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); D3DKMT_HANDLE getWddmContextHandle() const { return wddmContextHandle; } void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; } diff --git a/runtime/os_interface/windows/wddm/wddm.cpp b/runtime/os_interface/windows/wddm/wddm.cpp index a95c1d10d4..87065c01e8 100644 --- a/runtime/os_interface/windows/wddm/wddm.cpp +++ b/runtime/os_interface/windows/wddm/wddm.cpp @@ -657,7 +657,7 @@ bool Wddm::createContext(OsContextWin &osContext) { } CreateContext.PrivateDriverDataSize = sizeof(PrivateData); - CreateContext.NodeOrdinal = WddmEngineMapper::engineNodeMap(osContext.getEngineType().type); + CreateContext.NodeOrdinal = WddmEngineMapper::engineNodeMap(osContext.getEngineType()); CreateContext.pPrivateDriverData = &PrivateData; CreateContext.ClientHint = D3DKMT_CLIENTHINT_OPENGL; CreateContext.hDevice = device; diff --git a/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp b/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp index 73e4f0b26e..40f1bd0ddc 100644 --- a/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp +++ b/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp @@ -355,14 +355,14 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingComman EXPECT_EQ(retVal, CL_SUCCESS); } -TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingCommandQueueThenSelectRcs1Engine) { +TEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingCommandQueueThenSelectRcsEngine) { cl_queue_properties properties[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0}; auto cmdQ = clCreateCommandQueueWithProperties(pContext, devices[0], properties, nullptr); auto commandQueueObj = castToObject(cmdQ); - auto engine = commandQueueObj->getCommandStreamReceiver().getOsContext().getEngineType(); - EXPECT_EQ(EngineType::ENGINE_RCS, engine.type); - EXPECT_EQ(1, engine.id); + auto &osContext = commandQueueObj->getCommandStreamReceiver().getOsContext(); + EXPECT_EQ(EngineType::ENGINE_RCS, osContext.getEngineType()); + EXPECT_TRUE(osContext.isLowPriority()); clReleaseCommandQueue(cmdQ); } diff --git a/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp b/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp index 24255b13c8..6b8253bda8 100644 --- a/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp +++ b/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp @@ -31,7 +31,7 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) { const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); std::stringstream strfilename; auto engineType = pCmdQ->getCommandStreamReceiver().getOsContext().getEngineType(); - strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType.type).name; + strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name; if (testMode == TestMode::AubTestsWithTbx) { pCommandStreamReceiver = TbxCommandStreamReceiver::create(hwInfo, strfilename.str(), true, *device.executionEnvironment); diff --git a/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp b/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp index 775c1dce09..c0f53358c7 100644 --- a/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp +++ b/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp @@ -41,7 +41,7 @@ struct AUBFixture : public AUBCommandStreamFixture, template void testNoopIdXcs(EngineType engineType) { - pCommandStreamReceiver->getOsContext().getEngineType().type = engineType; + pCommandStreamReceiver->getOsContext().getEngineType() = engineType; typedef typename FamilyType::MI_NOOP MI_NOOP; diff --git a/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp index 35261de576..957d284579 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp @@ -172,7 +172,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithAubMana HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateHardwareContext) { uint32_t deviceIndex = 3; - MockOsContext osContext(0, 8, {EngineType::ENGINE_BCS}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 8, EngineType::ENGINE_BCS, PreemptionMode::Disabled, false); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -191,7 +191,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH } HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) { - MockOsContext osContext(0, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, true); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -785,7 +785,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupport DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(1, deviceBitfield, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); auto aubCsr = std::make_unique>(*platformDevices[0], "", true, *pDevice->executionEnvironment); aubCsr->setupContext(osContext); @@ -1096,7 +1096,7 @@ TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupported DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(1, deviceBitfield, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); HardwareContextController hwContextControler(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextControler.hardwareContexts.size()); @@ -1112,7 +1112,7 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(1, deviceBitfield, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); @@ -1153,7 +1153,7 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(1, deviceBitfield, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); diff --git a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp index 016f1ce409..43166c354b 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -894,7 +894,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -919,7 +919,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -946,7 +946,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -974,7 +974,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1003,7 +1003,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1031,7 +1031,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); aubCsr.latestSentTaskCount = 1; diff --git a/unit_tests/command_stream/aub_file_stream_tests.cpp b/unit_tests/command_stream/aub_file_stream_tests.cpp index e185a5a200..55088e50ba 100644 --- a/unit_tests/command_stream/aub_file_stream_tests.cpp +++ b/unit_tests/command_stream/aub_file_stream_tests.cpp @@ -262,7 +262,7 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -282,7 +282,7 @@ HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCalling pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -365,7 +365,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -394,7 +394,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -418,7 +418,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -434,7 +434,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -450,7 +450,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); diff --git a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp index ff697ea959..eafc7600db 100644 --- a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp @@ -31,7 +31,7 @@ struct MyMockCsr : UltCommandStreamReceiver { FlushStamp flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override { flushParametrization.wasCalled = true; flushParametrization.receivedBatchBuffer = &batchBuffer; - flushParametrization.receivedEngine = osContext->getEngineType().type; + flushParametrization.receivedEngine = osContext->getEngineType(); flushParametrization.receivedAllocationsForResidency = &allocationsForResidency; processResidency(allocationsForResidency); return flushParametrization.flushStampToReturn; @@ -189,7 +189,7 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub LinearStream cs(commandBuffer); BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs}; - auto engineType = csrWithAubDump->getOsContext().getEngineType().type; + auto engineType = csrWithAubDump->getOsContext().getEngineType(); ResidencyContainer allocationsForResidency; FlushStamp flushStamp = csrWithAubDump->flush(batchBuffer, allocationsForResidency); diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index a7658e5fcd..7a53c6e35e 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -351,7 +351,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -381,7 +381,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -403,7 +403,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -425,7 +425,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -441,7 +441,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsC pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); + MockOsContext osContext(0, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); diff --git a/unit_tests/device/device_tests.cpp b/unit_tests/device/device_tests.cpp index 041dd5a761..027b93de35 100644 --- a/unit_tests/device/device_tests.cpp +++ b/unit_tests/device/device_tests.cpp @@ -90,7 +90,7 @@ TEST_F(DeviceTest, retainAndRelease) { TEST_F(DeviceTest, getEngineTypeDefault) { auto pTestDevice = std::unique_ptr(createWithUsDeviceId(0)); - EngineType actualEngineType = pDevice->getDefaultEngine().osContext->getEngineType().type; + EngineType actualEngineType = pDevice->getDefaultEngine().osContext->getEngineType(); EngineType defaultEngineType = pDevice->getHardwareInfo().capabilityTable.defaultEngineType; EXPECT_EQ(&pDevice->getDefaultEngine().commandStreamReceiver->getOsContext(), pDevice->getDefaultEngine().osContext); @@ -210,11 +210,10 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperate TEST(DeviceCreation, givenDeviceWhenAskingForDefaultEngineThenReturnValidValue) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); auto device = std::unique_ptr(Device::create(platformDevices[0], executionEnvironment, 0)); + auto osContext = device->getDefaultEngine().osContext; - auto defaultEngine = device->getDefaultEngine().osContext->getEngineType(); - - EXPECT_EQ(platformDevices[0]->capabilityTable.defaultEngineType, defaultEngine.type); - EXPECT_EQ(0, defaultEngine.id); + EXPECT_EQ(platformDevices[0]->capabilityTable.defaultEngineType, osContext->getEngineType()); + EXPECT_FALSE(osContext->isLowPriority()); } TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsArePresentThenIsSimulationReturnsTrue) { diff --git a/unit_tests/helpers/get_gpgpu_engines_tests.inl b/unit_tests/helpers/get_gpgpu_engines_tests.inl index 74c3cf25a1..0ef94a6ea7 100644 --- a/unit_tests/helpers/get_gpgpu_engines_tests.inl +++ b/unit_tests/helpers/get_gpgpu_engines_tests.inl @@ -12,18 +12,8 @@ using namespace OCLRT; template void whenGetGpgpuEnginesThenReturnTwoRcsEngines() { - auto &hwHelper = HwHelperHw::get(); - auto &gpgpuEngines = hwHelper.getGpgpuEngineInstances(); + auto gpgpuEngines = HwHelperHw::get().getGpgpuEngineInstances(); EXPECT_EQ(2u, gpgpuEngines.size()); - int numRcsEngines = 0; - for (auto &engine : gpgpuEngines) { - if (ENGINE_RCS == engine.type) { - EXPECT_EQ(numRcsEngines, engine.id); - numRcsEngines++; - } - EXPECT_EQ(ENGINE_RCS, engine.type); - } - EXPECT_EQ(2, numRcsEngines); - EXPECT_EQ(gpgpuEngines[EngineInstanceConstants::lowPriorityGpgpuEngineIndex].type, lowPriorityGpgpuEngine.type); - EXPECT_EQ(gpgpuEngines[EngineInstanceConstants::lowPriorityGpgpuEngineIndex].id, lowPriorityGpgpuEngine.id); + EXPECT_EQ(ENGINE_RCS, gpgpuEngines[0]); + EXPECT_EQ(ENGINE_RCS, gpgpuEngines[1]); } diff --git a/unit_tests/libult/mock_gfx_family.cpp b/unit_tests/libult/mock_gfx_family.cpp index 4f548c0818..b00ff1be08 100644 --- a/unit_tests/libult/mock_gfx_family.cpp +++ b/unit_tests/libult/mock_gfx_family.cpp @@ -80,8 +80,8 @@ bool HwHelperHw::setupPreemptionRegisters(HardwareInfo *pHwInfo, bool enab } template <> -const AubMemDump::LrcaHelper &HwHelperHw::getCsTraits(EngineInstanceT engineInstance) const { - return *AUBFamilyMapper::csTraits[engineInstance.type]; +const AubMemDump::LrcaHelper &HwHelperHw::getCsTraits(EngineType engineType) const { + return *AUBFamilyMapper::csTraits[engineType]; } template <> diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 37141c8b67..cd2933855a 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -1524,8 +1524,8 @@ HWTEST_F(GraphicsAllocationTests, givenAllocationUsedByManyOsContextsWhenCheckin auto defaultCsr = reinterpret_cast *>(device->getDefaultEngine().commandStreamReceiver); auto defaultOsContext = device->getDefaultEngine().osContext; - EXPECT_FALSE(defaultOsContext->getEngineType().id == nonDefaultOsContext->getEngineType().id && - defaultOsContext->getEngineType().type == nonDefaultOsContext->getEngineType().type); + EXPECT_FALSE(defaultOsContext->isLowPriority()); + EXPECT_TRUE(nonDefaultOsContext->isLowPriority()); auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); diff --git a/unit_tests/mocks/mock_os_context.h b/unit_tests/mocks/mock_os_context.h index e84e7ec1bf..2f612f09d1 100644 --- a/unit_tests/mocks/mock_os_context.h +++ b/unit_tests/mocks/mock_os_context.h @@ -12,7 +12,7 @@ namespace OCLRT { class MockOsContext : public OsContext { public: MockOsContext(uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority) {} }; } // namespace OCLRT diff --git a/unit_tests/os_interface/linux/drm_tests.cpp b/unit_tests/os_interface/linux/drm_tests.cpp index da7b34babc..6baa45387d 100644 --- a/unit_tests/os_interface/linux/drm_tests.cpp +++ b/unit_tests/os_interface/linux/drm_tests.cpp @@ -147,8 +147,6 @@ TEST(DrmTest, GivenDrmWhenAskedForContextThatFailsThenFalseIsReturned) { delete pDrm; } -constexpr EngineInstanceT defaultEngine{ENGINE_RCS, 0}; - TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) { DrmMock drmMock; @@ -157,14 +155,14 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) { drmMock.StoredCtxId = drmContextId1; - OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); + OsContextLinux osContext1(drmMock, 0u, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); EXPECT_EQ(drmContextId1, osContext1.getDrmContextId()); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); { drmMock.StoredCtxId = drmContextId2; - OsContextLinux osContext2(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); + OsContextLinux osContext2(drmMock, 0u, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); EXPECT_EQ(drmContextId2, osContext2.getDrmContextId()); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); } @@ -180,17 +178,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext drmMock.StoredCtxId = 123; drmMock.preemptionSupported = false; - OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); - OsContextLinux osContext2(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true); + OsContextLinux osContext1(drmMock, 0u, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); + OsContextLinux osContext2(drmMock, 0u, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, true); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); drmMock.preemptionSupported = true; - OsContextLinux osContext3(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); + OsContextLinux osContext3(drmMock, 0u, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); - OsContextLinux osContext4(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true); + OsContextLinux osContext4(drmMock, 0u, 1, EngineType::ENGINE_RCS, PreemptionMode::Disabled, true); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id); EXPECT_EQ(static_cast(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param); diff --git a/unit_tests/os_interface/windows/wddm20_tests.cpp b/unit_tests/os_interface/windows/wddm20_tests.cpp index e69a4c85fd..5134ca00df 100644 --- a/unit_tests/os_interface/windows/wddm20_tests.cpp +++ b/unit_tests/os_interface/windows/wddm20_tests.cpp @@ -527,7 +527,7 @@ TEST_F(Wddm20WithMockGdiDllTestsWithoutWddmInit, givenUseNoRingFlushesKmdModeDeb TEST_F(Wddm20WithMockGdiDllTestsWithoutWddmInit, givenEngineTypeWhenCreatingContextThenPassCorrectNodeOrdinal) { init(); auto createContextParams = this->getCreateContextDataFcn(); - UINT expected = WddmEngineMapper::engineNodeMap(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0].type); + UINT expected = WddmEngineMapper::engineNodeMap(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]); EXPECT_EQ(expected, createContextParams->NodeOrdinal); } diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index 2275bd7f37..08fa4b36ba 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -66,11 +66,9 @@ TEST(WddmMemoryManager, NonAssignable) { EXPECT_FALSE(std::is_copy_assignable::value); } -constexpr EngineInstanceT defaultRcsEngine{ENGINE_RCS, 0}; - TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; - MockOsContext osContext(1u, 1, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + MockOsContext osContext(1u, 1, ENGINE_RCS, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); @@ -1349,16 +1347,16 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithNoRegisteredOsContextsWh } TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) { - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); } TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithExhaustedMemoryBudgetWhenCallingIsMemoryBudgetExhaustedThenReturnTrue) { - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto osContext = static_cast(memoryManager->getRegisteredEngines()[1].osContext); osContext->getResidencyController().setMemoryBudgetExhausted(); EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted()); @@ -1584,7 +1582,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); executionEnvironment.memoryManager = std::make_unique(false, false, wddm, executionEnvironment); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr, defaultRcsEngine, 1, preemptionMode, false); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr, ENGINE_RCS, 1, preemptionMode, false); csr->setupContext(*osContext); EXPECT_EQ(csr, executionEnvironment.memoryManager->getDefaultCommandStreamReceiver(0));