Debugger L0 Win: Implement CREATE_DEBUG_DATA/MODULE_CREATE events handling

Related-To: NEO-6723

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2022-07-05 13:40:15 +00:00
committed by Compute-Runtime-Automation
parent 20d0541e57
commit 547dd59272
22 changed files with 508 additions and 170 deletions

View File

@ -601,6 +601,7 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
if (device->getL0Debugger()) {
auto allocs = getModuleAllocations();
device->getL0Debugger()->notifyModuleLoadAllocations(allocs);
notifyModuleCreate();
}
}
return success;
@ -1181,7 +1182,9 @@ ze_result_t ModuleImp::destroy() {
return ZE_RESULT_SUCCESS;
}
void ModuleImp::registerElfInDebuggerL0() {
if (device->getL0Debugger() == nullptr) {
auto debuggerL0 = device->getL0Debugger();
if (!debuggerL0) {
return;
}
@ -1196,7 +1199,7 @@ void ModuleImp::registerElfInDebuggerL0() {
StackVec<NEO::GraphicsAllocation *, 32> segmentAllocs;
for (auto &kernImmData : kernelImmDatas) {
device->getL0Debugger()->registerElf(&debugData, kernImmData->getIsaGraphicsAllocation());
debuggerL0->registerElf(&debugData, kernImmData->getIsaGraphicsAllocation());
segmentAllocs.push_back(kernImmData->getIsaGraphicsAllocation());
}
@ -1207,7 +1210,7 @@ void ModuleImp::registerElfInDebuggerL0() {
segmentAllocs.push_back(translationUnit->globalConstBuffer);
}
device->getL0Debugger()->attachZebinModuleToSegmentAllocations(segmentAllocs, debugModuleHandle);
debuggerL0->attachZebinModuleToSegmentAllocations(segmentAllocs, debugModuleHandle);
} else {
for (auto &kernImmData : kernelImmDatas) {
if (kernImmData->getKernelInfo()->kernelDescriptor.external.debugData.get()) {
@ -1221,7 +1224,48 @@ void ModuleImp::registerElfInDebuggerL0() {
relocatedDebugData.vIsaSize = kernImmData->getKernelInfo()->kernelDescriptor.external.debugData->vIsaSize;
notifyDebugData = &relocatedDebugData;
}
device->getL0Debugger()->registerElf(notifyDebugData, kernImmData->getIsaGraphicsAllocation());
debuggerL0->registerElf(notifyDebugData, kernImmData->getIsaGraphicsAllocation());
}
}
}
}
void ModuleImp::notifyModuleCreate() {
auto debuggerL0 = device->getL0Debugger();
if (!debuggerL0) {
return;
}
auto refBin = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(translationUnit->unpackedDeviceBinary.get()), translationUnit->unpackedDeviceBinarySize);
if (NEO::isDeviceBinaryFormat<NEO::DeviceBinaryFormat::Zebin>(refBin)) {
size_t debugDataSize = 0;
getDebugInfo(&debugDataSize, nullptr);
NEO::DebugData debugData; // pass debug zebin in vIsa field
debugData.vIsa = reinterpret_cast<const char *>(translationUnit->debugData.get());
debugData.vIsaSize = static_cast<uint32_t>(translationUnit->debugDataSize);
StackVec<NEO::GraphicsAllocation *, 32> segmentAllocs = getModuleAllocations();
auto minAddressGpuAlloc = std::min_element(segmentAllocs.begin(), segmentAllocs.end(), [](const auto alloc1, const auto alloc2) { return alloc1->getGpuAddress() < alloc2->getGpuAddress(); });
debuggerL0->notifyModuleCreate(const_cast<char *>(debugData.vIsa), debugData.vIsaSize, (*minAddressGpuAlloc)->getGpuAddress());
} else {
for (auto &kernImmData : kernelImmDatas) {
if (kernImmData->getKernelInfo()->kernelDescriptor.external.debugData.get()) {
NEO::DebugData *notifyDebugData = kernImmData->getKernelInfo()->kernelDescriptor.external.debugData.get();
NEO::DebugData relocatedDebugData;
if (kernImmData->getKernelInfo()->kernelDescriptor.external.relocatedDebugData.get()) {
relocatedDebugData.genIsa = kernImmData->getKernelInfo()->kernelDescriptor.external.debugData->genIsa;
relocatedDebugData.genIsaSize = kernImmData->getKernelInfo()->kernelDescriptor.external.debugData->genIsaSize;
relocatedDebugData.vIsa = reinterpret_cast<char *>(kernImmData->getKernelInfo()->kernelDescriptor.external.relocatedDebugData.get());
relocatedDebugData.vIsaSize = kernImmData->getKernelInfo()->kernelDescriptor.external.debugData->vIsaSize;
notifyDebugData = &relocatedDebugData;
}
debuggerL0->notifyModuleCreate(const_cast<char *>(notifyDebugData->vIsa), notifyDebugData->vIsaSize, kernImmData->getIsaGraphicsAllocation()->getGpuAddress());
}
}
}

View File

@ -141,6 +141,7 @@ struct ModuleImp : public Module {
void passDebugData();
void createDebugZebin();
void registerElfInDebuggerL0();
void notifyModuleCreate();
bool populateHostGlobalSymbolsMap(std::unordered_map<std::string, std::string> &devToHostNameMapping);
StackVec<NEO::GraphicsAllocation *, 32> getModuleAllocations();

View File

@ -419,7 +419,7 @@ TEST_F(KernelInitializeTest, givenDebuggingEnabledWhenKernelsAreInitializedThenA
EXPECT_NE(0, memcmp(isa, &kernelHeap, sizeof(kernelHeap)));
};
HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithRelocationsWhenInitializingModuleThenRegisterElfWithRelocatedElf) {
HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithRelocationsWhenInitializingModuleThenRegisterElfWithRelocatedElfAndModuleCreateNotified) {
NEO::MockCompilerEnableGuard mock(true);
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
@ -458,12 +458,13 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithRelocationsWhenInitializing
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice));
EXPECT_EQ(1u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_EQ(1u, getMockDebuggerL0Hw<FamilyType>()->notifyModuleCreateCount);
EXPECT_NE(nullptr, kernelInfo->kernelDescriptor.external.relocatedDebugData.get());
EXPECT_EQ(reinterpret_cast<char *>(kernelInfo->kernelDescriptor.external.relocatedDebugData.get()), getMockDebuggerL0Hw<FamilyType>()->lastReceivedElf);
}
HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithoutRelocationsWhenInitializingModuleThenRegisterElfWithUnrelocatedElf) {
HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithoutRelocationsWhenInitializingModuleThenRegisterElfWithUnrelocatedElfAndModuleCreateNotified) {
NEO::MockCompilerEnableGuard mock(true);
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
@ -508,12 +509,13 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithoutRelocationsWhenInitializ
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice));
EXPECT_EQ(1u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_EQ(1u, getMockDebuggerL0Hw<FamilyType>()->notifyModuleCreateCount);
EXPECT_EQ(nullptr, kernelInfo->kernelDescriptor.external.relocatedDebugData.get());
EXPECT_EQ(kernelInfo->kernelDescriptor.external.debugData->vIsa, getMockDebuggerL0Hw<FamilyType>()->lastReceivedElf);
}
HWTEST_F(ModuleWithDebuggerL0Test, GivenNoDebugDataWhenInitializingModuleThenDoNotRegisterElf) {
HWTEST_F(ModuleWithDebuggerL0Test, GivenNoDebugDataWhenInitializingModuleThenDoNotRegisterElfAndDoNotNotifyModuleCreate) {
NEO::MockCompilerEnableGuard mock(true);
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
@ -544,11 +546,12 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenNoDebugDataWhenInitializingModuleThenDoN
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice));
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->notifyModuleCreateCount);
}
using ModuleWithZebinAndL0DebuggerTest = Test<L0DebuggerHwFixture>;
HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinDebugDataWhenInitializingModuleThenRegisterElf) {
HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinDebugDataWhenInitializingModuleThenRegisterElfAndNotifyModuleCreate) {
NEO::MockCompilerEnableGuard mock(true);
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
@ -583,9 +586,10 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinDebugDataWhenInitializingMo
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice));
EXPECT_EQ(2u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_EQ(1u, getMockDebuggerL0Hw<FamilyType>()->notifyModuleCreateCount);
}
HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinNoDebugDataWhenInitializingModuleThenDoNotRegisterElf) {
HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinNoDebugDataWhenInitializingModuleThenDoNotRegisterElfAndDoNotNotifyModuleCreate) {
NEO::MockCompilerEnableGuard mock(true);
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
@ -602,6 +606,7 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinNoDebugDataWhenInitializing
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice));
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->registerElfCount);
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->notifyModuleCreateCount);
}
HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinWhenModuleIsInitializedAndDestroyedThenModuleHandleIsAttachedAndRemoved) {

View File

@ -14,6 +14,7 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/windows/mock_gdi_interface.h"
#include "shared/test/common/mocks/windows/mock_wddm_eudebug.h"
#include "shared/test/common/os_interface/windows/mock_wddm_memory_manager.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/device/device.h"
@ -31,7 +32,7 @@ namespace ult {
struct L0DebuggerWindowsFixture {
void SetUp() {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment = new NEO::ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingEnabled();
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
@ -40,10 +41,15 @@ struct L0DebuggerWindowsFixture {
osEnvironment->gdi.reset(gdi);
executionEnvironment->osEnvironment.reset(osEnvironment);
wddm = new WddmEuDebugInterfaceMock(*rootDeviceEnvironment);
wddm->callBaseDestroyAllocations = false;
wddm->callBaseMapGpuVa = false;
wddm->callBaseWaitFromCpu = false;
rootDeviceEnvironment->osInterface = std::make_unique<OSInterface>();
rootDeviceEnvironment->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
wddm->init();
executionEnvironment->memoryManager.reset(new MockWddmMemoryManager(*executionEnvironment));
neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u);
NEO::DeviceVector devices;
@ -62,6 +68,7 @@ struct L0DebuggerWindowsFixture {
NEO::MockDevice *neoDevice = nullptr;
L0::Device *device = nullptr;
WddmEuDebugInterfaceMock *wddm = nullptr;
NEO::ExecutionEnvironment *executionEnvironment = nullptr;
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
MockGdi *gdi = nullptr;
};
@ -98,5 +105,70 @@ HWTEST_F(L0DebuggerWindowsTest, givenDebuggingEnabledAndCommandQueuesAreCreatedA
EXPECT_EQ(2u, debuggerL0Hw->commandQueueDestroyedCount);
}
TEST_F(L0DebuggerWindowsTest, givenAllocateGraphicsMemoryWhenAllocationRegistrationIsRequiredThenAllocationIsRegistered) {
auto memoryManager = executionEnvironment->memoryManager.get();
EXPECT_GE(wddm->registerAllocationTypeCalled, 3u); // At least 1xSBA + 1xMODULE_DEBUG + 1xSTATE_SAVE_AREA during DebuggerL0 init
uint32_t registerAllocationTypeCalled = wddm->registerAllocationTypeCalled;
for (auto allocationType : {AllocationType::DEBUG_CONTEXT_SAVE_AREA,
AllocationType::DEBUG_SBA_TRACKING_BUFFER,
AllocationType::DEBUG_MODULE_AREA,
AllocationType::KERNEL_ISA}) {
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0u, MemoryConstants::pageSize, allocationType}));
EXPECT_EQ(++registerAllocationTypeCalled, wddm->registerAllocationTypeCalled);
WddmAllocation::RegistrationData registrationData = {0};
registrationData.gpuVirtualAddress = wddmAlloc->getGpuAddress();
registrationData.size = wddmAlloc->getUnderlyingBufferSize();
EXPECT_EQ(0, memcmp(wddm->registerAllocationTypePassedParams.allocData, &registrationData, sizeof(registrationData)));
memoryManager->freeGraphicsMemory(wddmAlloc);
}
}
TEST_F(L0DebuggerWindowsTest, givenAllocateGraphicsMemoryWhenAllocationRegistrationIsNotRequiredThenAllocationIsNotRegistered) {
auto memoryManager = executionEnvironment->memoryManager.get();
EXPECT_GE(wddm->registerAllocationTypeCalled, 3u); // At least 1xSBA + 1xMODULE_DEBUG + 1xSTATE_SAVE_AREA during DebuggerL0 init
uint32_t registerAllocationTypeCalled = wddm->registerAllocationTypeCalled;
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0u, MemoryConstants::pageSize, AllocationType::BUFFER}));
EXPECT_EQ(registerAllocationTypeCalled, wddm->registerAllocationTypeCalled);
memoryManager->freeGraphicsMemory(wddmAlloc);
}
TEST_F(L0DebuggerWindowsTest, givenDebuggerL0NotifyModuleCreateCalledAndCreateDebugDataEscapeFailedThenModuleCreateNotifyEscapeIsNotCalled) {
wddm->createDebugDataPassedParam.ntStatus = STATUS_UNSUCCESSFUL;
auto debugger = static_cast<DebuggerL0 *>(neoDevice->getDebugger());
debugger->notifyModuleCreate((void *)0x12345678, 0x1000, 0x80000000);
EXPECT_EQ(wddm->createDebugDataCalled, 1u);
EXPECT_EQ(wddm->createDebugDataPassedParam.param.hElfAddressPtr, 0xDEADDEADu);
EXPECT_EQ(wddm->moduleCreateNotifyCalled, 0);
}
TEST_F(L0DebuggerWindowsTest, givenDebuggerL0NotifyModuleCreateCalledAndModuleCreateNotifyEscapeIsFailedThenModuleIsNotRegistered) {
wddm->moduleCreateNotificationPassedParam.ntStatus = STATUS_UNSUCCESSFUL;
auto debugger = static_cast<DebuggerL0 *>(neoDevice->getDebugger());
debugger->notifyModuleCreate((void *)0x12345678, 0x1000, 0x80000000);
EXPECT_EQ(wddm->createDebugDataCalled, 1u);
EXPECT_EQ(wddm->createDebugDataPassedParam.param.hElfAddressPtr, 0x12345678u);
EXPECT_EQ(wddm->moduleCreateNotifyCalled, 1u);
EXPECT_EQ(wddm->moduleCreateNotificationPassedParam.param.hElfAddressPtr, 0xDEADDEADu);
}
TEST_F(L0DebuggerWindowsTest, givenDebuggerL0NotifyModuleCreateCalledThenCreateDebugDataAndModuleCreateNotifyEscapesAreCalled) {
auto debugger = static_cast<DebuggerL0 *>(neoDevice->getDebugger());
debugger->notifyModuleCreate((void *)0x12345678, 0x1000, 0x80000000);
EXPECT_EQ(wddm->createDebugDataCalled, 1u);
EXPECT_EQ(wddm->createDebugDataPassedParam.param.DebugDataType, ELF_BINARY);
EXPECT_EQ(wddm->createDebugDataPassedParam.param.DataSize, 0x1000);
EXPECT_EQ(wddm->createDebugDataPassedParam.param.hElfAddressPtr, 0x12345678u);
EXPECT_EQ(wddm->moduleCreateNotifyCalled, 1u);
EXPECT_TRUE(wddm->moduleCreateNotificationPassedParam.param.IsCreate);
EXPECT_EQ(wddm->moduleCreateNotificationPassedParam.param.Modulesize, 0x1000);
EXPECT_EQ(wddm->moduleCreateNotificationPassedParam.param.hElfAddressPtr, 0x12345678u);
EXPECT_EQ(wddm->moduleCreateNotificationPassedParam.param.LoadAddress, 0x80000000);
}
} // namespace ult
} // namespace L0

View File

@ -60,7 +60,7 @@ ze_result_t DebugSessionWindows::initialize() {
}
debugHandle = escapeInfo.KmEuDbgL0EscapeInfo.AttachDebuggerParams.hDebugHandle;
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_ATTACH_DEBUGGER: SUCCESS - ProcessId: %d DebugHandle: 0x%llx\n", processId, debugHandle);
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_ATTACH_DEBUGGER: SUCCESS - ProcessId: %d DebugHandle: 0x%llX\n", processId, debugHandle);
auto result = ZE_RESULT_SUCCESS;
@ -166,7 +166,7 @@ ze_result_t DebugSessionWindows::readAndHandleEvent(uint64_t timeoutMs) {
auto seqNo = escapeInfo.KmEuDbgL0EscapeInfo.ReadEventParams.EventSeqNo;
switch (escapeInfo.KmEuDbgL0EscapeInfo.ReadEventParams.ReadEventType) {
case DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION:
return handleModuleCreateEvent(eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams);
return handleModuleCreateEvent(seqNo, eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams);
case DBGUMD_READ_EVENT_EU_ATTN_BIT_SET:
return handleEuAttentionBitsEvent(eventParamsBuffer.eventParamsBuffer.EuBitSetEventParams);
case DBGUMD_READ_EVENT_ALLOCATION_DATA_INFO:
@ -185,8 +185,27 @@ ze_result_t DebugSessionWindows::readAndHandleEvent(uint64_t timeoutMs) {
return ZE_RESULT_ERROR_UNKNOWN;
}
ze_result_t DebugSessionWindows::handleModuleCreateEvent(DBGUMD_READ_EVENT_MODULE_CREATE_EVENT_PARAMS &moduleCreateParams) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
ze_result_t DebugSessionWindows::handleModuleCreateEvent(uint32_t seqNo, DBGUMD_READ_EVENT_MODULE_CREATE_EVENT_PARAMS &moduleCreateParams) {
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_MODULE_CREATE_EVENT_PARAMS: hElfAddressPtr=0x%llX IsModuleCreate=%d LoadAddress=0x%llX ElfModuleSize=%d\n",
moduleCreateParams.hElfAddressPtr, moduleCreateParams.IsModuleCreate, moduleCreateParams.LoadAddress, moduleCreateParams.ElfModulesize);
if (moduleCreateParams.IsModuleCreate) {
Module module = {0};
module.cpuAddress = moduleCreateParams.hElfAddressPtr;
module.gpuAddress = moduleCreateParams.LoadAddress;
module.size = moduleCreateParams.ElfModulesize;
allModules.push_back(module);
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_MODULE_CREATE_EVENT_PARAMS: Immediately acknowledge...\n");
return acknowledgeEventImp(seqNo, DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION);
} else {
auto it = std::find_if(allModules.begin(), allModules.end(), [&](auto &m) { return m.gpuAddress == moduleCreateParams.LoadAddress; });
if (it != allModules.end()) {
allModules.erase(it);
}
}
return ZE_RESULT_SUCCESS;
}
ze_result_t DebugSessionWindows::handleEuAttentionBitsEvent(DBGUMD_READ_EVENT_EU_ATTN_BIT_SET_PARAMS &euAttentionBitsParams) {
@ -216,13 +235,15 @@ ze_result_t DebugSessionWindows::handleAllocationDataEvent(uint32_t seqNo, DBGUM
stateSaveAreaVA.store(registrationData.gpuVirtualAddress);
stateSaveAreaCaptured = true;
}
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_READ_ALLOCATION_DATA - Success - gpuVA=0x%llX Size=0x%X\n", registrationData.gpuVirtualAddress, registrationData.size);
}
return ZE_RESULT_SUCCESS;
}
ze_result_t DebugSessionWindows::handleContextCreateDestroyEvent(DBGUMD_READ_EVENT_CONTEXT_CREATE_DESTROY_EVENT_PARAMS &contextCreateDestroyParams) {
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_CONTEXT_CREATE_DESTROY_EVENT_PARAMS: hContextHandle: 0x%ullx IsCreated: %d SIPInstalled: %d\n", contextCreateDestroyParams.hContextHandle, contextCreateDestroyParams.IsCreated, contextCreateDestroyParams.IsSIPInstalled);
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_CONTEXT_CREATE_DESTROY_EVENT_PARAMS: hContextHandle: 0x%llX IsCreated: %d SIPInstalled: %d\n", contextCreateDestroyParams.hContextHandle, contextCreateDestroyParams.IsCreated, contextCreateDestroyParams.IsSIPInstalled);
if (!contextCreateDestroyParams.IsSIPInstalled) {
return ZE_RESULT_SUCCESS;
}
@ -238,7 +259,7 @@ ze_result_t DebugSessionWindows::handleContextCreateDestroyEvent(DBGUMD_READ_EVE
}
ze_result_t DebugSessionWindows::handleDeviceCreateDestroyEvent(DBGUMD_READ_EVENT_DEVICE_CREATE_DESTROY_EVENT_PARAMS &deviceCreateDestroyParams) {
PRINT_DEBUGGER_INFO_LOG("DEVICE_CREATE_DESTROY_EVENT: hDeviceContext=0x%llx IsCreated=%d ProcessId=%d\n",
PRINT_DEBUGGER_INFO_LOG("DEVICE_CREATE_DESTROY_EVENT: hDeviceContext=0x%llX IsCreated=%d ProcessId=%d\n",
deviceCreateDestroyParams.hDeviceContext, deviceCreateDestroyParams.IsCreated, deviceCreateDestroyParams.ProcessID);
return ZE_RESULT_SUCCESS;
@ -268,7 +289,7 @@ ze_result_t DebugSessionWindows::readAllocationDebugData(uint32_t seqNo, uint64_
}
ze_result_t DebugSessionWindows::handleCreateDebugDataEvent(DBGUMD_READ_EVENT_CREATE_DEBUG_DATA_PARAMS &createDebugDataParams) {
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_CREATE_DEBUG_DATA_PARAMS:. Type: %d BufferPtr: 0x%ullx DataSize: 0x%ullx\n", createDebugDataParams.DebugDataType, createDebugDataParams.DataBufferPtr, createDebugDataParams.DataSize);
PRINT_DEBUGGER_INFO_LOG("DBGUMD_READ_EVENT_CREATE_DEBUG_DATA_PARAMS: Type: %d BufferPtr: 0x%llX DataSize: 0x%lX\n", createDebugDataParams.DebugDataType, createDebugDataParams.DataBufferPtr, createDebugDataParams.DataSize);
if (createDebugDataParams.DebugDataType == ELF_BINARY) {
std::unique_lock<std::mutex> lock(asyncThreadMutex);
ElfRange elf;
@ -288,6 +309,28 @@ ze_result_t DebugSessionWindows::handleCreateDebugDataEvent(DBGUMD_READ_EVENT_CR
return ZE_RESULT_SUCCESS;
}
ze_result_t DebugSessionWindows::acknowledgeEventImp(uint32_t seqNo, uint32_t eventType) {
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_ACKNOWLEDGE_EVENT: seqNo: %d eventType: %d\n", seqNo, eventType);
KM_ESCAPE_INFO escapeInfo = {0};
escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_ACKNOWLEDGE_EVENT;
escapeInfo.KmEuDbgL0EscapeInfo.AckEventParams.EventSeqNo = seqNo;
escapeInfo.KmEuDbgL0EscapeInfo.AckEventParams.ReadEventType = eventType;
auto status = runEscape(escapeInfo);
if (STATUS_SUCCESS != status) {
PRINT_DEBUGGER_ERROR_LOG("DBGUMD_ACTION_ACKNOWLEDGE_EVENT: Failed - Status: 0x%llX EscapeReturnStatus: %d\n", status, escapeInfo.KmEuDbgL0EscapeInfo.EscapeReturnStatus);
return DebugSessionWindows::translateNtStatusToZeResult(status);
}
if (DBGUMD_RETURN_ESCAPE_SUCCESS != escapeInfo.KmEuDbgL0EscapeInfo.EscapeReturnStatus) {
PRINT_DEBUGGER_ERROR_LOG("DBGUMD_ACTION_ACKNOWLEDGE_EVENT: Failed - Status: 0x%llX EscapeReturnStatus: %d\n", status, escapeInfo.KmEuDbgL0EscapeInfo.EscapeReturnStatus);
return DebugSessionWindows::translateEscapeReturnStatusToZeResult(escapeInfo.KmEuDbgL0EscapeInfo.EscapeReturnStatus);
}
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_ACKNOWLEDGE_EVENT - Success\n", status, escapeInfo.KmEuDbgL0EscapeInfo.EscapeReturnStatus);
return ZE_RESULT_SUCCESS;
}
ze_result_t DebugSessionWindows::translateNtStatusToZeResult(NTSTATUS status) {
switch (status) {
case STATUS_SUCCESS:
@ -309,6 +352,7 @@ ze_result_t DebugSessionWindows::translateEscapeReturnStatusToZeResult(uint32_t
case DBGUMD_RETURN_READ_EVENT_TIMEOUT_EXPIRED:
return ZE_RESULT_ERROR_NOT_AVAILABLE;
case DBGUMD_RETURN_INVALID_ARGS:
case DBGUMD_RETURN_INVALID_EVENT_SEQ_NO:
case DBGUMD_RETURN_NOT_VALID_PROCESS:
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
case DBGUMD_RETURN_PERMISSION_DENIED:
@ -490,7 +534,7 @@ void DebugSessionWindows::getSbaBufferGpuVa(uint64_t &gpuVa) {
return;
}
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_READ_MMIO: SUCCESS - gpuVa: 0x%ullx\n", gpuVa);
PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_READ_MMIO: SUCCESS - gpuVa: 0x%llX\n", gpuVa);
return;
}
@ -515,7 +559,8 @@ bool DebugSessionWindows::readModuleDebugArea() {
PRINT_DEBUGGER_ERROR_LOG("Module Debug Area failed to match magic numbers\n");
return false;
}
PRINT_DEBUGGER_INFO_LOG("Reading Module Debug Area Passed");
PRINT_DEBUGGER_INFO_LOG("Reading Module Debug Area Passed\n");
return true;
}

View File

@ -44,6 +44,7 @@ struct DebugSessionWindows : DebugSessionImp {
}
ze_result_t interruptImp(uint32_t deviceIndex) override;
ze_result_t acknowledgeEventImp(uint32_t seqNo, uint32_t eventType);
ze_result_t readGpuMemory(uint64_t memoryHandle, char *output, size_t size, uint64_t gpuVa) override;
ze_result_t writeGpuMemory(uint64_t memoryHandle, const char *input, size_t size, uint64_t gpuVa) override;
@ -54,7 +55,7 @@ struct DebugSessionWindows : DebugSessionImp {
void readStateSaveAreaHeader() override;
MOCKABLE_VIRTUAL ze_result_t readAndHandleEvent(uint64_t timeoutMs);
ze_result_t handleModuleCreateEvent(DBGUMD_READ_EVENT_MODULE_CREATE_EVENT_PARAMS &moduleCreateParams);
ze_result_t handleModuleCreateEvent(uint32_t seqNo, DBGUMD_READ_EVENT_MODULE_CREATE_EVENT_PARAMS &moduleCreateParams);
ze_result_t handleEuAttentionBitsEvent(DBGUMD_READ_EVENT_EU_ATTN_BIT_SET_PARAMS &euAttentionBitsParams);
ze_result_t handleAllocationDataEvent(uint32_t seqNo, DBGUMD_READ_EVENT_READ_ALLOCATION_DATA_PARAMS &allocationDataParams);
ze_result_t handleContextCreateDestroyEvent(DBGUMD_READ_EVENT_CONTEXT_CREATE_DESTROY_EVENT_PARAMS &contextCreateDestroyParams);
@ -83,6 +84,12 @@ struct DebugSessionWindows : DebugSessionImp {
uint64_t endVA;
};
struct Module {
uint64_t cpuAddress;
uint64_t gpuAddress;
uint32_t size;
};
uint64_t debugAreaVA;
NEO::DebugAreaHeader debugArea;
std::atomic<uint64_t> stateSaveAreaVA{0};
@ -90,6 +97,7 @@ struct DebugSessionWindows : DebugSessionImp {
std::unordered_set<uint64_t> allContexts;
std::vector<ElfRange> allElfs;
std::vector<Module> allModules;
};
} // namespace L0

View File

@ -22,8 +22,10 @@ namespace L0 {
namespace ult {
struct MockDebugSessionWindows : DebugSessionWindows {
using DebugSessionWindows::acknowledgeEventImp;
using DebugSessionWindows::allContexts;
using DebugSessionWindows::allElfs;
using DebugSessionWindows::allModules;
using DebugSessionWindows::asyncThread;
using DebugSessionWindows::closeAsyncThread;
using DebugSessionWindows::debugArea;
@ -425,7 +427,7 @@ TEST_F(DebugApiWindowsTest, givenUnsupportedEventTypeWhenReadAndHandleEventCalle
session->wddm = mockWddm;
mockWddm->numEvents = 1;
for (auto unsupportedEventType : {DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION, DBGUMD_READ_EVENT_EU_ATTN_BIT_SET}) {
for (auto unsupportedEventType : {DBGUMD_READ_EVENT_EU_ATTN_BIT_SET}) {
mockWddm->curEvent = 0;
mockWddm->eventQueue[0].readEventType = unsupportedEventType;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, session->readAndHandleEvent(100));
@ -606,6 +608,100 @@ TEST_F(DebugApiWindowsTest, givenContextCreateEventTypeWhenReadAndHandleEventCal
EXPECT_EQ(0u, session->allContexts.size());
}
TEST_F(DebugApiWindowsTest, givenModuleCreateNotificationeEventTypeWhenReadAndHandleEventCalledThenModuleIsRegisteredAndEventIsAcknowledged) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
mockWddm->numEvents = 1;
mockWddm->eventQueue[0].readEventType = DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION;
mockWddm->eventQueue[0].seqNo = 123u;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.IsModuleCreate = true;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.hElfAddressPtr = 0x12345678;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.ElfModulesize = 0x1000;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.LoadAddress = 0x80000000;
EXPECT_EQ(ZE_RESULT_SUCCESS, session->readAndHandleEvent(100));
EXPECT_EQ(1u, session->allModules.size());
EXPECT_EQ(0x12345678u, session->allModules[0].cpuAddress);
EXPECT_EQ(0x80000000u, session->allModules[0].gpuAddress);
EXPECT_EQ(0x1000u, session->allModules[0].size);
EXPECT_EQ(1u, mockWddm->dbgUmdEscapeActionCalled[DBGUMD_ACTION_ACKNOWLEDGE_EVENT]);
EXPECT_EQ(123u, mockWddm->acknowledgeEventPassedParam.EventSeqNo);
EXPECT_EQ(DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION, mockWddm->acknowledgeEventPassedParam.ReadEventType);
}
TEST_F(DebugApiWindowsTest, givenModuleDestroyNotificationeEventTypeWhenReadAndHandleEventCalledThenModuleIsUnregisteredAndEventIsNotAcknowledged) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
session->allModules.push_back({0x12345678u, 0x80000000u, 0x1000u});
mockWddm->numEvents = 1;
mockWddm->eventQueue[0].readEventType = DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.IsModuleCreate = false;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.hElfAddressPtr = 0x12345678;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.ElfModulesize = 0x1000;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.LoadAddress = 0x80000000;
EXPECT_EQ(ZE_RESULT_SUCCESS, session->readAndHandleEvent(100));
EXPECT_EQ(0u, session->allModules.size());
EXPECT_EQ(0u, mockWddm->dbgUmdEscapeActionCalled[DBGUMD_ACTION_ACKNOWLEDGE_EVENT]);
}
TEST_F(DebugApiWindowsTest, givenModuleDestroyNotificationeEventTypeWhenReadAndHandleEventCalledWithUnknownLoadAddressThenModuleIsNotUnregistered) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
session->allModules.push_back({0x12345678u, 0x80000000u, 0x1000u});
mockWddm->numEvents = 1;
mockWddm->eventQueue[0].readEventType = DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.IsModuleCreate = false;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.hElfAddressPtr = 0x12345678;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.ElfModulesize = 0x1000;
mockWddm->eventQueue[0].eventParamsBuffer.eventParamsBuffer.ModuleCreateEventParams.LoadAddress = 0x10000000;
EXPECT_EQ(ZE_RESULT_SUCCESS, session->readAndHandleEvent(100));
EXPECT_EQ(1u, session->allModules.size());
EXPECT_EQ(0u, mockWddm->dbgUmdEscapeActionCalled[DBGUMD_ACTION_ACKNOWLEDGE_EVENT]);
}
TEST_F(DebugApiWindowsTest, givenAcknowledgeEventEscapeFailedWhenAcknolegeEventImpIsCalledThenResultUnknownIsReturned) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
mockWddm->ntStatus = STATUS_UNSUCCESSFUL;
DBGUMD_ACTION_ACKNOWLEDGE_EVENT_PARAMS ackEventParams = {100u, DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION};
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, session->acknowledgeEventImp(100, DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION));
}
TEST_F(DebugApiWindowsTest, givenInvalidSeqNoEscapeReturnStatusWhenAcknolegeEventImpIsCalledThenResultInvalidArgIsReturned) {
zet_debug_config_t config = {};
config.pid = 0x1234;
auto session = std::make_unique<MockDebugSessionWindows>(config, device);
session->wddm = mockWddm;
mockWddm->escapeReturnStatus = DBGUMD_RETURN_INVALID_EVENT_SEQ_NO;
DBGUMD_ACTION_ACKNOWLEDGE_EVENT_PARAMS ackEventParams = {100u, DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION};
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, session->acknowledgeEventImp(100, DBGUMD_READ_EVENT_MODULE_CREATE_NOTIFICATION));
}
TEST(DebugSessionWindowsTest, whenTranslateNtStatusCalledThenCorrectZeResultReturned) {
EXPECT_EQ(ZE_RESULT_SUCCESS, DebugSessionWindows::translateNtStatusToZeResult(STATUS_SUCCESS));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, DebugSessionWindows::translateNtStatusToZeResult(STATUS_INVALID_PARAMETER));
@ -618,6 +714,7 @@ TEST(DebugSessionWindowsTest, whenTranslateEscapeErrorStatusCalledThenCorrectZeR
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_DEBUGGER_ATTACH_DEVICE_BUSY));
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_READ_EVENT_TIMEOUT_EXPIRED));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_INVALID_ARGS));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_INVALID_EVENT_SEQ_NO));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_NOT_VALID_PROCESS));
EXPECT_EQ(ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_PERMISSION_DENIED));
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, DebugSessionWindows::translateEscapeReturnStatusToZeResult(DBGUMD_RETURN_EU_DEBUG_NOT_SUPPORTED));

View File

@ -25,10 +25,10 @@
#include "shared/test/common/mocks/mock_deferred_deleter.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_gmm_client_context.h"
#include "shared/test/common/mocks/mock_l0_debugger.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/mocks/windows/mock_wddm_eudebug.h"
#include "shared/test/unit_test/utilities/base_object_utils.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
@ -2244,33 +2244,6 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsSetThenUpd
EXPECT_EQ(expectedCallCount, mockMngr->updateAuxTableCalled);
}
TEST_F(MockWddmMemoryManagerWithEuDebugInterfaceTest, givenAllocateGraphicsMemoryWhenAllocationRegistrationIsRequiredThenAllocationIsRegistered) {
WddmMemoryManager memoryManager(*executionEnvironment);
uint32_t registerAllocationTypeCalled = 0;
for (auto allocationType : {AllocationType::DEBUG_CONTEXT_SAVE_AREA,
AllocationType::DEBUG_SBA_TRACKING_BUFFER,
AllocationType::DEBUG_MODULE_AREA}) {
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize, allocationType}));
EXPECT_EQ(++registerAllocationTypeCalled, wddm->registerAllocationTypeCalled);
WddmAllocation::RegistrationData registrationData = {0};
registrationData.gpuVirtualAddress = wddmAlloc->getGpuAddress();
registrationData.size = wddmAlloc->getUnderlyingBufferSize();
EXPECT_EQ(0, memcmp(wddm->registerAllocationTypePassedParams.allocData, &registrationData, sizeof(registrationData)));
memoryManager.freeGraphicsMemory(wddmAlloc);
}
}
TEST_F(MockWddmMemoryManagerWithEuDebugInterfaceTest, givenAllocateGraphicsMemoryWhenAllocationRegistrationIsNotRequiredThenAllocationIsNotRegistered) {
WddmMemoryManager memoryManager(*executionEnvironment);
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize, AllocationType::BUFFER}));
EXPECT_EQ(0, wddm->registerAllocationTypeCalled);
memoryManager.freeGraphicsMemory(wddmAlloc);
}
TEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryWhenCreateAllocationFailsThenPopulateOsHandlesReturnsInvalidPointer) {
OsHandleStorage handleStorage;
handleStorage.fragmentCount = 1;

View File

@ -16,7 +16,6 @@
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
#include "shared/test/common/mocks/mock_wddm_residency_allocations_container.h"
#include "shared/test/common/mocks/windows/mock_gdi_interface.h"
#include "shared/test/common/mocks/windows/mock_wddm_eudebug.h"
#include "shared/test/common/os_interface/windows/mock_wddm_memory_manager.h"
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
@ -84,6 +83,7 @@ class MockWddmMemoryManagerFixture {
ExecutionEnvironment *executionEnvironment;
std::unique_ptr<MockWddmMemoryManager> memoryManager;
std::unique_ptr<CommandStreamReceiver> csr;
WddmMock *wddm = nullptr;
MockWddmResidentAllocationsContainer *mockTemporaryResources;
OsContext *osContext = nullptr;
@ -189,26 +189,4 @@ class MockWddmMemoryManagerTest : public ::testing::Test {
const uint32_t rootDeviceIndex = 0u;
};
class MockWddmMemoryManagerWithEuDebugInterfaceTest : public ::testing::Test {
public:
void SetUp() override {
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
executionEnvironment->incRefInternal();
wddm = new WddmEuDebugInterfaceMock(*executionEnvironment->rootDeviceEnvironments[1].get());
wddm->callBaseDestroyAllocations = false;
wddm->callBaseMapGpuVa = false;
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
}
void TearDown() override {
executionEnvironment->decRefInternal();
}
HardwareInfo *hwInfo = nullptr;
WddmEuDebugInterfaceMock *wddm = nullptr;
ExecutionEnvironment *executionEnvironment = nullptr;
const uint32_t rootDeviceIndex = 0u;
};
using OsAgnosticMemoryManagerUsingWddmTest = MockWddmMemoryManagerTest;

View File

@ -60,6 +60,7 @@ void DebuggerL0::initialize() {
device->getMemoryManager()->copyMemoryToAllocation(sbaAllocation, 0, &sbaHeader, sizeof(sbaHeader));
perContextSbaAllocations[engine.osContext->getContextId()] = sbaAllocation;
registerAllocationType(sbaAllocation); // NOLINT(clang-analyzer-optin.cplusplus.VirtualCall)
}
{
@ -91,6 +92,8 @@ void DebuggerL0::initialize() {
if (hwHelper.disableL3CacheForDebug(hwInfo)) {
device->getGmmHelper()->forceAllResourcesUncached();
}
registerAllocationType(moduleDebugArea); // NOLINT(clang-analyzer-optin.cplusplus.VirtualCall)
}
}

View File

@ -94,6 +94,8 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
MOCKABLE_VIRTUAL void notifyCommandQueueCreated();
MOCKABLE_VIRTUAL void notifyCommandQueueDestroyed();
MOCKABLE_VIRTUAL void notifyModuleLoadAllocations(const StackVec<NEO::GraphicsAllocation *, 32> &allocs);
MOCKABLE_VIRTUAL void notifyModuleCreate(void *module, uint32_t moduleSize, uint64_t moduleLoadAddress);
MOCKABLE_VIRTUAL void registerAllocationType(GraphicsAllocation *allocation);
void initSbaTrackingMode();
virtual void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const SbaAddresses &sba) = 0;

View File

@ -28,6 +28,8 @@ void DebuggerL0::initSbaTrackingMode() {
singleAddressSpaceSbaTracking = false;
}
void DebuggerL0::registerAllocationType(GraphicsAllocation *allocation) {}
void DebuggerL0::registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation) {
if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) {
auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>();
@ -80,4 +82,6 @@ void DebuggerL0::notifyCommandQueueDestroyed() {
}
}
void DebuggerL0::notifyModuleCreate(void *module, uint32_t moduleSize, uint64_t moduleLoadAddress) {}
} // namespace NEO

View File

@ -10,11 +10,13 @@
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/kernel/debug_data.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
#include "shared/source/os_interface/windows/wddm_allocation.h"
#include "shared/source/os_interface/windows/wddm_debug.h"
#include "KmEscape.h"
namespace NEO {
bool DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) {
if (osInterface == nullptr) {
@ -31,13 +33,136 @@ void DebuggerL0::initSbaTrackingMode() {
singleAddressSpaceSbaTracking = true;
}
void DebuggerL0::registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation) {
void DebuggerL0::registerAllocationType(GraphicsAllocation *allocation) {
if (!device->getRootDeviceEnvironment().osInterface) {
return;
}
auto wddm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Wddm>();
auto dataType = MAX_GFX_ALLOCATION_TYPE;
auto wddmAllocation = static_cast<WddmAllocation *>(allocation);
switch (wddmAllocation->getAllocationType()) {
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
dataType = SIP_CONTEXT_SAVE_AREA;
break;
case AllocationType::DEBUG_SBA_TRACKING_BUFFER:
dataType = SBA_BUFFER_AREA;
break;
case AllocationType::DEBUG_MODULE_AREA:
dataType = MODULE_HEAP_DEBUG_AREA;
break;
case AllocationType::KERNEL_ISA:
dataType = ISA;
default:
break;
}
if (dataType == MAX_GFX_ALLOCATION_TYPE) {
return;
}
WddmAllocation::RegistrationData registrationData = {0};
registrationData.gpuVirtualAddress = wddmAllocation->getGpuAddress();
registrationData.size = wddmAllocation->getUnderlyingBufferSize();
PRINT_DEBUGGER_INFO_LOG("REGISTER_ALLOCATION_TYPE: gpuVA=0x%llX Size=%X DataType=%d DataSize=%d DataPointer=%p\n",
registrationData.gpuVirtualAddress, registrationData.size, dataType, sizeof(registrationData), &registrationData);
GFX_ALLOCATION_DEBUG_DATA_INFO allocationDebugDataInfo;
allocationDebugDataInfo.DataType = dataType;
allocationDebugDataInfo.DataSize = sizeof(registrationData);
allocationDebugDataInfo.DataPointer = reinterpret_cast<uint64_t>(&registrationData);
KM_ESCAPE_INFO escapeInfo;
memset(&escapeInfo, 0, sizeof(escapeInfo));
escapeInfo.Header.EscapeCode = GFX_ESCAPE_KMD;
escapeInfo.Header.Size = sizeof(escapeInfo) - sizeof(escapeInfo.Header);
escapeInfo.EscapeOperation = KM_ESCAPE_EUDBG_UMD_REGISTER_ALLOCATION_TYPE;
escapeInfo.KmEuDbgUmdRegisterAllocationData.hAllocation = wddmAllocation->getDefaultHandle();
escapeInfo.KmEuDbgUmdRegisterAllocationData.hElfAddressPtr = uint64_t(-1);
escapeInfo.KmEuDbgUmdRegisterAllocationData.NumOfDebugDataInfo = 1;
escapeInfo.KmEuDbgUmdRegisterAllocationData.DebugDataBufferPtr = reinterpret_cast<uint64_t>(&allocationDebugDataInfo);
D3DKMT_ESCAPE escapeCommand = {0};
escapeCommand.Flags.HardwareAccess = 0;
escapeCommand.Flags.Reserved = 0;
escapeCommand.hAdapter = wddm->getAdapter();
escapeCommand.hContext = (D3DKMT_HANDLE)0;
escapeCommand.hDevice = wddm->getDeviceHandle();
escapeCommand.pPrivateDriverData = &escapeInfo;
escapeCommand.PrivateDriverDataSize = sizeof(escapeInfo);
escapeCommand.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;
[[maybe_unused]] auto status = wddm->escape(escapeCommand);
DEBUG_BREAK_IF(STATUS_SUCCESS != status);
}
bool DebuggerL0::attachZebinModuleToSegmentAllocations(const StackVec<NEO::GraphicsAllocation *, 32> &kernelAlloc, uint32_t &moduleHandle) {
void DebuggerL0::registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *allocation) {
}
bool DebuggerL0::attachZebinModuleToSegmentAllocations(const StackVec<NEO::GraphicsAllocation *, 32> &kernelAllocs, uint32_t &moduleHandle) {
return false;
}
void DebuggerL0::notifyModuleCreate(void *module, uint32_t moduleSize, uint64_t moduleLoadAddress) {
if (device->getRootDeviceEnvironment().osInterface == nullptr) {
return;
}
// Register ELF
KM_ESCAPE_INFO escapeInfo;
memset(&escapeInfo, 0, sizeof(escapeInfo));
escapeInfo.Header.EscapeCode = GFX_ESCAPE_KMD;
escapeInfo.Header.Size = sizeof(escapeInfo) - sizeof(escapeInfo.Header);
escapeInfo.EscapeOperation = KM_ESCAPE_EUDBG_UMD_CREATE_DEBUG_DATA;
escapeInfo.KmEuDbgUmdCreateDebugData.DebugDataType = ELF_BINARY;
escapeInfo.KmEuDbgUmdCreateDebugData.DataSize = moduleSize;
escapeInfo.KmEuDbgUmdCreateDebugData.hElfAddressPtr = reinterpret_cast<uint64_t>(module);
auto wddm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Wddm>();
D3DKMT_ESCAPE escapeCommand = {0};
escapeCommand.Flags.HardwareAccess = 0;
escapeCommand.Flags.Reserved = 0;
escapeCommand.hAdapter = wddm->getAdapter();
escapeCommand.hContext = (D3DKMT_HANDLE)0;
escapeCommand.hDevice = wddm->getDeviceHandle();
escapeCommand.pPrivateDriverData = &escapeInfo;
escapeCommand.PrivateDriverDataSize = sizeof(escapeInfo);
escapeCommand.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;
auto status = wddm->escape(escapeCommand);
if (STATUS_SUCCESS != status) {
PRINT_DEBUGGER_ERROR_LOG("KM_ESCAPE_EUDBG_UMD_CREATE_DEBUG_DATA: Failed - Status: 0x%llX\n", status);
return;
}
PRINT_DEBUGGER_INFO_LOG("KM_ESCAPE_EUDBG_UMD_CREATE_DEBUG_DATA - Success\n");
// Fire MODULE_CREATE event
memset(&escapeInfo, 0, sizeof(escapeInfo));
escapeInfo.Header.EscapeCode = GFX_ESCAPE_KMD;
escapeInfo.Header.Size = sizeof(escapeInfo) - sizeof(escapeInfo.Header);
escapeInfo.EscapeOperation = KM_ESCAPE_EUDBG_UMD_MODULE_CREATE_NOTIFY;
escapeInfo.KmEuDbgUmdCreateModuleNotification.IsCreate = true;
escapeInfo.KmEuDbgUmdCreateModuleNotification.Modulesize = moduleSize;
escapeInfo.KmEuDbgUmdCreateModuleNotification.hElfAddressPtr = reinterpret_cast<uint64_t>(module);
escapeInfo.KmEuDbgUmdCreateModuleNotification.LoadAddress = moduleLoadAddress;
PRINT_DEBUGGER_INFO_LOG("Sending KM_ESCAPE_EUDBG_UMD_MODULE_CREATE_NOTIFY...\n");
status = wddm->escape(escapeCommand);
if (STATUS_SUCCESS != status) {
PRINT_DEBUGGER_ERROR_LOG("KM_ESCAPE_EUDBG_UMD_MODULE_CREATE_NOTIFY: Failed - Status: 0x%llX\n", status);
return;
}
PRINT_DEBUGGER_INFO_LOG("KM_ESCAPE_EUDBG_UMD_MODULE_CREATE_NOTIFY - Success\n");
}
bool DebuggerL0::removeZebinModule(uint32_t moduleHandle) {
return false;
}

View File

@ -122,11 +122,6 @@ if(NOT WIN32 AND NOT DISABLE_WDDM_LINUX)
${CMAKE_CURRENT_SOURCE_DIR}/wddm/adapter_factory_create_dxcore.cpp
${CMAKE_CURRENT_SOURCE_DIR}/trim_callback_stub.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sys_calls_wrapper_drm_or_wddm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_register_allocation.cpp
)
else()
list(APPEND NEO_CORE_OS_INTERFACE_WDDM
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_register_allocation_win.cpp
)
endif()

View File

@ -8,6 +8,7 @@
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
#include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/debugger/debugger_l0.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
@ -1153,4 +1154,13 @@ uint64_t WddmMemoryManager::getLocalMemorySize(uint32_t rootDeviceIndex, uint32_
return singleRegionSize * DeviceBitfield(deviceBitfield).count();
}
void WddmMemoryManager::registerAllocationInOs(GraphicsAllocation *allocation) {
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()].get();
auto debuggerL0 = static_cast<DebuggerL0 *>(rootDeviceEnvironment->debugger.get());
if (debuggerL0) {
debuggerL0->registerAllocationType(allocation);
}
}
} // namespace NEO

View File

@ -1,14 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
namespace NEO {
void WddmMemoryManager::registerAllocationInOs(GraphicsAllocation *allocation) {}
} // namespace NEO

View File

@ -1,74 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/windows/wddm/wddm.h"
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
#include "KmEscape.h"
namespace NEO {
void WddmMemoryManager::registerAllocationInOs(GraphicsAllocation *allocation) {
auto dataType = MAX_GFX_ALLOCATION_TYPE;
auto wddmAllocation = static_cast<WddmAllocation *>(allocation);
switch (wddmAllocation->getAllocationType()) {
case AllocationType::DEBUG_CONTEXT_SAVE_AREA:
dataType = SIP_CONTEXT_SAVE_AREA;
break;
case AllocationType::DEBUG_SBA_TRACKING_BUFFER:
dataType = SBA_BUFFER_AREA;
break;
case AllocationType::DEBUG_MODULE_AREA:
dataType = MODULE_HEAP_DEBUG_AREA;
break;
default:
break;
}
if (dataType == MAX_GFX_ALLOCATION_TYPE) {
return;
}
WddmAllocation::RegistrationData registrationData = {0};
registrationData.gpuVirtualAddress = wddmAllocation->getGpuAddress();
registrationData.size = wddmAllocation->getUnderlyingBufferSize();
PRINT_DEBUGGER_INFO_LOG("REGISTER_ALLOCATION_TYPE: gpuVA=0x%llX Size=%X DataType=%d DataSize=%d DataPointer=%p\n",
registrationData.gpuVirtualAddress, registrationData.size, dataType, sizeof(registrationData), &registrationData);
GFX_ALLOCATION_DEBUG_DATA_INFO allocationDebugDataInfo;
allocationDebugDataInfo.DataType = dataType;
allocationDebugDataInfo.DataSize = sizeof(registrationData);
allocationDebugDataInfo.DataPointer = reinterpret_cast<uint64_t>(&registrationData);
KM_ESCAPE_INFO escapeInfo;
memset(&escapeInfo, 0, sizeof(escapeInfo));
escapeInfo.Header.EscapeCode = GFX_ESCAPE_KMD;
escapeInfo.Header.Size = sizeof(escapeInfo) - sizeof(escapeInfo.Header);
escapeInfo.EscapeOperation = KM_ESCAPE_EUDBG_UMD_REGISTER_ALLOCATION_TYPE;
escapeInfo.KmEuDbgUmdRegisterAllocationData.hAllocation = wddmAllocation->getDefaultHandle();
escapeInfo.KmEuDbgUmdRegisterAllocationData.hElfAddressPtr = uint64_t(-1);
escapeInfo.KmEuDbgUmdRegisterAllocationData.NumOfDebugDataInfo = 1;
escapeInfo.KmEuDbgUmdRegisterAllocationData.DebugDataBufferPtr = reinterpret_cast<uint64_t>(&allocationDebugDataInfo);
auto &wddm = getWddm(allocation->getRootDeviceIndex());
D3DKMT_ESCAPE escapeCommand = {0};
escapeCommand.Flags.HardwareAccess = 0;
escapeCommand.Flags.Reserved = 0;
escapeCommand.hAdapter = wddm.getAdapter();
escapeCommand.hContext = (D3DKMT_HANDLE)0;
escapeCommand.hDevice = wddm.getDeviceHandle();
escapeCommand.pPrivateDriverData = &escapeInfo;
escapeCommand.PrivateDriverDataSize = sizeof(escapeInfo);
escapeCommand.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;
[[maybe_unused]] auto status = wddm.escape(escapeCommand);
DEBUG_BREAK_IF(STATUS_SUCCESS != status);
}
} // namespace NEO

View File

@ -90,12 +90,24 @@ class MockDebuggerL0Hw : public NEO::DebuggerL0Hw<GfxFamily> {
NEO::DebuggerL0Hw<GfxFamily>::notifyCommandQueueDestroyed();
}
void registerAllocationType(NEO::GraphicsAllocation *allocation) override {
registerAllocationTypeCount++;
NEO::DebuggerL0Hw<GfxFamily>::registerAllocationType(allocation);
}
void notifyModuleCreate(void *module, uint32_t moduleSize, uint64_t moduleLoadAddress) override {
notifyModuleCreateCount++;
NEO::DebuggerL0Hw<GfxFamily>::notifyModuleCreate(module, moduleSize, moduleLoadAddress);
}
uint32_t captureStateBaseAddressCount = 0;
uint32_t programSbaTrackingCommandsCount = 0;
uint32_t getSbaTrackingCommandsSizeCount = 0;
uint32_t registerElfCount = 0;
uint32_t commandQueueCreatedCount = 0;
uint32_t commandQueueDestroyedCount = 0;
uint32_t registerAllocationTypeCount = 0;
uint32_t notifyModuleCreateCount = 0;
const char *lastReceivedElf = nullptr;
uint32_t segmentCountWithAttachedModuleHandle = 0;

View File

@ -249,7 +249,10 @@ bool WddmMock::waitFromCpu(uint64_t lastFenceValue, const MonitoredFence &monito
waitFromCpuResult.called++;
waitFromCpuResult.uint64ParamPassed = lastFenceValue;
waitFromCpuResult.monitoredFence = &monitoredFence;
if (callBaseWaitFromCpu) {
return waitFromCpuResult.success = Wddm::waitFromCpu(lastFenceValue, monitoredFence);
}
return waitFromCpuResult.success = true;
}
void *WddmMock::virtualAlloc(void *inPtr, size_t size, bool topDownHint) {

View File

@ -177,5 +177,6 @@ class WddmMock : public Wddm {
bool callBaseCreatePagingLogger = true;
bool shutdownStatus = false;
bool callBaseSetAllocationPriority = true;
bool callBaseWaitFromCpu = true;
};
} // namespace NEO

View File

@ -30,6 +30,27 @@ struct WddmEuDebugInterfaceMock : public WddmMock {
return ntStatus;
}
if (pEscapeInfo->EscapeOperation == KM_ESCAPE_EUDBG_UMD_CREATE_DEBUG_DATA) {
++createDebugDataCalled;
if (STATUS_SUCCESS == createDebugDataPassedParam.ntStatus) {
createDebugDataPassedParam.param = pEscapeInfo->KmEuDbgUmdCreateDebugData;
} else {
createDebugDataPassedParam.param.hElfAddressPtr = 0xDEADDEAD;
}
return createDebugDataPassedParam.ntStatus;
}
if (pEscapeInfo->EscapeOperation == KM_ESCAPE_EUDBG_UMD_MODULE_CREATE_NOTIFY) {
++moduleCreateNotifyCalled;
if (STATUS_SUCCESS == moduleCreateNotificationPassedParam.ntStatus) {
moduleCreateNotificationPassedParam.param = pEscapeInfo->KmEuDbgUmdCreateModuleNotification;
} else {
moduleCreateNotificationPassedParam.param.hElfAddressPtr = 0xDEADDEAD;
}
return moduleCreateNotificationPassedParam.ntStatus;
}
if (pEscapeInfo->EscapeOperation != KM_ESCAPE_EUDBG_L0_DBGUMD_HANDLER) {
return ntStatus;
}
@ -53,6 +74,7 @@ struct WddmEuDebugInterfaceMock : public WddmMock {
pEscapeInfo->KmEuDbgL0EscapeInfo.EscapeReturnStatus = eventQueue[curEvent].escapeReturnStatus;
pEscapeInfo->KmEuDbgL0EscapeInfo.ReadEventParams.ReadEventType = eventQueue[curEvent].readEventType;
pEscapeInfo->KmEuDbgL0EscapeInfo.ReadEventParams.EventSeqNo = eventQueue[curEvent].seqNo;
auto paramBuffer = reinterpret_cast<uint8_t *>(pEscapeInfo->KmEuDbgL0EscapeInfo.ReadEventParams.EventParamBufferPtr);
memcpy_s(paramBuffer, pEscapeInfo->KmEuDbgL0EscapeInfo.ReadEventParams.EventParamsBufferSize, &eventQueue[curEvent].eventParamsBuffer, sizeof(READ_EVENT_PARAMS_BUFFER));
return eventQueue[curEvent++].ntStatus;
@ -83,12 +105,17 @@ struct WddmEuDebugInterfaceMock : public WddmMock {
pEscapeInfo->KmEuDbgL0EscapeInfo.EscapeReturnStatus = escapeReturnStatus;
break;
}
case DBGUMD_ACTION_READ_MMIO:
case DBGUMD_ACTION_READ_MMIO: {
uint64_t *ptr = reinterpret_cast<uint64_t *>(pEscapeInfo->KmEuDbgL0EscapeInfo.MmioReadParams.RegisterOutBufferPtr);
*ptr = mockGpuVa;
pEscapeInfo->KmEuDbgL0EscapeInfo.EscapeReturnStatus = DBGUMD_RETURN_ESCAPE_SUCCESS;
break;
}
case DBGUMD_ACTION_ACKNOWLEDGE_EVENT: {
acknowledgeEventPassedParam = pEscapeInfo->KmEuDbgL0EscapeInfo.AckEventParams;
break;
}
}
return ntStatus;
};
@ -99,6 +126,7 @@ struct WddmEuDebugInterfaceMock : public WddmMock {
NTSTATUS ntStatus = STATUS_SUCCESS;
EUDBG_L0DBGUMD_ESCAPE_RETURN_TYPE escapeReturnStatus = DBGUMD_RETURN_ESCAPE_SUCCESS;
EUDBG_DBGUMD_READ_EVENT_TYPE readEventType = DBGUMD_READ_EVENT_MAX;
uint32_t seqNo = 0;
union {
READ_EVENT_PARAMS_BUFFER eventParamsBuffer;
uint8_t rawBytes[READ_EVENT_PARAMS_BUFFER_MIN_SIZE_BYTES] = {0};
@ -116,6 +144,18 @@ struct WddmEuDebugInterfaceMock : public WddmMock {
uint32_t allocData[100] = {0};
} registerAllocationTypePassedParams;
struct {
EUDBG_UMD_CREATE_DEBUG_DATA param;
NTSTATUS ntStatus = STATUS_SUCCESS;
} createDebugDataPassedParam;
struct {
EUDBG_UMD_MODULE_NOTIFICATION param;
NTSTATUS ntStatus = STATUS_SUCCESS;
} moduleCreateNotificationPassedParam;
DBGUMD_ACTION_ACKNOWLEDGE_EVENT_PARAMS acknowledgeEventPassedParam = {0};
bool debugAttachAvailable = true;
NTSTATUS ntStatus = STATUS_SUCCESS;
EUDBG_L0DBGUMD_ESCAPE_RETURN_TYPE escapeReturnStatus = DBGUMD_RETURN_ESCAPE_SUCCESS;
@ -123,6 +163,8 @@ struct WddmEuDebugInterfaceMock : public WddmMock {
uint64_t debugHandle = 0x0DEB0DEB;
uint32_t dbgUmdEscapeActionCalled[DBGUMD_ACTION_MAX] = {0};
uint32_t registerAllocationTypeCalled = 0;
uint32_t createDebugDataCalled = 0;
uint32_t moduleCreateNotifyCalled = 0;
static constexpr size_t bufferSize = 16;
uint8_t testBuffer[bufferSize] = {0};
uint64_t mockGpuVa = 0x12345678;

View File

@ -82,7 +82,13 @@ class MockWddmMemoryManager : public MemoryManagerCreate<WddmMemoryManager> {
return BaseClass::allocateHugeGraphicsMemory(allocationData, sharedVirtualAddress);
}
void registerAllocationInOs(GraphicsAllocation *gfxAllocation) override {
registerAllocationInOsCalled++;
BaseClass::registerAllocationInOs(gfxAllocation);
}
uint32_t freeGraphicsMemoryImplCalled = 0u;
uint32_t registerAllocationInOsCalled = 0;
bool allocationGraphicsMemory64kbCreated = false;
bool allocateGraphicsMemoryInNonDevicePool = false;
bool allocateHugeGraphicsMemoryCalled = false;