From c959847355f0df34f71a83f9cd4ea1b4847d61ff Mon Sep 17 00:00:00 2001 From: Michal Mrozek Date: Tue, 11 Aug 2020 08:28:26 +0200 Subject: [PATCH] Expose sharing for sub-devices. Change-Id: I72b715d2eacba0178ee64eb4f37043bd453cef85 Signed-off-by: Michal Mrozek --- opencl/source/cl_device/cl_device_caps.cpp | 2 +- opencl/test/unit_test/device/device_caps_tests.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 4d39309221..f8f2f2cdff 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -186,7 +186,7 @@ void ClDevice::initializeCaps() { deviceExtensions += "cl_khr_3d_image_writes "; } - auto sharingAllowed = (HwHelper::getSubDevicesCount(&hwInfo) == 1u); + auto sharingAllowed = (getNumAvailableDevices() == 1u); if (sharingAllowed) { deviceExtensions += sharingFactory.getExtensions(driverInfo.get()); } diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 6b05fc99c4..667ebbd672 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -505,8 +505,9 @@ TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndDisabledMultipl EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_sharing_format_query "))); } -TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultipleSubDevicesWhenDeviceCapsAreCreatedThenSharingFormatQueryIsNotReported) { +TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultipleSubDevicesWhenDeviceCapsAreCreatedForRootDeviceThenSharingFormatQueryIsNotReported) { DebugManagerStateRestore dbgRestorer; + VariableBackup mockDeviceFlagBackup{&MockDevice::createSingleDevice, false}; DebugManager.flags.EnableFormatQuery.set(true); DebugManager.flags.CreateMultipleSubDevices.set(2); auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); @@ -514,6 +515,15 @@ TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultiple EXPECT_THAT(caps.deviceExtensions, ::testing::Not(::testing::HasSubstr(std::string("cl_intel_sharing_format_query ")))); } +TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultipleSubDevicesWhenDeviceCapsAreCreatedForSubDeviceThenSharingFormatQueryIsReported) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.EnableFormatQuery.set(true); + DebugManager.flags.CreateMultipleSubDevices.set(2); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); + const auto &caps = device->getDeviceInfo(); + EXPECT_THAT(caps.deviceExtensions, ::testing::HasSubstr(std::string("cl_intel_sharing_format_query "))); +} + TEST_F(DeviceGetCapsTest, givenOpenCLVersion20WhenCapsAreCreatedThenDeviceDoesntReportClKhrSubgroupsExtension) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceOCLVersion.set(20);