mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
Add diagnostic mode to direct submission
Related-To: NEO-4338 Change-Id: Ibcdc1b6a1762827337e4ff5364a972702130195a Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
@@ -53,7 +53,6 @@ set(NEO_CORE_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_residency_logger.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_residency_logger_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/wddm_memory_manager_allocate_in_device_pool.cpp
|
||||
|
||||
@@ -11,11 +11,4 @@ namespace NEO {
|
||||
Wddm *Wddm::createWddm(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
return new Wddm(std::move(hwDeviceId), rootDeviceEnvironment);
|
||||
}
|
||||
|
||||
namespace ResLog {
|
||||
fopenFuncPtr fopenPtr = &fopen;
|
||||
vfprintfFuncPtr vfprintfPtr = &vfprintf;
|
||||
fcloseFuncPtr fclosePtr = &fclose;
|
||||
} // namespace ResLog
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -8,13 +8,19 @@
|
||||
#pragma once
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm_defs.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm_residency_logger_defs.h"
|
||||
#include "shared/source/utilities/io_functions.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <sstream>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
#if defined(_RELEASE_INTERNAL) || (_DEBUG)
|
||||
constexpr bool wddmResidencyLoggingAvailable = true;
|
||||
#else
|
||||
constexpr bool wddmResidencyLoggingAvailable = false;
|
||||
#endif
|
||||
|
||||
class WddmResidencyLogger {
|
||||
public:
|
||||
WddmResidencyLogger(D3DKMT_HANDLE device, VOID *fenceValueCpuVirtualAddress) {
|
||||
@@ -24,17 +30,17 @@ class WddmResidencyLogger {
|
||||
<< "pfencecpu-0x" << fenceValueCpuVirtualAddress;
|
||||
std::stringstream filename;
|
||||
filename << "pagingfence_" << id.str() << ".log";
|
||||
pagingLog = ResLog::fopenPtr(filename.str().c_str(), "at");
|
||||
pagingLog = IoFunctions::fopenPtr(filename.str().c_str(), "at");
|
||||
UNRECOVERABLE_IF(pagingLog == nullptr);
|
||||
fPagingLog("%s\n", id.str().c_str());
|
||||
IoFunctions::fprintf(pagingLog, "%s\n", id.str().c_str());
|
||||
}
|
||||
|
||||
~WddmResidencyLogger() {
|
||||
ResLog::fclosePtr(pagingLog);
|
||||
IoFunctions::fclosePtr(pagingLog);
|
||||
}
|
||||
|
||||
void reportAllocations(uint32_t count, size_t size) {
|
||||
fPagingLog("residency for: handles %u size %zu\n", count, size);
|
||||
IoFunctions::fprintf(pagingLog, "residency for: handles %u size %zu\n", count, size);
|
||||
}
|
||||
|
||||
void makeResidentLog(bool pendingMakeResident, UINT64 makeResidentPagingFence) {
|
||||
@@ -57,19 +63,19 @@ class WddmResidencyLogger {
|
||||
endTime = std::chrono::high_resolution_clock::now();
|
||||
|
||||
int64_t timeDiff = 0;
|
||||
fPagingLog("makeResidentPagingFence: %x startWaitPagingFence: %x stopWaitPagingFence: %lld\n",
|
||||
makeResidentPagingFence,
|
||||
startWaitPagingFence,
|
||||
stopWaitPagingFence);
|
||||
IoFunctions::fprintf(pagingLog, "makeResidentPagingFence: %x startWaitPagingFence: %x stopWaitPagingFence: %lld\n",
|
||||
makeResidentPagingFence,
|
||||
startWaitPagingFence,
|
||||
stopWaitPagingFence);
|
||||
|
||||
timeDiff = std::chrono::duration_cast<std::chrono::microseconds>(endTime - pendingTime).count();
|
||||
fPagingLog("makeResidentCall: %x pending return: %x delta time makeResident: %lld\n",
|
||||
makeResidentCall,
|
||||
pendingMakeResident,
|
||||
timeDiff);
|
||||
IoFunctions::fprintf(pagingLog, "makeResidentCall: %x pending return: %x delta time makeResident: %lld\n",
|
||||
makeResidentCall,
|
||||
pendingMakeResident,
|
||||
timeDiff);
|
||||
|
||||
timeDiff = std::chrono::duration_cast<std::chrono::microseconds>(endTime - waitStartTime).count();
|
||||
fPagingLog("waiting: %x delta time wait loop: %lld\n", enterWait, timeDiff);
|
||||
IoFunctions::fprintf(pagingLog, "waiting: %x delta time wait loop: %lld\n", enterWait, timeDiff);
|
||||
|
||||
makeResidentCall = false;
|
||||
enterWait = false;
|
||||
@@ -78,17 +84,10 @@ class WddmResidencyLogger {
|
||||
}
|
||||
|
||||
void trimRequired(UINT64 numBytesToTrim) {
|
||||
fPagingLog("trimming required: bytes to trim: %llu\n", numBytesToTrim);
|
||||
IoFunctions::fprintf(pagingLog, "trimming required: bytes to trim: %llu\n", numBytesToTrim);
|
||||
}
|
||||
|
||||
protected:
|
||||
void fPagingLog(char const *const formatStr, ...) {
|
||||
va_list args;
|
||||
va_start(args, formatStr);
|
||||
ResLog::vfprintfPtr(pagingLog, formatStr, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
std::chrono::high_resolution_clock::time_point pendingTime;
|
||||
std::chrono::high_resolution_clock::time_point waitStartTime;
|
||||
std::chrono::high_resolution_clock::time_point endTime;
|
||||
@@ -104,7 +103,7 @@ class WddmResidencyLogger {
|
||||
};
|
||||
|
||||
inline void perfLogResidencyMakeResident(WddmResidencyLogger *log, bool pendingMakeResident, UINT64 makeResidentPagingFence) {
|
||||
if (residencyLoggingAvailable) {
|
||||
if (wddmResidencyLoggingAvailable) {
|
||||
if (log) {
|
||||
log->makeResidentLog(pendingMakeResident, makeResidentPagingFence);
|
||||
}
|
||||
@@ -112,7 +111,7 @@ inline void perfLogResidencyMakeResident(WddmResidencyLogger *log, bool pendingM
|
||||
}
|
||||
|
||||
inline void perfLogResidencyReportAllocations(WddmResidencyLogger *log, uint32_t count, size_t size) {
|
||||
if (residencyLoggingAvailable) {
|
||||
if (wddmResidencyLoggingAvailable) {
|
||||
if (log) {
|
||||
log->reportAllocations(count, size);
|
||||
}
|
||||
@@ -120,7 +119,7 @@ inline void perfLogResidencyReportAllocations(WddmResidencyLogger *log, uint32_t
|
||||
}
|
||||
|
||||
inline void perfLogStartWaitTime(WddmResidencyLogger *log, UINT64 startWaitPagingFence) {
|
||||
if (residencyLoggingAvailable) {
|
||||
if (wddmResidencyLoggingAvailable) {
|
||||
if (log) {
|
||||
log->startWaitTime(startWaitPagingFence);
|
||||
}
|
||||
@@ -128,7 +127,7 @@ inline void perfLogStartWaitTime(WddmResidencyLogger *log, UINT64 startWaitPagin
|
||||
}
|
||||
|
||||
inline void perfLogResidencyEnteredWait(WddmResidencyLogger *log) {
|
||||
if (residencyLoggingAvailable) {
|
||||
if (wddmResidencyLoggingAvailable) {
|
||||
if (log) {
|
||||
log->enteredWait();
|
||||
}
|
||||
@@ -136,7 +135,7 @@ inline void perfLogResidencyEnteredWait(WddmResidencyLogger *log) {
|
||||
}
|
||||
|
||||
inline void perfLogResidencyWaitPagingeFenceLog(WddmResidencyLogger *log, UINT64 stopWaitPagingFence) {
|
||||
if (residencyLoggingAvailable) {
|
||||
if (wddmResidencyLoggingAvailable) {
|
||||
if (log) {
|
||||
log->waitPagingeFenceLog(stopWaitPagingFence);
|
||||
}
|
||||
@@ -144,7 +143,7 @@ inline void perfLogResidencyWaitPagingeFenceLog(WddmResidencyLogger *log, UINT64
|
||||
}
|
||||
|
||||
inline void perfLogResidencyTrimRequired(WddmResidencyLogger *log, UINT64 numBytesToTrim) {
|
||||
if (residencyLoggingAvailable) {
|
||||
if (wddmResidencyLoggingAvailable) {
|
||||
if (log) {
|
||||
log->trimRequired(numBytesToTrim);
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
|
||||
namespace NEO {
|
||||
namespace ResLog {
|
||||
using fopenFuncPtr = FILE *(*)(const char *, const char *);
|
||||
using vfprintfFuncPtr = int (*)(FILE *, char const *const formatStr, va_list arg);
|
||||
using fcloseFuncPtr = int (*)(FILE *);
|
||||
|
||||
extern fopenFuncPtr fopenPtr;
|
||||
extern vfprintfFuncPtr vfprintfPtr;
|
||||
extern fcloseFuncPtr fclosePtr;
|
||||
} // namespace ResLog
|
||||
|
||||
#if defined(_RELEASE_INTERNAL) || (_DEBUG)
|
||||
constexpr bool residencyLoggingAvailable = true;
|
||||
#else
|
||||
constexpr bool residencyLoggingAvailable = false;
|
||||
#endif
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user