Skip to content

Commit 31dbc04

Browse files
L0Debug - capture SurfaceState heaps
Related-To: NEO-7103 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
1 parent 94f3e54 commit 31dbc04

File tree

5 files changed

+53
-7
lines changed

5 files changed

+53
-7
lines changed

opencl/test/unit_test/memory_manager/memory_manager_tests.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,13 +3052,6 @@ TEST(MemoryManagerTest, givenStorageInfoWithParamsWhenGettingAllocDataForLocalMe
30523052
EXPECT_FALSE(allocData.storageInfo.systemMemoryPlacement);
30533053
}
30543054

3055-
TEST(MemoryManagerTest, WhenCallingIsAllocationTypeToCaptureThenScratchAndPrivateTypesReturnTrue) {
3056-
MockMemoryManager mockMemoryManager;
3057-
3058-
EXPECT_TRUE(mockMemoryManager.isAllocationTypeToCapture(AllocationType::SCRATCH_SURFACE));
3059-
EXPECT_TRUE(mockMemoryManager.isAllocationTypeToCapture(AllocationType::PRIVATE_SURFACE));
3060-
}
3061-
30623055
TEST(MemoryTransferHelperTest, WhenBlitterIsSelectedButBlitCopyFailsThenFallbackToCopyOnCPU) {
30633056
constexpr uint32_t dataSize = 16;
30643057
uint8_t destData[dataSize] = {};

shared/source/memory_manager/memory_manager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,8 @@ bool MemoryManager::isAllocationTypeToCapture(AllocationType type) const {
856856
switch (type) {
857857
case AllocationType::SCRATCH_SURFACE:
858858
case AllocationType::PRIVATE_SURFACE:
859+
case AllocationType::LINEAR_STREAM:
860+
case AllocationType::INTERNAL_HEAP:
859861
return true;
860862
default:
861863
break;

shared/test/unit_test/memory_manager/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ target_sources(${TARGET_NAME} PRIVATE
1717
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_usage_tests.cpp
1818
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_allocate_in_device_pool_tests.cpp
1919
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_multi_device_tests.cpp
20+
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_tests.cpp
2021
${CMAKE_CURRENT_SOURCE_DIR}/memory_pool_tests.cpp
2122
${CMAKE_CURRENT_SOURCE_DIR}/multi_graphics_allocation_tests.cpp
2223
${CMAKE_CURRENT_SOURCE_DIR}/page_table_tests.cpp
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (C) 2022 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/test/common/mocks/mock_memory_manager.h"
9+
10+
#include "gtest/gtest.h"
11+
12+
using namespace NEO;
13+
14+
TEST(MemoryManagerTest, WhenCallingIsAllocationTypeToCaptureThenScratchAndPrivateTypesReturnTrue) {
15+
MockMemoryManager mockMemoryManager;
16+
17+
EXPECT_TRUE(mockMemoryManager.isAllocationTypeToCapture(AllocationType::SCRATCH_SURFACE));
18+
EXPECT_TRUE(mockMemoryManager.isAllocationTypeToCapture(AllocationType::PRIVATE_SURFACE));
19+
EXPECT_TRUE(mockMemoryManager.isAllocationTypeToCapture(AllocationType::LINEAR_STREAM));
20+
EXPECT_TRUE(mockMemoryManager.isAllocationTypeToCapture(AllocationType::INTERNAL_HEAP));
21+
}

shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3421,6 +3421,35 @@ TEST(DrmMemoryManager, givenTrackedAllocationTypeWhenFreeingThenRegisteredHandle
34213421
EXPECT_EQ(1u, mockDrm->unregisterCalledCount);
34223422
}
34233423

3424+
TEST(DrmMemoryManager, givenEnabledResourceRegistrationWhenSshIsAllocatedThenItIsMarkedForCapture) {
3425+
auto executionEnvironment = new MockExecutionEnvironment();
3426+
executionEnvironment->prepareRootDeviceEnvironments(1u);
3427+
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
3428+
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
3429+
3430+
auto mockDrm = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]);
3431+
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
3432+
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockDrm));
3433+
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mockDrm, 0u);
3434+
executionEnvironment->memoryManager = std::make_unique<TestedDrmMemoryManager>(false, false, false, *executionEnvironment);
3435+
3436+
for (uint32_t i = 3; i < 3 + static_cast<uint32_t>(DrmResourceClass::MaxSize); i++) {
3437+
mockDrm->classHandles.push_back(i);
3438+
}
3439+
EXPECT_TRUE(mockDrm->resourceRegistrationEnabled());
3440+
3441+
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
3442+
3443+
CommandContainer cmdContainer;
3444+
cmdContainer.initialize(device.get(), nullptr, true);
3445+
3446+
auto *ssh = cmdContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
3447+
auto bo = static_cast<DrmAllocation *>(ssh->getGraphicsAllocation())->getBO();
3448+
3449+
ASSERT_NE(nullptr, bo);
3450+
EXPECT_TRUE(bo->isMarkedForCapture());
3451+
}
3452+
34243453
TEST(DrmMemoryManager, givenNullBoWhenRegisteringBindExtHandleThenEarlyReturn) {
34253454
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
34263455
executionEnvironment->prepareRootDeviceEnvironments(1u);

0 commit comments

Comments
 (0)