fix: add debug key to provide alternative directory for wddm residency logs

Related-To: NEO-8211

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-08-31 03:45:38 +00:00
committed by Compute-Runtime-Automation
parent b77b0e487d
commit cb641226b5
6 changed files with 96 additions and 51 deletions

View File

@@ -93,6 +93,7 @@ DECLARE_DEBUG_VARIABLE(std::string, InjectInternalBuildOptions, std::string("unk
DECLARE_DEBUG_VARIABLE(std::string, InjectApiBuildOptions, std::string("unk"), "Append provided string to api build options for user modules; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, OverrideDeviceName, std::string("unk"), "Override device name to provided string; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, OverridePlatformName, std::string("unk"), "Override platform name to provided string; ignored when unk")
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(int32_t, ForceL1Caching, -1, "Program L1 cache policy for surface state and stateless accesses; values = -1: default, 0: disable, 1: enable")

View File

@@ -1236,7 +1236,7 @@ uint32_t Wddm::getRequestedEUCount() const {
void Wddm::createPagingFenceLogger() {
if (DebugManager.flags.WddmResidencyLogger.get()) {
residencyLogger = std::make_unique<WddmResidencyLogger>(device, pagingFenceAddress);
residencyLogger = std::make_unique<WddmResidencyLogger>(device, pagingFenceAddress, DebugManager.flags.WddmResidencyLoggerOutputDirectory.get());
}
}

View File

@@ -11,6 +11,7 @@
#include "shared/source/utilities/io_functions.h"
#include <chrono>
#include <cstring>
#include <sstream>
namespace NEO {
@@ -23,13 +24,23 @@ constexpr bool wddmResidencyLoggingAvailable = false;
class WddmResidencyLogger {
public:
WddmResidencyLogger(unsigned int device, void *fenceValueCpuVirtualAddress) {
WddmResidencyLogger(unsigned int device, void *fenceValueCpuVirtualAddress, std::string outDirectory) {
const char *wddmResidencyLoggerDefaultDirectory = "unk";
std::stringstream id;
id << std::hex;
id << "device-0x" << device << "_"
<< "pfencecpu-0x" << fenceValueCpuVirtualAddress;
std::stringstream filename;
if (std::strcmp(wddmResidencyLoggerDefaultDirectory, outDirectory.c_str()) != 0) {
filename << outDirectory;
if (outDirectory.back() != '\\') {
filename << "\\";
}
}
filename << "pagingfence_" << id.str() << ".log";
pagingLog = IoFunctions::fopenPtr(filename.str().c_str(), "at");
UNRECOVERABLE_IF(pagingLog == nullptr);
IoFunctions::fprintf(pagingLog, "%s\n", id.str().c_str());