AUB subcapture in filter mode to define start/end indexes to a given kernel

This commit introduces new controls to define start/end indexes
that apply only to the kernel specified by name for a sub-capture

Change-Id: I7ad7674d115f9addd35c44d824aee0731060881e
This commit is contained in:
Milczarek, Slawomir
2018-07-26 11:35:13 +02:00
parent ce8284bade
commit a7d41d95b4
6 changed files with 81 additions and 12 deletions

View File

@@ -53,6 +53,8 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
this->subCaptureManager->subCaptureMode = static_cast<AubSubCaptureManager::SubCaptureMode>(DebugManager.flags.AUBDumpSubCaptureMode.get());
this->subCaptureManager->subCaptureFilter.dumpKernelStartIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterKernelStartIdx.get());
this->subCaptureManager->subCaptureFilter.dumpKernelEndIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterKernelEndIdx.get());
this->subCaptureManager->subCaptureFilter.dumpNamedKernelStartIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterNamedKernelStartIdx.get());
this->subCaptureManager->subCaptureFilter.dumpNamedKernelEndIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterNamedKernelEndIdx.get());
if (DebugManager.flags.AUBDumpFilterKernelName.get() != "unk") {
this->subCaptureManager->subCaptureFilter.dumpKernelName = DebugManager.flags.AUBDumpFilterKernelName.get();
}

View File

@@ -47,7 +47,7 @@ bool AubSubCaptureManager::activateSubCapture(const MultiDispatchInfo &dispatchI
subCaptureIsActive = isSubCaptureToggleActive();
break;
case SubCaptureMode::Filter:
subCaptureIsActive = isSubCaptureFilterActive(dispatchInfo, kernelCurrentIdx);
subCaptureIsActive = isSubCaptureFilterActive(dispatchInfo);
break;
default:
DEBUG_BREAK_IF(false);
@@ -85,9 +85,8 @@ const std::string &AubSubCaptureManager::getSubCaptureFileName(const MultiDispat
return currentFileName;
}
bool AubSubCaptureManager::isKernelIndexInSubCaptureRange(uint32_t kernelIdx) const {
return ((subCaptureFilter.dumpKernelStartIdx <= kernelIdx) &&
(kernelIdx <= subCaptureFilter.dumpKernelEndIdx));
bool AubSubCaptureManager::isKernelIndexInSubCaptureRange(uint32_t kernelIdx, uint32_t rangeStartIdx, uint32_t rangeEndIdx) const {
return ((rangeStartIdx <= kernelIdx) && (kernelIdx <= rangeEndIdx));
}
bool AubSubCaptureManager::isSubCaptureToggleActive() const {
@@ -105,6 +104,8 @@ std::string AubSubCaptureManager::generateFilterFileName() const {
filterFileName += "_to_" + std::to_string(subCaptureFilter.dumpKernelEndIdx);
if (!subCaptureFilter.dumpKernelName.empty()) {
filterFileName += "_" + subCaptureFilter.dumpKernelName;
filterFileName += "_from_" + std::to_string(subCaptureFilter.dumpNamedKernelStartIdx);
filterFileName += "_to_" + std::to_string(subCaptureFilter.dumpNamedKernelEndIdx);
}
filterFileName += ".aub";
return filterFileName;
@@ -121,18 +122,20 @@ std::string AubSubCaptureManager::generateToggleFileName(const MultiDispatchInfo
return toggleFileName;
}
bool AubSubCaptureManager::isSubCaptureFilterActive(const MultiDispatchInfo &dispatchInfo, uint32_t kernelIdx) const {
DEBUG_BREAK_IF(dispatchInfo.size() > 1);
bool AubSubCaptureManager::isSubCaptureFilterActive(const MultiDispatchInfo &dispatchInfo) {
auto kernelName = dispatchInfo.peekMainKernel()->getKernelInfo().name;
auto subCaptureIsActive = false;
if (isKernelIndexInSubCaptureRange(kernelIdx)) {
if (subCaptureFilter.dumpKernelName.empty()) {
if (subCaptureFilter.dumpKernelName.empty()) {
if (isKernelIndexInSubCaptureRange(kernelCurrentIdx, subCaptureFilter.dumpKernelStartIdx, subCaptureFilter.dumpKernelEndIdx)) {
subCaptureIsActive = true;
} else {
if (0 == kernelName.compare(subCaptureFilter.dumpKernelName)) {
}
} else {
if (0 == kernelName.compare(subCaptureFilter.dumpKernelName)) {
if (isKernelIndexInSubCaptureRange(kernelNameMatchesNum, subCaptureFilter.dumpNamedKernelStartIdx, subCaptureFilter.dumpNamedKernelEndIdx)) {
subCaptureIsActive = true;
}
kernelNameMatchesNum++;
}
}
return subCaptureIsActive;

View File

@@ -38,6 +38,8 @@ class AubSubCaptureManager {
struct SubCaptureFilter {
std::string dumpKernelName = "";
uint32_t dumpNamedKernelStartIdx = 0;
uint32_t dumpNamedKernelEndIdx = static_cast<uint32_t>(-1);
uint32_t dumpKernelStartIdx = 0;
uint32_t dumpKernelEndIdx = static_cast<uint32_t>(-1);
} subCaptureFilter;
@@ -62,16 +64,17 @@ class AubSubCaptureManager {
protected:
MOCKABLE_VIRTUAL bool isSubCaptureToggleActive() const;
bool isSubCaptureFilterActive(const MultiDispatchInfo &dispatchInfo, uint32_t kernelIdx) const;
bool isSubCaptureFilterActive(const MultiDispatchInfo &dispatchInfo);
MOCKABLE_VIRTUAL std::string getExternalFileName() const;
MOCKABLE_VIRTUAL std::string generateFilterFileName() const;
MOCKABLE_VIRTUAL std::string generateToggleFileName(const MultiDispatchInfo &dispatchInfo) const;
bool isKernelIndexInSubCaptureRange(uint32_t kernelIdx) const;
bool isKernelIndexInSubCaptureRange(uint32_t kernelIdx, uint32_t rangeStartIdx, uint32_t rangeEndIdx) const;
void setDebugManagerFlags() const;
bool subCaptureIsActive = false;
bool subCaptureWasActive = false;
uint32_t kernelCurrentIdx = 0;
uint32_t kernelNameMatchesNum = 0;
bool useExternalFileName = true;
std::string initialFileName;
std::string currentFileName;

View File

@@ -25,6 +25,8 @@ DECLARE_DEBUG_VARIABLE(std::string, ProductFamilyOverride, std::string("unk"), "
DECLARE_DEBUG_VARIABLE(std::string, ForceCompilerUsePlatform, std::string("unk"), "Specify product for use in compiler interface")
DECLARE_DEBUG_VARIABLE(std::string, AUBDumpCaptureFileName, std::string("unk"), "Name of file to save AUB capture into")
DECLARE_DEBUG_VARIABLE(std::string, AUBDumpFilterKernelName, std::string("unk"), "Name of kernel to AUB capture")
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterNamedKernelStartIdx, 0, "Start index of named kernel to AUB capture")
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterNamedKernelEndIdx, -1, "End index of named kernel to AUB capture")
DECLARE_DEBUG_VARIABLE(std::string, AUBDumpToggleFileName, std::string("unk"), "Name of file to save AUB in toggle mode")
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpSubCaptureMode, 0, "AUB dump subcapture mode (off, toggle, filter)")
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterKernelStartIdx, 0, "Start index of kernel to AUB capture")