diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 90be020e7e..a2ca98cbf7 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -121,6 +121,7 @@ void Device::initializeCaps() { deviceInfo.platformLP = (hwInfo.capabilityTable.clVersionSupport == 12) ? true : false; deviceInfo.spirVersions = spirVersions.c_str(); auto supportsVme = hwInfo.capabilityTable.supportsVme; + auto supportsAdvancedVme = hwInfo.capabilityTable.supportsVme; if (enabledClVersion >= 21) { deviceInfo.independentForwardProgress = true; @@ -146,11 +147,19 @@ void Device::initializeCaps() { deviceExtensions += "cl_intel_packed_yuv "; deviceInfo.packedYuvExtension = true; } - if (DebugManager.flags.EnableIntelVme.get() && supportsVme) { + if (DebugManager.flags.EnableIntelVme.get() != -1) { + supportsVme = !!DebugManager.flags.EnableIntelVme.get(); + } + + if (supportsVme) { deviceExtensions += "cl_intel_motion_estimation cl_intel_device_side_avc_motion_estimation "; deviceInfo.vmeExtension = true; } - if (DebugManager.flags.EnableIntelAdvancedVme.get() && supportsVme) { + + if (DebugManager.flags.EnableIntelAdvancedVme.get() != -1) { + supportsAdvancedVme = !!DebugManager.flags.EnableIntelAdvancedVme.get(); + } + if (supportsAdvancedVme) { deviceExtensions += "cl_intel_advanced_motion_estimation "; } @@ -169,10 +178,11 @@ void Device::initializeCaps() { deviceInfo.deviceExtensions = deviceExtensions.c_str(); exposedBuiltinKernels = builtInKernels; - if (deviceExtensions.find("cl_intel_motion_estimation") != std::string::npos) { + + if (supportsVme) { exposedBuiltinKernels.append("block_motion_estimate_intel;"); } - if (deviceExtensions.find("cl_intel_advanced_motion_estimation") != std::string::npos) { + if (supportsAdvancedVme) { auto advVmeKernels = "block_advanced_motion_estimate_check_intel;block_advanced_motion_estimate_bidirectional_check_intel;"; exposedBuiltinKernels.append(advVmeKernels); } diff --git a/runtime/os_interface/debug_variables_base.inl b/runtime/os_interface/debug_variables_base.inl index 2a9207da01..713a60e8e5 100644 --- a/runtime/os_interface/debug_variables_base.inl +++ b/runtime/os_interface/debug_variables_base.inl @@ -89,8 +89,6 @@ DECLARE_DEBUG_VARIABLE(bool, DisableDcFlushInEpilogue, false, "Disable DC flush /*FEATURE FLAGS*/ DECLARE_DEBUG_VARIABLE(bool, EnableNV12, true, "Enables NV12 extension") DECLARE_DEBUG_VARIABLE(bool, EnablePackedYuv, true, "Enables cl_packed_yuv extension") -DECLARE_DEBUG_VARIABLE(bool, EnableIntelVme, true, "Enables cl_intel_motion_estimation extension") -DECLARE_DEBUG_VARIABLE(bool, EnableIntelAdvancedVme, true, "Enables cl_intel_advanced_motion_estimation extension") DECLARE_DEBUG_VARIABLE(bool, EnableDeferredDeleter, true, "Enables async deleter") DECLARE_DEBUG_VARIABLE(bool, EnableAsyncDestroyAllocations, true, "Enables async destroying graphics allocations in mem obj destructor") DECLARE_DEBUG_VARIABLE(bool, EnableAsyncEventsHandler, true, "Enables async events handler") @@ -104,6 +102,8 @@ DECLARE_DEBUG_VARIABLE(bool, EnablePassInlineData, false, "Enable passing of inl DECLARE_DEBUG_VARIABLE(bool, EnableFormatQuery, false, "Enable sharing format querying") DECLARE_DEBUG_VARIABLE(bool, AllowOpenFdOperations, false, "When enabled driver is allowed to call DRM_IOCTL_PRIME_HANDLE_TO_FD.") DECLARE_DEBUG_VARIABLE(bool, EnableFreeMemory, false, "Enable freeMemory in memory manager") +DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_motion_estimation extension") +DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelAdvancedVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_advanced_motion_estimation extension") DECLARE_DEBUG_VARIABLE(int32_t, EnableBlitterOperationsForReadWriteBuffers, -1, "Use Blitter engine for Read/Write Buffers operations. -1: default, 0: disabled, 1: enabled") DECLARE_DEBUG_VARIABLE(int32_t, EnableCacheFlushAfterWalker, -1, "-1: platform behavior, 0: disabled, 1: enabled. Adds dedicated cache flush command after WALKER command when surfaces used by kernel require to flush the cache") DECLARE_DEBUG_VARIABLE(int32_t, EnableLocalMemory, -1, "-1: default behavior, 0: disabled, 1: enabled, Allows allocating graphics memory in Local Memory") diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index db85935f64..fc3d4b8c04 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -451,7 +451,7 @@ TEST(DeviceGetCapsTest, givenEnablePackedYuvsetToFalseWhenCapsAreCreatedThenDevi TEST(DeviceGetCapsTest, givenEnableVmeSetToTrueAndDeviceSupportsVmeWhenCapsAreCreatedThenDeviceReportsVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelVme.set(true); + DebugManager.flags.EnableIntelVme.set(1); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = true; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); @@ -464,24 +464,24 @@ TEST(DeviceGetCapsTest, givenEnableVmeSetToTrueAndDeviceSupportsVmeWhenCapsAreCr EXPECT_THAT(caps.builtInKernels, testing::HasSubstr("block_motion_estimate_intel")); } -TEST(DeviceGetCapsTest, givenEnableVmeSetToTrueAndDeviceDoesNotSupportVmeWhenCapsAreCreatedThenDeviceDoesNotReportVmeExtensionAndBuiltins) { +TEST(DeviceGetCapsTest, givenEnableVmeSetToTrueAndDeviceDoesNotSupportVmeWhenCapsAreCreatedThenDeviceReportsVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelVme.set(true); + DebugManager.flags.EnableIntelVme.set(1); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = false; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); const auto &caps = device->getDeviceInfo(); - EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_motion_estimation")))); - EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_device_side_avc_motion_estimation")))); - EXPECT_FALSE(caps.vmeExtension); + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_motion_estimation"))); + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_device_side_avc_motion_estimation"))); + EXPECT_TRUE(caps.vmeExtension); - EXPECT_THAT(caps.builtInKernels, testing::Not(testing::HasSubstr("block_motion_estimate_intel"))); + EXPECT_THAT(caps.builtInKernels, testing::HasSubstr("block_motion_estimate_intel")); } TEST(DeviceGetCapsTest, givenEnableVmeSetToFalseAndDeviceDoesNotSupportVmeWhenCapsAreCreatedThenDeviceDoesNotReportVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelVme.set(false); + DebugManager.flags.EnableIntelVme.set(0); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = false; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); @@ -496,7 +496,7 @@ TEST(DeviceGetCapsTest, givenEnableVmeSetToFalseAndDeviceDoesNotSupportVmeWhenCa TEST(DeviceGetCapsTest, givenEnableVmeSetToFalseAndDeviceSupportsVmeWhenCapsAreCreatedThenDeviceDoesNotReportVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelVme.set(false); + DebugManager.flags.EnableIntelVme.set(0); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = true; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); @@ -511,7 +511,7 @@ TEST(DeviceGetCapsTest, givenEnableVmeSetToFalseAndDeviceSupportsVmeWhenCapsAreC TEST(DeviceGetCapsTest, givenEnableAdvancedVmeSetToTrueAndDeviceSupportsVmeWhenCapsAreCreatedThenDeviceReportsAdvancedVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelAdvancedVme.set(true); + DebugManager.flags.EnableIntelAdvancedVme.set(1); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = true; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); @@ -537,23 +537,23 @@ TEST(DeviceGetCapsTest, givenDeviceCapsSupportFor64BitAtomicsFollowsHardwareCapa } } -TEST(DeviceGetCapsTest, givenEnableAdvancedVmeSetToTrueAndDeviceDoesNotSupportVmeWhenCapsAreCreatedThenDeviceDoesNotReportAdvancedVmeExtensionAndBuiltins) { +TEST(DeviceGetCapsTest, givenEnableAdvancedVmeSetToTrueAndDeviceDoesNotSupportVmeWhenCapsAreCreatedThenDeviceReportAdvancedVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelAdvancedVme.set(true); + DebugManager.flags.EnableIntelAdvancedVme.set(1); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = false; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); const auto &caps = device->getDeviceInfo(); - EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_advanced_motion_estimation")))); + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_advanced_motion_estimation"))); - EXPECT_THAT(caps.builtInKernels, testing::Not(testing::HasSubstr("block_advanced_motion_estimate_check_intel"))); - EXPECT_THAT(caps.builtInKernels, testing::Not(testing::HasSubstr("block_advanced_motion_estimate_bidirectional_check_intel"))); + EXPECT_THAT(caps.builtInKernels, testing::HasSubstr("block_advanced_motion_estimate_check_intel")); + EXPECT_THAT(caps.builtInKernels, testing::HasSubstr("block_advanced_motion_estimate_bidirectional_check_intel")); } TEST(DeviceGetCapsTest, givenEnableAdvancedVmeSetToFalseAndDeviceDoesNotSupportVmeWhenCapsAreCreatedThenDeviceDoesNotReportAdvancedVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelAdvancedVme.set(false); + DebugManager.flags.EnableIntelAdvancedVme.set(0); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = false; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); @@ -567,7 +567,7 @@ TEST(DeviceGetCapsTest, givenEnableAdvancedVmeSetToFalseAndDeviceDoesNotSupportV TEST(DeviceGetCapsTest, givenEnableAdvancedVmeSetToFalseAndDeviceSupportsVmeWhenCapsAreCreatedThenDeviceDoesNotReportAdvancedVmeExtensionAndBuiltins) { DebugManagerStateRestore dbgRestorer; - DebugManager.flags.EnableIntelAdvancedVme.set(false); + DebugManager.flags.EnableIntelAdvancedVme.set(0); auto hwInfo = *platformDevices[0]; hwInfo.capabilityTable.supportsVme = true; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); diff --git a/unit_tests/test_files/igdrcl.config b/unit_tests/test_files/igdrcl.config index 38ab14d442..bd03b99c82 100644 --- a/unit_tests/test_files/igdrcl.config +++ b/unit_tests/test_files/igdrcl.config @@ -23,8 +23,8 @@ EnableVaLibCalls = 1 EnableExtendedVaFormats = 0 EnableNV12 = 1 EnablePackedYuv = 1 -EnableIntelVme = 1 -EnableAdvancedIntelVme = 1 +EnableIntelVme = -1 +EnableAdvancedIntelVme = -1 DisableStatelessToStatefulOptimization = 0 ForceDispatchScheduler = 0 PrintEMDebugInformation = 0