diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index 4a54df478b..4880c7fe6a 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -1922,6 +1922,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenMultipleFamiliesWhenCreatingQue } HWTEST_F(CommandQueueOnSpecificEngineTests, givenRootDeviceAndMultipleFamiliesWhenCreatingQueueOnSpecificEngineThenUseDefaultEngine) { + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = true; auto raiiHwHelper = overrideHwHelper>(); UltClDeviceFactory deviceFactory{1, 2}; MockContext context{deviceFactory.rootDevices[0]}; @@ -1986,6 +1988,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenBcsFamilySelectedWhenCreatingQu } HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedRcsOsContextWhenCreatingQueueThenInitializeOsContext) { + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = true; DebugManagerStateRestore restore{}; DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_RCS)); DebugManager.flags.DeferOsContextInitialization.set(1); @@ -2005,6 +2009,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedRcsOsContextWhenC } HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenCreatingQueueThenInitializeOsContext) { + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = true; DebugManagerStateRestore restore{}; DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_CCS)); DebugManager.flags.DeferOsContextInitialization.set(1); @@ -2024,6 +2030,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenC } TEST_F(MultiTileFixture, givenSubDeviceWhenQueueIsCreatedThenItContainsProperDevice) { + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = true; auto tile0 = platform()->getClDevice(0)->getSubDevice(0); const cl_device_id deviceId = tile0; 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 71b43f5dc8..d0f2aca252 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 @@ -31,6 +31,7 @@ class SyncBufferEnqueueHandlerTest : public EnqueueHandlerTest { public: void SetUp() override { hardwareInfo = *defaultHwInfo; + hardwareInfo.capabilityTable.blitterOperationsSupported = true; uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily]; hardwareInfoSetup[productFamily](&hardwareInfo, true, hwInfoConfig); SetUpImpl(&hardwareInfo); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index ee5e0497b6..b9a57eacc3 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -1352,3 +1352,14 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenCLImageFormatsWhenCallingIsFormat EXPECT_EQ(expectedResult, clHwHelper.isFormatRedescribable(oclFormat)); } } + +TEST(HwHelperTests, whenBlitterSupportIsDisabledThenDontExposeAnyBcsEngine) { + auto hwInfo = *defaultHwInfo; + hwInfo.capabilityTable.blitterOperationsSupported = false; + hwInfo.featureTable.ftrBcsInfo.set(0); + const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + auto engineUsageTypes = hwHelper.getGpgpuEngineInstances(hwInfo); + for (auto &engineUsageType : engineUsageTypes) { + EXPECT_FALSE(EngineHelpers::isBcs(engineUsageType.first)); + } +} diff --git a/opencl/test/unit_test/mocks/mock_cl_device.h b/opencl/test/unit_test/mocks/mock_cl_device.h index c50c00029d..fda5fa3440 100644 --- a/opencl/test/unit_test/mocks/mock_cl_device.h +++ b/opencl/test/unit_test/mocks/mock_cl_device.h @@ -76,6 +76,7 @@ class MockClDevice : public ClDevice { for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(pHwInfo); } + executionEnvironment->calculateMaxOsContextCount(); return executionEnvironment; } SubDevice *createSubDevice(uint32_t subDeviceIndex) { return device.createSubDevice(subDeviceIndex); } diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 23262831cc..4e765b9293 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -307,9 +307,7 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa const bool isDefaultEngine = defaultEngineType == engineType && engineUsage == EngineUsage::Regular; const bool createAsEngineInstanced = engineInstanced && EngineHelpers::isCcs(engineType); - if (EngineHelpers::isBcs(engineType) && !hwInfo.capabilityTable.blitterOperationsSupported) { - return true; - } + UNRECOVERABLE_IF(EngineHelpers::isBcs(engineType) && !hwInfo.capabilityTable.blitterOperationsSupported); std::unique_ptr commandStreamReceiver = createCommandStreamReceiver(); if (!commandStreamReceiver) { diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 097f21a3ac..fbc13b660e 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -96,8 +96,10 @@ const EngineInstancesContainer HwHelperHw::getGpgpuEngineInstances(const engines.push_back({aub_stream::ENGINE_CCS, EngineUsage::Regular}); } - if (hwInfo.featureTable.ftrBcsInfo.test(0)) { - engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Regular}); + if (hwInfo.capabilityTable.blitterOperationsSupported) { + if (hwInfo.featureTable.ftrBcsInfo.test(0)) { + engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Regular}); + } } return engines; diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index 21133ba2b4..44effe57ec 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -74,7 +74,7 @@ const EngineInstancesContainer HwHelperHw::getGpgpuEngineInstances(co } } - if (hwInfo.featureTable.ftrBcsInfo.test(0)) { + if (hwInfo.capabilityTable.blitterOperationsSupported && hwInfo.featureTable.ftrBcsInfo.test(0)) { engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Regular}); engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Internal}); // internal usage } diff --git a/shared/test/common/mocks/mock_device.h b/shared/test/common/mocks/mock_device.h index f357dc2d47..2d74e68d05 100644 --- a/shared/test/common/mocks/mock_device.h +++ b/shared/test/common/mocks/mock_device.h @@ -129,6 +129,7 @@ class MockDevice : public RootDevice { for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(pHwInfo); } + executionEnvironment->calculateMaxOsContextCount(); return executionEnvironment; } diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index 50a3afd29f..062141181b 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -21,3 +21,14 @@ TEST(DeviceTest, whenBlitterOperationsSupportIsDisabledThenNoInternalCopyEngineI UltDeviceFactory factory{1, 0}; EXPECT_EQ(nullptr, factory.rootDevices[0]->getInternalCopyEngine()); } + +TEST(DeviceTest, givenBlitterOperationsDisabledWhenCreatingBlitterEngineThenAbort) { + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = false; + + UltDeviceFactory factory{1, 0}; + EXPECT_THROW(factory.rootDevices[0]->createEngine(0, {aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular}), std::runtime_error); + EXPECT_THROW(factory.rootDevices[0]->createEngine(0, {aub_stream::EngineType::ENGINE_BCS, EngineUsage::Cooperative}), std::runtime_error); + EXPECT_THROW(factory.rootDevices[0]->createEngine(0, {aub_stream::EngineType::ENGINE_BCS, EngineUsage::Internal}), std::runtime_error); + EXPECT_THROW(factory.rootDevices[0]->createEngine(0, {aub_stream::EngineType::ENGINE_BCS, EngineUsage::LowPriority}), std::runtime_error); +} diff --git a/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp b/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp index 3cd9cf3e5a..2f65cf58a0 100644 --- a/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp +++ b/shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp @@ -24,6 +24,9 @@ using namespace NEO; struct WddmDirectSubmissionFixture : public WddmFixture { void SetUp() override { + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = true; + WddmFixture::SetUp(); wddm->wddmInterface.reset(new WddmMockInterface20(*wddm));