mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
Fix to use enum CurrentTotalAllocableMem for size in zesmemoryGetState.
Related-To: LOCI-3532 Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
74cf4189ca
commit
01eb8daea9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -223,7 +223,7 @@ ze_result_t WddmMemoryImp::getState(zes_mem_state_t *pState) {
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::MemoryComponent;
|
||||
request.requestId = KmdSysman::Requests::Memory::PhysicalSize;
|
||||
request.requestId = KmdSysman::Requests::Memory::CurrentTotalAllocableMem;
|
||||
|
||||
status = pKmdSysManager->requestSingle(request, response);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -37,6 +37,7 @@ struct Mock<MemoryKmdSysManager> : public MemoryKmdSysManager {
|
||||
uint32_t mockMemoryCurrentBandwidthRead = 561321;
|
||||
uint32_t mockMemoryCurrentBandwidthWrite = 664521;
|
||||
uint32_t mockMemoryDomains = 1;
|
||||
uint32_t mockMemoryCurrentTotalAllocableMem = 4294813695;
|
||||
|
||||
void getMemoryProperty(KmdSysman::GfxSysmanReqHeaderIn *pRequest, KmdSysman::GfxSysmanReqHeaderOut *pResponse) override {
|
||||
uint8_t *pBuffer = reinterpret_cast<uint8_t *>(pResponse);
|
||||
@@ -121,6 +122,12 @@ struct Mock<MemoryKmdSysManager> : public MemoryKmdSysManager {
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||
pResponse->outDataSize = sizeof(uint32_t);
|
||||
} break;
|
||||
case KmdSysman::Requests::Memory::CurrentTotalAllocableMem: {
|
||||
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
|
||||
*pValue = mockMemoryCurrentTotalAllocableMem;
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||
pResponse->outDataSize = sizeof(uint32_t);
|
||||
} break;
|
||||
default: {
|
||||
pResponse->outDataSize = 0;
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanFail;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,7 +17,7 @@ namespace ult {
|
||||
constexpr uint32_t memoryHandleComponentCount = 1u;
|
||||
class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
protected:
|
||||
Mock<MemoryKmdSysManager> *pKmdSysManager = nullptr;
|
||||
std::unique_ptr<Mock<MemoryKmdSysManager>> pKmdSysManager;
|
||||
KmdSysManager *pOriginalKmdSysManager = nullptr;
|
||||
void SetUp() override {
|
||||
if (!sysmanUltsEnable) {
|
||||
@@ -25,18 +25,12 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
SysmanDeviceFixture::SetUp();
|
||||
|
||||
pMemoryManagerOld = device->getDriverHandle()->getMemoryManager();
|
||||
pKmdSysManager.reset(new Mock<MemoryKmdSysManager>);
|
||||
|
||||
pMemoryManager = new ::testing::NiceMock<MockMemoryManagerSysman>(*neoDevice->getExecutionEnvironment());
|
||||
|
||||
pMemoryManager->localMemorySupported[0] = false;
|
||||
|
||||
device->getDriverHandle()->setMemoryManager(pMemoryManager);
|
||||
|
||||
pKmdSysManager = new Mock<MemoryKmdSysManager>;
|
||||
pKmdSysManager->allowSetCalls = true;
|
||||
|
||||
pOriginalKmdSysManager = pWddmSysmanImp->pKmdSysManager;
|
||||
pWddmSysmanImp->pKmdSysManager = pKmdSysManager;
|
||||
pWddmSysmanImp->pKmdSysManager = pKmdSysManager.get();
|
||||
|
||||
for (auto handle : pSysmanDeviceImp->pMemoryHandleContext->handleList) {
|
||||
delete handle;
|
||||
@@ -60,17 +54,8 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
if (!sysmanUltsEnable) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
device->getDriverHandle()->setMemoryManager(pMemoryManagerOld);
|
||||
SysmanDeviceFixture::TearDown();
|
||||
pWddmSysmanImp->pKmdSysManager = pOriginalKmdSysManager;
|
||||
if (pKmdSysManager != nullptr) {
|
||||
delete pKmdSysManager;
|
||||
pKmdSysManager = nullptr;
|
||||
}
|
||||
if (pMemoryManager != nullptr) {
|
||||
delete pMemoryManager;
|
||||
pMemoryManager = nullptr;
|
||||
}
|
||||
SysmanDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
void setLocalSupportedAndReinit(bool supported) {
|
||||
@@ -101,7 +86,6 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
|
||||
}
|
||||
|
||||
MockMemoryManagerSysman *pMemoryManager = nullptr;
|
||||
MemoryManager *pMemoryManagerOld;
|
||||
};
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, DISABLED_GivenComponentCountZeroWhenEnumeratingMemoryModulesWithLocalMemorySupportThenValidCountIsReturnedAndVerifySysmanPowerGetCallSucceeds) {
|
||||
@@ -184,6 +168,21 @@ TEST_F(SysmanDeviceMemoryFixture, DISABLED_GivenValidMemoryHandleWhenGettingStat
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenGettingStateThenCallSucceedsAndProperSizeIsReturned) {
|
||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||
pKmdSysManager->mockMemoryCurrentTotalAllocableMem = 4294813695;
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_mem_state_t state;
|
||||
|
||||
ze_result_t result = zesMemoryGetState(handle, &state);
|
||||
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(state.health, ZES_MEM_HEALTH_OK);
|
||||
EXPECT_EQ(state.size, pKmdSysManager->mockMemoryCurrentTotalAllocableMem);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceMemoryFixture, DISABLED_GivenValidMemoryHandleWhenGettingBandwidthThenCallSucceeds) {
|
||||
setLocalSupportedAndReinit(true);
|
||||
auto handles = getMemoryHandles(memoryHandleComponentCount);
|
||||
|
||||
Reference in New Issue
Block a user