From 68bfd49033fde1fc8ebecc9b1c1ffbadaa345074 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Fri, 27 Jan 2023 15:40:08 +0000 Subject: [PATCH] refactor: don't use global ProductHelper getter 15/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- level_zero/core/source/cmdlist/cmdlist_imp.cpp | 3 ++- level_zero/core/source/kernel/kernel_imp.cpp | 5 +++-- .../unit_tests/sources/device/test_device.cpp | 2 +- opencl/source/api/api.cpp | 2 +- opencl/source/kernel/kernel.cpp | 5 +++-- .../command_queue/enqueue_kernel_1_tests.cpp | 8 ++++---- .../command_queue/sync_buffer_handler_tests.cpp | 2 +- shared/source/gen12lp/hw_helper_gen12lp.cpp | 2 +- shared/source/helpers/hw_helper.h | 12 ++++++------ shared/source/helpers/hw_helper_base.inl | 7 +++---- shared/source/helpers/hw_helper_pvc_and_later.inl | 15 +++++++++------ shared/test/unit_test/helpers/hw_helper_tests.cpp | 9 ++++++--- .../helpers/hw_helper_tests_pvc_and_later.cpp | 6 ++++-- .../pvc/engine_node_helper_tests_pvc.cpp | 13 ++++++++----- 14 files changed, 52 insertions(+), 39 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index 0b01f3bd98..8e47b48685 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -135,7 +135,8 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device commandList->cmdListType = CommandListType::TYPE_IMMEDIATE; commandList->isSyncModeQueue = (desc->mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS); if (!internalUsage) { - commandList->isFlushTaskSubmissionEnabled = gfxCoreHelper.isPlatformFlushTaskEnabled(hwInfo); + auto &productHelper = device->getProductHelper(); + commandList->isFlushTaskSubmissionEnabled = gfxCoreHelper.isPlatformFlushTaskEnabled(productHelper); if (NEO::DebugManager.flags.EnableFlushTaskSubmission.get() != -1) { commandList->isFlushTaskSubmissionEnabled = !!NEO::DebugManager.flags.EnableFlushTaskSubmission.get(); } diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index e8731ef827..c9ac83430c 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -402,7 +402,8 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount dssCount = hardwareInfo.gtSystemInfo.SubSliceCount; } - auto &helper = module->getDevice()->getNEODevice()->getRootDeviceEnvironment().getHelper(); + auto &rootDeviceEnvironment = module->getDevice()->getNEODevice()->getRootDeviceEnvironment(); + auto &helper = rootDeviceEnvironment.getHelper(); auto &descriptor = kernelImmData->getDescriptor(); auto availableThreadCount = helper.calculateAvailableThreadCount(hardwareInfo, descriptor.kernelAttributes.numGrfRequired); @@ -422,7 +423,7 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount barrierCount, workDim, localWorkSize); - *totalGroupCount = helper.adjustMaxWorkGroupCount(*totalGroupCount, engineGroupType, hardwareInfo, isEngineInstanced); + *totalGroupCount = helper.adjustMaxWorkGroupCount(*totalGroupCount, engineGroupType, rootDeviceEnvironment, isEngineInstanced); return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index 9101be1d2c..e863d76e03 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -3579,7 +3579,7 @@ TEST_F(DeviceTest, givenValidDeviceWhenCallingReleaseResourcesThenResourcesRelea HWTEST_F(DeviceTest, givenCooperativeDispatchSupportedWhenQueryingPropertiesFlagsThenCooperativeKernelsAreSupported) { struct MockGfxCoreHelper : NEO::GfxCoreHelperHw { - bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const HardwareInfo &hwInfo) const override { + bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const override { return isCooperativeDispatchSupportedValue; } bool isCooperativeDispatchSupportedValue = true; diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 25c53ab7ec..76961d50ea 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -6049,7 +6049,7 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue, auto &gfxCoreHelper = device.getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(pCommandQueue->getGpgpuEngine().getEngineType(), pCommandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo)) { + if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, device.getRootDeviceEnvironment())) { retVal = CL_INVALID_COMMAND_QUEUE; return retVal; } diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index 8e4f77188f..1fb1470669 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -1110,7 +1110,8 @@ void Kernel::getSuggestedLocalWorkSize(const cl_uint workDim, const size_t *glob uint32_t Kernel::getMaxWorkGroupCount(const cl_uint workDim, const size_t *localWorkSize, const CommandQueue *commandQueue) const { auto &hardwareInfo = getHardwareInfo(); - auto &helper = this->getDevice().getRootDeviceEnvironment().getHelper(); + auto &rootDeviceEnvironment = this->getDevice().getRootDeviceEnvironment(); + auto &helper = rootDeviceEnvironment.getHelper(); auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); @@ -1136,7 +1137,7 @@ uint32_t Kernel::getMaxWorkGroupCount(const cl_uint workDim, const size_t *local workDim, localWorkSize); auto isEngineInstanced = commandQueue->getGpgpuCommandStreamReceiver().getOsContext().isEngineInstanced(); - maxWorkGroupCount = helper.adjustMaxWorkGroupCount(maxWorkGroupCount, engineGroupType, hardwareInfo, isEngineInstanced); + maxWorkGroupCount = helper.adjustMaxWorkGroupCount(maxWorkGroupCount, engineGroupType, rootDeviceEnvironment, isEngineInstanced); return maxWorkGroupCount; } diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp index 390343b2be..ea6c130120 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp @@ -316,7 +316,7 @@ TEST_F(clEnqueueNDCountKernelTests, GivenQueueIncapableWhenEnqueuingNDCountKerne auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(pCommandQueue->getGpgpuEngine().getEngineType(), pCommandQueue->getGpgpuEngine().getEngineUsage(), *::defaultHwInfo); - if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, *::defaultHwInfo)) { + if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getRootDeviceEnvironment())) { GTEST_SKIP(); } @@ -350,7 +350,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDCountKernel auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(), pCmdQ2->getGpgpuEngine().getEngineUsage(), hardwareInfo); - if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo)) { + if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getRootDeviceEnvironment())) { pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext; } @@ -398,7 +398,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenNotAllArgsAreSetButSetKernelArgIsCalled auto &gfxCoreHelper = pClDevice->getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(), pCmdQ2->getGpgpuEngine().getEngineUsage(), hardwareInfo); - if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo)) { + if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getRootDeviceEnvironment())) { pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext; } @@ -446,7 +446,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenSetKernelArgIsCalledForEachArgButAtLeas auto &gfxCoreHelper = pClDevice->getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(), pCmdQ2->getGpgpuEngine().getEngineUsage(), hardwareInfo); - if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo)) { + if (!gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getRootDeviceEnvironment())) { pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext; } diff --git a/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp b/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp index 6ad03d5b91..4fb9fcae28 100644 --- a/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp +++ b/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp @@ -102,7 +102,7 @@ class SyncBufferHandlerTest : public SyncBufferEnqueueHandlerTest { auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - return gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getHardwareInfo()); + return gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getRootDeviceEnvironment()); } const cl_uint workDim = 1; diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 263bdc6fd3..e6fb5a25ab 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -204,7 +204,7 @@ void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationD allocationData.flags.useSystemMemory = true; } } - if (ProductHelper::get(hwInfo.platform.eProductFamily)->isStorageInfoAdjustmentRequired()) { + if (productHelper.isStorageInfoAdjustmentRequired()) { if (properties.allocationType == AllocationType::BUFFER && !properties.flags.preferCompressed && !properties.flags.shareable) { allocationData.storageInfo.isLockable = true; } diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 46970286ca..ffdeab5b3e 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -115,9 +115,9 @@ class GfxCoreHelper { virtual bool packedFormatsSupported() const = 0; virtual bool isAssignEngineRoundRobinSupported(const HardwareInfo &hwInfo) const = 0; virtual bool isRcsAvailable(const HardwareInfo &hwInfo) const = 0; - virtual bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const HardwareInfo &hwInfo) const = 0; + virtual bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual uint32_t adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, const EngineGroupType engineGroupType, - const HardwareInfo &hwInfo, bool isEngineInstanced) const = 0; + const RootDeviceEnvironment &rootDeviceEnvironment, bool isEngineInstanced) const = 0; virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0; virtual size_t getSipKernelMaxDbgSurfaceSize(const HardwareInfo &hwInfo) const = 0; virtual bool isSipWANeeded(const HardwareInfo &hwInfo) const = 0; @@ -160,7 +160,7 @@ class GfxCoreHelper { virtual bool platformSupportsImplicitScaling(const NEO::HardwareInfo &hwInfo) const = 0; virtual size_t getBatchBufferEndSize() const = 0; virtual const void *getBatchBufferEndReference() const = 0; - virtual bool isPlatformFlushTaskEnabled(const NEO::HardwareInfo &hwInfo) const = 0; + virtual bool isPlatformFlushTaskEnabled(const NEO::ProductHelper &productHelper) const = 0; virtual uint32_t getMinimalScratchSpaceSize() const = 0; virtual bool copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const = 0; virtual uint32_t getAmountOfAllocationsToFill() const = 0; @@ -313,10 +313,10 @@ class GfxCoreHelperHw : public GfxCoreHelper { bool isRcsAvailable(const HardwareInfo &hwInfo) const override; - bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const HardwareInfo &hwInfo) const override; + bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const override; uint32_t adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, const EngineGroupType engineGroupType, - const HardwareInfo &hwInfo, bool isEngineInstanced) const override; + const RootDeviceEnvironment &rootDeviceEnvironment, bool isEngineInstanced) const override; size_t getMaxFillPaternSizeForCopyEngine() const override; @@ -377,7 +377,7 @@ class GfxCoreHelperHw : public GfxCoreHelper { bool platformSupportsImplicitScaling(const NEO::HardwareInfo &hwInfo) const override; size_t getBatchBufferEndSize() const override; const void *getBatchBufferEndReference() const override; - bool isPlatformFlushTaskEnabled(const NEO::HardwareInfo &hwInfo) const override; + bool isPlatformFlushTaskEnabled(const NEO::ProductHelper &productHelper) const override; uint32_t getMinimalScratchSpaceSize() const override; bool copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo) const override; uint32_t getAmountOfAllocationsToFill() const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index c1976162f9..6b6be2b189 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -587,13 +587,13 @@ bool GfxCoreHelperHw::isRcsAvailable(const HardwareInfo &hwInfo) cons } template -bool GfxCoreHelperHw::isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const HardwareInfo &hwInfo) const { +bool GfxCoreHelperHw::isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const { return true; } template uint32_t GfxCoreHelperHw::adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, const EngineGroupType engineGroupType, - const HardwareInfo &hwInfo, bool isEngineInstanced) const { + const RootDeviceEnvironment &rootDeviceEnvironment, bool isEngineInstanced) const { return maxWorkGroupCount; } @@ -684,8 +684,7 @@ const void *GfxCoreHelperHw::getBatchBufferEndReference() const { return reinterpret_cast(&GfxFamily::cmdInitBatchBufferEnd); } template -bool GfxCoreHelperHw::isPlatformFlushTaskEnabled(const HardwareInfo &hwInfo) const { - const auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); +bool GfxCoreHelperHw::isPlatformFlushTaskEnabled(const ProductHelper &productHelper) const { return productHelper.isFlushTaskAllowed(); } diff --git a/shared/source/helpers/hw_helper_pvc_and_later.inl b/shared/source/helpers/hw_helper_pvc_and_later.inl index 86c0c4508c..062370a098 100644 --- a/shared/source/helpers/hw_helper_pvc_and_later.inl +++ b/shared/source/helpers/hw_helper_pvc_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,8 +33,9 @@ bool GfxCoreHelperHw::isRcsAvailable(const HardwareInfo &hwInfo) const { } template <> -bool GfxCoreHelperHw::isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const HardwareInfo &hwInfo) const { - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); +bool GfxCoreHelperHw::isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const { + auto &productHelper = rootDeviceEnvironment.getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); if (productHelper.isCooperativeEngineSupported(hwInfo)) { if (engineGroupType == EngineGroupType::RenderCompute) { return false; @@ -49,19 +50,21 @@ bool GfxCoreHelperHw::isCooperativeDispatchSupported(const EngineGroupTy template <> uint32_t GfxCoreHelperHw::adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, const EngineGroupType engineGroupType, - const HardwareInfo &hwInfo, bool isEngineInstanced) const { + const RootDeviceEnvironment &rootDeviceEnvironment, bool isEngineInstanced) const { if ((DebugManager.flags.ForceTheoreticalMaxWorkGroupCount.get()) || (DebugManager.flags.OverrideMaxWorkGroupCount.get() != -1)) { return maxWorkGroupCount; } - if (!isCooperativeDispatchSupported(engineGroupType, hwInfo)) { + if (!isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment)) { return 1u; } - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = rootDeviceEnvironment.getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); bool requiresLimitation = productHelper.isCooperativeEngineSupported(hwInfo) && (engineGroupType != EngineGroupType::CooperativeCompute) && (!isEngineInstanced); if (requiresLimitation) { + auto ccsCount = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled; UNRECOVERABLE_IF(ccsCount == 0); return maxWorkGroupCount / ccsCount; diff --git a/shared/test/unit_test/helpers/hw_helper_tests.cpp b/shared/test/unit_test/helpers/hw_helper_tests.cpp index c8ddbbaf93..28a23636cd 100644 --- a/shared/test/unit_test/helpers/hw_helper_tests.cpp +++ b/shared/test/unit_test/helpers/hw_helper_tests.cpp @@ -1278,17 +1278,20 @@ HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenGettingIfRevisionSpecificBinar HWTEST2_F(GfxCoreHelperTest, givenDG2GfxCoreHelperWhenGettingIsPlatformFlushTaskEnabledThenTrueIsReturned, IsDG2) { const auto &gfxCoreHelper = getHelper(); - EXPECT_TRUE(gfxCoreHelper.isPlatformFlushTaskEnabled(*defaultHwInfo)); + auto &productHelper = getHelper(); + EXPECT_TRUE(gfxCoreHelper.isPlatformFlushTaskEnabled(productHelper)); } HWTEST2_F(GfxCoreHelperTest, givenPvcGfxCoreHelperWhenGettingIsPlatformFlushTaskEnabledThenTrueIsReturned, IsPVC) { const auto &gfxCoreHelper = getHelper(); - EXPECT_TRUE(gfxCoreHelper.isPlatformFlushTaskEnabled(*defaultHwInfo)); + auto &productHelper = getHelper(); + EXPECT_TRUE(gfxCoreHelper.isPlatformFlushTaskEnabled(productHelper)); } HWTEST2_F(GfxCoreHelperTest, givenAtMostGen12lpGfxCoreHelperWhenGettingIsPlatformFlushTaskEnabledThenFalseIsReturned, IsAtMostGen12lp) { const auto &gfxCoreHelper = getHelper(); - EXPECT_TRUE(gfxCoreHelper.isPlatformFlushTaskEnabled(*defaultHwInfo)); + auto &productHelper = getHelper(); + EXPECT_TRUE(gfxCoreHelper.isPlatformFlushTaskEnabled(productHelper)); } struct CoherentWANotNeeded { diff --git a/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp b/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp index 8a3139576b..68b5617e8e 100644 --- a/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp +++ b/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp @@ -138,7 +138,9 @@ HWTEST2_F(GfxCoreHelperTestPvcAndLater, WhenIsCooperativeDispatchSupportedThenCo }; MockProductHelperHw productHelper; - auto hwInfo = *::defaultHwInfo; + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0]; + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); VariableBackup productHelperFactoryBackup{&NEO::productHelperFactory[static_cast(hwInfo.platform.eProductFamily)]}; productHelperFactoryBackup = &productHelper; @@ -151,7 +153,7 @@ HWTEST2_F(GfxCoreHelperTestPvcAndLater, WhenIsCooperativeDispatchSupportedThenCo for (auto engineGroupType : {EngineGroupType::RenderCompute, EngineGroupType::Compute, EngineGroupType::CooperativeCompute}) { - auto isCooperativeDispatchSupported = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); + auto isCooperativeDispatchSupported = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment); if (isCooperativeEngineSupported) { switch (engineGroupType) { case EngineGroupType::RenderCompute: diff --git a/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp index 1588521ef6..52267623c2 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp @@ -155,28 +155,31 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledWhenGetGpgpuEnginesCalledTh PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) { const auto &gfxCoreHelper = getHelper(); - auto hwInfo = *defaultHwInfo; + auto &rootDeviceEnvironment = *pDevice->executionEnvironment->rootDeviceEnvironments[0]; + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; auto engineGroupType = gfxCoreHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(), pDevice->getDefaultEngine().getEngineUsage(), hwInfo); - auto retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); + auto retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment); EXPECT_TRUE(retVal); } PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCooperativeDispatchSupportedThenFalseIsReturned) { const auto &productHelper = getHelper(); const auto &gfxCoreHelper = getHelper(); - auto hwInfo = *defaultHwInfo; + auto &rootDeviceEnvironment = *pDevice->executionEnvironment->rootDeviceEnvironments[0]; + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS; auto engineGroupType = gfxCoreHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(), pDevice->getDefaultEngine().getEngineUsage(), hwInfo); - auto retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); + auto retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment); EXPECT_TRUE(retVal); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); - retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo); + retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment); EXPECT_FALSE(retVal); }