Extend Support for memory on Sysman for iGFX

Changing from discrete to iGFX the Memory Module support.

Signed-off-by: Daniel Enriquez <daniel.enriquez.montanez@intel.com>
This commit is contained in:
Daniel Enriquez
2021-04-26 18:56:18 -07:00
committed by Compute-Runtime-Automation
parent 5291722ef1
commit 0afe6b2caa
3 changed files with 25 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,7 +9,21 @@
namespace L0 {
bool WddmMemoryImp::isMemoryModuleSupported() {
return pDevice->getDriverHandle()->getMemoryManager()->isLocalMemorySupported(pDevice->getRootDeviceIndex());
uint32_t value = 0;
KmdSysman::RequestProperty request;
KmdSysman::ResponseProperty response;
request.commandId = KmdSysman::Command::Get;
request.componentId = KmdSysman::Component::MemoryComponent;
request.requestId = KmdSysman::Requests::Memory::NumMemoryDomains;
if (pKmdSysManager->requestSingle(request, response) != ZE_RESULT_SUCCESS) {
return false;
}
memcpy_s(&value, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
return (value > 0);
}
ze_result_t WddmMemoryImp::getProperties(zes_mem_properties_t *pProperties) {
ze_result_t status = ZE_RESULT_SUCCESS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,12 +35,19 @@ struct Mock<MemoryKmdSysManager> : public MemoryKmdSysManager {
uint32_t mockMemoryChannels = 2;
uint32_t mockMemoryMaxBandwidth = 4256000000;
uint32_t mockMemoryCurrentBandwidth = 561321;
uint32_t mockMemoryDomains = 1;
void getMemoryProperty(KmdSysman::GfxSysmanReqHeaderIn *pRequest, KmdSysman::GfxSysmanReqHeaderOut *pResponse) override {
uint8_t *pBuffer = reinterpret_cast<uint8_t *>(pResponse);
pBuffer += sizeof(KmdSysman::GfxSysmanReqHeaderOut);
switch (pRequest->inRequestId) {
case KmdSysman::Requests::Memory::NumMemoryDomains: {
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
*pValue = mockMemoryDomains;
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
pResponse->outDataSize = sizeof(uint32_t);
} break;
case KmdSysman::Requests::Memory::MemoryType: {
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
*pValue = mockMemoryType;

View File

@@ -138,33 +138,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryMo
uint32_t count = 0;
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
EXPECT_EQ(count, 0u);
}
TEST_F(SysmanDeviceMemoryFixture, GivenInvalidComponentCountWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenZeroCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
setLocalSupportedAndReinit(false);
uint32_t count = 0;
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
EXPECT_EQ(count, 0u);
count = count + 1;
EXPECT_EQ(zesDeviceEnumMemoryModules(device->toHandle(), &count, nullptr), ZE_RESULT_SUCCESS);
EXPECT_EQ(count, 0u);
}
TEST_F(SysmanDeviceMemoryFixture, GivenComponentCountZeroWhenEnumeratingMemoryModulesWithNoLocalMemorySupportThenValidPowerHandlesIsReturned) {
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);
}
EXPECT_EQ(count, memoryHandleComponentCount);
}
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingGettingPropertiesWithLocalMemoryThenCallSucceeds) {