From e146a8e8caa52e7ea07df907174ee44c1b4e5006 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibala Date: Wed, 1 Jun 2022 17:12:34 +0000 Subject: [PATCH] Correct wrong constructor pattern in GraphicsAllocation Related-To: NEO-6523 Signed-off-by: Krzysztof Gibala --- .../gen9/test_cmdlist_create_gen9.cpp | 11 +- .../test/unit_tests/mocks/mock_cmdlist.cpp | 11 +- .../core/test/unit_tests/mocks/mock_event.cpp | 11 +- .../core/test/unit_tests/mocks/mock_event.h | 11 +- .../core/test/unit_tests/mocks/mock_kernel.h | 11 +- .../sources/cmdlist/test_cmdlist_2.cpp | 245 ++++++++++++------ .../sources/cmdlist/test_cmdlist_4.cpp | 8 +- .../sources/cmdlist/test_cmdlist_blit.cpp | 14 +- .../sources/debugger/test_l0_debugger_1.cpp | 10 +- .../sources/helper/heap_assigner_l0_tests.cpp | 5 +- .../enqueue_read_buffer_tests.cpp | 2 +- .../enqueue_read_image_tests.cpp | 2 +- opencl/test/unit_test/kernel/kernel_tests.cpp | 4 +- .../memory_manager/memory_manager_tests.cpp | 28 +- .../unit_test/utilities/file_logger_tests.cpp | 11 +- .../debug_settings_manager_tests.cpp | 3 +- .../helpers/blit_commands_helper_tests.inl | 11 +- .../blit_commands_helper_tests_gen12lp.cpp | 16 +- ...st_blit_commands_helper_xehp_and_later.cpp | 4 +- shared/test/common/mocks/mock_sip.cpp | 3 +- .../command_encoder_tests.cpp | 3 +- .../command_stream/aub_file_stream_tests.cpp | 2 +- .../special_heap_pool_tests.cpp | 2 +- 23 files changed, 280 insertions(+), 148 deletions(-) diff --git a/level_zero/core/test/unit_tests/gen9/test_cmdlist_create_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_cmdlist_create_gen9.cpp index dc5d10b302..ef7e03a75e 100644 --- a/level_zero/core/test/unit_tests/gen9/test_cmdlist_create_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_cmdlist_create_gen9.cpp @@ -57,9 +57,14 @@ class CommandListCreateGen9 : public DeviceFixture, public testing::Test { if (!buffer) { buffer = alignedMalloc(isaSize, 64); } - auto allocation = new NEO::GraphicsAllocation(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - buffer, reinterpret_cast(buffer), 0, isaSize, - MemoryPool::System4KBPages); + auto allocation = new NEO::GraphicsAllocation(0, + NEO::AllocationType::INTERNAL_HOST_MEMORY, + buffer, + reinterpret_cast(buffer), + 0, + isaSize, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); if (isaBuffer != nullptr) { memcpy_s(allocation->getUnderlyingBuffer(), allocation->getUnderlyingBufferSize(), isaBuffer, isaSize); } diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp index 9d1cbd644d..c79f5c1b15 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp @@ -18,9 +18,14 @@ MockCommandList::MockCommandList(Device *device) : WhiteBox<::L0::CommandList>(d this->device = device; size_t batchBufferSize = 65536u; batchBuffer = new uint8_t[batchBufferSize]; - mockAllocation = new NEO::GraphicsAllocation(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - &batchBuffer, reinterpret_cast(&batchBuffer), 0, sizeof(batchBufferSize), - MemoryPool::System4KBPages); + mockAllocation = new NEO::GraphicsAllocation(0, + NEO::AllocationType::INTERNAL_HOST_MEMORY, + &batchBuffer, + reinterpret_cast(&batchBuffer), + 0, + sizeof(batchBufferSize), + MemoryPool::System4KBPages, + NEO::MemoryManager::maxOsContextCount); } MockCommandList::~MockCommandList() { diff --git a/level_zero/core/test/unit_tests/mocks/mock_event.cpp b/level_zero/core/test/unit_tests/mocks/mock_event.cpp index fc568d8c12..3477278a3f 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_event.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_event.cpp @@ -10,9 +10,14 @@ namespace L0 { namespace ult { -Mock::Mock() : mockAllocation(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - &memory, reinterpret_cast(&memory), 0, sizeof(memory), - MemoryPool::System4KBPages) {} +Mock::Mock() : mockAllocation(0, + NEO::AllocationType::INTERNAL_HOST_MEMORY, + &memory, + reinterpret_cast(&memory), + 0, + sizeof(memory), + MemoryPool::System4KBPages, + NEO::MemoryManager::maxOsContextCount) {} Mock::~Mock() {} diff --git a/level_zero/core/test/unit_tests/mocks/mock_event.h b/level_zero/core/test/unit_tests/mocks/mock_event.h index c67f509878..3fdf658eba 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_event.h +++ b/level_zero/core/test/unit_tests/mocks/mock_event.h @@ -68,9 +68,14 @@ class MockEvent : public ::L0::Event { public: using ::L0::Event::l3FlushAppliedOnKernel; MockEvent() { - mockAllocation.reset(new NEO::MockGraphicsAllocation(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages)); + mockAllocation.reset(new NEO::MockGraphicsAllocation(0, + NEO::AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + 0x1000, + 0, + sizeof(uint32_t), + MemoryPool::System4KBPages, + NEO::MemoryManager::maxOsContextCount)); this->timestampSizeInDw = 1; this->contextStartOffset = 0; this->contextEndOffset = 4; diff --git a/level_zero/core/test/unit_tests/mocks/mock_kernel.h b/level_zero/core/test/unit_tests/mocks/mock_kernel.h index b23f9eb4b3..82372dab66 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_kernel.h +++ b/level_zero/core/test/unit_tests/mocks/mock_kernel.h @@ -115,9 +115,14 @@ struct Mock<::L0::Kernel> : public WhiteBox<::L0::Kernel> { this->kernelImmData = &immutableData; - auto allocation = new NEO::GraphicsAllocation(0, NEO::AllocationType::KERNEL_ISA, - nullptr, 0, 0, 4096, - MemoryPool::System4KBPages); + auto allocation = new NEO::GraphicsAllocation(0, + NEO::AllocationType::KERNEL_ISA, + nullptr, + 0, + 0, + 4096, + MemoryPool::System4KBPages, + NEO::MemoryManager::maxOsContextCount); immutableData.isaGraphicsAllocation.reset(allocation); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index 1fc2b172de..26fee38fec 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -213,12 +213,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPa MockCommandListHw cmdList; size_t size = (sizeof(uint32_t) * 4); cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalledTimes, 1u); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u); @@ -228,12 +236,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngi MockCommandListHw cmdList; size_t size = (sizeof(uint32_t) * 4); cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyBlitCalledTimes, 1u); } @@ -242,12 +258,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPa MockCommandListHw cmdList; size_t size = ((sizeof(uint32_t) * 4) + 1); cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalledTimes, 2u); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u); @@ -257,12 +281,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledAndErrorOnMi MockCommandListHw cmdList(true); size_t size = ((sizeof(uint32_t) * 4) + 1); cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalledTimes, 1u); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u); @@ -272,12 +304,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngi MockCommandListHw cmdList; size_t size = ((sizeof(uint32_t) * 4) + 1); cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyBlitCalledTimes, 1u); } @@ -286,12 +326,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngi MockCommandListHw cmdList(true); size_t size = ((sizeof(uint32_t) * 4) + 1); cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyBlitCalledTimes, 1u); } @@ -300,12 +348,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhen4GBytePageFaultCopyCalledThenPa MockCommandListHw cmdList; size_t size = 0x100000000; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x100003456), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalledTimes, 1u); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 1u); @@ -315,12 +371,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhen4GBytePageFaultCopyCalledThenPa MockCommandListHw cmdList; size_t size = 0x100000001; cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x100003456), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalledTimes, 2u); EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 2u); @@ -912,12 +976,22 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyRegionWithinMaxBlitSize ze_copy_region_t dstRegion = srcRegion; Vec3 srcSize = {0x1000, 0x100, 1}; Vec3 dstSize = {0x100, 0x100, 1}; - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + auto size = 0x1000; + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + size_t rowPitch = copySize.x; size_t slicePitch = copySize.x * copySize.y; commandList->appendMemoryCopyBlitRegion(&mockAllocationDst, &mockAllocationSrc, 0, 0, srcRegion, dstRegion, copySize, rowPitch, slicePitch, rowPitch, slicePitch, srcSize, dstSize, nullptr, 0, nullptr); @@ -945,12 +1019,21 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyRegionWithinMaxBlitSize ze_copy_region_t dstRegion = srcRegion; Vec3 srcSize = {0x1000, 0x100, 1}; Vec3 dstSize = {0x100, 0x100, 1}; - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + auto size = 0x1000; + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); size_t rowPitch = copySize.x; size_t slicePitch = copySize.x * copySize.y; commandList->appendMemoryCopyBlitRegion(&mockAllocationDst, &mockAllocationSrc, 0, 0, srcRegion, dstRegion, copySize, rowPitch, slicePitch, rowPitch, slicePitch, srcSize, dstSize, nullptr, 0, nullptr); @@ -977,12 +1060,21 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyRegionGreaterThanMaxBli ze_copy_region_t dstRegion = srcRegion; Vec3 srcSize = {2 * BlitterConstants::maxBlitWidth, 2 * BlitterConstants::maxBlitHeight, 1}; Vec3 dstSize = srcSize; - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + auto size = 0x1000; + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); size_t rowPitch = copySize.x; size_t slicePitch = copySize.x * copySize.y; commandList->appendMemoryCopyBlitRegion(&mockAllocationDst, &mockAllocationSrc, 0, 0, srcRegion, dstRegion, copySize, rowPitch, slicePitch, rowPitch, slicePitch, srcSize, dstSize, nullptr, 0, nullptr); @@ -1084,14 +1176,21 @@ HWTEST2_F(CommandListAppendMemoryCopyBlit, whenAppendMemoryCopyBlitIsAppendedAnd useSize -= sizeof(MI_BATCH_BUFFER_END); commandList->commandContainer.getCommandStream()->getSpace(useSize); - NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + NEO::MockGraphicsAllocation mockAllocationSrc(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); void *srcPtr = reinterpret_cast(mockAllocationSrc.getGpuAddress()); - NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); - + NEO::MockGraphicsAllocation mockAllocationDst(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); void *dstPtr = reinterpret_cast(mockAllocationDst.getGpuAddress()); auto result = commandList->appendMemoryCopy(dstPtr, diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp index 4119ac5b80..111619ef6c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp @@ -315,10 +315,10 @@ HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenUseCsrImmediateSubmissi size_t size = 0x100000001; NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x100003456), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue)); @@ -339,10 +339,10 @@ HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenBindlessModeAndUseCsrIm size_t size = 0x100000001; NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x100003456), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue)); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp index 385b7d1c2b..cc90103e4f 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp @@ -45,7 +45,7 @@ class MockDriverHandle : public L0::DriverHandleImp { NEO::SvmAllocationData **allocData) override { mockAllocation.reset(new NEO::MockGraphicsAllocation(rootDeviceIndex, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages)); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount)); data.gpuAllocations.addAllocation(mockAllocation.get()); if (allocData) { *allocData = &data; @@ -162,10 +162,10 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListThenDcFlushIsNotAddedAfterBl uint64_t copySize = 0x301; NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(srcPtr), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(dstPtr), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); commandList->appendMemoryCopyBlit(ptrOffset(dstPtr, dstOffset), &mockAllocationDst, 0, ptrOffset(srcPtr, srcOffset), &mockAllocationSrc, 0, copySize); auto &commandContainer = commandList->commandContainer; @@ -199,10 +199,10 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyR ze_copy_region_t dstRegion = {4, 4, 4, 2, 2, 2}; NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); commandList->appendMemoryCopyBlitRegion(&mockAllocationDst, &mockAllocationSrc, 0, 0, srcRegion, dstRegion, {0, 0, 0}, 0, 0, 0, 0, 0, 0, event->toHandle(), 0, nullptr); GenCmdList cmdList; @@ -258,10 +258,10 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToImageCopyBl NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event->toHandle()); GenCmdList cmdList; diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index c2b2cb7a47..98d175c314 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -553,10 +553,10 @@ HWTEST2_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionEnabledCommandList NEO::GraphicsAllocation srcPtr(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::GraphicsAllocation dstPtr(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); auto result = commandList->appendPageFaultCopy(&dstPtr, &srcPtr, 0x100, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -576,10 +576,10 @@ HWTEST2_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionDisabledCommandLis NEO::GraphicsAllocation srcPtr(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); NEO::GraphicsAllocation dstPtr(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x2345), size, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); auto result = commandList->appendPageFaultCopy(&dstPtr, &srcPtr, 0x100, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -599,7 +599,7 @@ HWTEST_F(L0DebuggerSimpleTest, givenDebuggerWithoutMemoryOperationsHandlerWhenNo StackVec allocs; NEO::GraphicsAllocation alloc(0, NEO::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); allocs.push_back(&alloc); debugger->notifyModuleLoadAllocations(allocs); diff --git a/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp index 291450cd6b..6f7fa36dfa 100644 --- a/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp @@ -73,7 +73,8 @@ TEST_F(AlocationHelperTests, givenLinearStreamAllocationWhenSelectingHeapWithUse DebugManagerStateRestore dbgRestorer; DebugManager.flags.UseExternalAllocatorForSshAndDsh.set(true); std::unique_ptr mockMemoryManager(new MockMemoryManagerAllocationHelper(*device->getNEODevice()->getExecutionEnvironment())); - GraphicsAllocation allocation{0, AllocationType::LINEAR_STREAM, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::LINEAR_STREAM, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; + allocation.set32BitAllocation(false); EXPECT_EQ(MemoryManager::selectExternalHeap(allocation.isAllocatedInLocalMemoryPool()), mockMemoryManager->selectHeap(&allocation, false, false, false)); } @@ -91,4 +92,4 @@ TEST_F(AlocationHelperTests, givenOtherThanExternalHeapIndexWhenMapingToExternal } } // namespace ult -} // namespace L0 \ No newline at end of file +} // namespace L0 diff --git a/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp index 788ac715e2..339ca8c4bd 100644 --- a/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp @@ -556,7 +556,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferIsCall HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferWithMapAllocationIsCalledThenItDoesntCallNotifyFunction) { auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); - GraphicsAllocation mapAllocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation mapAllocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; auto retVal = mockCmdQ->enqueueReadBuffer(srcBuffer.get(), CL_TRUE, 0, diff --git a/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp index 17a8400dd0..4192cda3d3 100644 --- a/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp @@ -910,7 +910,7 @@ HWTEST_F(EnqueueReadImageTest, givenCommandQueueWhenEnqueueReadImageWithMapAlloc size_t region[] = {imageDesc.image_width, imageDesc.image_height, imageDesc.image_array_size}; size_t rowPitch = srcImage->getHostPtrRowPitch(); size_t slicePitch = srcImage->getHostPtrSlicePitch(); - GraphicsAllocation mapAllocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation mapAllocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; EnqueueReadImageHelper<>::enqueueReadImage(mockCmdQ.get(), srcImage.get(), CL_TRUE, origin, region, rowPitch, slicePitch, dstPtr, &mapAllocation); diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index 25daec8c3e..ac234f1cca 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -819,7 +819,7 @@ TEST_F(KernelGlobalSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenGlobalS char buffer[16]; - GraphicsAllocation gfxAlloc(0, AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, static_cast(1u), MemoryPool::MemoryNull); + GraphicsAllocation gfxAlloc(0, AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, static_cast(1u), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); uint64_t bufferAddress = (uint64_t)gfxAlloc.getUnderlyingBuffer(); // create kernel @@ -939,7 +939,7 @@ TEST_F(KernelConstantSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenConst char buffer[16]; - GraphicsAllocation gfxAlloc(0, AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, static_cast(1u), MemoryPool::MemoryNull); + GraphicsAllocation gfxAlloc(0, AllocationType::UNKNOWN, buffer, (uint64_t)buffer - 8u, 8, static_cast(1u), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); uint64_t bufferAddress = (uint64_t)gfxAlloc.getUnderlyingBuffer(); // create kernel diff --git a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp index 2563aa0b45..e3f597853d 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -2575,43 +2575,43 @@ class HeapSelectorTest : public Test { }; TEST_F(HeapSelectorTest, given32bitInternalAllocationWhenSelectingHeapThenInternalHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::KERNEL_ISA, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::KERNEL_ISA, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; allocation.set32BitAllocation(true); EXPECT_EQ(MemoryManager::selectInternalHeap(allocation.isAllocatedInLocalMemoryPool()), memoryManager->selectHeap(&allocation, false, false, false)); - GraphicsAllocation allocation2{0, AllocationType::KERNEL_ISA_INTERNAL, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation2{0, AllocationType::KERNEL_ISA_INTERNAL, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; allocation2.set32BitAllocation(true); EXPECT_EQ(MemoryManager::selectInternalHeap(allocation2.isAllocatedInLocalMemoryPool()), memoryManager->selectHeap(&allocation2, false, false, false)); } TEST_F(HeapSelectorTest, givenNon32bitInternalAllocationWhenSelectingHeapThenInternalHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::KERNEL_ISA, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::KERNEL_ISA, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; allocation.set32BitAllocation(false); EXPECT_EQ(MemoryManager::selectInternalHeap(allocation.isAllocatedInLocalMemoryPool()), memoryManager->selectHeap(&allocation, false, false, false)); - GraphicsAllocation allocation2{0, AllocationType::KERNEL_ISA_INTERNAL, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation2{0, AllocationType::KERNEL_ISA_INTERNAL, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; allocation2.set32BitAllocation(false); EXPECT_EQ(MemoryManager::selectInternalHeap(allocation2.isAllocatedInLocalMemoryPool()), memoryManager->selectHeap(&allocation2, false, false, false)); } TEST_F(HeapSelectorTest, given32bitExternalAllocationWhenSelectingHeapThenExternalHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; allocation.set32BitAllocation(true); EXPECT_EQ(MemoryManager::selectExternalHeap(allocation.isAllocatedInLocalMemoryPool()), memoryManager->selectHeap(&allocation, false, false, false)); } TEST_F(HeapSelectorTest, givenLimitedAddressSpaceWhenSelectingHeapForExternalAllocationThenStandardHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; EXPECT_EQ(HeapIndex::HEAP_STANDARD, memoryManager->selectHeap(&allocation, true, false, false)); } TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithPtrThenSvmHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; EXPECT_EQ(HeapIndex::HEAP_SVM, memoryManager->selectHeap(&allocation, true, true, false)); } TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIs64KSuitableThenStandard64kHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get(); auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); @@ -2621,7 +2621,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca } TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIsNot64KSuitableThenStandardHeapIsUsed) { - GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get(); auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); @@ -2889,7 +2889,7 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenMapAuxGpuVaThenForAllEng memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(mockMngr); memoryManager->getRegisteredEngines()[1].commandStreamReceiver->pageTableManager.reset(mockMngr2); - MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); + MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); gmm.isCompressionEnabled = true; allocation.setDefaultGmm(&gmm); @@ -2933,7 +2933,7 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenUpdateAuxTableGmmErrorTh memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(mockMngr); - MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); + MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); gmm.isCompressionEnabled = true; allocation.setDefaultGmm(&gmm); @@ -2965,7 +2965,7 @@ HWTEST_F(PageTableManagerTest, givenNullPageTableManagerWhenMapAuxGpuVaThenNoThr memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(nullptr); - MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); + MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); gmm.isCompressionEnabled = true; allocation.setDefaultGmm(&gmm); @@ -2993,7 +2993,7 @@ HWTEST_F(PageTableManagerTest, givenNullPageTableManagerWhenMapAuxGpuVaThenRetur engine.commandStreamReceiver->pageTableManager.reset(nullptr); } - MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); + MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); bool result = memoryManager->mapAuxGpuVA(&allocation); EXPECT_FALSE(result); @@ -3008,7 +3008,7 @@ HWTEST_F(PageTableManagerTest, givenMemoryManagerThatSupportsPageTableManagerWhe } auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); + MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); allocation.setDefaultGmm(&gmm); bool mapped = memoryManager->mapAuxGpuVA(&allocation); diff --git a/opencl/test/unit_test/utilities/file_logger_tests.cpp b/opencl/test/unit_test/utilities/file_logger_tests.cpp index 6b67e9b8af..af41bce0cf 100644 --- a/opencl/test/unit_test/utilities/file_logger_tests.cpp +++ b/opencl/test/unit_test/utilities/file_logger_tests.cpp @@ -950,8 +950,7 @@ TEST_P(AllocationTypeLogging, givenGraphicsAllocationTypeWhenConvertingToStringT FullyEnabledFileLogger fileLogger(testFile, flags); auto input = GetParam(); - GraphicsAllocation graphicsAllocation(0, input.type, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull); - + GraphicsAllocation graphicsAllocation(0, input.type, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); auto result = getAllocationTypeString(&graphicsAllocation); EXPECT_STREQ(result, input.str); @@ -966,7 +965,7 @@ TEST(AllocationTypeLoggingSingle, givenGraphicsAllocationTypeWhenConvertingToStr DebugVariables flags; FullyEnabledFileLogger fileLogger(testFile, flags); - GraphicsAllocation graphicsAllocation(0, static_cast(999), nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull); + GraphicsAllocation graphicsAllocation(0, static_cast(999), nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); auto result = getAllocationTypeString(&graphicsAllocation); @@ -978,7 +977,7 @@ TEST(AllocationTypeLoggingSingle, givenAllocationTypeWhenConvertingToStringThenS DebugVariables flags; FullyEnabledFileLogger fileLogger(testFile, flags); - GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull); + GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); for (uint32_t i = 0; i < static_cast(AllocationType::COUNT); i++) { graphicsAllocation.setAllocationType(static_cast(i)); @@ -996,7 +995,7 @@ TEST(AllocationTypeLoggingSingle, givenDebugVariableToCaptureAllocationTypeWhenF FullyEnabledFileLogger fileLogger(testFile, flags); - GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull); + GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); testing::internal::CaptureStdout(); fileLogger.logAllocation(&graphicsAllocation); @@ -1014,7 +1013,7 @@ TEST(AllocationTypeLoggingSingle, givenLogAllocationTypeWhenLoggingAllocationThe FullyEnabledFileLogger fileLogger(testFile, flags); - GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull); + GraphicsAllocation graphicsAllocation(0, AllocationType::COMMAND_BUFFER, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); // Log file not created bool logFileCreated = fileExists(fileLogger.getLogFileName()); diff --git a/shared/test/common/debug_settings/debug_settings_manager_tests.cpp b/shared/test/common/debug_settings/debug_settings_manager_tests.cpp index 8692ec4180..41629310bb 100644 --- a/shared/test/common/debug_settings/debug_settings_manager_tests.cpp +++ b/shared/test/common/debug_settings/debug_settings_manager_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/memory_manager/graphics_allocation.h" +#include "shared/source/memory_manager/memory_manager.h" #include "shared/source/utilities/debug_file_reader.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/test_macros/test.h" @@ -154,7 +155,7 @@ TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledOnDisabledDebugManagerW } TEST(AllocationInfoLogging, givenBaseGraphicsAllocationWhenGettingImplementationSpecificAllocationInfoThenReturnEmptyInfoString) { - GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0ull, 0ull, 0, MemoryPool::MemoryNull); + GraphicsAllocation graphicsAllocation(0, AllocationType::UNKNOWN, nullptr, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount); EXPECT_STREQ(graphicsAllocation.getAllocationInfoString().c_str(), ""); } diff --git a/shared/test/common/helpers/blit_commands_helper_tests.inl b/shared/test/common/helpers/blit_commands_helper_tests.inl index 2dd314e42d..921fa9b324 100644 --- a/shared/test/common/helpers/blit_commands_helper_tests.inl +++ b/shared/test/common/helpers/blit_commands_helper_tests.inl @@ -32,9 +32,14 @@ class GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProg void TestBodyImpl(size_t patternSize, COLOR_DEPTH expectedDepth) { // NOLINT(readability-identifier-naming) uint32_t streamBuffer[100] = {}; LinearStream stream(streamBuffer, sizeof(streamBuffer)); - MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + auto size = 0x1000; + MockGraphicsAllocation mockAllocation(0, + AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), + size, + 0u, + MemoryPool::System4KBPages, + MemoryManager::maxOsContextCount); uint32_t patternToCommand[4]; memset(patternToCommand, 4, patternSize); BlitCommandsHelper::dispatchBlitMemoryColorFill(&mockAllocation, 0, patternToCommand, patternSize, stream, mockAllocation.getUnderlyingBufferSize(), *device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]); diff --git a/shared/test/common/helpers/blit_commands_helper_tests_gen12lp.cpp b/shared/test/common/helpers/blit_commands_helper_tests_gen12lp.cpp index d9c345097e..ffb0a21c59 100644 --- a/shared/test/common/helpers/blit_commands_helper_tests_gen12lp.cpp +++ b/shared/test/common/helpers/blit_commands_helper_tests_gen12lp.cpp @@ -80,10 +80,10 @@ HWTEST2_F(BlitTests, givenSrcAndDestinationImagesWhenAppendSliceOffsetsThenAdres auto gmm = std::make_unique(pDevice->getGmmHelper()); MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); mockAllocationSrc.setGmm(gmm.get(), 0); mockAllocationDst.setGmm(gmm.get(), 0); auto bltCmd = FamilyType::cmdInitXyCopyBlt; @@ -118,10 +118,10 @@ HWTEST2_F(BlitTests, givenInputAndDefaultSlicePitchWhenAppendBlitCommandsForImag MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); auto bltCmd = FamilyType::cmdInitXyCopyBlt; BlitProperties properties = {}; properties.srcAllocation = &mockAllocationSrc; @@ -182,10 +182,10 @@ HWTEST2_F(BlitTests, givenTiledSrcAndDestinationImagesWhenAppendImageCommandsThe gmm->gmmResourceInfo.reset(myResourecInfo.release()); MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); mockAllocationSrc.setGmm(gmm.get(), 0); mockAllocationDst.setGmm(gmm.get(), 0); auto bltCmd = FamilyType::cmdInitXyCopyBlt; @@ -213,10 +213,10 @@ HWTEST2_F(BlitTests, givenLinearSrcAndDestinationImagesWhenAppendImageCommandsTh gmm->gmmResourceInfo.reset(myResourecInfo.release()); MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); MockGraphicsAllocation mockAllocationDst(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages); + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); mockAllocationSrc.setGmm(gmm.get(), 0); mockAllocationDst.setGmm(gmm.get(), 0); auto bltCmd = FamilyType::cmdInitXyCopyBlt; diff --git a/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp index 2493c69ee4..32816a7c73 100644 --- a/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -80,7 +80,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForFillB auto gmm = std::make_unique(gmmContext); gmm->isCompressionEnabled = true; MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), - 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory); + 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); mockAllocation.setGmm(gmm.get(), 0); uint32_t compressionFormat = gmmContext->getClientContext()->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); @@ -100,7 +100,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionAndDebugFlagSetWhenAppendBlitC auto gmm = std::make_unique(pDevice->getGmmHelper()); gmm->isCompressionEnabled = true; MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), - 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory); + 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); mockAllocation.setGmm(gmm.get(), 0); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); diff --git a/shared/test/common/mocks/mock_sip.cpp b/shared/test/common/mocks/mock_sip.cpp index 16a7f17c8d..ef7b43713c 100644 --- a/shared/test/common/mocks/mock_sip.cpp +++ b/shared/test/common/mocks/mock_sip.cpp @@ -46,7 +46,8 @@ void MockSipKernel::createMockSipAllocation() { MemoryConstants::pageSize * 10u, 0u, MemoryConstants::pageSize, - MemoryPool::System4KBPages, 3u); + MemoryPool::System4KBPages, + 3u); } } // namespace NEO diff --git a/shared/test/unit_test/command_container/command_encoder_tests.cpp b/shared/test/unit_test/command_container/command_encoder_tests.cpp index 9b9f024274..0fecd43a15 100644 --- a/shared/test/unit_test/command_container/command_encoder_tests.cpp +++ b/shared/test/unit_test/command_container/command_encoder_tests.cpp @@ -9,6 +9,7 @@ #include "shared/source/command_stream/linear_stream.h" #include "shared/source/gmm_helper/gmm_lib.h" #include "shared/source/memory_manager/graphics_allocation.h" +#include "shared/source/memory_manager/memory_manager.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/unit_test_helper.h" @@ -54,7 +55,7 @@ HWTEST_F(CommandEncoderTests, whenEncodeMemoryPrefetchCalledThenDoNothing) { uint8_t buffer[MemoryConstants::pageSize] = {}; LinearStream linearStream(buffer, sizeof(buffer)); - GraphicsAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 123, 456, 789, MemoryPool::LocalMemory); + GraphicsAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 123, 456, 789, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); EncodeMemoryPrefetch::programMemoryPrefetch(linearStream, allocation, 2, 0, *defaultHwInfo); diff --git a/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp b/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp index 175b5bb94c..62ab302e49 100644 --- a/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp +++ b/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp @@ -266,7 +266,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenDumpAllocationIsCa auto mockAubFileStream = std::make_unique(); auto aubExecutionEnvironment = getEnvironment>(true, true, true); auto aubCsr = aubExecutionEnvironment->template getCsr>(); - GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; aubCsr->stream = static_cast(mockAubFileStream.get()); diff --git a/shared/test/unit_test/memory_manager/special_heap_pool_tests.cpp b/shared/test/unit_test/memory_manager/special_heap_pool_tests.cpp index a93be98d36..3145d32a97 100644 --- a/shared/test/unit_test/memory_manager/special_heap_pool_tests.cpp +++ b/shared/test/unit_test/memory_manager/special_heap_pool_tests.cpp @@ -74,7 +74,7 @@ TEST_F(FrontWindowAllocatorTests, givenInitializedHeapsWhenUseExternalAllocatorF } TEST_F(FrontWindowAllocatorTests, givenLinearStreamAllocWhenSelectingHeapWithFrontWindowThenCorrectIndexReturned) { - GraphicsAllocation allocation{0, AllocationType::LINEAR_STREAM, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; + GraphicsAllocation allocation{0, AllocationType::LINEAR_STREAM, nullptr, 0, 0, 0, MemoryPool::MemoryNull, MemoryManager::maxOsContextCount}; EXPECT_EQ(HeapIndex::HEAP_EXTERNAL_FRONT_WINDOW, memManager->selectHeap(&allocation, true, true, true)); }