fix: disable 3d and media sharing support on PVC

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2025-02-13 17:19:05 +00:00
committed by Compute-Runtime-Automation
parent 7cb7229c1c
commit c2387954e9
12 changed files with 105 additions and 23 deletions

View File

@@ -201,7 +201,7 @@ void ClDevice::initializeCaps() {
deviceInfo.vmeExtension = true;
}
auto sharingAllowed = (getNumGenericSubDevices() <= 1u);
auto sharingAllowed = (getNumGenericSubDevices() <= 1u) && productHelper.isSharingWith3dOrMediaAllowed();
if (sharingAllowed) {
deviceExtensions += sharingFactory.getExtensions(driverInfo.get());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "shared/source/device/device.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "opencl/test/unit_test/api/cl_api_tests.h"
@@ -16,7 +17,6 @@ using namespace NEO;
namespace ULT {
//------------------------------------------------------------------------------
struct GetDeviceInfoP : public ApiFixture<>, public ::testing::TestWithParam<uint32_t /*cl_device_info*/> {
void SetUp() override {
param = GetParam();
@@ -28,11 +28,13 @@ struct GetDeviceInfoP : public ApiFixture<>, public ::testing::TestWithParam<uin
cl_device_info param;
};
typedef GetDeviceInfoP GetDeviceGlInfoStr;
using GetDeviceGlInfoStr = GetDeviceInfoP;
TEST_P(GetDeviceGlInfoStr, WhenGettingDeviceExtensionsThenExtensionsAreReportedCorrectly) {
char *paramValue = nullptr;
size_t paramRetSize = 0;
auto &productHelper = pDevice->getProductHelper();
bool clGLSharingAllowed = productHelper.isSharingWith3dOrMediaAllowed();
cl_int retVal = clGetDeviceInfo(testedClDevice, param, 0, nullptr, &paramRetSize);
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -66,17 +68,27 @@ TEST_P(GetDeviceGlInfoStr, WhenGettingDeviceExtensionsThenExtensionsAreReportedC
"cl_khr_priority_hints ",
"cl_khr_throttle_hints ",
"cl_khr_create_command_queue ",
"cl_khr_gl_depth_images",
"cl_khr_gl_event",
"cl_khr_gl_msaa_sharing",
};
for (auto element = 0u; element < sizeof(supportedExtensions) / sizeof(supportedExtensions[0]); element++) {
auto foundOffset = extensionString.find(supportedExtensions[element]);
for (auto &element : supportedExtensions) {
auto foundOffset = extensionString.find(element);
EXPECT_TRUE(foundOffset != std::string::npos);
EXPECT_GE(foundOffset, currentOffset);
currentOffset = foundOffset;
}
if (clGLSharingAllowed) {
std::string optionalSupportedExtensions[] = {
"cl_khr_gl_depth_images",
"cl_khr_gl_event",
"cl_khr_gl_msaa_sharing",
};
for (auto &element : optionalSupportedExtensions) {
auto foundOffset = extensionString.find(element);
EXPECT_TRUE(foundOffset != std::string::npos);
}
}
}
delete[] paramValue;

View File

@@ -500,7 +500,14 @@ TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndDisabledMultipl
debugManager.flags.CreateMultipleSubDevices.set(0);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
const auto &caps = device->getDeviceInfo();
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_sharing_format_query ")));
auto &productHelper = device->getProductHelper();
if (productHelper.isSharingWith3dOrMediaAllowed()) {
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_sharing_format_query ")));
} else {
EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_sharing_format_query ")));
}
}
TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultipleSubDevicesWhenDeviceCapsAreCreatedForRootDeviceThenSharingFormatQueryIsNotReported) {
@@ -519,13 +526,20 @@ TEST_F(DeviceGetCapsTest, givenEnableSharingFormatQuerySetTrueAndEnabledMultiple
debugManager.flags.CreateMultipleSubDevices.set(2);
auto rootDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto &productHelper = rootDevice->getProductHelper();
EXPECT_FALSE(hasSubstr(rootDevice->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
auto subDevice0 = rootDevice->getSubDevice(0);
EXPECT_TRUE(hasSubstr(subDevice0->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
auto subDevice1 = rootDevice->getSubDevice(1);
EXPECT_TRUE(hasSubstr(subDevice1->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
if (productHelper.isSharingWith3dOrMediaAllowed()) {
EXPECT_TRUE(hasSubstr(subDevice0->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
EXPECT_TRUE(hasSubstr(subDevice1->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
} else {
EXPECT_FALSE(hasSubstr(subDevice0->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
EXPECT_FALSE(hasSubstr(subDevice1->getDeviceInfo().deviceExtensions, std::string("cl_intel_sharing_format_query ")));
}
}
TEST_F(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReportsClIntelSpirvExtensions) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -28,8 +28,31 @@ TEST(Device_GetCaps, givenForceClGlSharingWhenCapsAreCreatedThenDeviceReportsClG
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
const auto &caps = device->getDeviceInfo();
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_sharing ")));
auto &productHelper = device->getProductHelper();
if (productHelper.isSharingWith3dOrMediaAllowed()) {
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_sharing ")));
}
debugManager.flags.AddClGlSharing.set(false);
}
}
TEST(GetDeviceInfo, givenImageSupportedWhenCapsAreCreatedThenDeviceReportsClGlSharingExtensions) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
const auto &caps = device->getDeviceInfo();
if (defaultHwInfo->capabilityTable.supportsImages) {
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_sharing ")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_depth_images ")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_event ")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_msaa_sharing ")));
} else {
EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_sharing ")));
EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_depth_images ")));
EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_event ")));
EXPECT_FALSE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_gl_msaa_sharing ")));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#include "shared/source/device/device.h"
#include "shared/source/helpers/get_info.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/helpers/ult_hw_config.h"
@@ -32,13 +33,24 @@ TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCo
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
auto pClDevice = new ClDevice{*pDevice, platform()};
std::string extensionString(pClDevice->getDeviceInfo().deviceExtensions);
auto &productHelper = pDevice->getProductHelper();
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_intel_va_api_media_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_intel_dx9_media_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_khr_dx9_media_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_khr_d3d10_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_khr_d3d11_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_intel_d3d11_nv12_media_sharing ")));
if (productHelper.isSharingWith3dOrMediaAllowed()) {
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_intel_dx9_media_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_khr_dx9_media_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_khr_d3d10_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_khr_d3d11_sharing ")));
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_intel_d3d11_nv12_media_sharing ")));
} else {
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_intel_dx9_media_sharing ")));
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_khr_dx9_media_sharing ")));
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_khr_d3d10_sharing ")));
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_khr_d3d11_sharing ")));
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_intel_d3d11_nv12_media_sharing ")));
}
EXPECT_TRUE(hasSubstr(extensionString, std::string("cl_intel_simultaneous_sharing ")));
delete pClDevice;