From 004d3e341613f99a08082ec8db385da72e095c8f Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 30 Jan 2023 00:09:45 +0000 Subject: [PATCH] refactor: don't use global ProductHelper getter 18 Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- level_zero/core/source/device/device_imp.cpp | 2 +- .../unit_tests/sources/device/test_device.cpp | 2 +- opencl/source/command_queue/command_queue.cpp | 9 ++-- .../aub_batch_buffer_tests_gen11.h | 2 +- .../batch_buffer/aub_batch_buffer_tests.h | 2 +- .../device/get_device_info_tests.cpp | 2 +- .../unit_test/device/sub_device_tests.cpp | 16 ++++--- .../xe_hp_core/hw_helper_tests_xe_hp_core.cpp | 4 +- .../hw_helper_tests_xe_hpc_core.cpp | 5 ++- .../command_container/command_encoder.h | 4 +- .../command_encoder_bdw_and_later.inl | 9 ++-- .../command_encoder_xehp_and_later.inl | 9 ++-- .../command_container/implicit_scaling.h | 2 +- .../implicit_scaling_xehp_and_later.inl | 2 +- .../command_stream_receiver.cpp | 3 +- shared/source/device/device.cpp | 6 ++- shared/source/device/device_caps.cpp | 4 +- shared/source/helpers/engine_node_helper.cpp | 12 ++--- shared/source/helpers/hw_helper.h | 12 ++--- shared/source/helpers/hw_helper_base.inl | 2 +- .../helpers/hw_helper_bdw_and_later.inl | 7 +-- .../helpers/hw_helper_xehp_and_later.inl | 9 +--- ...ate_base_address_xe_hpg_core_and_later.inl | 6 +-- .../implicit_scaling_xe_hp_core.cpp | 4 +- .../xe_hpc_core/hw_helper_xe_hpc_core.cpp | 11 ++--- .../implicit_scaling_xe_hpc_core.cpp | 8 ++-- .../pvc/os_agnostic_hw_info_config_pvc.inl | 5 --- .../command_encoder_xe_hpg_core.cpp | 5 ++- shared/test/common/cmd_parse/hw_parse.h | 8 ++-- .../command_encoder_tests.cpp | 9 ++-- .../encoders/test_encode_dispatch_kernel.cpp | 25 ++++++----- ..._encode_dispatch_kernel_xehp_and_later.cpp | 44 ++++++++++++------- ...ngine_node_helper_tests_xehp_and_later.cpp | 41 +++++++++-------- .../os_interface/hw_info_config_tests.cpp | 4 ++ .../hw_helper_xe_hpc_core_tests.cpp | 9 ---- .../hw_helper_tests_xe_hpg_core.cpp | 5 --- ...est_encode_dispatch_kernel_xe_hpg_core.cpp | 14 +++--- 37 files changed, 166 insertions(+), 157 deletions(-) diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 30eee02373..d7c200f21f 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -1115,7 +1115,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool device->execEnvironment = (void *)neoDevice->getExecutionEnvironment(); device->allocationsForReuse = std::make_unique(); - bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(hwInfo); + bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(rootDeviceEnvironment); device->implicitScalingCapable = NEO::ImplicitScalingHelper::isImplicitScalingEnabled(neoDevice->getDeviceBitfield(), platformImplicitScaling); device->metricContext = MetricDeviceContext::create(*device); device->builtins = BuiltinFunctionsLib::create( 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 e863d76e03..507cb822e8 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 @@ -3951,7 +3951,7 @@ struct MultiSubDeviceFixture : public DeviceFixture { using MultiSubDeviceTest = Test>; TEST_F(MultiSubDeviceTest, GivenApiSupportAndLocalMemoryEnabledWhenDeviceContainsSubDevicesThenItIsImplicitScalingCapable) { auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); - if (gfxCoreHelper.platformSupportsImplicitScaling(neoDevice->getHardwareInfo())) { + if (gfxCoreHelper.platformSupportsImplicitScaling(neoDevice->getRootDeviceEnvironment())) { EXPECT_TRUE(device->isImplicitScalingCapable()); EXPECT_EQ(neoDevice, deviceImp->getActiveDevice()); } else { diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index a5ab3603e6..678ab1f39c 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -100,9 +100,10 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr auto &hwInfo = device->getHardwareInfo(); auto &gfxCoreHelper = device->getGfxCoreHelper(); auto &productHelper = device->getProductHelper(); + auto &rootDeviceEnvironment = device->getRootDeviceEnvironment(); bcsAllowed = productHelper.isBlitterFullySupported(hwInfo) && - gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS); + gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS); if (bcsAllowed || device->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled()) { timestampPacketContainer = std::make_unique(); @@ -165,10 +166,8 @@ void CommandQueue::initializeGpgpu() const { static std::mutex mutex; std::lock_guard lock(mutex); if (gpgpuEngine == nullptr) { - auto &hwInfo = device->getDevice().getHardwareInfo(); - auto &gfxCoreHelper = device->getGfxCoreHelper(); - - auto engineRoundRobinAvailable = gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo) && + auto &productHelper = device->getProductHelper(); + auto engineRoundRobinAvailable = productHelper.isAssignEngineRoundRobinSupported() && this->isAssignEngineRoundRobinEnabled(); if (DebugManager.flags.EnableCmdQRoundRobindEngineAssign.get() != -1) { diff --git a/opencl/test/unit_test/aub_tests/gen11/batch_buffer/aub_batch_buffer_tests_gen11.h b/opencl/test/unit_test/aub_tests/gen11/batch_buffer/aub_batch_buffer_tests_gen11.h index 728d326c99..cf9b4b55db 100644 --- a/opencl/test/unit_test/aub_tests/gen11/batch_buffer/aub_batch_buffer_tests_gen11.h +++ b/opencl/test/unit_test/aub_tests/gen11/batch_buffer/aub_batch_buffer_tests_gen11.h @@ -30,7 +30,7 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType // Header auto &hwInfo = pDevice->getHardwareInfo(); - const auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); aubFile.init(productHelper.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device); aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280); diff --git a/opencl/test/unit_test/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h b/opencl/test/unit_test/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h index 1b1a56b25f..b9fc0bc47d 100644 --- a/opencl/test/unit_test/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h +++ b/opencl/test/unit_test/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h @@ -31,7 +31,7 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType // Header auto &hwInfo = pDevice->getHardwareInfo(); auto deviceId = hwInfo.capabilityTable.aubDeviceId; - const auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); aubFile.init(productHelper.getAubStreamSteppingFromHwRevId(hwInfo), deviceId); aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280); diff --git a/opencl/test/unit_test/device/get_device_info_tests.cpp b/opencl/test/unit_test/device/get_device_info_tests.cpp index 0fe4b7cbc5..e48d417f8e 100644 --- a/opencl/test/unit_test/device/get_device_info_tests.cpp +++ b/opencl/test/unit_test/device/get_device_info_tests.cpp @@ -703,7 +703,7 @@ class MockGfxCoreHelper : public GfxCoreHelperHw { } } - bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override { + bool isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override { if ((deviceBitfield.to_ulong() == disableEngineSupportOnSubDevice) && (disabledSubDeviceEngineType == engineType)) { return false; } diff --git a/opencl/test/unit_test/device/sub_device_tests.cpp b/opencl/test/unit_test/device/sub_device_tests.cpp index fb7abadc0c..4f6554d6ce 100644 --- a/opencl/test/unit_test/device/sub_device_tests.cpp +++ b/opencl/test/unit_test/device/sub_device_tests.cpp @@ -993,8 +993,9 @@ HWTEST_F(EngineInstancedDeviceTests, whenCreateMultipleCommandQueuesThenEnginesA auto &hwInfo = rootDevice->getHardwareInfo(); const auto &gfxCoreHelper = rootDevice->getGfxCoreHelper(); + const auto &productHelper = rootDevice->getProductHelper(); - if (!gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo)) { + if (!productHelper.isAssignEngineRoundRobinSupported()) { GTEST_SKIP(); } @@ -1039,8 +1040,9 @@ HWTEST_F(EngineInstancedDeviceTests, givenCmdQRoundRobindEngineAssignBitfieldwWe auto &hwInfo = rootDevice->getHardwareInfo(); const auto &gfxCoreHelper = rootDevice->getGfxCoreHelper(); + const auto &productHelper = rootDevice->getProductHelper(); - if (!gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo)) { + if (!productHelper.isAssignEngineRoundRobinSupported()) { GTEST_SKIP(); } @@ -1088,8 +1090,9 @@ HWTEST_F(EngineInstancedDeviceTests, givenCmdQRoundRobindEngineAssignNTo1wWenCre auto &hwInfo = rootDevice->getHardwareInfo(); const auto &gfxCoreHelper = rootDevice->getGfxCoreHelper(); + const auto &productHelper = rootDevice->getProductHelper(); - if (!gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo)) { + if (!productHelper.isAssignEngineRoundRobinSupported()) { GTEST_SKIP(); } @@ -1135,8 +1138,9 @@ HWTEST_F(EngineInstancedDeviceTests, givenCmdQRoundRobindEngineAssignNTo1AndCmdQ auto &hwInfo = rootDevice->getHardwareInfo(); const auto &gfxCoreHelper = rootDevice->getGfxCoreHelper(); + const auto &productHelper = rootDevice->getProductHelper(); - if (!gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo)) { + if (!productHelper.isAssignEngineRoundRobinSupported()) { GTEST_SKIP(); } @@ -1182,9 +1186,9 @@ HWTEST_F(EngineInstancedDeviceTests, givenEnableCmdQRoundRobindEngineAssignDisab } auto &hwInfo = rootDevice->getHardwareInfo(); - const auto &gfxCoreHelper = rootDevice->getGfxCoreHelper(); + const auto &productHelper = rootDevice->getProductHelper(); - if (!gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo)) { + if (!productHelper.isAssignEngineRoundRobinSupported()) { GTEST_SKIP(); } diff --git a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp index 96a4c2d74b..2b48e8b8be 100644 --- a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp +++ b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp @@ -202,7 +202,9 @@ XE_HP_CORE_TEST_F(GfxCoreHelperTestXE_HP_CORE, givenDisablePipeControlFlagIsEnab XE_HP_CORE_TEST_F(GfxCoreHelperTestXE_HP_CORE, givenXeHPAndLaterPlatformWhenCheckAssignEngineRoundRobinSupportedThenReturnFalse) { auto &gfxCoreHelper = GfxCoreHelperHw::get(); - EXPECT_FALSE(gfxCoreHelper.isAssignEngineRoundRobinSupported(*defaultHwInfo)); + auto &productHelper = getHelper(); + + EXPECT_FALSE(productHelper.isAssignEngineRoundRobinSupported()); } using ProductHelperTestXE_HP_CORE = Test; diff --git a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp index c36242e6dd..f422adf5b7 100644 --- a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp @@ -725,7 +725,8 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, WhenCheckingSipWAThenFalseIsRetur XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenBcsSubDeviceSupportIsCheckedThenReturnFalse) { DebugManagerStateRestore restore; - HardwareInfo hwInfo = *defaultHwInfo; + auto &rootDeviceEnvironment = this->getRootDeviceEnvironment(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); auto &gfxCoreHelper = getHelper(); auto &productHelper = getHelper(); @@ -741,7 +742,7 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenBcsSubDeviceSupportI for (uint32_t engineType = 0; engineType < static_cast(aub_stream::EngineType::NUM_ENGINES); engineType++) { auto engineTypeT = static_cast(engineType); - bool result = gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, DeviceBitfield(1llu << subDevice), engineTypeT); + bool result = gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, DeviceBitfield(1llu << subDevice), engineTypeT); bool affectedEngine = ((subDevice == 1) && (aub_stream::ENGINE_BCS == engineTypeT || diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index 9c82598cd9..456584b417 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -119,7 +119,7 @@ struct EncodeDispatchKernel { bool inlineDataProgrammingRequired, bool isIndirect, uint32_t requiredWorkGroupOrder, - const HardwareInfo &hwInfo); + const RootDeviceEnvironment &rootDeviceEnvironment); static void programBarrierEnable(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo); @@ -131,7 +131,7 @@ struct EncodeDispatchKernel { static void setupPostSyncMocs(WALKER_TYPE &walkerCmd, const RootDeviceEnvironment &rootDeviceEnvironment, bool dcFlush); - static void adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const HardwareInfo &hwInfo); + static void adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const RootDeviceEnvironment &rootDeviceEnvironment); static void adjustNumberOfThreadsInThreadGroup(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, const uint32_t simd, uint32_t &threadsPerThreadGroup); diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index bd805bd6b8..b21f722f17 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -58,8 +58,9 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis auto sizePerThreadDataForWholeGroup = args.dispatchInterface->getPerThreadDataSizeForWholeThreadGroup(); auto pImplicitArgs = args.dispatchInterface->getImplicitArgs(); - const HardwareInfo &hwInfo = args.device->getHardwareInfo(); + auto &hwInfo = args.device->getHardwareInfo(); auto &gfxCoreHelper = args.device->getGfxCoreHelper(); + auto &rootDeviceEnvironment = args.device->getRootDeviceEnvironment(); LinearStream *listCmdBufferStream = container.getCommandStream(); @@ -239,7 +240,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis false, args.isIndirect, args.dispatchInterface->getRequiredWorkgroupOrder(), - hwInfo); + rootDeviceEnvironment); cmd.setPredicateEnable(args.isPredicate); @@ -331,7 +332,7 @@ void EncodeDispatchKernel::encodeThreadData(WALKER_TYPE &walkerCmd, bool inlineDataProgrammingRequired, bool isIndirect, uint32_t requiredWorkGroupOrder, - const HardwareInfo &hwInfo) { + const RootDeviceEnvironment &rootDeviceEnvironment) { if (isIndirect) { walkerCmd.setIndirectParameterEnable(true); @@ -556,7 +557,7 @@ template void EncodeDispatchKernel::setupPostSyncMocs(WALKER_TYPE &walkerCmd, const RootDeviceEnvironment &rootDeviceEnvironment, bool dcFlush) {} template -void EncodeDispatchKernel::adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const HardwareInfo &hwInfo) {} +void EncodeDispatchKernel::adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const RootDeviceEnvironment &rootDeviceEnvironment) {} template uint32_t EncodeDispatchKernel::additionalSizeRequiredDsh() { diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index ba64cf1dd5..42776ac2c4 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -263,7 +263,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis inlineDataProgramming, args.isIndirect, requiredWorkgroupOrder, - hwInfo); + rootDeviceEnvironment); using POSTSYNC_DATA = typename Family::POSTSYNC_DATA; auto &postSync = walkerCmd.getPostSync(); @@ -440,7 +440,7 @@ void EncodeDispatchKernel::encodeThreadData(WALKER_TYPE &walkerCmd, bool inlineDataProgrammingRequired, bool isIndirect, uint32_t requiredWorkGroupOrder, - const HardwareInfo &hwInfo) { + const RootDeviceEnvironment &rootDeviceEnvironment) { if (isIndirect) { walkerCmd.setIndirectParameterEnable(true); @@ -490,7 +490,8 @@ void EncodeDispatchKernel::encodeThreadData(WALKER_TYPE &walkerCmd, walkerCmd.setGenerateLocalId(1); walkerCmd.setWalkOrder(requiredWorkGroupOrder); } - adjustWalkOrder(walkerCmd, requiredWorkGroupOrder, hwInfo); + + adjustWalkOrder(walkerCmd, requiredWorkGroupOrder, rootDeviceEnvironment); if (inlineDataProgrammingRequired == true) { walkerCmd.setEmitInlineParameter(1); } @@ -783,7 +784,7 @@ inline void EncodeStoreMMIO::appendFlags(MI_STORE_REGISTER_MEM *storeReg } template -void EncodeDispatchKernel::adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const HardwareInfo &hwInfo) {} +void EncodeDispatchKernel::adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const RootDeviceEnvironment &rootDeviceEnvironment) {} template uint32_t EncodeDispatchKernel::additionalSizeRequiredDsh() { diff --git a/shared/source/command_container/implicit_scaling.h b/shared/source/command_container/implicit_scaling.h index 54dceb0eb4..13a9684349 100644 --- a/shared/source/command_container/implicit_scaling.h +++ b/shared/source/command_container/implicit_scaling.h @@ -83,7 +83,7 @@ struct ImplicitScalingDispatch { static uint32_t getPostSyncOffset(); - static bool platformSupportsImplicitScaling(const HardwareInfo &hwInfo); + static bool platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment); private: static bool pipeControlStallRequired; diff --git a/shared/source/command_container/implicit_scaling_xehp_and_later.inl b/shared/source/command_container/implicit_scaling_xehp_and_later.inl index d586c5f6f2..7c38263ffa 100644 --- a/shared/source/command_container/implicit_scaling_xehp_and_later.inl +++ b/shared/source/command_container/implicit_scaling_xehp_and_later.inl @@ -239,7 +239,7 @@ inline uint32_t ImplicitScalingDispatch::getPostSyncOffset() { } template -inline bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const HardwareInfo &hwInfo) { +inline bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment) { return false; } diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 42b1312007..6ec7687467 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -80,7 +80,8 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi const auto &hwInfo = peekHwInfo(); uint32_t subDeviceCount = static_cast(deviceBitfield.count()); auto &gfxCoreHelper = getGfxCoreHelper(); - bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(hwInfo); + auto &rootDeviceEnvironment = peekRootDeviceEnvironment(); + bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(rootDeviceEnvironment); if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(deviceBitfield, platformImplicitScaling) && subDeviceCount > 1 && DebugManager.flags.EnableStaticPartitioning.get() != 0) { diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 26059e4bd4..10b24bfbc0 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -309,11 +309,13 @@ bool Device::createEngines() { } void Device::addEngineToEngineGroup(EngineControl &engine) { - const HardwareInfo &hardwareInfo = this->getHardwareInfo(); + auto &hardwareInfo = this->getHardwareInfo(); auto &gfxCoreHelper = getGfxCoreHelper(); + auto &rootDeviceEnvironment = this->getRootDeviceEnvironment(); + const EngineGroupType engineGroupType = gfxCoreHelper.getEngineGroupType(engine.getEngineType(), engine.getEngineUsage(), hardwareInfo); - if (!gfxCoreHelper.isSubDeviceEngineSupported(hardwareInfo, getDeviceBitfield(), engine.getEngineType())) { + if (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, getDeviceBitfield(), engine.getEngineType())) { return; } diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index b06b44a373..2087eb9dd1 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -85,8 +85,8 @@ void Device::initializeCaps() { deviceInfo.maxMemAllocSize = std::min(deviceInfo.globalMemSize, deviceInfo.maxMemAllocSize); // if globalMemSize was reduced for 32b uint32_t subDeviceCount = gfxCoreHelper.getSubDevicesCount(&getHardwareInfo()); - - bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(hwInfo); + auto &rootDeviceEnvironment = this->getRootDeviceEnvironment(); + bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(rootDeviceEnvironment); if (((NEO::ImplicitScalingHelper::isImplicitScalingEnabled( getDeviceBitfield(), platformImplicitScaling))) && diff --git a/shared/source/helpers/engine_node_helper.cpp b/shared/source/helpers/engine_node_helper.cpp index 4d2e4f8016..65facf3ed0 100644 --- a/shared/source/helpers/engine_node_helper.cpp +++ b/shared/source/helpers/engine_node_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -174,7 +174,7 @@ bool isBcsEnabled(const HardwareInfo &hwInfo, aub_stream::EngineType engineType) bool linkCopyEnginesSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield) { auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); - const aub_stream::EngineType engine1 = gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, aub_stream::ENGINE_BCS1) + const aub_stream::EngineType engine1 = gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, aub_stream::ENGINE_BCS1) ? aub_stream::ENGINE_BCS1 : aub_stream::ENGINE_BCS4; const aub_stream::EngineType engine2 = aub_stream::ENGINE_BCS2; @@ -224,14 +224,14 @@ aub_stream::EngineType selectLinkCopyEngine(const RootDeviceEnvironment &rootDev engineType = static_cast(aub_stream::EngineType::ENGINE_BCS1 + selectEngineValue); } - } while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, engineType) || !hwInfo.featureTable.ftrBcsInfo.test(engineType == aub_stream::EngineType::ENGINE_BCS - ? 0 - : engineType - aub_stream::EngineType::ENGINE_BCS1 + 1)); + } while (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, engineType) || !hwInfo.featureTable.ftrBcsInfo.test(engineType == aub_stream::EngineType::ENGINE_BCS + ? 0 + : engineType - aub_stream::EngineType::ENGINE_BCS1 + 1)); return engineType; } - const aub_stream::EngineType engine1 = gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, aub_stream::ENGINE_BCS1) + const aub_stream::EngineType engine1 = gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, aub_stream::ENGINE_BCS1) ? aub_stream::ENGINE_BCS1 : aub_stream::ENGINE_BCS4; const aub_stream::EngineType engine2 = aub_stream::ENGINE_BCS2; diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 1dcee98bb6..2fe991efda 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -113,7 +113,6 @@ class GfxCoreHelper { virtual bool useOnlyGlobalTimestamps() const = 0; virtual bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const = 0; 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 RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual uint32_t adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, const EngineGroupType engineGroupType, @@ -125,7 +124,7 @@ class GfxCoreHelper { virtual bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const = 0; virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0; virtual uint32_t getNumCacheRegions() const = 0; - virtual bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const = 0; + virtual bool isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const = 0; virtual uint32_t getPlanarYuvMaxHeight() const = 0; virtual size_t getPreemptionAllocationAlignment() const = 0; virtual std::unique_ptr createTimestampPacketAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memoryManager, @@ -157,7 +156,7 @@ class GfxCoreHelper { virtual bool disableL3CacheForDebug(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const = 0; virtual bool isRevisionSpecificBinaryBuiltinRequired() const = 0; virtual bool forceNonGpuCoherencyWA(bool requiresCoherency) const = 0; - virtual bool platformSupportsImplicitScaling(const NEO::HardwareInfo &hwInfo) const = 0; + virtual bool platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual size_t getBatchBufferEndSize() const = 0; virtual const void *getBatchBufferEndReference() const = 0; virtual bool isPlatformFlushTaskEnabled(const NEO::ProductHelper &productHelper) const = 0; @@ -332,7 +331,7 @@ class GfxCoreHelperHw : public GfxCoreHelper { uint32_t getNumCacheRegions() const override; - bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override; + bool isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override; uint32_t getPlanarYuvMaxHeight() const override; @@ -353,9 +352,6 @@ class GfxCoreHelperHw : public GfxCoreHelper { void applyRenderCompressionFlag(Gmm &gmm, uint32_t isCompressed) const override; bool unTypedDataPortCacheFlushRequired() const override; - - bool isAssignEngineRoundRobinSupported(const HardwareInfo &hwInfo) const override; - bool isEngineTypeRemappingToHwSpecificRequired() const override; bool isSipKernelAsHexadecimalArrayPreferred() const override; @@ -374,7 +370,7 @@ class GfxCoreHelperHw : public GfxCoreHelper { bool disableL3CacheForDebug(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const override; bool isRevisionSpecificBinaryBuiltinRequired() const override; bool forceNonGpuCoherencyWA(bool requiresCoherency) const override; - bool platformSupportsImplicitScaling(const NEO::HardwareInfo &hwInfo) const override; + bool platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const override; size_t getBatchBufferEndSize() const override; const void *getBatchBufferEndReference() const override; bool isPlatformFlushTaskEnabled(const NEO::ProductHelper &productHelper) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 78b09e3753..2d200044d1 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -616,7 +616,7 @@ uint32_t GfxCoreHelperHw::getNumCacheRegions() const { } template -bool GfxCoreHelperHw::isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const { +bool GfxCoreHelperHw::isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const { return true; } diff --git a/shared/source/helpers/hw_helper_bdw_and_later.inl b/shared/source/helpers/hw_helper_bdw_and_later.inl index 1fa305a274..1bfb46cf6d 100644 --- a/shared/source/helpers/hw_helper_bdw_and_later.inl +++ b/shared/source/helpers/hw_helper_bdw_and_later.inl @@ -51,11 +51,6 @@ bool GfxCoreHelperHw::isUpdateTaskCountFromWaitSupported() const { return false; } -template -bool GfxCoreHelperHw::isAssignEngineRoundRobinSupported(const HardwareInfo &hwInfo) const { - return false; -} - template const EngineInstancesContainer GfxCoreHelperHw::getGpgpuEngineInstances(const RootDeviceEnvironment &rootDeviceEnvironment) const { return { @@ -151,7 +146,7 @@ uint32_t GfxCoreHelperHw::getMaxScratchSize() const { } template -inline bool GfxCoreHelperHw::platformSupportsImplicitScaling(const NEO::HardwareInfo &hwInfo) const { +inline bool GfxCoreHelperHw::platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const { return false; } diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index 4a44854c2b..8be6278a8a 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -149,11 +149,6 @@ uint32_t GfxCoreHelperHw::getPlanarYuvMaxHeight() const { return planarYuvMaxHeight; } -template -bool GfxCoreHelperHw::isAssignEngineRoundRobinSupported(const HardwareInfo &hwInfo) const { - return false; -} - template aub_stream::MMIOList GfxCoreHelperHw::getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const { aub_stream::MMIOList mmioList; @@ -212,8 +207,8 @@ uint32_t GfxCoreHelperHw::getMaxScratchSize() const { } template -inline bool GfxCoreHelperHw::platformSupportsImplicitScaling(const NEO::HardwareInfo &hwInfo) const { - return ImplicitScalingDispatch::platformSupportsImplicitScaling(hwInfo); +inline bool GfxCoreHelperHw::platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const { + return ImplicitScalingDispatch::platformSupportsImplicitScaling(rootDeviceEnvironment); } template diff --git a/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl b/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl index 49ec767809..c30ff728ca 100644 --- a/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl +++ b/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,8 +7,8 @@ template void StateBaseAddressHelper::appendExtraCacheSettings(StateBaseAddressHelperArgs &args) { - auto productHelper = ProductHelper::get(args.gmmHelper->getHardwareInfo()->platform.eProductFamily); - auto cachePolicy = productHelper->getL1CachePolicy(args.isDebuggerActive); + auto &productHelper = args.gmmHelper->getRootDeviceEnvironment().template getHelper(); + auto cachePolicy = productHelper.getL1CachePolicy(args.isDebuggerActive); args.stateBaseAddressCmd->setL1CachePolicyL1CacheControl(static_cast(cachePolicy)); if (DebugManager.flags.ForceStatelessL1CachingPolicy.get() != -1 && diff --git a/shared/source/xe_hp_core/implicit_scaling_xe_hp_core.cpp b/shared/source/xe_hp_core/implicit_scaling_xe_hp_core.cpp index 37cae34823..a4fff9c2d5 100644 --- a/shared/source/xe_hp_core/implicit_scaling_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/implicit_scaling_xe_hp_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,7 +18,7 @@ template <> bool ImplicitScalingDispatch::pipeControlStallRequired = true; template <> -bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const HardwareInfo &hwInfo) { +bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment) { if (ApiSpecificConfig::getApiType() == ApiSpecificConfig::ApiType::OCL) { return true; } else { diff --git a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp index e713220be0..254d8382ff 100644 --- a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp @@ -363,12 +363,7 @@ int32_t GfxCoreHelperHw::getDefaultThreadArbitrationPolicy() const { } template <> -bool GfxCoreHelperHw::isAssignEngineRoundRobinSupported(const HardwareInfo &hwInfo) const { - return ProductHelper::get(hwInfo.platform.eProductFamily)->isAssignEngineRoundRobinSupported(); -} - -template <> -bool GfxCoreHelperHw::isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const { +bool GfxCoreHelperHw::isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const { constexpr uint64_t tile1Bitfield = 0b10; bool affectedEngine = (deviceBitfield.to_ulong() == tile1Bitfield) && @@ -376,7 +371,9 @@ bool GfxCoreHelperHw::isSubDeviceEngineSupported(const HardwareInfo &hwI aub_stream::ENGINE_BCS1 == engineType || aub_stream::ENGINE_BCS3 == engineType); - return affectedEngine ? !ProductHelper::get(hwInfo.platform.eProductFamily)->isBcsReportWaRequired(hwInfo) : true; + auto &productHelper = rootDeviceEnvironment.template getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); + return affectedEngine ? !productHelper.isBcsReportWaRequired(hwInfo) : true; } template <> diff --git a/shared/source/xe_hpc_core/implicit_scaling_xe_hpc_core.cpp b/shared/source/xe_hpc_core/implicit_scaling_xe_hpc_core.cpp index fbae888b1b..6535ffd58a 100644 --- a/shared/source/xe_hpc_core/implicit_scaling_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/implicit_scaling_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,11 +19,13 @@ template <> bool ImplicitScalingDispatch::pipeControlStallRequired = false; template <> -bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const HardwareInfo &hwInfo) { +bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment) { if (ApiSpecificConfig::getApiType() == ApiSpecificConfig::ApiType::OCL) { return true; } else { - return ProductHelper::get(hwInfo.platform.eProductFamily)->isImplicitScalingSupported(hwInfo); + auto &productHelper = rootDeviceEnvironment.template getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); + return productHelper.isImplicitScalingSupported(hwInfo); } } diff --git a/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl b/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl index c4b1f534bc..293c094507 100644 --- a/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl +++ b/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl @@ -181,11 +181,6 @@ bool ProductHelperHw::isImplicitScalingSupported(const HardwareInfo return getSteppingFromHwRevId(hwInfo) >= REVISION_B; } -template <> -bool ProductHelperHw::isAssignEngineRoundRobinSupported() const { - return false; -} - template <> bool ProductHelperHw::isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const { return false; diff --git a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp index fae06fe3d3..c8c4f42051 100644 --- a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp @@ -178,8 +178,9 @@ void EncodeSurfaceState::appendParamsForImageFromBuffer(R_SURFACE_STATE } template <> -void EncodeDispatchKernel::adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const HardwareInfo &hwInfo) { - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); +void EncodeDispatchKernel::adjustWalkOrder(WALKER_TYPE &walkerCmd, uint32_t requiredWorkGroupOrder, const RootDeviceEnvironment &rootDeviceEnvironment) { + auto &productHelper = rootDeviceEnvironment.template getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); if (productHelper.isAdjustWalkOrderAvailable(hwInfo)) { if (HwWalkOrderHelper::compatibleDimensionOrders[requiredWorkGroupOrder] == HwWalkOrderHelper::linearWalk) { walkerCmd.setDispatchWalkOrder(WALKER_TYPE::DISPATCH_WALK_ORDER::LINERAR_WALKER); diff --git a/shared/test/common/cmd_parse/hw_parse.h b/shared/test/common/cmd_parse/hw_parse.h index e829b5e0ae..0030930564 100644 --- a/shared/test/common/cmd_parse/hw_parse.h +++ b/shared/test/common/cmd_parse/hw_parse.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,6 +14,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "gtest/gtest.h" @@ -131,7 +132,7 @@ struct HardwareParse { template int getNumberOfPipelineSelectsThatEnablePipelineSelect() { - typedef typename FamilyType::PIPELINE_SELECT PIPELINE_SELECT; + using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT; int numberOfGpgpuSelects = 0; int numberOf3dSelects = 0; auto itorCmd = find(cmdList.begin(), cmdList.end()); @@ -147,7 +148,8 @@ struct HardwareParse { } itorCmd = find(++itorCmd, cmdList.end()); } - const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); + MockExecutionEnvironment mockExecutionEnvironment{}; + const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); if (productHelper.is3DPipelineSelectWARequired()) { auto maximalNumberOf3dSelectsRequired = 2; EXPECT_LE(numberOf3dSelects, maximalNumberOf3dSelectsRequired); diff --git a/shared/test/unit_test/command_container/command_encoder_tests.cpp b/shared/test/unit_test/command_container/command_encoder_tests.cpp index 13d2e4c86a..08426763f9 100644 --- a/shared/test/unit_test/command_container/command_encoder_tests.cpp +++ b/shared/test/unit_test/command_container/command_encoder_tests.cpp @@ -223,20 +223,21 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenAtLeastXeHpPlatformWhenSe HWTEST2_F(CommandEncoderTests, givenRequiredWorkGroupOrderWhenCallAdjustWalkOrderThenWalkerIsNotChanged, IsAtMostXeHpcCore) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; WALKER_TYPE walkerCmd{}; WALKER_TYPE walkerOnStart{}; uint32_t yOrder = 2u; - EncodeDispatchKernel::adjustWalkOrder(walkerCmd, yOrder, *defaultHwInfo); + EncodeDispatchKernel::adjustWalkOrder(walkerCmd, yOrder, rootDeviceEnvironment); EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(WALKER_TYPE))); // no change uint32_t linearOrder = 0u; - EncodeDispatchKernel::adjustWalkOrder(walkerCmd, linearOrder, *defaultHwInfo); + EncodeDispatchKernel::adjustWalkOrder(walkerCmd, linearOrder, rootDeviceEnvironment); EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(WALKER_TYPE))); // no change uint32_t fakeOrder = 5u; - EncodeDispatchKernel::adjustWalkOrder(walkerCmd, fakeOrder, *defaultHwInfo); + EncodeDispatchKernel::adjustWalkOrder(walkerCmd, fakeOrder, rootDeviceEnvironment); EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(WALKER_TYPE))); // no change } diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel.cpp index fe5e306f41..cd2b0975df 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel.cpp @@ -1056,13 +1056,14 @@ HWTEST_F(EncodeDispatchKernelTest, givenNonBindlessOrStatelessArgWhenDispatching HWCMDTEST_F(IGFX_GEN8_CORE, WalkerThreadTest, givenStartWorkGroupWhenIndirectIsFalseThenExpectStartGroupAndThreadDimensionsProgramming) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -1086,9 +1087,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, WalkerThreadTest, givenNoStartWorkGroupWhenIndirectI WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, nullptr, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, true, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, true, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_TRUE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(0u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(0u, walkerCmd.getThreadGroupIdYDimension()); @@ -1113,9 +1115,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, WalkerThreadTest, givenStartWorkGroupWhenWorkGroupSm startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; workGroupSizes[0] = 30u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -1137,10 +1140,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, WalkerThreadTest, WhenThreadPerThreadGroupNotZeroThe using WALKER_TYPE = typename FamilyType::WALKER_TYPE; WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; uint32_t expectedThreadPerThreadGroup = 5u; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - expectedThreadPerThreadGroup, 0, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + expectedThreadPerThreadGroup, 0, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -1162,10 +1166,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, WalkerThreadTest, WhenExecutionMaskNotZeroThenExpect using WALKER_TYPE = typename FamilyType::WALKER_TYPE; WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; uint32_t expectedExecutionMask = 0xFFFFu; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, expectedExecutionMask, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, expectedExecutionMask, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp index 2de6cae66e..c58b240e8a 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp @@ -692,9 +692,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenStartWorkGroupWh WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -726,9 +728,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenNoStartWorkGroup WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, nullptr, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, true, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, true, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_TRUE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(0u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(0u, walkerCmd.getThreadGroupIdYDimension()); @@ -762,9 +765,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenSimdSizeOneWhenW startWorkGroup[2] = 3u; workGroupSizes[0] = 30u; simd = 1; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -797,9 +801,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenStartWorkGroupWh startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; workGroupSizes[0] = 30u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -830,9 +835,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenLocalIdGeneratio WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; localIdDimensions = 0u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, nullptr, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, false, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, false, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -864,9 +870,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenLocalIdGeneratio WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; requiredWorkGroupOrder = 2u; workGroupSizes[1] = workGroupSizes[2] = 2u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, nullptr, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, false, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, false, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -898,13 +905,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, givenDebugVariableToO DebugManager.flags.ForceSimdMessageSizeInWalker.set(1); using WALKER_TYPE = typename FamilyType::WALKER_TYPE; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; requiredWorkGroupOrder = 2u; workGroupSizes[1] = workGroupSizes[2] = 2u; EncodeDispatchKernel::encodeThreadData(walkerCmd, nullptr, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, false, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, false, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_EQ(1u, walkerCmd.getMessageSimd()); } @@ -914,9 +922,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, WhenInlineDataIsTrueT WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; startWorkGroup[1] = 2u; startWorkGroup[2] = 3u; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, 0, true, true, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, 0, true, true, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); @@ -946,10 +955,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerThreadTestXeHPAndLater, WhenExecutionMaskNotZ using WALKER_TYPE = typename FamilyType::WALKER_TYPE; WALKER_TYPE walkerCmd = FamilyType::cmdInitGpgpuWalker; - + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; uint32_t expectedExecutionMask = 0xFFFFu; EncodeDispatchKernel::encodeThreadData(walkerCmd, startWorkGroup, numWorkGroups, workGroupSizes, simd, localIdDimensions, - 0, expectedExecutionMask, true, false, false, requiredWorkGroupOrder, *defaultHwInfo); + 0, expectedExecutionMask, true, false, false, requiredWorkGroupOrder, rootDeviceEnvironment); EXPECT_FALSE(walkerCmd.getIndirectParameterEnable()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdXDimension()); EXPECT_EQ(1u, walkerCmd.getThreadGroupIdYDimension()); diff --git a/shared/test/unit_test/helpers/engine_node_helper_tests_xehp_and_later.cpp b/shared/test/unit_test/helpers/engine_node_helper_tests_xehp_and_later.cpp index 425549963d..cab951843f 100644 --- a/shared/test/unit_test/helpers/engine_node_helper_tests_xehp_and_later.cpp +++ b/shared/test/unit_test/helpers/engine_node_helper_tests_xehp_and_later.cpp @@ -69,14 +69,15 @@ HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngine DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.set(1u); DeviceBitfield deviceBitfield = 0b10; - auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); hwInfo.featureTable.ftrBcsInfo.set(7); auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine(); int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); for (int32_t i = 0; i <= 20; i++) { - while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { + while (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { expectedEngineType++; if (static_cast(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS8) { expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; @@ -99,16 +100,17 @@ HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngine DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignStartingValue.set(0); DeviceBitfield deviceBitfield = 0b10; - auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); hwInfo.featureTable.ftrBcsInfo = 0x17f; auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine(); int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS; auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); for (int32_t i = 0; i <= 20; i++) { - while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS - ? 0 - : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { + while (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS + ? 0 + : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) { expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; } else { @@ -140,16 +142,17 @@ HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngine DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.set(6); DeviceBitfield deviceBitfield = 0b10; - auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); hwInfo.featureTable.ftrBcsInfo = 0x17f; auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine(); int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS; auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); for (int32_t i = 0; i <= 20; i++) { - while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS - ? 0 - : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { + while (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS + ? 0 + : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) { expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; } else { @@ -180,16 +183,17 @@ HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngine DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.set(6); DeviceBitfield deviceBitfield = 0b10; - auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); hwInfo.featureTable.ftrBcsInfo = 0x17f; auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine(); int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); for (int32_t i = 0; i <= 20; i++) { - while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS - ? 0 - : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { + while (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS + ? 0 + : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) { expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; } else { @@ -221,16 +225,17 @@ HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngine DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.set(5); DeviceBitfield deviceBitfield = 0b10; - auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); hwInfo.featureTable.ftrBcsInfo = 0x17f; auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine(); int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS3; auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); for (int32_t i = 0; i <= 20; i++) { - while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS - ? 0 - : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { + while (!gfxCoreHelper.isSubDeviceEngineSupported(rootDeviceEnvironment, deviceBitfield, static_cast(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS + ? 0 + : expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) { if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) { expectedEngineType = aub_stream::EngineType::ENGINE_BCS1; } else { diff --git a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp index 507cda7de8..788363b229 100644 --- a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -313,6 +313,10 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenAskedIfAllocationSizeAdjustmen EXPECT_FALSE(productHelper->isAllocationSizeAdjustmentRequired(pInHwInfo)); } +HWTEST_F(ProductHelperTest, WhenCheckAssignEngineRoundRobinSupportedThenReturnFalse) { + EXPECT_FALSE(productHelper->isAssignEngineRoundRobinSupported()); +} + HWTEST_F(ProductHelperTest, givenProductHelperWhenAskedIfPrefetchDisablingIsRequiredThenFalseIsReturned) { EXPECT_FALSE(productHelper->isPrefetchDisablingRequired(pInHwInfo)); diff --git a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp index 41d4a284c0..5849e0111c 100644 --- a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp @@ -80,15 +80,6 @@ XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckTimesta EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents()); } -XE_HPC_CORETEST_F(GfxCoreHelperXeHpcCoreTest, givenXeHPCPlatformWhenCheckAssignEngineRoundRobinSupportedThenReturnTrue) { - auto hwInfo = *defaultHwInfo; - MockExecutionEnvironment mockExecutionEnvironment{}; - auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - - EXPECT_EQ(gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo), productHelper.isAssignEngineRoundRobinSupported()); -} - XE_HPC_CORETEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnTrue) { auto &gfxCoreHelper = getHelper(); EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo)); diff --git a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp index 0e42aa15df..462852f33d 100644 --- a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp @@ -158,11 +158,6 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, WhenCheckingSipWAThenFalseIsReturn EXPECT_FALSE(gfxCoreHelper.isSipWANeeded(pDevice->getHardwareInfo())); } -XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenXeHPAndLaterPlatformWhenCheckAssignEngineRoundRobinSupportedThenReturnFalse) { - auto &gfxCoreHelper = getHelper(); - EXPECT_FALSE(gfxCoreHelper.isAssignEngineRoundRobinSupported(*defaultHwInfo)); -} - XE_HPG_CORETEST_F(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckTimestampWaitSupportForEventsThenReturnFalse) { auto &productHelper = getHelper(); EXPECT_FALSE(productHelper.isTimestampWaitSupportedForEvents()); diff --git a/shared/test/unit_test/xe_hpg_core/test_encode_dispatch_kernel_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/test_encode_dispatch_kernel_xe_hpg_core.cpp index 1cc9cdcee2..2780d9e41d 100644 --- a/shared/test/unit_test/xe_hpg_core/test_encode_dispatch_kernel_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/test_encode_dispatch_kernel_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/variable_backup.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/hw_test.h" #include "hw_cmds_xe_hpg_core_base.h" @@ -34,9 +35,12 @@ struct MockProductHelper : NEO::ProductHelperHw { bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const override { return true; } }; -HWTEST2_F(CommandEncodeStatesTestXeHpgCore, givenRequiredWorkGroupOrderAndIsAdjusttWalkOrderAvailableReturnTureWhenCallAdjustWalkOrderThenWalkerIsProgrammedCorrectly, IsXeHpgCore) { +HWTEST2_F(CommandEncodeStatesTestXeHpgCore, givenRequiredWorkGroupOrderAndIsAdjustWalkOrderAvailableReturnTrueWhenCallAdjustWalkOrderThenWalkerIsProgrammedCorrectly, IsXeHpgCore) { using WALKER_TYPE = typename FamilyType::WALKER_TYPE; + MockExecutionEnvironment executionEnvironment{}; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; + MockProductHelper productHelper{}; VariableBackup productHelperFactoryBackup{&NEO::productHelperFactory[static_cast(defaultHwInfo->platform.eProductFamily)]}; productHelperFactoryBackup = &productHelper; @@ -45,14 +49,14 @@ HWTEST2_F(CommandEncodeStatesTestXeHpgCore, givenRequiredWorkGroupOrderAndIsAdju WALKER_TYPE walkerOnStart{}; uint32_t fakeOrder = 5u; - EncodeDispatchKernel::adjustWalkOrder(walkerCmd, fakeOrder, *defaultHwInfo); + EncodeDispatchKernel::adjustWalkOrder(walkerCmd, fakeOrder, rootDeviceEnvironment); EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(WALKER_TYPE))); // no change uint32_t yOrder = 2u; - EncodeDispatchKernel::adjustWalkOrder(walkerCmd, yOrder, *defaultHwInfo); + EncodeDispatchKernel::adjustWalkOrder(walkerCmd, yOrder, rootDeviceEnvironment); EXPECT_EQ(WALKER_TYPE::DISPATCH_WALK_ORDER::Y_ORDER_WALKER, walkerCmd.getDispatchWalkOrder()); uint32_t linearOrder = 0u; - EncodeDispatchKernel::adjustWalkOrder(walkerCmd, linearOrder, *defaultHwInfo); + EncodeDispatchKernel::adjustWalkOrder(walkerCmd, linearOrder, rootDeviceEnvironment); EXPECT_EQ(WALKER_TYPE::DISPATCH_WALK_ORDER::LINERAR_WALKER, walkerCmd.getDispatchWalkOrder()); } \ No newline at end of file