@@ -1617,6 +1617,46 @@ HWTEST2_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesForMemoryExtProper
16171617 EXPECT_EQ (memExtProperties.bandwidthUnit , ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC);
16181618}
16191619
1620+ HWTEST2_F (DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWith2LevelsOfPnextForMemoryExtPropertiesThenPropertiesAreReturned, MatchAny) {
1621+ uint32_t count = 0 ;
1622+ ze_result_t res = device->getMemoryProperties (&count, nullptr );
1623+ EXPECT_EQ (res, ZE_RESULT_SUCCESS);
1624+ EXPECT_EQ (1u , count);
1625+
1626+ auto hwInfo = *NEO::defaultHwInfo;
1627+ MockHwInfoConfigHw<productFamily> hwInfoConfig;
1628+ VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast <size_t >(hwInfo.platform .eProductFamily )]};
1629+ hwInfoConfigFactoryBackup = &hwInfoConfig;
1630+
1631+ ze_device_memory_properties_t memProperties = {};
1632+ ze_base_properties_t baseProperties{};
1633+ ze_device_memory_ext_properties_t memExtProperties = {};
1634+ memExtProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_EXT_PROPERTIES;
1635+ // Setting up the 1st level pNext
1636+ memProperties.pNext = &baseProperties;
1637+ // Setting up the 2nd level pNext with device memory properties
1638+ baseProperties.pNext = &memExtProperties;
1639+
1640+ res = device->getMemoryProperties (&count, &memProperties);
1641+ EXPECT_EQ (res, ZE_RESULT_SUCCESS);
1642+ EXPECT_EQ (1u , count);
1643+ const std::array<ze_device_memory_ext_type_t , 5 > sysInfoMemType = {
1644+ ZE_DEVICE_MEMORY_EXT_TYPE_LPDDR4,
1645+ ZE_DEVICE_MEMORY_EXT_TYPE_LPDDR5,
1646+ ZE_DEVICE_MEMORY_EXT_TYPE_HBM2,
1647+ ZE_DEVICE_MEMORY_EXT_TYPE_HBM2,
1648+ ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6,
1649+ };
1650+
1651+ auto bandwidthPerNanoSecond = hwInfoConfig.getDeviceMemoryMaxBandWidthInBytesPerSecond (hwInfo, nullptr , 0 ) / 1000000000 ;
1652+
1653+ EXPECT_EQ (memExtProperties.type , sysInfoMemType[hwInfo.gtSystemInfo .MemoryType ]);
1654+ EXPECT_EQ (memExtProperties.physicalSize , hwInfoConfig.getDeviceMemoryPhysicalSizeInBytes (nullptr , 0 ));
1655+ EXPECT_EQ (memExtProperties.readBandwidth , bandwidthPerNanoSecond);
1656+ EXPECT_EQ (memExtProperties.writeBandwidth , memExtProperties.readBandwidth );
1657+ EXPECT_EQ (memExtProperties.bandwidthUnit , ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC);
1658+ }
1659+
16201660TEST_F (DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWhenPnextIsNonNullAndStypeIsUnSupportedThenNoErrorIsReturned) {
16211661 uint32_t count = 0 ;
16221662 ze_result_t res = device->getMemoryProperties (&count, nullptr );
0 commit comments