Print driver diagnostics if aux translation of allocation in SVM allocs manager

Related-To: NEO-5107

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2021-09-12 21:36:27 +00:00
committed by Compute-Runtime-Automation
parent 029fedabab
commit 9d99ee1636
2 changed files with 45 additions and 4 deletions

View File

@ -518,6 +518,43 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF
EXPECT_TRUE(containsHint(expectedHint, userData));
}
TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallFillWithKernelObjsForAuxTranslationOnAllocationInSvmAllocsManagerThenContextProvidesProperHint) {
if (context->getSVMAllocsManager() == nullptr) {
return;
}
DebugManagerStateRestore dbgRestore;
DebugManager.flags.PrintDriverDiagnostics.set(1);
DebugManager.flags.EnableStatelessCompression.set(1);
auto pDevice = castToObject<ClDevice>(devices[0]);
MockKernelWithInternals mockKernel(*pDevice, context);
char data[128];
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
gfxAllocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
mockKernel.mockKernel->initialize();
SvmAllocationData allocData(0);
allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
allocData.device = &pDevice->getDevice();
context->getSVMAllocsManager()->insertSVMAlloc(allocData);
testing::internal::CaptureStdout();
KernelObjsForAuxTranslation kernelObjects;
mockKernel.mockKernel->fillWithKernelObjsForAuxTranslation(kernelObjects);
snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[KERNEL_ALLOCATION_AUX_TRANSLATION],
mockKernel.mockKernel->getKernelInfo().kernelDescriptor.kernelMetadata.kernelName.c_str(), ptr, 128);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_NE(0u, output.size());
EXPECT_TRUE(containsHint(expectedHint, userData));
}
TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenKernelObjectWithGraphicsAllocationAccessedStatefullyOnlyThenDontReportAnyHint) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.PrintDriverDiagnostics.set(1);