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

@ -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;