mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 17:00:59 +08:00
fix: earlier stopping of usm reuse cleaner thread
Usm cleaner needs to stop before usm reuse cleanup. Related-To: HSD-18043613805 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f827cda964
commit
f126203df3
@@ -49,9 +49,6 @@ ExecutionEnvironment::~ExecutionEnvironment() {
|
||||
if (directSubmissionController) {
|
||||
directSubmissionController->stopThread();
|
||||
}
|
||||
if (unifiedMemoryReuseCleaner) {
|
||||
unifiedMemoryReuseCleaner->stopThread();
|
||||
}
|
||||
if (memoryManager) {
|
||||
memoryManager->commonCleanup();
|
||||
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
|
||||
@@ -177,6 +174,9 @@ void ExecutionEnvironment::prepareRootDeviceEnvironments(uint32_t numRootDevices
|
||||
}
|
||||
|
||||
void ExecutionEnvironment::prepareForCleanup() const {
|
||||
if (unifiedMemoryReuseCleaner) {
|
||||
unifiedMemoryReuseCleaner->stopThread();
|
||||
}
|
||||
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
|
||||
if (rootDeviceEnvironment) {
|
||||
rootDeviceEnvironment->prepareForCleanup();
|
||||
|
||||
@@ -27,7 +27,7 @@ class UnifiedMemoryReuseCleaner : NEO::NonCopyableAndNonMovableClass {
|
||||
virtual ~UnifiedMemoryReuseCleaner();
|
||||
|
||||
MOCKABLE_VIRTUAL void startThread();
|
||||
void stopThread();
|
||||
MOCKABLE_VIRTUAL void stopThread();
|
||||
|
||||
static bool isSupported();
|
||||
|
||||
|
||||
@@ -22,15 +22,22 @@ struct MockUnifiedMemoryReuseCleaner : public UnifiedMemoryReuseCleaner {
|
||||
UnifiedMemoryReuseCleaner::trimOldInCaches();
|
||||
}
|
||||
}
|
||||
bool trimOldInCachesCalled = false;
|
||||
bool callBaseTrimOldInCaches = true;
|
||||
|
||||
void startThread() override {
|
||||
startThreadCalled = true;
|
||||
if (callBaseStartThread) {
|
||||
UnifiedMemoryReuseCleaner::startThread();
|
||||
}
|
||||
};
|
||||
bool trimOldInCachesCalled = false;
|
||||
bool startThreadCalled = false;
|
||||
bool callBaseStartThread = false;
|
||||
bool callBaseTrimOldInCaches = true;
|
||||
|
||||
void stopThread() override {
|
||||
stopThreadCalled = true;
|
||||
UnifiedMemoryReuseCleaner::stopThread();
|
||||
};
|
||||
bool stopThreadCalled = false;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -314,6 +314,10 @@ TEST(SvmAllocationCacheSimpleTest, givenReuseCleanerWhenInsertingAllocationIntoC
|
||||
EXPECT_TRUE(allocationCache.insert(1u, ptr, &svmAllocData, false));
|
||||
EXPECT_TRUE(reuseCleaner->startThreadCalled);
|
||||
|
||||
EXPECT_FALSE(reuseCleaner->stopThreadCalled);
|
||||
memoryManager.executionEnvironment.prepareForCleanup();
|
||||
EXPECT_TRUE(reuseCleaner->stopThreadCalled);
|
||||
|
||||
allocationCache.allocations.clear();
|
||||
svmAllocsManager.internalAllocationsMap.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user