mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
feature: add debug flag to wait for release memory
Related-To: NEO-6766 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9ed942e552
commit
03d9a20559
@@ -81,6 +81,7 @@ DECLARE_DEBUG_VARIABLE(bool, DontDisableZebinIfVmeUsed, false, "When enabled, dr
|
||||
DECLARE_DEBUG_VARIABLE(bool, AppendMemoryPrefetchForKmdMigratedSharedAllocations, true, "Allow prefetching shared memory to the device associated with the specified command list")
|
||||
DECLARE_DEBUG_VARIABLE(bool, ForceMemoryPrefetchForKmdMigratedSharedAllocations, false, "Force prefetch of shared memory in command queue execute command lists")
|
||||
DECLARE_DEBUG_VARIABLE(bool, ClKhrExternalMemoryExtension, false, "Enable cl_khr_external_memory extension")
|
||||
DECLARE_DEBUG_VARIABLE(bool, WaitForMemoryRelease, false, "Wait for memory release when out of memory")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "Override device id in AUB/TBX mode")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, FilterDeviceId, std::string("unk"), "Device id filter, adapter matching device id will be opened; ignored when unk")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, FilterBdfPath, std::string("unk"), "Linux-only, BDF path filter, only matching paths will be opened; ignored when unk")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -235,7 +235,9 @@ bool WddmResidencyController::makeResidentResidencyAllocations(const ResidencyCo
|
||||
continue;
|
||||
}
|
||||
DEBUG_BREAK_IF(evictionStatus != MemoryOperationsStatus::MEMORY_NOT_FOUND);
|
||||
result = wddm.makeResident(&handlesForResidency[0], totalHandlesCount, true, &bytesToTrim, totalSize);
|
||||
do {
|
||||
result = wddm.makeResident(&handlesForResidency[0], totalHandlesCount, true, &bytesToTrim, totalSize);
|
||||
} while (DebugManager.flags.WaitForMemoryRelease.get() && result == false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,6 +441,7 @@ ForceRunAloneContext = -1
|
||||
AppendMemoryPrefetchForKmdMigratedSharedAllocations = 1
|
||||
ForceMemoryPrefetchForKmdMigratedSharedAllocations = 0
|
||||
ClKhrExternalMemoryExtension = 0
|
||||
WaitForMemoryRelease = 0
|
||||
KMDSupportForCrossTileMigrationPolicy = -1
|
||||
CreateContextWithAccessCounters = -1
|
||||
AccessCountersTrigger = -1
|
||||
|
||||
@@ -1135,3 +1135,54 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin
|
||||
EXPECT_TRUE(residencyController->isMemoryBudgetExhausted());
|
||||
EXPECT_EQ(2u, wddm->makeResidentResult.called);
|
||||
}
|
||||
|
||||
struct WddmMakeResidentMock : public WddmMock {
|
||||
WddmMakeResidentMock::WddmMakeResidentMock(RootDeviceEnvironment &rootDeviceEnvironment) : WddmMock(rootDeviceEnvironment){};
|
||||
|
||||
bool makeResident(const D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim, size_t totalSize) override {
|
||||
*numberOfBytesToTrim = makeResidentNumberOfBytesToTrim;
|
||||
makeResidentResult.called++;
|
||||
|
||||
if (makeResidentResult.called > 2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct WddmResidencyControllerWithMockWddmMakeResidentTest : public WddmResidencyControllerWithMockWddmTest {
|
||||
void SetUp() override {
|
||||
wddm = new WddmMakeResidentMock(*executionEnvironment.rootDeviceEnvironments[0].get());
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo);
|
||||
wddm->init();
|
||||
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(executionEnvironment);
|
||||
|
||||
csr.reset(createCommandStream(executionEnvironment, 0u, 1));
|
||||
auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
|
||||
osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor(gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment.rootDeviceEnvironments[0])[0],
|
||||
preemptionMode));
|
||||
|
||||
osContext->incRefInternal();
|
||||
residencyController = &static_cast<OsContextWin *>(osContext)->getResidencyController();
|
||||
gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(WddmResidencyControllerWithMockWddmMakeResidentTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenCallItAgainWithWaitForMemoryReleaseSetToTrue) {
|
||||
DebugManagerStateRestore restorer{};
|
||||
DebugManager.flags.WaitForMemoryRelease.set(1);
|
||||
|
||||
wddm->makeResidentNumberOfBytesToTrim = 4 * 4096;
|
||||
|
||||
MockWddmAllocation allocation1(gmmHelper);
|
||||
ResidencyContainer residencyPack{&allocation1};
|
||||
|
||||
bool result = residencyController->makeResidentResidencyAllocations(residencyPack);
|
||||
|
||||
EXPECT_TRUE(result);
|
||||
EXPECT_EQ(3u, wddm->makeResidentResult.called);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user