refactor: add debug flag to control delay after waiting for paging fence on cpu

Related-To: NEO-8395

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-11-02 14:37:19 +00:00
committed by Compute-Runtime-Automation
parent 9f0ac8a7a3
commit 19586277ca
7 changed files with 68 additions and 2 deletions

View File

@@ -97,6 +97,7 @@ DECLARE_DEBUG_VARIABLE(std::string, OverridePlatformName, std::string("unk"), "O
DECLARE_DEBUG_VARIABLE(std::string, WddmResidencyLoggerOutputDirectory, std::string("unk"), "Selects non-default output directory for Wddm Residency logger file")
DECLARE_DEBUG_VARIABLE(int64_t, OverrideMultiStoragePlacement, -1, "Place memory only in selected tiles indicated by bit mask; ignore when -1")
DECLARE_DEBUG_VARIABLE(int64_t, ForceCompressionDisabledForCompressedBlitCopies, -1, "If compression is required, set AUX_CCS_E, but force CompressionEnable filed; 0 should result in uncompressed read/write; values = -1: default, 0: disabled, 1: enabled")
DECLARE_DEBUG_VARIABLE(int64_t, WddmPagingFenceCpuWaitDelayTime, 0, "Amount of microseconds after waitng for paging fence on CPU")
DECLARE_DEBUG_VARIABLE(int32_t, ForceL1Caching, -1, "Program L1 cache policy for surface state and stateless accesses; values = -1: default, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, ForceAuxTranslationEnabled, -1, "Require AUX translation for kernels; values = -1: default, 0: disabled, 1: enabled")
DECLARE_DEBUG_VARIABLE(int32_t, EnableExperimentalCommandBuffer, 0, "Inject experimental command buffer")

View File

@@ -73,6 +73,7 @@ Wddm::Wddm(std::unique_ptr<HwDeviceIdWddm> &&hwDeviceIdIn, RootDeviceEnvironment
forceCheck = true;
#endif
checkDeviceState = (DebugManager.flags.EnableDeviceStateVerification.get() != -1) ? DebugManager.flags.EnableDeviceStateVerification.get() : forceCheck;
pagingFenceDelayTime = DebugManager.flags.WddmPagingFenceCpuWaitDelayTime.get();
}
Wddm::~Wddm() {
@@ -1264,12 +1265,27 @@ void Wddm::virtualFree(void *ptr, size_t size) {
void Wddm::waitOnPagingFenceFromCpu() {
perfLogStartWaitTime(residencyLogger.get(), currentPagingFenceValue);
while (currentPagingFenceValue > *getPagingFenceAddress())
perfLogResidencyEnteredWait(residencyLogger.get());
if (currentPagingFenceValue > *getPagingFenceAddress()) {
while (currentPagingFenceValue > *getPagingFenceAddress()) {
perfLogResidencyEnteredWait(residencyLogger.get());
}
if (pagingFenceDelayTime > 0) {
delayPagingFenceFromCpu(pagingFenceDelayTime);
}
}
perfLogResidencyWaitPagingeFenceLog(residencyLogger.get(), *getPagingFenceAddress(), false);
}
void Wddm::delayPagingFenceFromCpu(int64_t delayTime) {
int64_t timeDiff = 0u;
auto waitStartTime = std::chrono::high_resolution_clock::now();
while (timeDiff < delayTime) {
auto currentTime = std::chrono::high_resolution_clock::now();
timeDiff = std::chrono::duration_cast<std::chrono::microseconds>(currentTime - waitStartTime).count();
}
}
void Wddm::updatePagingFenceValue(uint64_t newPagingFenceValue) {
NEO::MultiThreadHelpers::interlockedMax(currentPagingFenceValue, newPagingFenceValue);
}

View File

@@ -171,6 +171,7 @@ class Wddm : public DriverModel {
return gmmMemory.get();
}
MOCKABLE_VIRTUAL void waitOnPagingFenceFromCpu();
MOCKABLE_VIRTUAL void delayPagingFenceFromCpu(int64_t delayTime);
void setGmmInputArgs(void *args) override;
@@ -270,6 +271,7 @@ class Wddm : public DriverModel {
RootDeviceEnvironment &rootDeviceEnvironment;
uint64_t *pagingFenceAddress = nullptr;
int64_t pagingFenceDelayTime = 0;
uintptr_t maximumApplicationAddress = 0;
uintptr_t minAddress = 0;