mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
feature(sysman): Add support for Memory properties & state for iGPU's in Linux
Related-To: NEO-14198, NEO-15464 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
735a2a5b94
commit
286f973d0c
@@ -40,7 +40,8 @@ ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
|||||||
if (pLinuxSysmanImp->getHardwareInfo().capabilityTable.isIntegratedDevice) {
|
if (pLinuxSysmanImp->getHardwareInfo().capabilityTable.isIntegratedDevice) {
|
||||||
const std::string memFreeKey = "MemFree";
|
const std::string memFreeKey = "MemFree";
|
||||||
const std::string memAvailableKey = "MemAvailable";
|
const std::string memAvailableKey = "MemAvailable";
|
||||||
auto memInfoValues = readMemInfoValues(&pLinuxSysmanImp->getFsAccess(), {memFreeKey, memAvailableKey});
|
std::unordered_set<std::string> keys{memFreeKey, memAvailableKey};
|
||||||
|
auto memInfoValues = readMemInfoValues(&pLinuxSysmanImp->getFsAccess(), keys);
|
||||||
if (memInfoValues.find(memFreeKey) != memInfoValues.end() && memInfoValues.find(memAvailableKey) != memInfoValues.end()) {
|
if (memInfoValues.find(memFreeKey) != memInfoValues.end() && memInfoValues.find(memAvailableKey) != memInfoValues.end()) {
|
||||||
pState->free = memInfoValues[memFreeKey] * 1024;
|
pState->free = memInfoValues[memFreeKey] * 1024;
|
||||||
pState->size = memInfoValues[memAvailableKey] * 1024;
|
pState->size = memInfoValues[memAvailableKey] * 1024;
|
||||||
@@ -77,25 +78,21 @@ ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, uint64_t> LinuxMemoryImp::readMemInfoValues(FsAccessInterface *pFsAccess, const std::vector<std::string> &keys) {
|
std::unordered_map<std::string, uint64_t> LinuxMemoryImp::readMemInfoValues(FsAccessInterface *pFsAccess, const std::unordered_set<std::string> &keys) {
|
||||||
std::map<std::string, uint64_t> result = {};
|
std::unordered_map<std::string, uint64_t> result;
|
||||||
const std::string memInfoFile = "/proc/meminfo";
|
const std::string memInfoFile = "/proc/meminfo";
|
||||||
std::vector<std::string> memInfo{};
|
std::vector<std::string> memInfo;
|
||||||
|
|
||||||
if (pFsAccess->read(memInfoFile, memInfo) == ZE_RESULT_SUCCESS) {
|
if (pFsAccess->read(memInfoFile, memInfo) == ZE_RESULT_SUCCESS) {
|
||||||
for (const auto &line : memInfo) {
|
for (const auto &line : memInfo) {
|
||||||
std::istringstream lineStream(line);
|
std::istringstream lineStream(line);
|
||||||
std::string label = "";
|
std::string label, unit;
|
||||||
std::string unit = "";
|
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
|
|
||||||
lineStream >> label >> value >> unit;
|
lineStream >> label >> value >> unit;
|
||||||
|
|
||||||
if (!label.empty() && label.back() == ':') {
|
if (!label.empty() && label.back() == ':') {
|
||||||
label.pop_back();
|
label.pop_back();
|
||||||
}
|
}
|
||||||
|
if (keys.count(label)) {
|
||||||
if (std::find(keys.begin(), keys.end(), label) != keys.end()) {
|
|
||||||
result[label] = value;
|
result[label] = value;
|
||||||
if (result.size() == keys.size()) {
|
if (result.size() == keys.size()) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
#include "level_zero/sysman/source/api/memory/sysman_os_memory.h"
|
#include "level_zero/sysman/source/api/memory/sysman_os_memory.h"
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
@@ -31,7 +32,7 @@ class LinuxMemoryImp : public OsMemory, NEO::NonCopyableAndNonMovableClass {
|
|||||||
ze_result_t getProperties(zes_mem_properties_t *pProperties) override;
|
ze_result_t getProperties(zes_mem_properties_t *pProperties) override;
|
||||||
ze_result_t getBandwidth(zes_mem_bandwidth_t *pBandwidth) override;
|
ze_result_t getBandwidth(zes_mem_bandwidth_t *pBandwidth) override;
|
||||||
ze_result_t getState(zes_mem_state_t *pState) override;
|
ze_result_t getState(zes_mem_state_t *pState) override;
|
||||||
static std::map<std::string, uint64_t> readMemInfoValues(FsAccessInterface *pFsAccess, const std::vector<std::string> &keys);
|
static std::unordered_map<std::string, uint64_t> readMemInfoValues(FsAccessInterface *pFsAccess, const std::unordered_set<std::string> &keys);
|
||||||
bool isMemoryModuleSupported() override;
|
bool isMemoryModuleSupported() override;
|
||||||
LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||||
LinuxMemoryImp() = default;
|
LinuxMemoryImp() = default;
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getMemoryProperties(zes_mem_prope
|
|||||||
pProperties->type = ZES_MEM_TYPE_FORCE_UINT32;
|
pProperties->type = ZES_MEM_TYPE_FORCE_UINT32;
|
||||||
|
|
||||||
const std::string memTotalKey = "MemTotal";
|
const std::string memTotalKey = "MemTotal";
|
||||||
auto memInfoValues = LinuxMemoryImp::readMemInfoValues(&pLinuxSysmanImp->getFsAccess(), {memTotalKey});
|
std::unordered_set<std::string> keys{memTotalKey};
|
||||||
|
auto memInfoValues = LinuxMemoryImp::readMemInfoValues(&pLinuxSysmanImp->getFsAccess(), keys);
|
||||||
if (memInfoValues.find(memTotalKey) != memInfoValues.end()) {
|
if (memInfoValues.find(memTotalKey) != memInfoValues.end()) {
|
||||||
pProperties->physicalSize = memInfoValues[memTotalKey] * 1024;
|
pProperties->physicalSize = memInfoValues[memTotalKey] * 1024;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,14 +172,11 @@ struct MockMemorySysFsAccessInterface : public L0::Sysman::SysFsAccessInterface
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct MockMemoryFsAccessInterface : public L0::Sysman::FsAccessInterface {
|
struct MockMemoryFsAccessInterface : public L0::Sysman::FsAccessInterface {
|
||||||
bool mockMemInfoIncorrectValue = false;
|
std::vector<std::string> customMemInfo;
|
||||||
ze_result_t read(std::string file, std::vector<std::string> &val) override {
|
ze_result_t read(std::string file, std::vector<std::string> &val) override {
|
||||||
if (file == "/proc/meminfo") {
|
if (file == "/proc/meminfo") {
|
||||||
if (mockMemInfoIncorrectValue) {
|
if (!customMemInfo.empty()) {
|
||||||
val.push_back("Buffers: 158772 kB");
|
val = customMemInfo;
|
||||||
val.push_back("Cached: 11744244 kB");
|
|
||||||
val.push_back("SwapCached: 1376 kB");
|
|
||||||
val.push_back("Active: 6777644 kB");
|
|
||||||
} else {
|
} else {
|
||||||
val.push_back("MemTotal: 16384 kB");
|
val.push_back("MemTotal: 16384 kB");
|
||||||
val.push_back("MemFree: 4096 kB");
|
val.push_back("MemFree: 4096 kB");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/test/common/mocks/linux/mock_ioctl_helper.h"
|
#include "shared/test/common/mocks/linux/mock_ioctl_helper.h"
|
||||||
|
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||||
|
|
||||||
#include "level_zero/sysman/source/device/sysman_device_imp.h"
|
#include "level_zero/sysman/source/device/sysman_device_imp.h"
|
||||||
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
|
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
|
||||||
@@ -685,9 +686,7 @@ HWTEST2_F(SysmanDeviceMemoryFixtureI915, GivenValidMemoryHandleWhenCallingZesSys
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixtureI915, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndIoctlReturnedErrorThenApiReturnsError) {
|
TEST_F(SysmanDeviceMemoryFixtureI915, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndIoctlReturnedErrorThenApiReturnsError) {
|
||||||
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
GTEST_SKIP() << "This test is not applicable for integrated devices";
|
|
||||||
}
|
|
||||||
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
||||||
ioctlHelper->returnEmptyMemoryInfo = true;
|
ioctlHelper->returnEmptyMemoryInfo = true;
|
||||||
ioctlHelper->mockErrorNumber = EBUSY;
|
ioctlHelper->mockErrorNumber = EBUSY;
|
||||||
@@ -705,9 +704,7 @@ TEST_F(SysmanDeviceMemoryFixtureI915, GivenValidMemoryHandleWhenCallingZesSysman
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixtureI915, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndDeviceIsNotAvailableThenDeviceLostErrorIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixtureI915, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndDeviceIsNotAvailableThenDeviceLostErrorIsReturned) {
|
||||||
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
GTEST_SKIP() << "This test is not applicable for integrated devices";
|
|
||||||
}
|
|
||||||
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
||||||
ioctlHelper->returnEmptyMemoryInfo = true;
|
ioctlHelper->returnEmptyMemoryInfo = true;
|
||||||
ioctlHelper->mockErrorNumber = ENODEV;
|
ioctlHelper->mockErrorNumber = ENODEV;
|
||||||
@@ -901,10 +898,36 @@ HWTEST2_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesMe
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanMultiDeviceMemoryFixture, GivenMemFreeAndMemAvailableMissingInMemInfoWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
TEST_F(SysmanMultiDeviceMemoryFixture, GivenMemFreeAndMemAvailableMissingInMemInfoWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
||||||
if (!defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
REQUIRE_INTEGRATED_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
GTEST_SKIP() << "This test is only applicable for integrated devices.";
|
pFsAccess->customMemInfo = {
|
||||||
}
|
"Buffers: 158772 kB",
|
||||||
pFsAccess->mockMemInfoIncorrectValue = true;
|
"Cached: 11744244 kB"};
|
||||||
|
auto handles = getMemoryHandles(pOsSysman->getSubDeviceCount());
|
||||||
|
zes_mem_state_t state = {};
|
||||||
|
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
||||||
|
|
||||||
|
EXPECT_EQ(result, ZE_RESULT_ERROR_UNKNOWN);
|
||||||
|
EXPECT_EQ(state.free, 0u);
|
||||||
|
EXPECT_EQ(state.size, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanMultiDeviceMemoryFixture, GivenMemInfoWithoutColonSeparatorWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
||||||
|
REQUIRE_INTEGRATED_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
pFsAccess->customMemInfo = {
|
||||||
|
"Buffers 158772 kB",
|
||||||
|
"Cached 11744244 kB"};
|
||||||
|
auto handles = getMemoryHandles(pOsSysman->getSubDeviceCount());
|
||||||
|
zes_mem_state_t state = {};
|
||||||
|
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
||||||
|
|
||||||
|
EXPECT_EQ(result, ZE_RESULT_ERROR_UNKNOWN);
|
||||||
|
EXPECT_EQ(state.free, 0u);
|
||||||
|
EXPECT_EQ(state.size, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanMultiDeviceMemoryFixture, GivenMemInfoIsEmptyWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
||||||
|
REQUIRE_INTEGRATED_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
pFsAccess->customMemInfo = {""};
|
||||||
auto handles = getMemoryHandles(pOsSysman->getSubDeviceCount());
|
auto handles = getMemoryHandles(pOsSysman->getSubDeviceCount());
|
||||||
zes_mem_state_t state = {};
|
zes_mem_state_t state = {};
|
||||||
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||||
#include "shared/source/device/device.h"
|
#include "shared/source/device/device.h"
|
||||||
|
#include "shared/source/execution_environment/root_device_environment.h"
|
||||||
|
#include "shared/source/helpers/gfx_core_helper.h"
|
||||||
#include "shared/source/helpers/hw_info.h"
|
#include "shared/source/helpers/hw_info.h"
|
||||||
#include "shared/source/memory_manager/memory_banks.h"
|
#include "shared/source/memory_manager/memory_banks.h"
|
||||||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
@@ -22,6 +24,8 @@
|
|||||||
|
|
||||||
#include "neo_igfxfmid.h"
|
#include "neo_igfxfmid.h"
|
||||||
|
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
|
|
||||||
const std::string LinuxMemoryImp::deviceMemoryHealth("device_memory_health");
|
const std::string LinuxMemoryImp::deviceMemoryHealth("device_memory_health");
|
||||||
@@ -38,6 +42,31 @@ void LinuxMemoryImp::init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::unordered_map<std::string, uint64_t> readMemInfoValues(FsAccess &fsAccess, const std::unordered_set<std::string> &keys) {
|
||||||
|
std::unordered_map<std::string, uint64_t> result;
|
||||||
|
const std::string memInfoFile = "/proc/meminfo";
|
||||||
|
std::vector<std::string> memInfo;
|
||||||
|
|
||||||
|
if (fsAccess.read(memInfoFile, memInfo) == ZE_RESULT_SUCCESS) {
|
||||||
|
for (const auto &line : memInfo) {
|
||||||
|
std::istringstream lineStream(line);
|
||||||
|
std::string label, unit;
|
||||||
|
uint64_t value = 0;
|
||||||
|
lineStream >> label >> value >> unit;
|
||||||
|
if (!label.empty() && label.back() == ':') {
|
||||||
|
label.pop_back();
|
||||||
|
}
|
||||||
|
if (keys.count(label)) {
|
||||||
|
result[label] = value;
|
||||||
|
if (result.size() == keys.size()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) : isSubdevice(onSubdevice), subdeviceId(subdeviceId) {
|
LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) : isSubdevice(onSubdevice), subdeviceId(subdeviceId) {
|
||||||
pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||||
pDrm = &pLinuxSysmanImp->getDrm();
|
pDrm = &pLinuxSysmanImp->getDrm();
|
||||||
@@ -48,10 +77,33 @@ LinuxMemoryImp::LinuxMemoryImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint3
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LinuxMemoryImp::isMemoryModuleSupported() {
|
bool LinuxMemoryImp::isMemoryModuleSupported() {
|
||||||
return pDevice->getDriverHandle()->getMemoryManager()->isLocalMemorySupported(pDevice->getRootDeviceIndex());
|
auto &gfxCoreHelper = pDevice->getNEODevice()->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||||
|
auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo();
|
||||||
|
if (hwInfo.capabilityTable.isIntegratedDevice) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return gfxCoreHelper.getEnableLocalMemory(hwInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t LinuxMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
ze_result_t LinuxMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
||||||
|
auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo();
|
||||||
|
pProperties->physicalSize = 0;
|
||||||
|
if (hwInfo.capabilityTable.isIntegratedDevice) {
|
||||||
|
const std::string memTotalKey = "MemTotal";
|
||||||
|
std::unordered_set<std::string> keys{memTotalKey};
|
||||||
|
auto memInfoValues = readMemInfoValues(pLinuxSysmanImp->getFsAccess(), keys);
|
||||||
|
if (memInfoValues.find(memTotalKey) != memInfoValues.end()) {
|
||||||
|
pProperties->physicalSize = memInfoValues[memTotalKey] * 1024;
|
||||||
|
}
|
||||||
|
pProperties->type = ZES_MEM_TYPE_DDR;
|
||||||
|
pProperties->numChannels = -1;
|
||||||
|
pProperties->location = ZES_MEM_LOC_SYSTEM;
|
||||||
|
pProperties->onSubdevice = isSubdevice;
|
||||||
|
pProperties->subdeviceId = subdeviceId;
|
||||||
|
pProperties->busWidth = -1;
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
pProperties->type = ZES_MEM_TYPE_DDR;
|
pProperties->type = ZES_MEM_TYPE_DDR;
|
||||||
pProperties->numChannels = -1;
|
pProperties->numChannels = -1;
|
||||||
if (pDrm->querySystemInfo()) {
|
if (pDrm->querySystemInfo()) {
|
||||||
@@ -81,7 +133,6 @@ ze_result_t LinuxMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
|
|||||||
pProperties->subdeviceId = subdeviceId;
|
pProperties->subdeviceId = subdeviceId;
|
||||||
pProperties->busWidth = memoryBusWidth; // Hardcode
|
pProperties->busWidth = memoryBusWidth; // Hardcode
|
||||||
|
|
||||||
pProperties->physicalSize = 0;
|
|
||||||
if (isSubdevice) {
|
if (isSubdevice) {
|
||||||
std::string memval;
|
std::string memval;
|
||||||
ze_result_t result = pSysfsAccess->read(physicalSizeFile, memval);
|
ze_result_t result = pSysfsAccess->read(physicalSizeFile, memval);
|
||||||
@@ -348,6 +399,22 @@ ze_result_t LinuxMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) {
|
|||||||
ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) {
|
||||||
ze_result_t status = ZE_RESULT_SUCCESS;
|
ze_result_t status = ZE_RESULT_SUCCESS;
|
||||||
pState->health = ZES_MEM_HEALTH_UNKNOWN;
|
pState->health = ZES_MEM_HEALTH_UNKNOWN;
|
||||||
|
auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo();
|
||||||
|
if (hwInfo.capabilityTable.isIntegratedDevice) {
|
||||||
|
const std::string memFreeKey = "MemFree";
|
||||||
|
const std::string memAvailableKey = "MemAvailable";
|
||||||
|
std::unordered_set<std::string> keys{memFreeKey, memAvailableKey};
|
||||||
|
auto memInfoValues = readMemInfoValues(pLinuxSysmanImp->getFsAccess(), keys);
|
||||||
|
if (memInfoValues.find(memFreeKey) != memInfoValues.end() && memInfoValues.find(memAvailableKey) != memInfoValues.end()) {
|
||||||
|
pState->free = memInfoValues[memFreeKey] * 1024;
|
||||||
|
pState->size = memInfoValues[memAvailableKey] * 1024;
|
||||||
|
} else {
|
||||||
|
pState->free = 0;
|
||||||
|
pState->size = 0;
|
||||||
|
status = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
FirmwareUtil *pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
FirmwareUtil *pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||||
auto productFamily = SysmanDeviceImp::getProductFamily(pDevice);
|
auto productFamily = SysmanDeviceImp::getProductFamily(pDevice);
|
||||||
if ((pFwInterface != nullptr) && (IGFX_PVC == productFamily)) {
|
if ((pFwInterface != nullptr) && (IGFX_PVC == productFamily)) {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "shared/source/os_interface/linux/memory_info.h"
|
#include "shared/source/os_interface/linux/memory_info.h"
|
||||||
#include "shared/source/os_interface/linux/system_info.h"
|
#include "shared/source/os_interface/linux/system_info.h"
|
||||||
|
|
||||||
#include "level_zero/core/test/unit_tests/mocks/mock_memory_manager.h"
|
|
||||||
#include "level_zero/tools/source/sysman/linux/os_sysman_imp.h"
|
#include "level_zero/tools/source/sysman/linux/os_sysman_imp.h"
|
||||||
#include "level_zero/tools/source/sysman/memory/linux/os_memory_imp.h"
|
#include "level_zero/tools/source/sysman/memory/linux/os_memory_imp.h"
|
||||||
#include "level_zero/tools/source/sysman/memory/memory_imp.h"
|
#include "level_zero/tools/source/sysman/memory/memory_imp.h"
|
||||||
@@ -78,6 +77,10 @@ constexpr uint64_t mockDisplayVc1ReadVal = 10u;
|
|||||||
constexpr uint64_t numberMcChannels = 16;
|
constexpr uint64_t numberMcChannels = 16;
|
||||||
constexpr uint64_t transactionSize = 32;
|
constexpr uint64_t transactionSize = 32;
|
||||||
|
|
||||||
|
constexpr uint64_t mockIntegratedDeviceAvailableMemory = 8192 * 1024;
|
||||||
|
constexpr uint64_t mockIntegratedDeviceFreeMemory = 4096 * 1024;
|
||||||
|
constexpr uint64_t mockIntegratedDevicePhysicalSize = 16384 * 1024;
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
namespace ult {
|
namespace ult {
|
||||||
uint32_t mockMemoryType = NEO::DeviceBlobConstants::MemoryType::hbm2e;
|
uint32_t mockMemoryType = NEO::DeviceBlobConstants::MemoryType::hbm2e;
|
||||||
@@ -201,10 +204,6 @@ struct MockMemorySysfsAccess : public SysfsAccess {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MockMemoryManagerSysman : public MemoryManagerMock {
|
|
||||||
MockMemoryManagerSysman(NEO::ExecutionEnvironment &executionEnvironment) : MemoryManagerMock(const_cast<NEO::ExecutionEnvironment &>(executionEnvironment)) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MockMemoryNeoDrm : public Drm {
|
struct MockMemoryNeoDrm : public Drm {
|
||||||
using Drm::ioctlHelper;
|
using Drm::ioctlHelper;
|
||||||
const int mockFd = 33;
|
const int mockFd = 33;
|
||||||
@@ -221,6 +220,10 @@ struct MockMemoryNeoDrm : public Drm {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetSystemInfo() {
|
||||||
|
systemInfo.reset(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
bool querySystemInfo() override {
|
bool querySystemInfo() override {
|
||||||
bool returnValue = true;
|
bool returnValue = true;
|
||||||
if (!mockQuerySystemInfoReturnValue.empty()) {
|
if (!mockQuerySystemInfoReturnValue.empty()) {
|
||||||
@@ -228,6 +231,7 @@ struct MockMemoryNeoDrm : public Drm {
|
|||||||
if (isRepeated != true) {
|
if (isRepeated != true) {
|
||||||
mockQuerySystemInfoReturnValue.erase(mockQuerySystemInfoReturnValue.begin());
|
mockQuerySystemInfoReturnValue.erase(mockQuerySystemInfoReturnValue.begin());
|
||||||
}
|
}
|
||||||
|
resetSystemInfo();
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,6 +473,20 @@ struct MockMemoryFsAccess : public FsAccess {
|
|||||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> customMemInfo;
|
||||||
|
ze_result_t read(std::string file, std::vector<std::string> &val) override {
|
||||||
|
if (file == "/proc/meminfo") {
|
||||||
|
if (!customMemInfo.empty()) {
|
||||||
|
val = customMemInfo;
|
||||||
|
} else {
|
||||||
|
val.push_back("MemTotal: 16384 kB");
|
||||||
|
val.push_back("MemFree: 4096 kB");
|
||||||
|
val.push_back("MemAvailable: 8192 kB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
MockMemoryFsAccess() = default;
|
MockMemoryFsAccess() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "shared/source/os_interface/driver_info.h"
|
#include "shared/source/os_interface/driver_info.h"
|
||||||
#include "shared/test/common/mocks/linux/mock_ioctl_helper.h"
|
#include "shared/test/common/mocks/linux/mock_ioctl_helper.h"
|
||||||
|
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||||
|
|
||||||
#include "level_zero/tools/source/sysman/linux/pmt/pmt_xml_offsets.h"
|
#include "level_zero/tools/source/sysman/linux/pmt/pmt_xml_offsets.h"
|
||||||
#include "level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h"
|
#include "level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h"
|
||||||
@@ -56,17 +57,13 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
|||||||
if (!sysmanUltsEnable) {
|
if (!sysmanUltsEnable) {
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
}
|
}
|
||||||
|
debugManager.flags.EnableLocalMemory.set(1);
|
||||||
SysmanDeviceFixture::SetUp();
|
SysmanDeviceFixture::SetUp();
|
||||||
|
|
||||||
pSysfsAccessOld = pLinuxSysmanImp->pSysfsAccess;
|
pSysfsAccessOld = pLinuxSysmanImp->pSysfsAccess;
|
||||||
pSysfsAccess = std::make_unique<MockMemorySysfsAccess>();
|
pSysfsAccess = std::make_unique<MockMemorySysfsAccess>();
|
||||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccess.get();
|
pLinuxSysmanImp->pSysfsAccess = pSysfsAccess.get();
|
||||||
|
|
||||||
pMemoryManagerOld = device->getDriverHandle()->getMemoryManager();
|
|
||||||
pMemoryManager = new MockMemoryManagerSysman(*neoDevice->getExecutionEnvironment());
|
|
||||||
pMemoryManager->localMemorySupported[0] = false;
|
|
||||||
device->getDriverHandle()->setMemoryManager(pMemoryManager);
|
|
||||||
|
|
||||||
pDrm = new MockMemoryNeoDrm(const_cast<NEO::RootDeviceEnvironment &>(neoDevice->getRootDeviceEnvironment()));
|
pDrm = new MockMemoryNeoDrm(const_cast<NEO::RootDeviceEnvironment &>(neoDevice->getRootDeviceEnvironment()));
|
||||||
|
|
||||||
pSysmanDevice = device->getSysmanHandle();
|
pSysmanDevice = device->getSysmanHandle();
|
||||||
@@ -112,7 +109,6 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
|||||||
}
|
}
|
||||||
pLinuxSysmanImp->releasePmtObject();
|
pLinuxSysmanImp->releasePmtObject();
|
||||||
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
|
pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject = pmtMapOriginal;
|
||||||
device->getDriverHandle()->setMemoryManager(pMemoryManagerOld);
|
|
||||||
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
|
pLinuxSysmanImp->pFsAccess = pFsAccessOriginal;
|
||||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
|
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
|
||||||
pLinuxSysmanImp->pDrm = pOriginalDrm;
|
pLinuxSysmanImp->pDrm = pOriginalDrm;
|
||||||
@@ -120,15 +116,11 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
|||||||
delete pDrm;
|
delete pDrm;
|
||||||
pDrm = nullptr;
|
pDrm = nullptr;
|
||||||
}
|
}
|
||||||
if (pMemoryManager != nullptr) {
|
|
||||||
delete pMemoryManager;
|
|
||||||
pMemoryManager = nullptr;
|
|
||||||
}
|
|
||||||
SysmanDeviceFixture::TearDown();
|
SysmanDeviceFixture::TearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLocalSupportedAndReinit(bool supported) {
|
void setLocalSupportedAndReinit(bool supported) {
|
||||||
pMemoryManager->localMemorySupported[0] = supported;
|
debugManager.flags.EnableLocalMemory.set(supported);
|
||||||
|
|
||||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||||
uint32_t subDeviceCount = 0;
|
uint32_t subDeviceCount = 0;
|
||||||
@@ -149,9 +141,6 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
|||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
||||||
return handles;
|
return handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
MockMemoryManagerSysman *pMemoryManager = nullptr;
|
|
||||||
MemoryManager *pMemoryManagerOld;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenWhenGettingMemoryPropertiesThenSuccessIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenWhenGettingMemoryPropertiesThenSuccessIsReturned) {
|
||||||
@@ -161,16 +150,12 @@ TEST_F(SysmanDeviceMemoryFixture, GivenWhenGettingMemoryPropertiesThenSuccessIsR
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||||
@@ -181,8 +166,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemor
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidHandlesIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidHandlesIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(count, memoryHandleComponentCount);
|
EXPECT_EQ(count, memoryHandleComponentCount);
|
||||||
@@ -194,43 +177,43 @@ TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryMo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedForDiscretePlatforms) {
|
||||||
setLocalSupportedAndReinit(false);
|
if (!defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
setLocalSupportedAndReinit(false);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(count, 0u);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(count, 1u);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(count, 0u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedForDiscretePlatforms) {
|
||||||
setLocalSupportedAndReinit(false);
|
if (!defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
setLocalSupportedAndReinit(false);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(count, 0u);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(count, 1u);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(count, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
count = count + 1;
|
count = count + 1;
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(count, 0u);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
}
|
EXPECT_EQ(count, 1u);
|
||||||
|
} else {
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidHandlesAreReturned) {
|
EXPECT_EQ(count, 0u);
|
||||||
setLocalSupportedAndReinit(false);
|
|
||||||
|
|
||||||
uint32_t count = 0;
|
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
|
|
||||||
EXPECT_EQ(count, 0u);
|
|
||||||
|
|
||||||
std::vector<zes_mem_handle_t> handles(count, nullptr);
|
|
||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
|
||||||
for (auto handle : handles) {
|
|
||||||
EXPECT_NE(handle, nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesWithLocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesWithLocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -240,21 +223,28 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_HBM);
|
|
||||||
|
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_HBM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesAndQuerySystemInfoFailsThenVerifySysmanMemoryGetPropertiesCallReturnsMemoryTypeAsDdrAndNumberOfChannelsAsUnknown) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesAndQuerySystemInfoFailsThenVerifySysmanMemoryGetPropertiesCallReturnsMemoryTypeAsDdrAndNumberOfChannelsAsUnknownForDiscretePlatforms) {
|
||||||
pDrm->mockQuerySystemInfoReturnValue.push_back(false);
|
pDrm->mockQuerySystemInfoReturnValue.push_back(false);
|
||||||
setLocalSupportedAndReinit(true);
|
setLocalSupportedAndReinit(true);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -264,22 +254,30 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
|
||||||
EXPECT_EQ(properties.numChannels, -1);
|
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesAndQuerySystemInfoSucceedsButMemSysInfoIsNullThenVerifySysmanMemoryGetPropertiesCallReturnsMemoryTypeAsDdrAndNumberOfChannelsAsUnknown) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesAndQuerySystemInfoSucceedsButMemSysInfoIsNullThenVerifySysmanMemoryGetPropertiesCallReturnsMemoryTypeAsDdrAndNumberOfChannelsAsUnknownForDiscretePlatforms) {
|
||||||
|
|
||||||
pDrm->mockQuerySystemInfoReturnValue.push_back(true);
|
pDrm->mockQuerySystemInfoReturnValue.push_back(true);
|
||||||
setLocalSupportedAndReinit(true);
|
setLocalSupportedAndReinit(true);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
ASSERT_NE(nullptr, handle);
|
ASSERT_NE(nullptr, handle);
|
||||||
zes_mem_properties_t properties;
|
zes_mem_properties_t properties;
|
||||||
@@ -287,20 +285,26 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
|
||||||
EXPECT_EQ(properties.numChannels, -1);
|
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesWithHBMLocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesWithHBMLocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
||||||
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::hbm2);
|
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::hbm2);
|
||||||
setLocalSupportedAndReinit(true);
|
setLocalSupportedAndReinit(true);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -310,20 +314,26 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_HBM);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_HBM);
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesWithLPDDR4LocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesWithLPDDR4LocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
||||||
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::lpddr4);
|
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::lpddr4);
|
||||||
setLocalSupportedAndReinit(true);
|
setLocalSupportedAndReinit(true);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -333,20 +343,26 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_LPDDR4);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_LPDDR4);
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesWithLPDDR5LocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesWithLPDDR5LocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
||||||
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::lpddr5);
|
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::lpddr5);
|
||||||
setLocalSupportedAndReinit(true);
|
setLocalSupportedAndReinit(true);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -356,20 +372,26 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_LPDDR5);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_LPDDR5);
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetPropertiesWithDDRLocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetPropertiesWithDDRLocalMemoryThenVerifySysmanMemoryGetPropertiesCallSucceeds) {
|
||||||
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::gddr6);
|
pDrm->setMemoryType(NEO::DeviceBlobConstants::MemoryType::gddr6);
|
||||||
setLocalSupportedAndReinit(true);
|
setLocalSupportedAndReinit(true);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -379,19 +401,24 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
ze_result_t result = zesMemoryGetProperties(handle, &properties);
|
||||||
|
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
if (defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_SYSTEM);
|
||||||
|
EXPECT_EQ(properties.physicalSize, mockIntegratedDevicePhysicalSize);
|
||||||
|
EXPECT_EQ(properties.numChannels, -1);
|
||||||
|
EXPECT_EQ(properties.busWidth, -1);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(properties.type, ZES_MEM_TYPE_DDR);
|
||||||
|
EXPECT_EQ(properties.location, ZES_MEM_LOC_DEVICE);
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
||||||
|
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
||||||
|
}
|
||||||
EXPECT_FALSE(properties.onSubdevice);
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.subdeviceId, 0u);
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
|
||||||
EXPECT_EQ(properties.numChannels, numMemoryChannels);
|
|
||||||
EXPECT_EQ(properties.busWidth, memoryBusWidth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsOK, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsOK, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -407,8 +434,8 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesMemoryG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsUnknown, IsNotPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsUnknown, IsNotPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
@@ -425,8 +452,8 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetStateAndIoctlReturnedErrorThenApiReturnsError) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndIoctlReturnedErrorThenApiReturnsError) {
|
||||||
setLocalSupportedAndReinit(true);
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
|
||||||
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
||||||
ioctlHelper->returnEmptyMemoryInfo = true;
|
ioctlHelper->returnEmptyMemoryInfo = true;
|
||||||
@@ -443,8 +470,8 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetStateAndDeviceIsNotAvailableThenDeviceLostErrorIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndDeviceIsNotAvailableThenDeviceLostErrorIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
|
||||||
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
auto ioctlHelper = static_cast<SysmanMemoryMockIoctlHelper *>(pDrm->ioctlHelper.get());
|
||||||
ioctlHelper->returnEmptyMemoryInfo = true;
|
ioctlHelper->returnEmptyMemoryInfo = true;
|
||||||
@@ -464,7 +491,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenSysmanResourcesAreReleasedAndReInitializedWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsOK, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenSysmanResourcesAreReleasedAndReInitializedWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsOK, IsPVC) {
|
||||||
pMemoryManager->localMemorySupported[0] = true;
|
debugManager.flags.EnableLocalMemory.set(1);
|
||||||
|
|
||||||
pLinuxSysmanImp->releaseSysmanDeviceResources();
|
pLinuxSysmanImp->releaseSysmanDeviceResources();
|
||||||
pLinuxSysmanImp->pDrm = pDrm;
|
pLinuxSysmanImp->pDrm = pDrm;
|
||||||
@@ -503,7 +530,8 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenSysmanResourcesAreReleasedAndReInitial
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenSysmanResourcesAreReleasedAndReInitializedWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsUnknown, IsNotPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenSysmanResourcesAreReleasedAndReInitializedWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsUnknown, IsNotPVC) {
|
||||||
pMemoryManager->localMemorySupported[0] = true;
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
debugManager.flags.EnableLocalMemory.set(1);
|
||||||
|
|
||||||
pLinuxSysmanImp->releaseSysmanDeviceResources();
|
pLinuxSysmanImp->releaseSysmanDeviceResources();
|
||||||
pLinuxSysmanImp->pDrm = pDrm;
|
pLinuxSysmanImp->pDrm = pDrm;
|
||||||
@@ -558,7 +586,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthWhenVFID0IsActiveThenSuccessIsReturnedAndBandwidthIsValid, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthWhenVFID0IsActiveThenSuccessIsReturnedAndBandwidthIsValid, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -593,7 +620,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthWhenVFID1IsActiveThenSuccessIsReturnedAndBandwidthIsValid, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthWhenVFID1IsActiveThenSuccessIsReturnedAndBandwidthIsValid, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -628,7 +654,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_READ_LFailsThenFailureIsReturned, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_READ_LFailsThenFailureIsReturned, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -651,7 +676,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_VFIDFailsForOldGuidThenFailureIsReturned, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_VFIDFailsForOldGuidThenFailureIsReturned, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -670,7 +694,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF1_VFIDFailsForOldGuidThenFailureIsReturned, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF1_VFIDFailsForOldGuidThenFailureIsReturned, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -691,7 +714,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_READ_HFailsThenFailureIsReturned, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_READ_HFailsThenFailureIsReturned, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -716,7 +738,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_WRITE_LFailsThenFailureIsReturned, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_WRITE_LFailsThenFailureIsReturned, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -743,7 +764,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_WRITE_HFailsThenFailureIsReturned, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthAndVF0_HBM_WRITE_HFailsThenFailureIsReturned, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -772,7 +792,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidUsRevIdForRevisionBWhenCallingzesSysmanMemoryGetBandwidthThenSuccessIsReturnedAndBandwidthIsValid, IsPVC) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidUsRevIdForRevisionBWhenCallingzesSysmanMemoryGetBandwidthThenSuccessIsReturnedAndBandwidthIsValid, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
for (auto &handle : handles) {
|
for (auto &handle : handles) {
|
||||||
@@ -797,7 +816,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidUsRevIdForRevisionBWhenCallingzes
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformThenSuccessIsReturnedAndBandwidthIsValid) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformThenSuccessIsReturnedAndBandwidthIsValid) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_DG2;
|
hwInfo.platform.eProductFamily = IGFX_DG2;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -825,7 +843,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForUnknownPlatformThenFailureIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForUnknownPlatformThenFailureIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_UNKNOWN;
|
hwInfo.platform.eProductFamily = IGFX_UNKNOWN;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -839,7 +856,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiReadFailsTheFailureIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiReadFailsTheFailureIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_DG2;
|
hwInfo.platform.eProductFamily = IGFX_DG2;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -859,7 +875,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformAndReadingMaxBwFailsThenMaxBwIsReturnedAsZero, IsDG2) {
|
HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformAndReadingMaxBwFailsThenMaxBwIsReturnedAsZero, IsDG2) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_DG2;
|
hwInfo.platform.eProductFamily = IGFX_DG2;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -879,7 +894,6 @@ HWTEST2_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanM
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiWriteFailsTheFailureIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfIdiWriteFailsTheFailureIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_DG2;
|
hwInfo.platform.eProductFamily = IGFX_DG2;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -899,7 +913,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfDisplayVc1ReadFailsTheFailureIsReturned) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemoryGetBandwidthForDg2PlatformIfDisplayVc1ReadFailsTheFailureIsReturned) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_DG2;
|
hwInfo.platform.eProductFamily = IGFX_DG2;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -963,7 +976,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenCallinggetHbmFrequencyWhenProductFamilyIs
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenBothVfid0AndVfid1AreTrueThenErrorIsReturnedWhileGettingMemoryBandwidth) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenBothVfid0AndVfid1AreTrueThenErrorIsReturnedWhileGettingMemoryBandwidth) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_PVC;
|
hwInfo.platform.eProductFamily = IGFX_PVC;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -986,7 +998,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenBothVfid0AndVfid1Are
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenBothVfid0AndVfid1AreFalseThenErrorIsReturnedWhileGettingMemoryBandwidth) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenBothVfid0AndVfid1AreFalseThenErrorIsReturnedWhileGettingMemoryBandwidth) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
hwInfo.platform.eProductFamily = IGFX_PVC;
|
hwInfo.platform.eProductFamily = IGFX_PVC;
|
||||||
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
pLinuxSysmanImp->getDeviceHandle()->getNEODevice()->getRootDeviceEnvironmentRef().setHwInfoAndInitHelpers(&hwInfo);
|
||||||
@@ -1018,8 +1029,6 @@ TEST_F(SysmanDeviceMemoryFixture, GivenCallinggetHbmFrequencyWhenProductFamilyIs
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndFwUtilInterfaceIsAbsentThenMemoryHealthWillBeUnknown) {
|
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateAndFwUtilInterfaceIsAbsentThenMemoryHealthWillBeUnknown) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
|
||||||
@@ -1038,6 +1047,47 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDeviceMemoryFixture, GivenMemFreeAndMemAvailableMissingInMemInfoWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
||||||
|
REQUIRE_INTEGRATED_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
pFsAccess->customMemInfo = {
|
||||||
|
"Buffers: 158772 kB",
|
||||||
|
"Cached: 11744244 kB"};
|
||||||
|
setLocalSupportedAndReinit(false);
|
||||||
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
zes_mem_state_t state = {};
|
||||||
|
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
||||||
|
|
||||||
|
EXPECT_EQ(result, ZE_RESULT_ERROR_UNKNOWN);
|
||||||
|
EXPECT_EQ(state.free, 0u);
|
||||||
|
EXPECT_EQ(state.size, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDeviceMemoryFixture, GivenMemInfoWithoutColonSeparatorWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
||||||
|
REQUIRE_INTEGRATED_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
pFsAccess->customMemInfo = {
|
||||||
|
"Buffers 158772 kB",
|
||||||
|
"Cached 11744244 kB"};
|
||||||
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
zes_mem_state_t state = {};
|
||||||
|
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
||||||
|
|
||||||
|
EXPECT_EQ(result, ZE_RESULT_ERROR_UNKNOWN);
|
||||||
|
EXPECT_EQ(state.free, 0u);
|
||||||
|
EXPECT_EQ(state.size, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDeviceMemoryFixture, GivenMemInfoIsEmptySeparatorWhenCallingGetStateThenFreeAndSizeValuesAreZero) {
|
||||||
|
REQUIRE_INTEGRATED_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
pFsAccess->customMemInfo = {""};
|
||||||
|
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||||
|
zes_mem_state_t state = {};
|
||||||
|
ze_result_t result = zesMemoryGetState(handles[0], &state);
|
||||||
|
|
||||||
|
EXPECT_EQ(result, ZE_RESULT_ERROR_UNKNOWN);
|
||||||
|
EXPECT_EQ(state.free, 0u);
|
||||||
|
EXPECT_EQ(state.size, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(SysmanMultiDeviceFixture, GivenValidDevicePointerWhenGettingMemoryPropertiesThenValidMemoryPropertiesRetrieved) {
|
TEST_F(SysmanMultiDeviceFixture, GivenValidDevicePointerWhenGettingMemoryPropertiesThenValidMemoryPropertiesRetrieved) {
|
||||||
zes_mem_properties_t properties = {};
|
zes_mem_properties_t properties = {};
|
||||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||||
@@ -1063,17 +1113,13 @@ class SysmanMultiDeviceMemoryFixture : public SysmanMultiDeviceFixture {
|
|||||||
if (!sysmanUltsEnable) {
|
if (!sysmanUltsEnable) {
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
}
|
}
|
||||||
|
debugManager.flags.EnableLocalMemory.set(1);
|
||||||
SysmanMultiDeviceFixture::SetUp();
|
SysmanMultiDeviceFixture::SetUp();
|
||||||
|
|
||||||
pSysfsAccessOld = pLinuxSysmanImp->pSysfsAccess;
|
pSysfsAccessOld = pLinuxSysmanImp->pSysfsAccess;
|
||||||
pSysfsAccess = std::make_unique<MockMemorySysfsAccess>();
|
pSysfsAccess = std::make_unique<MockMemorySysfsAccess>();
|
||||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccess.get();
|
pLinuxSysmanImp->pSysfsAccess = pSysfsAccess.get();
|
||||||
|
|
||||||
pMemoryManagerOld = device->getDriverHandle()->getMemoryManager();
|
|
||||||
pMemoryManager = new MockMemoryManagerSysman(*neoDevice->getExecutionEnvironment());
|
|
||||||
pMemoryManager->localMemorySupported[0] = true;
|
|
||||||
device->getDriverHandle()->setMemoryManager(pMemoryManager);
|
|
||||||
|
|
||||||
pDrm = new MockMemoryNeoDrm(const_cast<NEO::RootDeviceEnvironment &>(neoDevice->getRootDeviceEnvironment()));
|
pDrm = new MockMemoryNeoDrm(const_cast<NEO::RootDeviceEnvironment &>(neoDevice->getRootDeviceEnvironment()));
|
||||||
pDrm->ioctlHelper = static_cast<std::unique_ptr<NEO::IoctlHelper>>(std::make_unique<NEO::MockIoctlHelper>(*pDrm));
|
pDrm->ioctlHelper = static_cast<std::unique_ptr<NEO::IoctlHelper>>(std::make_unique<NEO::MockIoctlHelper>(*pDrm));
|
||||||
|
|
||||||
@@ -1099,7 +1145,6 @@ class SysmanMultiDeviceMemoryFixture : public SysmanMultiDeviceFixture {
|
|||||||
if (!sysmanUltsEnable) {
|
if (!sysmanUltsEnable) {
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
}
|
}
|
||||||
device->getDriverHandle()->setMemoryManager(pMemoryManagerOld);
|
|
||||||
SysmanMultiDeviceFixture::TearDown();
|
SysmanMultiDeviceFixture::TearDown();
|
||||||
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
|
pLinuxSysmanImp->pSysfsAccess = pSysfsAccessOld;
|
||||||
pLinuxSysmanImp->pDrm = pOriginalDrm;
|
pLinuxSysmanImp->pDrm = pOriginalDrm;
|
||||||
@@ -1107,14 +1152,10 @@ class SysmanMultiDeviceMemoryFixture : public SysmanMultiDeviceFixture {
|
|||||||
delete pDrm;
|
delete pDrm;
|
||||||
pDrm = nullptr;
|
pDrm = nullptr;
|
||||||
}
|
}
|
||||||
if (pMemoryManager != nullptr) {
|
|
||||||
delete pMemoryManager;
|
|
||||||
pMemoryManager = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLocalSupportedAndReinit(bool supported) {
|
void setLocalSupportedAndReinit(bool supported) {
|
||||||
pMemoryManager->localMemorySupported[0] = supported;
|
debugManager.flags.EnableLocalMemory.set(supported);
|
||||||
|
|
||||||
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
|
||||||
uint32_t subDeviceCount = 0;
|
uint32_t subDeviceCount = 0;
|
||||||
@@ -1135,12 +1176,9 @@ class SysmanMultiDeviceMemoryFixture : public SysmanMultiDeviceFixture {
|
|||||||
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
||||||
return handles;
|
return handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
MockMemoryManagerSysman *pMemoryManager = nullptr;
|
|
||||||
MemoryManager *pMemoryManagerOld;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenGettingMemoryPropertiesWhileCallingGetValErrorThenValidMemoryPropertiesRetrieved) {
|
TEST_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenGettingMemoryPropertiesWhileCallingGetValErrorThenValidMemoryPropertiesRetrievedForDiscretePlatforms) {
|
||||||
pSysfsAccess->mockReadStringValue.push_back("0");
|
pSysfsAccess->mockReadStringValue.push_back("0");
|
||||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||||
|
|
||||||
@@ -1154,12 +1192,14 @@ TEST_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenGettingMemoryPr
|
|||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxMemoryImp->getProperties(&properties));
|
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxMemoryImp->getProperties(&properties));
|
||||||
EXPECT_EQ(properties.subdeviceId, deviceProperties.subdeviceId);
|
EXPECT_EQ(properties.subdeviceId, deviceProperties.subdeviceId);
|
||||||
EXPECT_EQ(properties.onSubdevice, isSubDevice);
|
EXPECT_EQ(properties.onSubdevice, isSubDevice);
|
||||||
EXPECT_EQ(properties.physicalSize, 0u);
|
if (!defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(properties.physicalSize, 0u);
|
||||||
|
}
|
||||||
delete pLinuxMemoryImp;
|
delete pLinuxMemoryImp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SysmanMultiDeviceMemoryFixture, GivenValidDevicePointerWhenGettingMemoryPropertiesThenValidMemoryPropertiesRetrieved) {
|
TEST_F(SysmanMultiDeviceMemoryFixture, GivenValidDevicePointerWhenGettingMemoryPropertiesThenValidMemoryPropertiesRetrievedForDiscretePlatforms) {
|
||||||
pSysfsAccess->mockReadStringValue.push_back(mockPhysicalSize.data());
|
pSysfsAccess->mockReadStringValue.push_back(mockPhysicalSize.data());
|
||||||
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_SUCCESS);
|
pSysfsAccess->mockReadReturnStatus.push_back(ZE_RESULT_SUCCESS);
|
||||||
pSysfsAccess->isRepeated = true;
|
pSysfsAccess->isRepeated = true;
|
||||||
@@ -1183,14 +1223,14 @@ TEST_F(SysmanMultiDeviceMemoryFixture, GivenValidDevicePointerWhenGettingMemoryP
|
|||||||
EXPECT_EQ(zesMemoryGetProperties(handle, &properties), ZE_RESULT_SUCCESS);
|
EXPECT_EQ(zesMemoryGetProperties(handle, &properties), ZE_RESULT_SUCCESS);
|
||||||
EXPECT_EQ(properties.subdeviceId, devicesProperties[subDeviceIndex].subdeviceId);
|
EXPECT_EQ(properties.subdeviceId, devicesProperties[subDeviceIndex].subdeviceId);
|
||||||
EXPECT_TRUE(properties.onSubdevice);
|
EXPECT_TRUE(properties.onSubdevice);
|
||||||
EXPECT_EQ(properties.physicalSize, strtoull(mockPhysicalSize.data(), nullptr, 16));
|
if (!defaultHwInfo->capabilityTable.isIntegratedDevice) {
|
||||||
|
EXPECT_EQ(properties.physicalSize, strtoull(mockPhysicalSize.data(), nullptr, 16));
|
||||||
|
}
|
||||||
subDeviceIndex++;
|
subDeviceIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsOK, IsPVC) {
|
HWTEST2_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsOK, IsPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
|
||||||
|
|
||||||
auto handles = getMemoryHandles(subDeviceCount);
|
auto handles = getMemoryHandles(subDeviceCount);
|
||||||
|
|
||||||
for (auto handle : handles) {
|
for (auto handle : handles) {
|
||||||
@@ -1211,8 +1251,8 @@ HWTEST2_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSy
|
|||||||
EXPECT_EQ(state2.free, NEO::unallocatedSizeRegionFour);
|
EXPECT_EQ(state2.free, NEO::unallocatedSizeRegionFour);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZetSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsUnknown, IsNotPVC) {
|
HWTEST2_F(SysmanMultiDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingZesSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceedsAndHealthIsUnknown, IsNotPVC) {
|
||||||
setLocalSupportedAndReinit(true);
|
REQUIRE_DISCRETE_DEVICE_OR_SKIP(*defaultHwInfo);
|
||||||
|
|
||||||
auto handles = getMemoryHandles(subDeviceCount);
|
auto handles = getMemoryHandles(subDeviceCount);
|
||||||
|
|
||||||
|
|||||||
@@ -49,4 +49,8 @@ bool TestChecks::supportsImages(const HardwareInfo &hardwareInfo) {
|
|||||||
|
|
||||||
bool TestChecks::supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo) {
|
bool TestChecks::supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo) {
|
||||||
return supportsImages(*pHardwareInfo);
|
return supportsImages(*pHardwareInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TestChecks::isIntegrated(const HardwareInfo &hardwareInfo) {
|
||||||
|
return hardwareInfo.capabilityTable.isIntegratedDevice;
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@ bool fullySupportsBlitter(const RootDeviceEnvironment &rootDeviceEnvironment);
|
|||||||
bool allowsDcFlush(const Device *device);
|
bool allowsDcFlush(const Device *device);
|
||||||
bool supportsImages(const HardwareInfo &hardwareInfo);
|
bool supportsImages(const HardwareInfo &hardwareInfo);
|
||||||
bool supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
bool supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
||||||
|
bool isIntegrated(const HardwareInfo &hardwareInfo);
|
||||||
} // namespace TestChecks
|
} // namespace TestChecks
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
@@ -54,3 +55,13 @@ bool supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
|||||||
if (NEO::TestChecks::supportsImages(param) == false) { \
|
if (NEO::TestChecks::supportsImages(param) == false) { \
|
||||||
GTEST_SKIP(); \
|
GTEST_SKIP(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define REQUIRE_INTEGRATED_DEVICE_OR_SKIP(hwInfoParam) \
|
||||||
|
if (NEO::TestChecks::isIntegrated(hwInfoParam) == false) { \
|
||||||
|
GTEST_SKIP(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define REQUIRE_DISCRETE_DEVICE_OR_SKIP(hwInfoParam) \
|
||||||
|
if (NEO::TestChecks::isIntegrated(hwInfoParam) == true) { \
|
||||||
|
GTEST_SKIP(); \
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user