feature: Adding mechanism for overriding exposed device IP version
Related-To: GSD-10248 Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
parent
680fa1ec1d
commit
a97563bf48
|
@ -1082,7 +1082,10 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
|
|||
ze_device_ip_version_ext_t *zeDeviceIpVersion = reinterpret_cast<ze_device_ip_version_ext_t *>(extendedProperties);
|
||||
NEO::Device *activeDevice = getActiveDevice();
|
||||
auto &compilerProductHelper = activeDevice->getCompilerProductHelper();
|
||||
zeDeviceIpVersion->ipVersion = compilerProductHelper.getHwIpVersion(hardwareInfo);
|
||||
zeDeviceIpVersion->ipVersion = hardwareInfo.ipVersionOverrideExposedToTheApplication.value;
|
||||
if (0 == zeDeviceIpVersion->ipVersion) {
|
||||
zeDeviceIpVersion->ipVersion = compilerProductHelper.getHwIpVersion(hardwareInfo);
|
||||
}
|
||||
} else if (extendedProperties->stype == ZE_STRUCTURE_TYPE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_PROPERTIES) {
|
||||
ze_event_query_kernel_timestamps_ext_properties_t *kernelTimestampExtProperties = reinterpret_cast<ze_event_query_kernel_timestamps_ext_properties_t *>(extendedProperties);
|
||||
kernelTimestampExtProperties->flags = ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_KERNEL | ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_SYNCHRONIZED;
|
||||
|
|
|
@ -773,7 +773,7 @@ struct DeviceTest : public ::testing::Test {
|
|||
DebugManagerStateRestore restorer;
|
||||
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
|
||||
NEO::ExecutionEnvironment *execEnv;
|
||||
NEO::Device *neoDevice = nullptr;
|
||||
NEO::MockDevice *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
const uint32_t rootDeviceIndex = 1u;
|
||||
const uint32_t numRootDevices = 2u;
|
||||
|
@ -1481,6 +1481,7 @@ TEST_F(DeviceTest, givenDeviceIpVersionWhenGetDevicePropertiesThenCorrectResultI
|
|||
deviceProperties.pNext = &zeDeviceIpVersion;
|
||||
|
||||
auto &compilerProductHelper = device->getCompilerProductHelper();
|
||||
|
||||
auto expectedIpVersion = compilerProductHelper.getHwIpVersion(device->getHwInfo());
|
||||
|
||||
device->getProperties(&deviceProperties);
|
||||
|
@ -1488,6 +1489,27 @@ TEST_F(DeviceTest, givenDeviceIpVersionWhenGetDevicePropertiesThenCorrectResultI
|
|||
EXPECT_EQ(expectedIpVersion, zeDeviceIpVersion.ipVersion);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenDeviceIpVersionOverrideWhenGetDevicePropertiesThenReturnedOverridenIpVersion) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
ze_device_ip_version_ext_t zeDeviceIpVersion = {ZE_STRUCTURE_TYPE_DEVICE_IP_VERSION_EXT};
|
||||
zeDeviceIpVersion.ipVersion = std::numeric_limits<uint32_t>::max();
|
||||
deviceProperties.pNext = &zeDeviceIpVersion;
|
||||
|
||||
auto &compilerProductHelper = device->getCompilerProductHelper();
|
||||
auto originalIpVersion = compilerProductHelper.getHwIpVersion(device->getHwInfo());
|
||||
auto overridenHwInfo = device->getHwInfo();
|
||||
overridenHwInfo.ipVersionOverrideExposedToTheApplication.value = originalIpVersion + 1;
|
||||
|
||||
NEO::DeviceVector neoDevices;
|
||||
neoDevices.push_back(std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&overridenHwInfo, rootDeviceIndex)));
|
||||
auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
driverHandle->initialize(std::move(neoDevices));
|
||||
auto l0DeviceWithOverride = driverHandle->devices[0];
|
||||
|
||||
l0DeviceWithOverride->getProperties(&deviceProperties);
|
||||
EXPECT_EQ(overridenHwInfo.ipVersionOverrideExposedToTheApplication.value, zeDeviceIpVersion.ipVersion);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCorrectlyReturned) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
deviceProperties.maxMemAllocSize = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -258,8 +258,12 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
|
|||
retSize = srcSize = deviceInfo.supportedThreadArbitrationPolicies.size() * sizeof(cl_uint);
|
||||
break;
|
||||
case CL_DEVICE_IP_VERSION_INTEL: {
|
||||
auto &compilerProductHelper = device.getCompilerProductHelper();
|
||||
param.uint = static_cast<cl_version>(compilerProductHelper.getHwIpVersion(getHardwareInfo()));
|
||||
uint32_t hwIpVersion = getHardwareInfo().ipVersionOverrideExposedToTheApplication.value;
|
||||
if (0 == hwIpVersion) {
|
||||
auto &compilerProductHelper = device.getCompilerProductHelper();
|
||||
hwIpVersion = compilerProductHelper.getHwIpVersion(getHardwareInfo());
|
||||
}
|
||||
param.uint = static_cast<cl_version>(hwIpVersion);
|
||||
src = ¶m.uint;
|
||||
retSize = srcSize = sizeof(cl_version);
|
||||
break;
|
||||
|
|
|
@ -1196,6 +1196,19 @@ TEST_P(DeviceAttributeQueryTest, givenGetDeviceInfoWhenDeviceAttributeIsQueriedO
|
|||
}
|
||||
}
|
||||
|
||||
TEST(ExposedIpVersionOverrideTest, givenGetDeviceInfoWhenDeviceIpOverrideIsSetThenReturnOverridenValue) {
|
||||
HardwareInfo hwInfoWithOverride = *defaultHwInfo;
|
||||
uint32_t versionExpected = 7U;
|
||||
hwInfoWithOverride.ipVersionOverrideExposedToTheApplication.value = versionExpected;
|
||||
|
||||
auto deviceWithOverride = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfoWithOverride));
|
||||
uint32_t versionGot = 0;
|
||||
auto retVal = deviceWithOverride->getDeviceInfo(CL_DEVICE_IP_VERSION_INTEL, sizeof(uint32_t), &versionGot, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
EXPECT_EQ(versionExpected, versionGot);
|
||||
}
|
||||
|
||||
cl_device_info deviceAttributeQueryParams[] = {
|
||||
CL_DEVICE_IP_VERSION_INTEL,
|
||||
CL_DEVICE_ID_INTEL,
|
||||
|
|
|
@ -131,6 +131,7 @@ struct HardwareInfo { // NOLINT(clang-analyzer-optin.performance.Padding)
|
|||
alignas(4) GT_SYSTEM_INFO gtSystemInfo{};
|
||||
alignas(8) RuntimeCapabilityTable capabilityTable{};
|
||||
alignas(8) HardwareIpVersion ipVersion{};
|
||||
alignas(8) HardwareIpVersion ipVersionOverrideExposedToTheApplication{};
|
||||
};
|
||||
|
||||
// Global table of hardware prefixes
|
||||
|
|
Loading…
Reference in New Issue