From bb8dd181a7a0e41b158dbc17ae20df2f88213f0d Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Tue, 21 Jan 2020 13:43:34 +0100 Subject: [PATCH] Disable sharing extensions on specific configs Change-Id: Ib2be6e797095bf771c618ba3515236e3f3eb16c6 Signed-off-by: Kamil Kopryk Resolves: NEO-4010 --- runtime/device/device_caps.cpp | 5 ++++- unit_tests/device/device_caps_tests.cpp | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 3c93f6ab7d..d7b8cd5a6d 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -181,7 +181,10 @@ void Device::initializeCaps() { deviceExtensions += "cl_intel_media_block_io "; } - deviceExtensions += sharingFactory.getExtensions(); + auto sharingAllowed = (HwHelper::getSubDevicesCount(&hwInfo) == 1u); + if (sharingAllowed) { + deviceExtensions += sharingFactory.getExtensions(); + } deviceExtensions += hwHelper.getExtensions(); diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index ed50a28aa0..ca034916e6 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -366,6 +366,24 @@ TEST_F(DeviceGetCapsTest, DISABLED_givenDeviceWhenCapsAreCreateThenClGLSharingIs EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_gl_sharing "))); } +TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndDisabledMultipleSubDevicesWhenDeviceCapsAreCreatedThenSharingFormatQueryIsReported) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.EnableFormatQuery.set(true); + DebugManager.flags.CreateMultipleSubDevices.set(0); + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + const auto &caps = device->getDeviceInfo(); + EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_sharing_format_query "))); +} + +TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultipleSubDevicesWhenDeviceCapsAreCreatedThenSharingFormatQueryIsNotReported) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.EnableFormatQuery.set(true); + DebugManager.flags.CreateMultipleSubDevices.set(2); + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + const auto &caps = device->getDeviceInfo(); + EXPECT_THAT(caps.deviceExtensions, ::testing::Not(::testing::HasSubstr(std::string("cl_intel_sharing_format_query ")))); +} + TEST_F(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClKhrSubgroupsExtension) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceOCLVersion.set(21);