Avoid cmpexchg due to CPU Hardware limitation

Limit the amount of times compare_exchange_weak is called,
to avoid issues with contention when multiple cpu cores request
the same address.

Related-To: NEO-7030

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2022-08-09 13:34:45 +00:00
committed by Compute-Runtime-Automation
parent f77f47099c
commit 30fe24aa79
12 changed files with 114 additions and 66 deletions

View File

@@ -7,7 +7,7 @@
#pragma once
#include "shared/source/helpers/interlocked_max.h"
#include "shared/source/helpers/mt_helpers.h"
#include "shared/source/os_interface/os_context.h"
#include <atomic>
@@ -33,7 +33,7 @@ class OsContextLinux : public OsContext {
uint32_t peekTlbFlushCounter() const { return tlbFlushCounter.load(); }
void setTlbFlushed(uint32_t newCounter) {
interlockedMax(lastFlushedTlbFlushCounter, newCounter);
NEO::MultiThreadHelpers::interlockedMax(lastFlushedTlbFlushCounter, newCounter);
};
bool isTlbFlushRequired() const {
return (tlbFlushCounter.load() > lastFlushedTlbFlushCounter.load());

View File

@@ -18,7 +18,7 @@
#include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/heap_assigner.h"
#include "shared/source/helpers/interlocked_max.h"
#include "shared/source/helpers/mt_helpers.h"
#include "shared/source/helpers/string.h"
#include "shared/source/helpers/windows/gmm_callbacks.h"
#include "shared/source/os_interface/hw_info_config.h"
@@ -1171,7 +1171,7 @@ void Wddm::waitOnPagingFenceFromCpu() {
}
void Wddm::updatePagingFenceValue(uint64_t newPagingFenceValue) {
interlockedMax(currentPagingFenceValue, newPagingFenceValue);
NEO::MultiThreadHelpers::interlockedMax(currentPagingFenceValue, newPagingFenceValue);
}
WddmVersion Wddm::getWddmVersion() {