diff --git a/level_zero/core/source/helpers/api_specific_config_l0.cpp b/level_zero/core/source/helpers/api_specific_config_l0.cpp index b5c15f4494..e260823fcd 100644 --- a/level_zero/core/source/helpers/api_specific_config_l0.cpp +++ b/level_zero/core/source/helpers/api_specific_config_l0.cpp @@ -72,6 +72,6 @@ const StackVec &ApiSpecificConfig::getPrefixTypes() { bool ApiSpecificConfig::isSharedAllocPrefetchEnabled() { return (NEO::DebugManager.flags.ForceMemoryPrefetchForKmdMigratedSharedAllocations.get() || - (NEO::DebugManager.flags.EnableBOChunkingPrefetch.get() && ((NEO::DebugManager.flags.EnableBOChunking.get()) & 0x1))); + (NEO::DebugManager.flags.EnableBOChunkingPrefetch.get() && ((NEO::DebugManager.flags.EnableBOChunking.get()) != -1) && ((NEO::DebugManager.flags.EnableBOChunking.get()) & 0x1))); } } // namespace NEO diff --git a/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp index 9f3f1d9fcd..fdb994662c 100644 --- a/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp @@ -53,6 +53,38 @@ TEST(ApiSpecificConfigL0Tests, GivenDebugFlagSetWhenCheckingIfDynamicPostSyncAll EXPECT_FALSE(ApiSpecificConfig::isDynamicPostSyncAllocLayoutEnabled()); } +TEST(ApiSpecificConfigL0Tests, GivenDebugFlagCombinationsGetCorrectSharedAllocPrefetchEnabled) { + DebugManagerStateRestore restore; + + EXPECT_FALSE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); + + DebugManager.flags.ForceMemoryPrefetchForKmdMigratedSharedAllocations.set(true); + + EXPECT_TRUE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); + + DebugManager.flags.ForceMemoryPrefetchForKmdMigratedSharedAllocations.set(false); + + DebugManager.flags.EnableBOChunkingPrefetch.set(true); + + EXPECT_FALSE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); + + DebugManager.flags.EnableBOChunking.set(1); + + EXPECT_TRUE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); + + DebugManager.flags.EnableBOChunking.set(2); + + EXPECT_FALSE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); + + DebugManager.flags.EnableBOChunking.set(3); + + EXPECT_TRUE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); + + DebugManager.flags.EnableBOChunking.set(0); + + EXPECT_FALSE(ApiSpecificConfig::isSharedAllocPrefetchEnabled()); +} + TEST(ImplicitScalingApiTests, givenLevelZeroApiUsedThenSupportEnabled) { EXPECT_TRUE(ImplicitScaling::apiSupport); }