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:
Chodor, Jaroslaw
2025-01-20 17:38:50 +00:00
committed by Compute-Runtime-Automation
parent 680fa1ec1d
commit a97563bf48
5 changed files with 48 additions and 5 deletions

View File

@@ -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;

View File

@@ -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;