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) {
|
if (directSubmissionController) {
|
||||||
directSubmissionController->stopThread();
|
directSubmissionController->stopThread();
|
||||||
}
|
}
|
||||||
if (unifiedMemoryReuseCleaner) {
|
|
||||||
unifiedMemoryReuseCleaner->stopThread();
|
|
||||||
}
|
|
||||||
if (memoryManager) {
|
if (memoryManager) {
|
||||||
memoryManager->commonCleanup();
|
memoryManager->commonCleanup();
|
||||||
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
|
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
|
||||||
@@ -177,6 +174,9 @@ void ExecutionEnvironment::prepareRootDeviceEnvironments(uint32_t numRootDevices
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionEnvironment::prepareForCleanup() const {
|
void ExecutionEnvironment::prepareForCleanup() const {
|
||||||
|
if (unifiedMemoryReuseCleaner) {
|
||||||
|
unifiedMemoryReuseCleaner->stopThread();
|
||||||
|
}
|
||||||
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
|
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
|
||||||
if (rootDeviceEnvironment) {
|
if (rootDeviceEnvironment) {
|
||||||
rootDeviceEnvironment->prepareForCleanup();
|
rootDeviceEnvironment->prepareForCleanup();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class UnifiedMemoryReuseCleaner : NEO::NonCopyableAndNonMovableClass {
|
|||||||
virtual ~UnifiedMemoryReuseCleaner();
|
virtual ~UnifiedMemoryReuseCleaner();
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL void startThread();
|
MOCKABLE_VIRTUAL void startThread();
|
||||||
void stopThread();
|
MOCKABLE_VIRTUAL void stopThread();
|
||||||
|
|
||||||
static bool isSupported();
|
static bool isSupported();
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,22 @@ struct MockUnifiedMemoryReuseCleaner : public UnifiedMemoryReuseCleaner {
|
|||||||
UnifiedMemoryReuseCleaner::trimOldInCaches();
|
UnifiedMemoryReuseCleaner::trimOldInCaches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool trimOldInCachesCalled = false;
|
||||||
|
bool callBaseTrimOldInCaches = true;
|
||||||
|
|
||||||
void startThread() override {
|
void startThread() override {
|
||||||
startThreadCalled = true;
|
startThreadCalled = true;
|
||||||
if (callBaseStartThread) {
|
if (callBaseStartThread) {
|
||||||
UnifiedMemoryReuseCleaner::startThread();
|
UnifiedMemoryReuseCleaner::startThread();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
bool trimOldInCachesCalled = false;
|
|
||||||
bool startThreadCalled = false;
|
bool startThreadCalled = false;
|
||||||
bool callBaseStartThread = false;
|
bool callBaseStartThread = false;
|
||||||
bool callBaseTrimOldInCaches = true;
|
|
||||||
|
void stopThread() override {
|
||||||
|
stopThreadCalled = true;
|
||||||
|
UnifiedMemoryReuseCleaner::stopThread();
|
||||||
|
};
|
||||||
|
bool stopThreadCalled = false;
|
||||||
};
|
};
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
@@ -314,6 +314,10 @@ TEST(SvmAllocationCacheSimpleTest, givenReuseCleanerWhenInsertingAllocationIntoC
|
|||||||
EXPECT_TRUE(allocationCache.insert(1u, ptr, &svmAllocData, false));
|
EXPECT_TRUE(allocationCache.insert(1u, ptr, &svmAllocData, false));
|
||||||
EXPECT_TRUE(reuseCleaner->startThreadCalled);
|
EXPECT_TRUE(reuseCleaner->startThreadCalled);
|
||||||
|
|
||||||
|
EXPECT_FALSE(reuseCleaner->stopThreadCalled);
|
||||||
|
memoryManager.executionEnvironment.prepareForCleanup();
|
||||||
|
EXPECT_TRUE(reuseCleaner->stopThreadCalled);
|
||||||
|
|
||||||
allocationCache.allocations.clear();
|
allocationCache.allocations.clear();
|
||||||
svmAllocsManager.internalAllocationsMap.clear();
|
svmAllocsManager.internalAllocationsMap.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user