Debug flag to print completion fence usage.

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz 2022-10-11 12:36:19 +00:00 committed by Compute-Runtime-Automation
parent 31f97717db
commit eb79500c60
5 changed files with 33 additions and 1 deletions

View File

@ -259,6 +259,7 @@ DECLARE_DEBUG_VARIABLE(bool, PrintIoctlTimes, false, "Print ioctl times")
DECLARE_DEBUG_VARIABLE(bool, PrintIoctlEntries, false, "Print ioctl being called")
DECLARE_DEBUG_VARIABLE(bool, PrintUmdSharedMigration, false, "Print log message when shared allocation is being migrated by UMD")
DECLARE_DEBUG_VARIABLE(bool, PrintImageBlitBlockCopyCmdDetails, false, "Prints XY_BLOCK_COPY_BLT command details")
DECLARE_DEBUG_VARIABLE(bool, PrintCompletionFenceUsage, false, "Prints all usages of DRM completion fences")
DECLARE_DEBUG_VARIABLE(bool, LogGdiCalls, false, "Log GDI calls")
DECLARE_DEBUG_VARIABLE(bool, LogGdiCallsToFile, false, "Log GDI calls to file")

View File

@ -55,6 +55,13 @@ DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(const DirectSubm
if (drm.completionFenceSupport()) {
this->completionFenceSupported = true;
}
if (DebugManager.flags.PrintCompletionFenceUsage.get()) {
std::cout << "Completion fence for DirectSubmission:"
<< " GPU address: " << std::hex << (this->completionFenceAllocation->getGpuAddress() + Drm::completionFenceOffset)
<< ", CPU address: " << (castToUint64(this->completionFenceAllocation->getUnderlyingBuffer()) + Drm::completionFenceOffset)
<< std::dec << std::endl;
}
}
}
}

View File

@ -1055,6 +1055,9 @@ bool Drm::completionFenceSupport() {
}
completionFenceSupported = support;
if (DebugManager.flags.PrintCompletionFenceUsage.get()) {
std::cout << "Completion fence supported: " << completionFenceSupported << std::endl;
}
});
return completionFenceSupported;
}
@ -1581,7 +1584,20 @@ void Drm::waitOnUserFences(const OsContextLinux &osContext, uint64_t address, ui
if (*reinterpret_cast<uint32_t *>(completionFenceCpuAddress) < value) {
constexpr int64_t timeout = -1;
constexpr uint16_t flags = 0;
waitUserFence(drmContextIds[drmIterator], completionFenceCpuAddress, value, Drm::ValueWidth::U32, timeout, flags);
int retVal = waitUserFence(drmContextIds[drmIterator], completionFenceCpuAddress, value, Drm::ValueWidth::U32, timeout, flags);
if (DebugManager.flags.PrintCompletionFenceUsage.get()) {
std::cout << "Completion fence waited."
<< " Status: " << retVal
<< ", CPU address: " << std::hex << completionFenceCpuAddress << std::dec
<< ", current value: " << *reinterpret_cast<uint32_t *>(completionFenceCpuAddress)
<< ", wait value: " << value << std::endl;
}
} else if (DebugManager.flags.PrintCompletionFenceUsage.get()) {
std::cout << "Completion fence already completed."
<< " CPU address: " << std::hex << completionFenceCpuAddress << std::dec
<< ", current value: " << *reinterpret_cast<uint32_t *>(completionFenceCpuAddress)
<< ", wait value: " << value << std::endl;
}
completionFenceCpuAddress = ptrOffset(completionFenceCpuAddress, postSyncOffset);
}

View File

@ -19,6 +19,7 @@
#include <algorithm>
#include <cerrno>
#include <cstring>
#include <iostream>
#include <new>
#include <sys/ioctl.h>
@ -248,6 +249,12 @@ int IoctlHelperPrelim20::execBuffer(ExecBuffer *execBuffer, uint64_t completionG
drmExecBuffer.flags |= I915_EXEC_USE_EXTENSIONS;
drmExecBuffer.num_cliprects = 0;
drmExecBuffer.cliprects_ptr = castToUint64(&fenceObject);
if (DebugManager.flags.PrintCompletionFenceUsage.get()) {
std::cout << "Completion fence submitted."
<< " GPU address: " << std::hex << completionGpuAddress << std::dec
<< ", value: " << counterValue << std::endl;
}
}
return IoctlHelper::ioctl(DrmIoctl::GemExecbuffer2, execBuffer);

View File

@ -467,4 +467,5 @@ ExperimentalCopyThroughLock = -1
ExperimentalH2DCpuCopyThreshold = -1
ExperimentalD2HCpuCopyThreshold = -1
CopyHostPtrOnCpu = -1
PrintCompletionFenceUsage = 0
SetAmountOfReusableAllocations = -1