From 9b778863b457172b5650f0de259d444e4bffbf05 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibala Date: Wed, 27 Apr 2022 10:20:10 +0000 Subject: [PATCH] Store GmmHelper in Gmm class Store GmmHelper in Gmm class instead of GmmClientContext Related-To: NEO-6523 Signed-off-by: Krzysztof Gibala --- .../unit_tests/sources/driver/test_driver.cpp | 2 +- .../unit_tests/sources/image/test_image.cpp | 2 +- opencl/source/mem_obj/image.cpp | 10 +- .../sharings/gl/windows/gl_buffer_windows.cpp | 4 +- .../gl/windows/gl_texture_windows.cpp | 6 +- .../aub_mem_dump/aub_alloc_dump_tests.cpp | 4 +- .../mem_obj/create_image_aub_tests.cpp | 10 +- .../unit_test/built_ins/built_in_tests.cpp | 8 +- .../command_queue/blit_enqueue_tests.cpp | 4 +- .../command_queue/command_queue_fixture.cpp | 2 +- .../enqueue_map_buffer_tests.cpp | 6 +- .../enqueue_read_buffer_tests.cpp | 4 +- .../enqueue_write_buffer_tests.cpp | 4 +- .../enqueue_kernel_gl_tests_windows.cpp | 4 +- .../multiple_map_buffer_tests.cpp | 4 +- .../read_write_buffer_cpu_copy.cpp | 2 +- .../context/driver_diagnostics_tests.cpp | 18 +- .../test/unit_test/d3d_sharing/d3d9_tests.cpp | 8 +- .../unit_test/fixtures/d3d_test_fixture.h | 2 +- .../gen12lp/hw_helper_tests_gen12lp.inl | 2 +- .../unit_test/gen12lp/image_tests_gen12lp.inl | 2 +- .../gen12lp/kernel_tests_gen12lp.inl | 6 +- .../unit_test/gmm_helper/gmm_helper_tests.cpp | 162 +++++++++--------- .../unit_test/helpers/hw_helper_tests.cpp | 14 +- .../kernel/kernel_arg_buffer_tests.cpp | 4 +- .../mem_obj/buffer_set_arg_tests.cpp | 2 +- .../test/unit_test/mem_obj/buffer_tests.cpp | 6 +- .../mem_obj/buffer_tests_xehp_and_later.cpp | 4 +- .../mem_obj/get_mem_object_info_tests.cpp | 6 +- .../mem_obj/image2d_from_buffer_tests.cpp | 6 +- .../test/unit_test/mem_obj/image3d_tests.cpp | 6 +- .../unit_test/mem_obj/image_set_arg_tests.cpp | 12 +- opencl/test/unit_test/mem_obj/image_tests.cpp | 2 +- .../mem_obj/image_tests_xehp_and_later.cpp | 8 +- .../unit_test/mem_obj/image_tiled_tests.cpp | 6 +- .../test/unit_test/mem_obj/mem_obj_tests.cpp | 4 +- .../unit_test/mem_obj/sub_buffer_tests.cpp | 2 +- .../memory_manager/memory_manager_tests.cpp | 16 +- .../migraton_controller_tests.cpp | 6 +- opencl/test/unit_test/mocks/mock_buffer.h | 6 +- .../linux/drm_command_stream_tests_1.cpp | 4 +- .../linux/drm_memory_manager_tests.cpp | 2 +- .../windows/file_logger_win_tests.cpp | 4 +- .../windows/mock_wddm_allocation.h | 10 +- .../os_interface/windows/wddm20_tests.cpp | 52 +++--- .../windows/wddm_kmdaf_listener_tests.cpp | 12 +- .../windows/wddm_memory_manager_tests.cpp | 72 ++++---- .../wddm_residency_controller_tests.cpp | 130 +++++++------- .../windows/wddm_residency_handler_tests.cpp | 6 +- .../windows/gl_create_from_texture_tests.cpp | 4 +- .../gl/windows/gl_reused_buffers_tests.cpp | 2 +- .../sharings/gl/windows/gl_sharing_tests.cpp | 6 +- .../sharings/gl/windows/gl_texture_tests.cpp | 4 +- .../unified/unified_sharing_fixtures.h | 2 +- .../copy_engine_tests_xe_hp_core.cpp | 2 +- .../test_cmds_programming_xe_hpg_core.cpp | 8 +- shared/source/gmm_helper/gmm.cpp | 32 ++-- shared/source/gmm_helper/gmm.h | 10 +- .../source/memory_manager/memory_manager.cpp | 2 +- .../os_agnostic_memory_manager.cpp | 12 +- .../os_interface/linux/drm_memory_manager.cpp | 24 +-- .../source/os_interface/windows/wddm/wddm.cpp | 4 +- .../windows/wddm_memory_manager.cpp | 45 ++--- ...allocator_multi_device_fixture_windows.cpp | 2 +- .../blit_commands_helper_tests_gen12lp.cpp | 6 +- ...est_blit_commands_helper_pvc_and_later.cpp | 4 +- ...st_blit_commands_helper_xehp_and_later.cpp | 34 ++-- shared/test/common/mocks/mock_gmm.h | 6 +- .../aub_command_stream_receiver_2_tests.cpp | 6 +- ...ommand_stream_receiver_simulated_tests.cpp | 8 +- .../image/image_surface_state_fixture.h | 2 +- .../aub_memory_operations_handler_tests.cpp | 4 +- ..._device_address_space_drm_or_wddm_test.cpp | 2 +- .../windows/wddm_shared_allocations_test.cpp | 2 +- .../os_interface/windows/wddm_tests.cpp | 2 +- 75 files changed, 457 insertions(+), 456 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp index 743dd55dc5..a3a3adc013 100644 --- a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp +++ b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp @@ -159,7 +159,7 @@ class MemoryManagerNTHandleMock : public NEO::OsAgnosticMemoryManager { rootDeviceIndex, false, false, false); graphicsAllocation->setSharedHandle(static_cast(reinterpret_cast(handle))); graphicsAllocation->set32BitAllocation(false); - graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); return graphicsAllocation; } }; diff --git a/level_zero/core/test/unit_tests/sources/image/test_image.cpp b/level_zero/core/test/unit_tests/sources/image/test_image.cpp index 498682c6ee..e117c9bd46 100644 --- a/level_zero/core/test/unit_tests/sources/image/test_image.cpp +++ b/level_zero/core/test/unit_tests/sources/image/test_image.cpp @@ -363,7 +363,7 @@ class MemoryManagerNTHandleMock : public NEO::OsAgnosticMemoryManager { rootDeviceIndex, false, false, false); graphicsAllocation->setSharedHandle(static_cast(reinterpret_cast(handle))); graphicsAllocation->set32BitAllocation(false); - graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); return graphicsAllocation; } }; diff --git a/opencl/source/mem_obj/image.cpp b/opencl/source/mem_obj/image.cpp index 4733f804b6..966fc80993 100644 --- a/opencl/source/mem_obj/image.cpp +++ b/opencl/source/mem_obj/image.cpp @@ -250,7 +250,7 @@ Image *Image::create(Context *context, Gmm *gmm = nullptr; auto &hwInfo = *memoryManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); auto &hwHelper = HwHelper::get((&memoryManager->peekExecutionEnvironment())->rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->platform.eRenderCoreFamily); - auto clientContext = (&memoryManager->peekExecutionEnvironment())->rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext(); + auto gmmHelper = (&memoryManager->peekExecutionEnvironment())->rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper(); if (((imageDesc->image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) || (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D)) && (parentBuffer != nullptr)) { @@ -273,7 +273,7 @@ Image *Image::create(Context *context, if (memoryManager->peekVirtualPaddingSupport() && (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D) && (allocationInfo[rootDeviceIndex].memory->getUnderlyingBuffer() != 0)) { // Retrieve sizes from GMM and apply virtual padding if buffer storage is not big enough auto queryGmmImgInfo(imgInfo); - auto gmm = std::make_unique(clientContext, queryGmmImgInfo, StorageInfo{}, preferCompression); + auto gmm = std::make_unique(gmmHelper, queryGmmImgInfo, StorageInfo{}, preferCompression); auto gmmAllocationSize = gmm->gmmResourceInfo->getSizeAllocation(); if (gmmAllocationSize > allocationInfo[rootDeviceIndex].memory->getUnderlyingBufferSize()) { allocationInfo[rootDeviceIndex].memory = memoryManager->createGraphicsAllocationWithPadding(allocationInfo[rootDeviceIndex].memory, gmmAllocationSize); @@ -304,7 +304,7 @@ Image *Image::create(Context *context, } } } else { - gmm = new Gmm(clientContext, imgInfo, StorageInfo{}, preferCompression); + gmm = new Gmm(gmmHelper, imgInfo, StorageInfo{}, preferCompression); allocationInfo[rootDeviceIndex].memory = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex, false, // allocateMemory imgInfo.size, AllocationType::SHARED_CONTEXT_IMAGE, @@ -759,14 +759,14 @@ cl_int Image::getImageParams(Context *context, size_t *imageRowPitch, size_t *imageSlicePitch) { cl_int retVal = CL_SUCCESS; - auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(); + auto gmmHelper = context->getDevice(0)->getRootDeviceEnvironment().getGmmHelper(); ImageInfo imgInfo = {}; cl_image_desc imageDescriptor = *imageDesc; imgInfo.imgDesc = Image::convertDescriptor(imageDescriptor); imgInfo.surfaceFormat = &surfaceFormat->surfaceFormat; - auto gmm = std::make_unique(clientContext, imgInfo, StorageInfo{}, false); + auto gmm = std::make_unique(gmmHelper, imgInfo, StorageInfo{}, false); *imageRowPitch = imgInfo.rowPitch; *imageSlicePitch = imgInfo.slicePitch; diff --git a/opencl/source/sharings/gl/windows/gl_buffer_windows.cpp b/opencl/source/sharings/gl/windows/gl_buffer_windows.cpp index e5b69af151..26b560bfc9 100644 --- a/opencl/source/sharings/gl/windows/gl_buffer_windows.cpp +++ b/opencl/source/sharings/gl/windows/gl_buffer_windows.cpp @@ -163,8 +163,8 @@ GraphicsAllocation *GlBuffer::createGraphicsAllocation(Context *context, unsigne sharingFunctions->graphicsAllocationsForGlBufferReuse.push_back(std::make_pair(bufferId, graphicsAllocation)); if (bufferInfo.pGmmResInfo) { DEBUG_BREAK_IF(graphicsAllocation->getDefaultGmm() != nullptr); - auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(); - graphicsAllocation->setDefaultGmm(new Gmm(clientContext, bufferInfo.pGmmResInfo)); + auto gmmHelper = context->getDevice(0)->getRootDeviceEnvironment().getGmmHelper(); + graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, bufferInfo.pGmmResInfo)); } } diff --git a/opencl/source/sharings/gl/windows/gl_texture_windows.cpp b/opencl/source/sharings/gl/windows/gl_texture_windows.cpp index 3fc4d05476..4d065d00c9 100644 --- a/opencl/source/sharings/gl/windows/gl_texture_windows.cpp +++ b/opencl/source/sharings/gl/windows/gl_texture_windows.cpp @@ -31,7 +31,7 @@ namespace NEO { Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int *errcodeRet) { ErrorCodeHelper errorCode(errcodeRet, CL_INVALID_GL_OBJECT); - auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(); + auto gmmHelper = context->getDevice(0)->getRootDeviceEnvironment().getGmmHelper(); auto memoryManager = context->getMemoryManager(); cl_image_desc imgDesc = {}; cl_image_format imgFormat = {}; @@ -65,7 +65,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl } if (texInfo.pGmmResInfo) { DEBUG_BREAK_IF(alloc->getDefaultGmm() != nullptr); - alloc->setDefaultGmm(new Gmm(clientContext, texInfo.pGmmResInfo)); + alloc->setDefaultGmm(new Gmm(gmmHelper, texInfo.pGmmResInfo)); } auto gmm = alloc->getDefaultGmm(); @@ -129,7 +129,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl mcsAlloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandleMCS, allocProperties, false, false); if (texInfo.pGmmResInfoMCS) { DEBUG_BREAK_IF(mcsAlloc->getDefaultGmm() != nullptr); - mcsAlloc->setDefaultGmm(new Gmm(clientContext, texInfo.pGmmResInfoMCS)); + mcsAlloc->setDefaultGmm(new Gmm(gmmHelper, texInfo.pGmmResInfoMCS)); } mcsSurfaceInfo.pitch = getValidParam(static_cast(mcsAlloc->getDefaultGmm()->gmmResourceInfo->getRenderPitch() / 128)); mcsSurfaceInfo.qPitch = mcsAlloc->getDefaultGmm()->gmmResourceInfo->getQPitch(); diff --git a/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp b/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp index ecdbb8dbb9..9305563e6b 100644 --- a/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp +++ b/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp @@ -414,7 +414,7 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA auto bufferAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); ASSERT_NE(nullptr, bufferAllocation); - MockBuffer::setAllocationType(bufferAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), isCompressed); + MockBuffer::setAllocationType(bufferAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), isCompressed); std::unique_ptr surfaceInfo(AubAllocDump::getDumpSurfaceInfo(*bufferAllocation, dumpFormat)); if (nullptr != surfaceInfo) { @@ -439,7 +439,7 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA imgDesc.imageHeight = 1; imgDesc.imageType = ImageType::Image2D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false); AllocationData allocationData; allocationData.imgInfo = &imgInfo; auto imageAllocation = memoryManager.allocateGraphicsMemoryForImage(allocationData); diff --git a/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp index b65a60f685..f89b01ed7c 100644 --- a/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -89,7 +89,7 @@ HWTEST_F(AUBCreateImageArray, Given1DImageArrayThenExpectationsMet) { auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat); imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false); - auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false); //allocate host_ptr auto pixelSize = 4; @@ -168,7 +168,7 @@ HWTEST_F(AUBCreateImageArray, Given2DImageArrayThenExpectationsMet) { auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat); imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false); - auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false); //allocate host_ptr auto pixelSize = 4; @@ -290,7 +290,7 @@ HWTEST_P(CopyHostPtrTest, GivenImageWithDoubledRowPitchWhenCreatedWithCopyHostPt auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat); - MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false); auto lineWidth = imageDesc.image_width * elementSize; auto passedRowPitch = imgInfo.rowPitch * 2; imageDesc.image_row_pitch = passedRowPitch; @@ -360,7 +360,7 @@ HWTEST_P(UseHostPtrTest, GivenImageWithRowPitchWhenCreatedWithUseHostPtrFlagThen auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat); - MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false); auto passedRowPitch = imgInfo.rowPitch + 32; imageDesc.image_row_pitch = passedRowPitch; unsigned char *pUseHostPtr = new unsigned char[passedRowPitch * imageDesc.image_height * elementSize]; diff --git a/opencl/test/unit_test/built_ins/built_in_tests.cpp b/opencl/test/unit_test/built_ins/built_in_tests.cpp index c6f0fdaa6e..4452a23426 100644 --- a/opencl/test/unit_test/built_ins/built_in_tests.cpp +++ b/opencl/test/unit_test/built_ins/built_in_tests.cpp @@ -593,14 +593,14 @@ HWTEST2_P(AuxBuiltInTests, givenKernelWithAuxTranslationRequiredWhenEnqueueCalle MockKernelObjForAuxTranslation mockKernelObjForAuxTranslation(kernelObjType); if (kernelObjType == KernelObjForAuxTranslation::Type::MEM_OBJ) { - MockBuffer::setAllocationType(mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmHelper(), true); cl_mem clMem = mockKernelObjForAuxTranslation.mockBuffer.get(); mockKernel.mockKernel->setArgBuffer(0, sizeof(cl_mem *), &clMem); } else { auto gfxAllocation = mockKernelObjForAuxTranslation.mockGraphicsAllocation.get(); - MockBuffer::setAllocationType(gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); auto ptr = reinterpret_cast(gfxAllocation->getGpuAddressToPatch()); mockKernel.mockKernel->setArgSvmAlloc(0, ptr, gfxAllocation, 0u); @@ -703,7 +703,7 @@ HWTEST2_P(AuxBuiltInTests, givenAuxToNonAuxTranslationWhenSettingSurfaceStateThe std::unique_ptr buffer = nullptr; std::unique_ptr gfxAllocation = nullptr; - auto gmm = std::unique_ptr(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->isCompressionEnabled = true; auto kernelObjsForAuxTranslation = std::make_unique(); @@ -758,7 +758,7 @@ HWTEST2_P(AuxBuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThe builtinOpParams.auxTranslationDirection = AuxTranslationDirection::NonAuxToAux; MockKernelObjForAuxTranslation mockKernelObjForAuxTranslation(kernelObjType); - auto gmm = std::make_unique(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); gmm->isCompressionEnabled = true; if (kernelObjType == MockKernelObjForAuxTranslation::Type::MEM_OBJ) { mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->setDefaultGmm(gmm.release()); diff --git a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp index 18d23cba74..622a90b420 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp @@ -163,9 +163,9 @@ struct BlitEnqueueTests : public ::testing::Test { graphicsAllocation->setAllocationType(AllocationType::BUFFER); if (compressed && !graphicsAllocation->getDefaultGmm()) { - auto clientContext = device->getRootDeviceEnvironment().getGmmClientContext(); + auto gmmHelper = device->getRootDeviceEnvironment().getGmmHelper(); - graphicsAllocation->setDefaultGmm(new Gmm(clientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); } if (graphicsAllocation->getDefaultGmm()) { diff --git a/opencl/test/unit_test/command_queue/command_queue_fixture.cpp b/opencl/test/unit_test/command_queue/command_queue_fixture.cpp index afb6fb78f7..c87aeebfd0 100644 --- a/opencl/test/unit_test/command_queue/command_queue_fixture.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_fixture.cpp @@ -63,7 +63,7 @@ void CommandQueueHwFixture::forceMapBufferOnGpu(Buffer &buffer) { buffer.setSharingHandler(new SharingHandler()); auto gfxAllocation = buffer.getGraphicsAllocation(clDevice->getRootDeviceIndex()); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(clDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(clDevice->getGmmHelper()), handleId); } } diff --git a/opencl/test/unit_test/command_queue/enqueue_map_buffer_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_map_buffer_tests.cpp index 351e085157..c03f92ec2a 100644 --- a/opencl/test/unit_test/command_queue/enqueue_map_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_map_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -378,7 +378,7 @@ TEST_F(EnqueueMapBufferTest, givenNonReadOnlyBufferWhenMappedOnGpuThenSetValidEv buffer->setSharingHandler(new SharingHandler()); auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex()); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId); } buffer->forceDisallowCPUCopy = true; @@ -426,7 +426,7 @@ TEST_F(EnqueueMapBufferTest, givenReadOnlyBufferWhenMappedOnGpuThenSetValidEvent buffer->setSharingHandler(new SharingHandler()); auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex()); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId); } EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, buffer.get()); 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 152e8a340d..1570623e71 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 @@ -615,7 +615,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB static_cast(graphicsAllocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); - MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); retVal = mockCmdQ->enqueueReadBuffer(buffer.get(), CL_TRUE, @@ -631,7 +631,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB EXPECT_FALSE(graphicsAllocation->isLocked()); EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled); - MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false); + MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false); retVal = mockCmdQ->enqueueReadBuffer(buffer.get(), CL_TRUE, diff --git a/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp index 42a07b20a1..1a4624188d 100644 --- a/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp @@ -444,7 +444,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse allocation->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); - MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(), CL_FALSE, @@ -460,7 +460,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse EXPECT_FALSE(allocation->isLocked()); EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled); - MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false); + MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false); retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(), CL_FALSE, diff --git a/opencl/test/unit_test/command_queue/gl/windows/enqueue_kernel_gl_tests_windows.cpp b/opencl/test/unit_test/command_queue/gl/windows/enqueue_kernel_gl_tests_windows.cpp index 6e86794f19..01be2012fd 100644 --- a/opencl/test/unit_test/command_queue/gl/windows/enqueue_kernel_gl_tests_windows.cpp +++ b/opencl/test/unit_test/command_queue/gl/windows/enqueue_kernel_gl_tests_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,7 @@ TEST_F(EnqueueKernelTest, givenKernelWithSharedObjArgsWhenEnqueueIsCalledThenRes auto nonSharedBuffer = new MockBuffer; MockGlSharing glSharing; - MockGmm mockGmm(pDevice->getGmmClientContext()); + MockGmm mockGmm(pDevice->getGmmHelper()); glSharing.uploadDataToBufferInfo(1, 0, mockGmm.gmmResourceInfo->peekGmmResourceInfo()); pContext->setSharingFunctions(glSharing.sharingFunctions.release()); auto retVal = CL_SUCCESS; diff --git a/opencl/test/unit_test/command_queue/multiple_map_buffer_tests.cpp b/opencl/test/unit_test/command_queue/multiple_map_buffer_tests.cpp index 7ecd15a1fe..33d6ce7fa0 100644 --- a/opencl/test/unit_test/command_queue/multiple_map_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/multiple_map_buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -99,7 +99,7 @@ struct MultipleMapBufferTest : public ClDeviceFixture, public ::testing::Test { buffer->setSharingHandler(new SharingHandler()); auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex()); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId); } } return std::unique_ptr>(buffer); diff --git a/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp b/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp index a7cdf50ab9..e5ed8d4ec4 100644 --- a/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp +++ b/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp @@ -24,7 +24,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, givenCompressedGmmWhenAskingForCpuOperation cl_int retVal; auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex(); std::unique_ptr buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); - auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = false; auto allocation = buffer->getGraphicsAllocation(rootDeviceIndex); allocation->setDefaultGmm(gmm); diff --git a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp index 0f6dfc7146..aadadd5d2c 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp @@ -438,7 +438,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF MockBuffer buffer; cl_mem clMem = &buffer; - MockBuffer::setAllocationType(buffer.getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(buffer.getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0); mockKernel.kernelInfo.addExtendedMetadata(0, "arg0"); @@ -468,7 +468,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF void *ptr = &data; MockGraphicsAllocation gfxAllocation(ptr, 128); - MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.kernelInfo.addExtendedMetadata(0, "arg0"); mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0); @@ -501,7 +501,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF void *ptr = &data; MockGraphicsAllocation gfxAllocation(ptr, 128); - MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.mockKernel->initialize(); mockKernel.mockKernel->setUnifiedMemoryExecInfo(&gfxAllocation); @@ -534,7 +534,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF void *ptr = &data; MockGraphicsAllocation gfxAllocation(ptr, 128); - MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.mockKernel->initialize(); @@ -567,7 +567,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenKerne void *ptr = &data; MockGraphicsAllocation gfxAllocation(ptr, 128); - MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.kernelInfo.addExtendedMetadata(0, "arg0"); mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0); @@ -594,7 +594,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeDisabledWhenCall void *ptr = &data; MockGraphicsAllocation gfxAllocation(ptr, 128); - MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.kernelInfo.addExtendedMetadata(0, "arg0"); mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0); @@ -641,7 +641,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeDisabledWhenCall void *ptr = &data; MockGraphicsAllocation gfxAllocation(ptr, 128); - MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); mockKernel.mockKernel->initialize(); mockKernel.mockKernel->setUnifiedMemoryExecInfo(&gfxAllocation); @@ -737,7 +737,7 @@ HWTEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerfor auto mockBuffer = std::unique_ptr(new MockBuffer()); StorageInfo info; size_t t = 4; - auto gmm = new Gmm(device->getGmmClientContext(), static_cast(nullptr), t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true); + auto gmm = new Gmm(device->getGmmHelper(), static_cast(nullptr), t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true); gmm->isCompressionEnabled = true; auto graphicsAllocation = mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex()); @@ -807,7 +807,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor auto mockBuffer = std::unique_ptr(new MockBuffer()); StorageInfo info; size_t t = 4; - auto gmm = new Gmm(device->getGmmClientContext(), (const void *)nullptr, t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true); + auto gmm = new Gmm(device->getGmmHelper(), (const void *)nullptr, t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true); gmm->isCompressionEnabled = false; mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex())->setDefaultGmm(gmm); diff --git a/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp b/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp index e9d5351373..5bb5050291 100644 --- a/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp +++ b/opencl/test/unit_test/d3d_sharing/d3d9_tests.cpp @@ -40,7 +40,7 @@ class MockMM : public OsAgnosticMemoryManager { return alloc; } GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override { - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, StorageInfo{}, false); + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), *allocationData.imgInfo, StorageInfo{}, false); AllocationProperties properties(allocationData.rootDeviceIndex, nullptr, false, AllocationType::SHARED_IMAGE, false, {}); auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false, false); alloc->setDefaultGmm(forceGmm); @@ -83,7 +83,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test { imgDesc.imageDepth = 1; imgDesc.imageType = ImageType::Image2D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - gmm = MockGmm::queryImgParams(pPlatform->getClDevice(0)->getGmmClientContext(), imgInfo, false).release(); + gmm = MockGmm::queryImgParams(pPlatform->getClDevice(0)->getGmmHelper(), imgInfo, false).release(); mockGmmResInfo = static_cast(gmm->gmmResourceInfo.get()); memoryManager->forceGmm = gmm; @@ -1302,7 +1302,7 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNullWhenCreatingSharedSurfaceAnd imgDesc.imageDepth = 1; imgDesc.imageType = ImageType::Image2D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto gmm = MockGmm::queryImgParams(device1->getGmmClientContext(), imgInfo, false).release(); + auto gmm = MockGmm::queryImgParams(device1->getGmmHelper(), imgInfo, false).release(); auto memoryManager = std::make_unique(*device1->executionEnvironment); memoryManager->forceGmm = gmm; @@ -1336,7 +1336,7 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNotNullWhenCreatingSharedSurface imgDesc.imageDepth = 1; imgDesc.imageType = ImageType::Image2D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto gmm = MockGmm::queryImgParams(device1->getGmmClientContext(), imgInfo, false).release(); + auto gmm = MockGmm::queryImgParams(device1->getGmmHelper(), imgInfo, false).release(); auto memoryManager = std::make_unique(*device1->executionEnvironment); memoryManager->forceGmm = gmm; diff --git a/opencl/test/unit_test/fixtures/d3d_test_fixture.h b/opencl/test/unit_test/fixtures/d3d_test_fixture.h index 910e1955fa..856b32e30e 100644 --- a/opencl/test/unit_test/fixtures/d3d_test_fixture.h +++ b/opencl/test/unit_test/fixtures/d3d_test_fixture.h @@ -86,7 +86,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test { imgDesc.imageDepth = 1; imgDesc.imageType = ImageType::Image2D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo, false).release(); + gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmHelper(), imgInfo, false).release(); mockGmmResInfo = static_cast(gmm->gmmResourceInfo.get()); mockMM->forceGmm = gmm; diff --git a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl index 4e1c154fef..4d96e4d395 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -220,7 +220,7 @@ GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenCompressedBufferThenCheckResource buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal)); - MockBuffer::setAllocationType(buffer->getGraphicsAllocation(rootDeviceIndex), context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(buffer->getGraphicsAllocation(rootDeviceIndex), context->getDevice(0)->getRootDeviceEnvironment().getGmmHelper(), true); EXPECT_FALSE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation(rootDeviceIndex))); } diff --git a/opencl/test/unit_test/gen12lp/image_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/image_tests_gen12lp.inl index 6bff47ef83..cd36bc1b03 100644 --- a/opencl/test/unit_test/gen12lp/image_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/image_tests_gen12lp.inl @@ -94,7 +94,7 @@ GEN12LPTEST_F(ImageClearColorFixture, givenMcsAllocationWhenSetArgIsCalledWithUn auto surfaceState = FamilyType::cmdInitRenderSurfaceState; auto imageHw = static_cast *>(image.get()); - mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); surfaceState.setSurfaceBaseAddress(0xABCDEF1000); imageHw->setMcsSurfaceInfo(msi); imageHw->setMcsAllocation(mcsAlloc); diff --git a/opencl/test/unit_test/gen12lp/kernel_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/kernel_tests_gen12lp.inl index 4c0dde7281..5d00262b53 100644 --- a/opencl/test/unit_test/gen12lp/kernel_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/kernel_tests_gen12lp.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -37,7 +37,7 @@ GEN12LPTEST_F(Gen12LpKernelTest, GivenKernelWhenAtLeastOneArgIsMediaCompressedTh MockBuffer buffer; auto allocation = buffer.getGraphicsAllocation(pClDevice->getRootDeviceIndex()); - auto gmm1 = new MockGmm(pDevice->getGmmClientContext()); + auto gmm1 = new MockGmm(pDevice->getGmmHelper()); allocation->setGmm(gmm1, 0); cl_mem clMem = &buffer; @@ -49,7 +49,7 @@ GEN12LPTEST_F(Gen12LpKernelTest, GivenKernelWhenAtLeastOneArgIsMediaCompressedTh MockBuffer bufferMediaCompressed; bufferMediaCompressed.setSharingHandler(new SharingHandler()); allocation = bufferMediaCompressed.getGraphicsAllocation(pClDevice->getRootDeviceIndex()); - auto gmm2 = new MockGmm(pDevice->getGmmClientContext()); + auto gmm2 = new MockGmm(pDevice->getGmmHelper()); allocation->setGmm(gmm2, 0); allocation->getGmm(0)->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = 1; cl_mem clMem2 = &bufferMediaCompressed; diff --git a/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp b/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp index 9e97aed43b..1282f619b8 100644 --- a/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp +++ b/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp @@ -76,7 +76,7 @@ TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) { TEST_F(GmmTests, WhenGmmIsCreatedThenAllResourceAreCreated) { std::unique_ptr mm(new MemoryManagerCreate(false, false, *executionEnvironment)); void *pSysMem = mm->allocateSystemMemory(4096, 4096); - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr); @@ -91,7 +91,7 @@ TEST_F(GmmTests, GivenUncacheableWhenGmmIsCreatedThenAllResourceAreCreated) { std::unique_ptr mm(new MemoryManagerCreate(false, false, *executionEnvironment)); void *pSysMem = mm->allocateSystemMemory(4096, 4096); - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC, false, {}, true)); ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr); @@ -108,7 +108,7 @@ TEST_F(GmmTests, givenHostPointerWithHighestBitSetWhenGmmIsCreatedThenItHasTheSa auto address = reinterpret_cast(addressWithHighestBitSet); auto expectedAddress = castToUint64(address); - std::unique_ptr gmm(new Gmm(getGmmClientContext(), address, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), address, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); EXPECT_EQ(gmm->resourceParams.pExistingSysMem, expectedAddress); } @@ -118,7 +118,7 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm MemoryManager *mm = new MemoryManagerCreate(false, false, *executionEnvironment); void *pSysMem = mm->allocateSystemMemory(4096, 4096); - auto gmmRes = new Gmm(getGmmClientContext(), pSysMem, maxSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmmRes = new Gmm(getGmmHelper(), pSysMem, maxSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr); @@ -132,8 +132,8 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) { auto size = 4096u; void *incomingPtr = (void *)0x1000; - auto gmmRes = new Gmm(getGmmClientContext(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); - auto gmmRes2 = new Gmm(getGmmClientContext(), gmmRes->gmmResourceInfo->peekGmmResourceInfo()); + auto gmmRes = new Gmm(getGmmHelper(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmmRes2 = new Gmm(getGmmHelper(), gmmRes->gmmResourceInfo->peekGmmResourceInfo()); // copy is being made EXPECT_NE(gmmRes2->gmmResourceInfo->peekHandle(), gmmRes->gmmResourceInfo->peekGmmResourceInfo()); @@ -154,7 +154,7 @@ TEST_F(GmmTests, GivenInvalidImageSizeWhenQueryingImgParamsThenImageInfoReturnsS imgDesc.imageType = ImageType::Image1D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_EQ(imgInfo.size, 0u); } @@ -165,7 +165,7 @@ TEST_F(GmmTests, GivenInvalidImageTypeWhenQueryingImgParamsThenExceptionIsThrown imgDesc.imageType = ImageType::Invalid; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - EXPECT_THROW(MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false), std::exception); + EXPECT_THROW(MockGmm::queryImgParams(getGmmHelper(), imgInfo, false), std::exception); } TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) { @@ -180,7 +180,7 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) { auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_GT(imgInfo.size, minSize); EXPECT_GT(imgInfo.rowPitch, 0u); @@ -210,27 +210,27 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) { TEST_F(GmmTests, givenWidthWhenCreatingResourceThenSetWidth64Field) { const void *dummyPtr = reinterpret_cast(0x123); size_t allocationSize = std::numeric_limits::max(); - Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm gmm(getGmmHelper(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); EXPECT_EQ(static_cast(allocationSize), gmm.resourceParams.BaseWidth64); } TEST_F(GmmTests, givenNullptrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) { void *pSysMem = nullptr; - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 1u); } HWTEST_F(GmmTests, givenGmmWithForceLocalMemThenNonLocalIsSetToFalse) { void *pSysMem = nullptr; - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); EXPECT_EQ(gmm->resourceParams.Flags.Info.NonLocalOnly, 0u); } TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) { void *pSysMem = reinterpret_cast(0x1111); - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 0u); } @@ -247,7 +247,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedThenItH SurfaceFormatInfo surfaceFormat = {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16}; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation(); size_t expectedSize = imgDesc.imageRowPitch * imgDesc.imageHeight; @@ -268,7 +268,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedAndPitc auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat); EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.imageRowPitch); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation(); size_t expectedSize = imgDesc.imageRowPitch * imgDesc.imageHeight; @@ -288,14 +288,14 @@ TEST_F(GmmTests, givenPlanarFormatsWhenQueryingImageParamsThenUvOffsetIsQueried) auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatNV12); imgInfo.yOffsetForUVPlane = 0; - MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_NE(0u, imgInfo.yOffsetForUVPlane); imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatP010); imgInfo.yOffsetForUVPlane = 0; - MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_NE(0u, imgInfo.yOffsetForUVPlane); } @@ -308,7 +308,7 @@ TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); imgInfo.linearStorage = false; - auto gmm = std::make_unique(getGmmClientContext(), imgInfo, StorageInfo{}, false); + auto gmm = std::make_unique(getGmmHelper(), imgInfo, StorageInfo{}, false); EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 0u); EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u); @@ -323,7 +323,7 @@ TEST_F(GmmTests, givenTilingModeSetToNonTiledWhenCreatingGmmThenLinearFlagIsSet) auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); imgInfo.linearStorage = true; - auto gmm = std::make_unique(getGmmClientContext(), imgInfo, StorageInfo{}, false); + auto gmm = std::make_unique(getGmmHelper(), imgInfo, StorageInfo{}, false); EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 1u); EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u); @@ -474,7 +474,7 @@ TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturn auto imgInfo = MockGmm::initImgInfo(imgDesc, mipLevel, nullptr); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_EQ(static_cast(queryGmm->resourceParams.MaxLod), mipLevel); } @@ -491,7 +491,7 @@ struct GmmMediaCompressedTests : public GmmTests { void SetUp() override { GmmTests::SetUp(); StorageInfo info; - gmm = std::make_unique(getGmmClientContext(), nullptr, 4, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true); + gmm = std::make_unique(getGmmHelper(), nullptr, 4, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true); flags = gmm->gmmResourceInfo->getResourceFlags(); flags->Gpu.CCS = true; flags->Gpu.UnifiedAuxSurface = true; @@ -607,7 +607,7 @@ TEST_P(GmmImgTest, WhenUpdatingImgInfoAndDescThenInformationIsCorrect) { } auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); auto mockResInfo = new MyMockGmmResourceInfo(&queryGmm->resourceParams); queryGmm->gmmResourceInfo.reset(mockResInfo); @@ -671,7 +671,7 @@ TEST_F(GmmImgTest, givenImgInfoWhenUpdatingOffsetsThenGmmIsCalledToGetOffsets) { imgDesc.imageArraySize = 10; ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - std::unique_ptr gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + std::unique_ptr gmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); MyMockGmmResourceInfo *mockGmmResourceInfo = new MyMockGmmResourceInfo(&gmm->resourceParams); gmm->gmmResourceInfo.reset(mockGmmResourceInfo); @@ -695,7 +695,7 @@ TEST_F(GmmTests, GivenPlaneWhenCopyingResourceBltThenResourceIsCopiedCorrectly) auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto gmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); auto mockResInfo = static_cast(gmm->gmmResourceInfo.get()); GMM_RES_COPY_BLT &requestedCpuBlt = mockResInfo->requestedResCopyBlt; @@ -751,7 +751,7 @@ TEST_F(GmmTests, GivenPlaneWhenCopyingResourceBltThenResourceIsCopiedCorrectly) } TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) { - auto gmm = std::unique_ptr(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto mockResource = reinterpret_cast(gmm->gmmResourceInfo.get()); mockResource->setUnifiedAuxTranslationCapable(); @@ -764,12 +764,12 @@ TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityTh TEST_F(GmmTests, givenAlignmentValueWhenConstructingGmmThenSetAlignmentInResourceCreateObject) { const uint32_t alignment = 8096; - Gmm gmm{getGmmClientContext(), nullptr, 1, alignment, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true}; + Gmm gmm{getGmmHelper(), nullptr, 1, alignment, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true}; EXPECT_EQ(alignment, gmm.resourceParams.BaseAlignment); } TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) { - auto gmm = std::unique_ptr(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto mockResource = reinterpret_cast(gmm->gmmResourceInfo.get()); mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0; @@ -788,14 +788,14 @@ TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapability TEST_F(GmmTests, whenLargePagesAreImplicitlyAllowedThenEnableOptimizationPadding) { size_t allocationSize = 128; - Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); } TEST_F(GmmTests, whenLargePagesAreExplicitlyAllowedAndUserPtrIsNullThenAllowOptimizationPadding) { size_t allocationSize = 128; bool allowLargePages = true; - Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); + Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); } @@ -803,14 +803,14 @@ TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedButUserPtrIsNotNullThenAll const void *dummyPtr = reinterpret_cast(0x123); size_t allocationSize = 128; bool allowLargePages = false; - Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); + Gmm gmm(getGmmHelper(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); } TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedAndUserPtrIsNullThenDisableOptimizationPadding) { size_t allocationSize = 128; bool allowLargePages = false; - Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); + Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); EXPECT_TRUE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); } @@ -818,14 +818,14 @@ TEST_F(GmmTests, givenSizeIsMisallignedTo64kbWhenForceDisablingLargePagesThenSiz const void *dummyPtr = reinterpret_cast(0x123); size_t allocationSize = 256U; bool allowLargePages = false; - Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); + Gmm gmm(getGmmHelper(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); EXPECT_EQ(allocationSize, gmm.resourceParams.BaseWidth64); } TEST_F(GmmTests, givenSizeIsAllignedTo64kbWhenForceDisablingLargePagesThenSizeIsAlteredToBreak64kbAlignment) { size_t allocationSize = MemoryConstants::pageSize64k; bool allowLargePages = false; - Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); + Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages); EXPECT_EQ(allocationSize + MemoryConstants::pageSize, gmm.resourceParams.BaseWidth64); } @@ -958,16 +958,16 @@ TEST_F(GmmTests, whenGmmIsCreatedAndForceAllResourcesUncachedIsSetThenResourceUs auto size = 4096u; void *incomingPtr = (void *)0x1000; - auto gmm1 = std::make_unique(getGmmClientContext(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm1 = std::make_unique(getGmmHelper(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); EXPECT_EQ(GMM_RESOURCE_USAGE_SURFACE_UNCACHED, gmm1->resourceParams.Usage); ImageDescriptor imgDesc = {}; imgDesc.imageType = ImageType::Image1D; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - auto gmm2 = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto gmm2 = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_EQ(GMM_RESOURCE_USAGE_SURFACE_UNCACHED, gmm2->resourceParams.Usage); - auto gmm3 = std::make_unique(getGmmClientContext(), gmm1->gmmResourceInfo->peekGmmResourceInfo()); + auto gmm3 = std::make_unique(getGmmHelper(), gmm1->gmmResourceInfo->peekGmmResourceInfo()); EXPECT_EQ(GMM_RESOURCE_USAGE_SURFACE_UNCACHED, gmm3->resourceParams.Usage); } @@ -1002,12 +1002,12 @@ TEST_F(GmmTests, whenResourceIsCreatedThenHandleItsOwnership) { using GmmEnvironmentTest = MockExecutionEnvironmentGmmFixtureTest; TEST_F(GmmEnvironmentTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) { - auto gmm = std::unique_ptr(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); EXPECT_FALSE(gmm->hasMultisampleControlSurface()); } TEST_F(GmmEnvironmentTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) { - auto gmm = std::unique_ptr(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto mockResource = reinterpret_cast(gmm->gmmResourceInfo.get()); mockResource->setMultisampleControlSurface(); EXPECT_TRUE(gmm->hasMultisampleControlSurface()); @@ -1152,7 +1152,7 @@ struct GmmCompressionTests : public MockExecutionEnvironmentGmmFixtureTest { }; TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) { - std::unique_ptr gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->resourceParams = {}; localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true; @@ -1165,7 +1165,7 @@ TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffer } TEST_F(GmmCompressionTests, givenDisabledAndPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) { - std::unique_ptr gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->resourceParams = {}; localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = false; @@ -1182,7 +1182,7 @@ HWTEST_F(GmmCompressionTests, givenAllValidInputsWhenQueryingThenSetAppropriateF EXPECT_TRUE(imgInfo.surfaceFormat->GMMSurfaceFormat != GMM_RESOURCE_FORMAT::GMM_FORMAT_NV12); EXPECT_TRUE(imgInfo.plane == GMM_YUV_PLANE_ENUM::GMM_NO_PLANE); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat(); auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); EXPECT_GT(compressionFormat, 0u); @@ -1203,7 +1203,7 @@ TEST_F(GmmCompressionTests, givenAllValidInputsAndNoLocalMemoryRequestWhenQueryi imgInfo.useLocalMemory = false; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat(); auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); EXPECT_GT(compressionFormat, 0u); @@ -1217,7 +1217,7 @@ TEST_F(GmmCompressionTests, givenAllValidInputsAndNoLocalMemoryRequestWhenQueryi TEST_F(GmmCompressionTests, givenNotAllowedRenderCompressionWhenQueryingThenSetAppropriateFlags) { localPlatformDevice->capabilityTable.ftrRenderCompressedImages = false; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.Linear); EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.RenderCompressed); @@ -1231,7 +1231,7 @@ HWTEST_F(GmmCompressionTests, givenNotAllowedCompressionAndEnabledDebugFlagWhenQ DebugManagerStateRestore restore; DebugManager.flags.RenderCompressedImagesEnabled.set(1); localPlatformDevice->capabilityTable.ftrRenderCompressedImages = false; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.Linear); EXPECT_EQ(1u, queryGmm->resourceParams.Flags.Info.RenderCompressed); @@ -1242,7 +1242,7 @@ HWTEST_F(GmmCompressionTests, givenNotAllowedCompressionAndEnabledDebugFlagWhenQ DebugManager.flags.RenderCompressedImagesEnabled.set(0); localPlatformDevice->capabilityTable.ftrRenderCompressedImages = true; - queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.RenderCompressed); EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Gpu.CCS); @@ -1252,7 +1252,7 @@ HWTEST_F(GmmCompressionTests, givenNotAllowedCompressionAndEnabledDebugFlagWhenQ } TEST_F(GmmCompressionTests, givenNotPreferredCompressionFlagWhenQueryingThenDisallow) { - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false); EXPECT_FALSE(queryGmm->isCompressionEnabled); } @@ -1260,7 +1260,7 @@ TEST_F(GmmCompressionTests, givenNotPreferredCompressionFlagWhenQueryingThenDisa TEST_F(GmmCompressionTests, givenNV12FormatWhenQueryingThenDisallow) { imgInfo.surfaceFormat = &SurfaceFormats::planarYuv()[0].surfaceFormat; EXPECT_TRUE(imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_RESOURCE_FORMAT::GMM_FORMAT_NV12); - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat(); auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); @@ -1278,14 +1278,14 @@ TEST_F(GmmCompressionTests, givenInvalidCompressionFormatAndFlatCcsFtrSetWhenQue uint8_t invalidFormat = static_cast(GMM_FLATCCS_FORMAT::GMM_FLATCCS_FORMAT_INVALID); mockGmmClient->compressionFormatToReturn = invalidFormat; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat(); auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); EXPECT_EQ(compressionFormat, invalidFormat); EXPECT_FALSE(queryGmm->isCompressionEnabled); mockGmmClient->compressionFormatToReturn = validFormat; - queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_TRUE(queryGmm->isCompressionEnabled); } @@ -1298,14 +1298,14 @@ TEST_F(GmmCompressionTests, givenInvalidCompressionFormatAndFlatCcsFtrNotSetWhen uint8_t validFormat = static_cast(GMM_FLATCCS_FORMAT::GMM_FLATCCS_FORMAT_INVALID); mockGmmClient->compressionFormatToReturn = invalidFormat; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat(); auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); EXPECT_EQ(compressionFormat, invalidFormat); EXPECT_FALSE(queryGmm->isCompressionEnabled); mockGmmClient->compressionFormatToReturn = validFormat; - queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_TRUE(queryGmm->isCompressionEnabled); } @@ -1315,7 +1315,7 @@ TEST_F(GmmCompressionTests, givenPlaneFormatWhenQueryingThenDisallow) { for (auto &plane : gmmPlane) { imgInfo.plane = plane; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_EQ(queryGmm->isCompressionEnabled, plane == GMM_YUV_PLANE::GMM_NO_PLANE); @@ -1325,24 +1325,24 @@ TEST_F(GmmCompressionTests, givenPlaneFormatWhenQueryingThenDisallow) { TEST_F(GmmCompressionTests, givenPackedYuvFormatWhenQueryingThenDisallow) { for (auto &surfaceFormat : SurfaceFormats::packedYuv()) { imgInfo.surfaceFormat = &surfaceFormat.surfaceFormat; - auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true); + auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true); EXPECT_FALSE(queryGmm->isCompressionEnabled); } } HWTEST_F(GmmCompressionTests, whenConstructedWithPreferCompressionFlagThenApplyAuxFlags) { - Gmm gmm1(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm gmm1(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); EXPECT_EQ(0u, gmm1.resourceParams.Flags.Info.RenderCompressed); - Gmm gmm2(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm gmm2(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); EXPECT_EQ(0u, gmm2.resourceParams.Flags.Info.RenderCompressed); - Gmm gmm3(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true); + Gmm gmm3(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true); EXPECT_EQ(1u, gmm3.resourceParams.Flags.Info.RenderCompressed); } TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) { - MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.resourceParams.Flags.Info.MediaCompressed = true; gmm.resourceParams.Flags.Info.RenderCompressed = false; gmm.setupImageResourceParams(imgInfo, true); @@ -1351,7 +1351,7 @@ TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSe } TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) { - MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.resourceParams.Flags.Info.MediaCompressed = false; gmm.resourceParams.Flags.Info.RenderCompressed = true; gmm.setupImageResourceParams(imgInfo, true); @@ -1360,7 +1360,7 @@ TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenS } HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffersThenSetValidFlags) { - std::unique_ptr gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->resourceParams = {}; localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true; @@ -1374,7 +1374,7 @@ HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffers HWTEST_F(GmmCompressionTests, givenDisabledE2ECAndEnabledDebugFlagWhenApplyingForBuffersThenSetValidFlags) { DebugManagerStateRestore restore; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.resourceParams = {}; DebugManager.flags.RenderCompressedBuffersEnabled.set(1); @@ -1420,7 +1420,7 @@ struct MultiTileGmmTests : GmmLocalMemoryTests { }; TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsTrueThenNonLocalOnlyFlagIsSetAndLocalOnlyCleared) { - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); } @@ -1430,7 +1430,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryAndAllocation storageInfo.isLockable = true; storageInfo.memoryBanks.set(1); storageInfo.systemMemoryPlacement = false; - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NotLockable); @@ -1441,7 +1441,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryFalseAndAlloc storageInfo.isLockable = false; storageInfo.memoryBanks.set(1); storageInfo.systemMemoryPlacement = false; - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); @@ -1454,7 +1454,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndNotLockableAllocationAndStorageIn storageInfo.memoryBanks.set(1); storageInfo.systemMemoryPlacement = false; - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); @@ -1471,7 +1471,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithLocalOnlyRequiredW for (auto csrMode = static_cast(CommandStreamReceiverType::CSR_HW); csrMode < static_cast(CommandStreamReceiverType::CSR_TYPES_NUM); csrMode++) { DebugManager.flags.SetCommandStreamReceiver.set(csrMode); - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); } @@ -1480,7 +1480,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithLocalOnlyRequiredW TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) { StorageInfo storageInfo{}; storageInfo.localOnlyRequired = true; - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); } @@ -1488,7 +1488,7 @@ TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequired TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithoutLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) { StorageInfo storageInfo{}; storageInfo.localOnlyRequired = false; - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); } @@ -1501,7 +1501,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryAndCompressionEnabledWhenUsingLoc storageInfo.systemMemoryPlacement = false; storageInfo.memoryBanks.set(1); - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true); EXPECT_TRUE(gmm->isCompressionEnabled); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); @@ -1516,7 +1516,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsFalseAndAllo storageInfo.memoryBanks.set(1); storageInfo.systemMemoryPlacement = false; storageInfo.isLockable = false; - auto gmm = std::make_unique(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); @@ -1541,7 +1541,7 @@ TEST_F(GmmLocalMemoryTests, givenUseLocalMemoryInImageInfoTrueWhenGmmIsCreatedTh storageInfo.systemMemoryPlacement = false; storageInfo.memoryBanks.set(1); - auto gmm = std::make_unique(getGmmClientContext(), imgInfo, storageInfo, false); + auto gmm = std::make_unique(getGmmHelper(), imgInfo, storageInfo, false); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); @@ -1568,7 +1568,7 @@ TEST_F(GmmLocalMemoryTests, givenUseCompressionAndLocalMemoryInImageInfoTrueWhen storageInfo.memoryBanks.set(1); storageInfo.systemMemoryPlacement = false; - auto gmm = std::make_unique(getGmmClientContext(), imgInfo, storageInfo, true); + auto gmm = std::make_unique(getGmmHelper(), imgInfo, storageInfo, true); EXPECT_TRUE(gmm->isCompressionEnabled); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); @@ -1590,7 +1590,7 @@ TEST_F(GmmLocalMemoryTests, givenUseLocalMemoryInImageInfoFalseWhenGmmIsCreatedT imgInfo.useLocalMemory = false; - auto gmm = std::make_unique(getGmmClientContext(), imgInfo, StorageInfo{}, false); + auto gmm = std::make_unique(getGmmHelper(), imgInfo, StorageInfo{}, false); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); } @@ -1609,11 +1609,11 @@ TEST_F(MultiTileGmmTests, whenCreateGmmWithImageInfoThenEnableMultiTileArch) { imgInfo.surfaceFormat = &surfaceFormat->surfaceFormat; imgInfo.useLocalMemory = false; - auto gmm = std::make_unique(getGmmClientContext(), imgInfo, StorageInfo{}, false); + auto gmm = std::make_unique(getGmmHelper(), imgInfo, StorageInfo{}, false); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.MultiTileArch.Enable); imgInfo.useLocalMemory = true; - gmm = std::make_unique(getGmmClientContext(), imgInfo, StorageInfo{}, false); + gmm = std::make_unique(getGmmHelper(), imgInfo, StorageInfo{}, false); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.MultiTileArch.Enable); } @@ -1622,7 +1622,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWhenGmmIsCreatedWithEmptyMempo StorageInfo storageInfo; storageInfo.memoryBanks = 0; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced); @@ -1634,7 +1634,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWithoutCloningWhenGmmIsCreated storageInfo.cloningOfPageTables = false; storageInfo.systemMemoryPlacement = false; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.GpuVaMappingSet); @@ -1646,7 +1646,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWithoutCloningWhenGmmIsCreated TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithNonLocalMemoryThenMultitileArchIsPropertlyFilled) { StorageInfo storageInfo; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(customTileMask, gmm.resourceParams.MultiTileArch.GpuVaMappingSet); @@ -1661,7 +1661,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithSpecificMemoryBanksT storageInfo.memoryBanks = 1u; storageInfo.cloningOfPageTables = false; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet); @@ -1677,7 +1677,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithCloningEnabledThenGp storageInfo.systemMemoryPlacement = false; storageInfo.pageTablesVisibility = 3u; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet); @@ -1693,7 +1693,7 @@ TEST_F(MultiTileGmmTests, whenAllocationIsTileInstancedWithoutClonningPageTables storageInfo.memoryBanks = 2u; storageInfo.systemMemoryPlacement = false; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.TileInstanced); @@ -1704,7 +1704,7 @@ TEST_F(MultiTileGmmTests, whenAllocationIsTileInstancedWithClonningPageTablesThe storageInfo.cloningOfPageTables = true; storageInfo.tileInstanced = true; - Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); + Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 5c5e8a1c91..f97ad57fd1 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -491,7 +491,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU size_t allocSize = size; length.Length = static_cast(allocSize - 1); GraphicsAllocation allocation(0, AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u); - allocation.setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation.setDefaultGmm(new Gmm(pDevice->getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); @@ -528,7 +528,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres uint64_t gpuAddr = 0x4000u; size_t allocSize = size; GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u); - allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); allocation.getDefaultGmm()->isCompressionEnabled = true; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false); @@ -560,7 +560,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionDisabledA uint64_t gpuAddr = 0x4000u; size_t allocSize = size; GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1); - allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false); EXPECT_EQ(UnitTestHelper::getCoherencyTypeSupported(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT), state->getCoherencyType()); @@ -593,7 +593,7 @@ HWTEST_F(HwHelperTest, givenOverrideMocsIndexForScratchSpaceWhenSurfaceStateIsPr uint64_t gpuAddr = 0x4000u; size_t allocSize = size; GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1); - allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false); @@ -625,7 +625,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres uint64_t gpuAddr = 0x4000u; size_t allocSize = size; GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1u); - allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); allocation.getDefaultGmm()->isCompressionEnabled = true; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false); @@ -1036,7 +1036,7 @@ HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredFo EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType())); graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory); - MockGmm mockGmm(pDevice->getGmmClientContext(), nullptr, 100, 100, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm mockGmm(pDevice->getGmmHelper(), nullptr, 100, 100, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); mockGmm.resourceParams.Flags.Info.NotLockable = true; graphicsAllocation.setDefaultGmm(&mockGmm); @@ -1308,7 +1308,7 @@ TEST_F(HwHelperTest, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequir HWTEST_F(HwHelperTest, whenSetCompressedFlagThenProperFlagSet) { auto &hwHelper = HwHelper::get(renderCoreFamily); - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); gmm->resourceParams.Flags.Info.RenderCompressed = 0; hwHelper.applyRenderCompressionFlag(*gmm, 1); diff --git a/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp b/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp index f3ecd10dc5..04629032a9 100644 --- a/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_arg_buffer_tests.cpp @@ -657,7 +657,7 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithIndirectSta {AllocationType::BUFFER_HOST_MEMORY, false}, {AllocationType::SVM_GPU, true}}}; - auto gmm = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); MockGraphicsAllocation gfxAllocation; gfxAllocation.setDefaultGmm(gmm.get()); @@ -697,7 +697,7 @@ TEST_F(KernelArgBufferTest, givenSVMAllocsManagerWithCompressedSVMAllocationsWhe {AllocationType::BUFFER_HOST_MEMORY, false}, {AllocationType::SVM_GPU, true}}}; - auto gmm = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); MockGraphicsAllocation gfxAllocation; gfxAllocation.setDefaultGmm(gmm.get()); diff --git a/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp index 0ed7a9e885..73a1213c31 100644 --- a/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_set_arg_tests.cpp @@ -165,7 +165,7 @@ HWTEST_F(BufferSetArgTest, givenNonPureStatefulArgWhenCompressedBufferIsSetThenS pKernelInfo->argAsPtr(0).bindful = 0; auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()); - graphicsAllocation->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + graphicsAllocation->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); graphicsAllocation->getDefaultGmm()->isCompressionEnabled = true; cl_mem clMem = buffer; diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index 80ba646bcf..5efe916b37 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -1711,7 +1711,7 @@ HWTEST_F(BufferSetSurfaceTests, givenCompressedGmmResourceWhenSurfaceStateIsProg std::unique_ptr buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); auto graphicsAllocation = buffer->getGraphicsAllocation(rootDeviceIndex); - auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); graphicsAllocation->setDefaultGmm(gmm); gmm->isCompressionEnabled = true; @@ -1732,7 +1732,7 @@ HWTEST_F(BufferSetSurfaceTests, givenNonCompressedGmmResourceWhenSurfaceStateIsP auto retVal = CL_SUCCESS; std::unique_ptr buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); - auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); buffer->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(gmm); gmm->isCompressionEnabled = false; @@ -1894,7 +1894,7 @@ HWTEST_F(BufferUnmapTest, givenBufferWithSharingHandlerWhenUnmappingThenUseNonBl auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex()); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId); } auto mappedPtr = clEnqueueMapBuffer(&cmdQ, buffer.get(), CL_TRUE, CL_MAP_WRITE, 0, 1, 0, nullptr, nullptr, &retVal); diff --git a/opencl/test/unit_test/mem_obj/buffer_tests_xehp_and_later.cpp b/opencl/test/unit_test/mem_obj/buffer_tests_xehp_and_later.cpp index 6ac1384992..2b4d67c2d5 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests_xehp_and_later.cpp @@ -34,7 +34,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenDebugFlagSetWhenProgr uint32_t defaultCompressionFormat = gmmContext->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); auto retVal = CL_SUCCESS; - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = true; auto buffer = std::unique_ptr(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); @@ -76,7 +76,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenBufferAllocationInDev auto &device = context.getDevice(0)->getDevice(); auto allocation = buffer->getGraphicsAllocation(device.getRootDeviceIndex()); - auto gmm = new MockGmm(device.getGmmClientContext()); + auto gmm = new MockGmm(device.getGmmHelper()); gmm->isCompressionEnabled = true; allocation->setDefaultGmm(gmm); diff --git a/opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp b/opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp index 005459ad17..596c74c4fc 100644 --- a/opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp +++ b/opencl/test/unit_test/mem_obj/get_mem_object_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -341,7 +341,7 @@ TEST_F(GetMemObjectInfo, GivenValidBufferWhenGettingCompressionOfMemObjectThenCo EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(sizeof(cl_bool), sizeReturned); - MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true); retVal = buffer->getMemObjectInfo( CL_MEM_USES_COMPRESSION_INTEL, @@ -351,7 +351,7 @@ TEST_F(GetMemObjectInfo, GivenValidBufferWhenGettingCompressionOfMemObjectThenCo EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(cl_bool{CL_TRUE}, usesCompression); - MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false); + MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false); retVal = buffer->getMemObjectInfo( CL_MEM_USES_COMPRESSION_INTEL, diff --git a/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp b/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp index c2a0345e49..3fcdb14448 100644 --- a/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp @@ -340,7 +340,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat); - auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imgInfo, false); EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size); @@ -372,7 +372,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat); - auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imgInfo, false); EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size); @@ -412,7 +412,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat); - auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo, false); + auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imgInfo, false); EXPECT_GT(queryGmm->gmmResourceInfo->getSizeAllocation(), bufferSize); diff --git a/opencl/test/unit_test/mem_obj/image3d_tests.cpp b/opencl/test/unit_test/mem_obj/image3d_tests.cpp index db7072c36d..d0db97afce 100644 --- a/opencl/test/unit_test/mem_obj/image3d_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image3d_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -93,7 +93,7 @@ HWTEST_F(CreateImage3DTest, GivenTiledOrForcedLinearWhenCreatingImageThenPropert auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto imageDescriptor = Image::convertDescriptor(imageDesc); auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat); - MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(context->getDevice(0)->getGmmHelper(), imgInfo, false); auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &context->getDevice(0)->getDevice()); auto image = Image::create( @@ -118,7 +118,7 @@ HWTEST_F(CreateImage3DTest, GivenTiledOrForcedLinearWhenCreatingImageThenPropert // query again surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo, false); + MockGmm::queryImgParams(context->getDevice(0)->getGmmHelper(), imgInfo, false); image = Image::create( context, diff --git a/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp b/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp index 423a273aed..5864d2489f 100644 --- a/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_set_arg_tests.cpp @@ -273,7 +273,7 @@ HWTEST_F(ImageSetArgTest, givenImageArraySizeGreaterThanOneButTypeIsNotImageArra imageInfo.imgDesc = Image::convertDescriptor(imageDesc); imageInfo.plane = GMM_NO_PLANE; - auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imageInfo, false); + auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imageInfo, false); allocation->setDefaultGmm(gmm.release()); auto image = std::unique_ptr{Image::createSharedImage( @@ -514,7 +514,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxC typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; McsSurfaceInfo msi = {10, 20, 3}; auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); - mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); cl_image_desc imgDesc = Image2dDefaults::imageDesc; imgDesc.num_samples = 8; @@ -613,7 +613,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationAndCompressionWhenSetArgOnMultisampl typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; McsSurfaceInfo msi = {10, 20, 3}; auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); - mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); cl_image_desc imgDesc = Image2dDefaults::imageDesc; imgDesc.num_samples = 8; @@ -676,7 +676,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa McsSurfaceInfo msi = {10, 20, 3}; auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); - mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); cl_image_desc imgDesc = Image2dDefaults::imageDesc; imgDesc.num_samples = 8; @@ -708,7 +708,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa McsSurfaceInfo msi = {10, 20, 3}; auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); - mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); cl_image_desc imgDesc = Image2dDefaults::imageDesc; imgDesc.num_samples = 8; @@ -737,7 +737,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa McsSurfaceInfo msi = {10, 20, 3}; auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); - mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); cl_image_desc imgDesc = Image2dDefaults::imageDesc; imgDesc.num_samples = 8; diff --git a/opencl/test/unit_test/mem_obj/image_tests.cpp b/opencl/test/unit_test/mem_obj/image_tests.cpp index ac726dbc53..f60ca21b46 100644 --- a/opencl/test/unit_test/mem_obj/image_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests.cpp @@ -1699,7 +1699,7 @@ HWTEST_F(ImageTransformTest, givenSurfaceBaseAddressAndUnifiedSurfaceWhenSetUnif MockContext context; auto image = std::unique_ptr(ImageHelper::create(&context)); auto surfaceState = FamilyType::cmdInitRenderSurfaceState; - auto gmm = std::unique_ptr(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); uint64_t surfBsaseAddress = 0xABCDEF1000; surfaceState.setSurfaceBaseAddress(surfBsaseAddress); auto mockResource = reinterpret_cast(gmm->gmmResourceInfo.get()); diff --git a/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp b/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp index d80b85f7ec..4ea282e504 100644 --- a/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp @@ -89,7 +89,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenCompressionWhenAppendi imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal); - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = true; auto buffer = castToObject(imageDesc.mem_object); @@ -130,7 +130,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenImageFromBufferWhenSet imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal); - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = true; auto buffer = castToObject(imageDesc.mem_object); @@ -173,7 +173,7 @@ HWTEST2_F(XeHPAndLaterImageTests, givenMcsAllocationWhenSetArgIsCalledWithUnifie auto surfaceState = FamilyType::cmdInitRenderSurfaceState; auto imageHw = static_cast *>(image.get()); - mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getRootDeviceEnvironment().getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); surfaceState.setSurfaceBaseAddress(0xABCDEF1000); imageHw->setMcsSurfaceInfo(msi); imageHw->setMcsAllocation(mcsAlloc); @@ -279,7 +279,7 @@ HWTEST2_F(XeHPAndLaterImageTests, givenCompressionWhenAppendingNewAllocationThen gmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = true; gmm->isCompressionEnabled = true; - auto mcsGmm = new MockGmm(context.getDevice(0)->getGmmClientContext()); + auto mcsGmm = new MockGmm(context.getDevice(0)->getGmmHelper()); mcsGmm->isCompressionEnabled = true; mcsGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = true; mcsGmm->gmmResourceInfo->getResourceFlags()->Gpu.UnifiedAuxSurface = true; diff --git a/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp b/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp index 4e4dc53459..8999e65a67 100644 --- a/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -99,7 +99,7 @@ TEST_P(CreateTiledImageTest, GivenSharedTiledImageWhenCheckingIsTiledThenTrueRet info.imgDesc = Image::convertDescriptor(imageDesc); info.plane = GMM_NO_PLANE; - auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), info, false); + auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), info, false); alloc->setDefaultGmm(gmm.release()); @@ -139,7 +139,7 @@ TEST_P(CreateNonTiledImageTest, GivenSharedNonTiledImageWhenCheckingIsTiledThenF info.imgDesc = Image::convertDescriptor(imageDesc); info.plane = GMM_NO_PLANE; - auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), info, false); + auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), info, false); alloc->setDefaultGmm(gmm.release()); diff --git a/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp b/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp index a0593d56ae..425843067f 100644 --- a/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp +++ b/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp @@ -313,7 +313,7 @@ TEST(MemObj, givenCompressedGmmWhenAskingForMappingOnCpuThenDisallow) { context.memoryManager = &memoryManager; auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); - allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, 1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false); @@ -347,7 +347,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) { context.memoryManager = &memoryManager; auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); - allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, 1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false); diff --git a/opencl/test/unit_test/mem_obj/sub_buffer_tests.cpp b/opencl/test/unit_test/mem_obj/sub_buffer_tests.cpp index 2ed573daf2..5753b638ff 100644 --- a/opencl/test/unit_test/mem_obj/sub_buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/sub_buffer_tests.cpp @@ -99,7 +99,7 @@ TEST_F(SubBufferTest, GivenAlignmentThatIsHigherThen4BytesWhenCheckedForValidity cl_buffer_region region3 = {8, 4}; EXPECT_TRUE(buffer->isValidSubBufferOffset(region3.origin)); - MockBuffer::setAllocationType(buffer->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()), context.getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), true); + MockBuffer::setAllocationType(buffer->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()), context.getDevice(0)->getRootDeviceEnvironment().getGmmHelper(), true); EXPECT_FALSE(buffer->isValidSubBufferOffset(region.origin)); EXPECT_FALSE(buffer->isValidSubBufferOffset(region2.origin)); 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 ce122c773f..6b5855f594 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -975,7 +975,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAlloc executionEnvironment.initGmm(); OsAgnosticMemoryManager memoryManager(executionEnvironment); - auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, MemoryConstants::pageSize}); allocation->setDefaultGmm(gmm); @@ -1849,7 +1849,7 @@ TEST(MemoryManager, givenShareableWhenAllocatingGraphicsMemoryThenAllocateSharea } TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenNonNullPointerIsReturned) { - Gmm *gmm = new Gmm(device->getGmmClientContext(), nullptr, 65536, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm *gmm = new Gmm(device->getGmmHelper(), nullptr, 65536, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); EXPECT_NE(nullptr, gmm); delete gmm; } @@ -2608,7 +2608,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIs64KSuitableThenStandard64kHeapIsUsed) { GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get(); - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + 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()); resourceInfo->is64KBPageSuitableValue = true; allocation.setDefaultGmm(gmm.get()); @@ -2618,7 +2618,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIsNot64KSuitableThenStandardHeapIsUsed) { GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get(); - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + 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()); resourceInfo->is64KBPageSuitableValue = false; allocation.setDefaultGmm(gmm.get()); @@ -2885,7 +2885,7 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenMapAuxGpuVaThenForAllEng memoryManager->getRegisteredEngines()[1].commandStreamReceiver->pageTableManager.reset(mockMngr2); MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); - MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext()); + MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); gmm.isCompressionEnabled = true; allocation.setDefaultGmm(&gmm); GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {}; @@ -2929,7 +2929,7 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenUpdateAuxTableGmmErrorTh memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(mockMngr); MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); - MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext()); + MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); gmm.isCompressionEnabled = true; allocation.setDefaultGmm(&gmm); @@ -2961,7 +2961,7 @@ HWTEST_F(PageTableManagerTest, givenNullPageTableManagerWhenMapAuxGpuVaThenNoThr memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(nullptr); MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull); - MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext()); + MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); gmm.isCompressionEnabled = true; allocation.setDefaultGmm(&gmm); @@ -3004,7 +3004,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); - MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext()); + MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper()); allocation.setDefaultGmm(&gmm); bool mapped = memoryManager->mapAuxGpuVA(&allocation); auto hwInfo = executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getHardwareInfo(); diff --git a/opencl/test/unit_test/memory_manager/migraton_controller_tests.cpp b/opencl/test/unit_test/memory_manager/migraton_controller_tests.cpp index bc33c26e3d..f3ed07098f 100644 --- a/opencl/test/unit_test/memory_manager/migraton_controller_tests.cpp +++ b/opencl/test/unit_test/memory_manager/migraton_controller_tests.cpp @@ -98,8 +98,8 @@ TEST_F(MigrationControllerTests, givenNotLockableBufferAllocationWithDefinedLoca auto srcAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(0); auto dstAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(1); - auto gmm0 = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); - auto gmm1 = new Gmm(context.getDevice(1)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm0 = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm1 = new Gmm(context.getDevice(1)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); srcAllocation->setDefaultGmm(gmm0); dstAllocation->setDefaultGmm(gmm1); @@ -212,4 +212,4 @@ TEST_F(MigrationControllerTests, whenHandleMigrationThenProperTagAddressAndTaskC EXPECT_EQ(pCsr0->getTagAddress(), migrationSyncData->tagAddress); EXPECT_EQ(pCsr0->peekTaskCount() + 1, migrationSyncData->latestTaskCountUsed); -} \ No newline at end of file +} diff --git a/opencl/test/unit_test/mocks/mock_buffer.h b/opencl/test/unit_test/mocks/mock_buffer.h index aeaefdd8c4..e42aaeb07d 100644 --- a/opencl/test/unit_test/mocks/mock_buffer.h +++ b/opencl/test/unit_test/mocks/mock_buffer.h @@ -54,12 +54,12 @@ class MockBuffer : public MockBufferStorage, public Buffer { void setAllocationType(uint32_t rootDeviceIndex, bool compressed) { setAllocationType(multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex), - device->getRootDeviceEnvironment().getGmmClientContext(), compressed); + device->getRootDeviceEnvironment().getGmmHelper(), compressed); } - static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmClientContext *gmmClientContext, bool compressed) { + static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmHelper *gmmHelper, bool compressed) { if (compressed && !graphicsAllocation->getDefaultGmm()) { - graphicsAllocation->setDefaultGmm(new Gmm(gmmClientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true)); + graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true)); } if (graphicsAllocation->getDefaultGmm()) { diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp index 3e2bcde186..342722fb0c 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp @@ -900,7 +900,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPageTableManagerAndMapTrueWhenUpda auto mockMngr = new MockGmmPageTableMngr(); csr->pageTableManager.reset(mockMngr); executionEnvironment.rootDeviceEnvironments[0]->initGmm(); - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext()); + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper()); auto result = csr->pageTableManager->updateAuxTable(0, gmm.get(), true); EXPECT_EQ(0ull, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseGpuVA); EXPECT_EQ(gmm->gmmResourceInfo->peekHandle(), mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseResInfo); @@ -915,7 +915,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPageTableManagerAndMapFalseWhenUpd auto mockMngr = new MockGmmPageTableMngr(); csr->pageTableManager.reset(mockMngr); executionEnvironment.rootDeviceEnvironments[0]->initGmm(); - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext()); + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper()); auto result = csr->pageTableManager->updateAuxTable(0, gmm.get(), false); EXPECT_EQ(0ull, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseGpuVA); EXPECT_EQ(gmm->gmmResourceInfo->peekHandle(), mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseResInfo); diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index e7d6a64295..0a559d7b65 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -2773,7 +2773,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation mock->ioctl_expected.gemWait = 1; mock->ioctl_expected.gemClose = 1; - auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize}); allocation->setDefaultGmm(gmm); diff --git a/opencl/test/unit_test/os_interface/windows/file_logger_win_tests.cpp b/opencl/test/unit_test/os_interface/windows/file_logger_win_tests.cpp index 14b3bd2e0d..1698e7750e 100644 --- a/opencl/test/unit_test/os_interface/windows/file_logger_win_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/file_logger_win_tests.cpp @@ -28,7 +28,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) { bool logFileCreated = fileExists(fileLogger.getLogFileName()); EXPECT_FALSE(logFileCreated); - MockWddmAllocation allocation(getGmmClientContext()); + MockWddmAllocation allocation(getGmmHelper()); allocation.handle = 4; allocation.setAllocationType(AllocationType::BUFFER); allocation.memoryPool = MemoryPool::System64KBPages; @@ -74,7 +74,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIs auto executionEnvironment = std::unique_ptr(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u)); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext()); + MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper()); allocation.handle = 4; allocation.setAllocationType(AllocationType::BUFFER); allocation.memoryPool = MemoryPool::System64KBPages; diff --git a/opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h b/opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h index 5552bfb9c2..a32c4dc268 100644 --- a/opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h +++ b/opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h @@ -14,12 +14,12 @@ namespace NEO { class MockWddmAllocation : public WddmAllocation { public: - MockWddmAllocation(GmmClientContext *gmmClientContext) : MockWddmAllocation(gmmClientContext, EngineLimits::maxHandleCount) {} - MockWddmAllocation(GmmClientContext *gmmClientContext, uint32_t numGmms) : WddmAllocation(0, numGmms, AllocationType::UNKNOWN, - nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 3u), - gpuPtr(gpuAddress), handle(handles[0]) { + MockWddmAllocation(GmmHelper *gmmHelper) : MockWddmAllocation(gmmHelper, EngineLimits::maxHandleCount) {} + MockWddmAllocation(GmmHelper *gmmHelper, uint32_t numGmms) : WddmAllocation(0, numGmms, AllocationType::UNKNOWN, + nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 3u), + gpuPtr(gpuAddress), handle(handles[0]) { for (uint32_t i = 0; i < numGmms; i++) { - setGmm(new MockGmm(gmmClientContext), i); + setGmm(new MockGmm(gmmHelper), i); setHandle(ALLOCATION_HANDLE, i); } } diff --git a/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp index 561d89ac1a..7a137f365f 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp @@ -54,11 +54,11 @@ std::unique_ptr createHwDeviceIdFromAdapterLuid(OsEnvironmentWin using namespace NEO; namespace GmmHelperFunctions { -Gmm *getGmm(void *ptr, size_t size, GmmClientContext *clientContext) { +Gmm *getGmm(void *ptr, size_t size, GmmHelper *gmmHelper) { size_t alignedSize = alignSizeWholePage(ptr, size); void *alignedPtr = alignUp(ptr, 4096); - Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + Gmm *gmm = new Gmm(gmmHelper, alignedPtr, alignedSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr); return gmm; } @@ -89,7 +89,7 @@ TEST_F(Wddm20Tests, GivenExisitingContextWhenInitializingWddmThenCreateContextRe } TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) { - auto gmm = std::unique_ptr(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto mockGmmRes = reinterpret_cast(gmm->gmmResourceInfo.get()); mockGmmRes->setUnifiedAuxTranslationCapable(); @@ -248,7 +248,7 @@ TEST_F(Wddm20Tests, whenInitPrivateDataThenDefaultValuesAreSet) { TEST_F(Wddm20Tests, WhenCreatingAllocationAndDestroyingAllocationThenCorrectResultReturned) { OsAgnosticMemoryManager mm(*executionEnvironment); WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); - Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext()); + Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper()); allocation.setDefaultGmm(gmm); auto status = wddm->createAllocation(&allocation); @@ -272,7 +272,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz size_t alignedPages = alignedSize / MemoryConstants::pageSize; WddmAllocation allocation(0, AllocationType::UNKNOWN, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 0u, 1u); - Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext()); + Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmHelper()); allocation.setDefaultGmm(gmm); auto status = wddm->createAllocation(&allocation); @@ -314,7 +314,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) { void *fakePtr = reinterpret_cast(0x123); WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); - std::unique_ptr gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext())); + std::unique_ptr gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmHelper())); allocation.setDefaultGmm(gmm.get()); auto status = wddm->createAllocation(&allocation); @@ -332,7 +332,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmS TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap0ThenItHasGpuAddressWithinHeapInternalLimits) { void *alignedPtr = (void *)0x12000; size_t alignedSize = 0x2000; - std::unique_ptr gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize, getGmmClientContext())); + std::unique_ptr gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize, getGmmHelper())); uint64_t gpuAddress = 0u; auto heapBase = wddm->getGfxPartition().Heap32[static_cast(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base; auto heapLimit = wddm->getGfxPartition().Heap32[static_cast(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Limit; @@ -399,7 +399,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati TEST_F(Wddm20Tests, WhenMappingAndFreeingGpuVaThenReturnIsCorrect) { OsAgnosticMemoryManager mm(*executionEnvironment); WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); - Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext()); + Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper()); allocation.setDefaultGmm(gmm); auto status = wddm->createAllocation(&allocation); @@ -425,7 +425,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) { OsAgnosticMemoryManager mm(*executionEnvironment); WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); - auto gmm = std::unique_ptr(GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext())); + auto gmm = std::unique_ptr(GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper())); allocation.setDefaultGmm(gmm.get()); auto status = wddm->createAllocation(&allocation); @@ -443,7 +443,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) { TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenCreateResourceFlagIsEnabled) { init(); WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u); - auto gmm = std::unique_ptr(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext())); + auto gmm = std::unique_ptr(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmHelper())); allocation.setDefaultGmm(gmm.get()); auto status = wddm->createAllocation(&allocation); EXPECT_EQ(STATUS_SUCCESS, status); @@ -460,7 +460,7 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandl }; MemoryManagerCreate memoryManager(false, false, *executionEnvironment); WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u); - auto gmm = std::unique_ptr(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext())); + auto gmm = std::unique_ptr(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmHelper())); allocation.setDefaultGmm(gmm.get()); auto status = memoryManager.createGpuAllocationsWithRetry(&allocation); EXPECT_TRUE(status); @@ -484,7 +484,7 @@ TEST(WddmAllocationTest, whenAllocationIsNotShareableThenItDoesntReturnSharedHan TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) { OsAgnosticMemoryManager mm(*executionEnvironment); WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); - Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext()); + Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper()); allocation.setDefaultGmm(gmm); auto status = wddm->createAllocation(&allocation); @@ -517,7 +517,7 @@ TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) { TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) { void *pSysMem = (void *)0x1000; - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); EXPECT_EQ(0u, status); @@ -554,7 +554,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) { void *pSysMem = (void *)0x1000; - std::unique_ptr gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); EXPECT_EQ(0u, status); @@ -744,7 +744,7 @@ TEST_F(Wddm20Tests, WhenMakingNonResidentThenEvictIsCalled) { } TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.getResidencyData().updateCompletionData(10, osContext->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -770,7 +770,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo } TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.getResidencyData().updateCompletionData(10, osContext->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -793,7 +793,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle } TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.getResidencyData().updateCompletionData(10, osContext->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -850,7 +850,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) { gdi->createAllocation2 = FailingCreateAllocation::mockCreateAllocation2; void *fakePtr = reinterpret_cast(0x123); - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), fakePtr, 100, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); allocation.setDefaultGmm(gmm.get()); @@ -877,7 +877,7 @@ TEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemor handleStorage.fragmentStorageData[0].freeTheFragment = false; handleStorage.fragmentStorageData[0].osHandleStorage = &handle; handleStorage.fragmentStorageData[0].residency = &residency; - handle.gmm = GmmHelperFunctions::getGmm(nullptr, 0, getGmmClientContext()); + handle.gmm = GmmHelperFunctions::getGmm(nullptr, 0, getGmmHelper()); NTSTATUS result = wddm->createAllocationsAndMapGpuVa(handleStorage); @@ -964,7 +964,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside } TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.handle = 0x3; WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]); mockWddm.makeResidentStatus = false; @@ -976,7 +976,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside } TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.handle = 0x3; WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]); mockWddm.makeResidentStatus = false; @@ -990,7 +990,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryR } TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.handle = 0x2; WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]); mockWddm.makeResidentStatus = false; @@ -1005,7 +1005,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside } TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.handle = 0x2; WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]); mockWddm.makeResidentResults = {false, true}; @@ -1021,7 +1021,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside } TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.handle = 0x2; WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]); auto mockTemporaryResources = static_cast(mockWddm.temporaryResources.get()); @@ -1045,7 +1045,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesThenAcqui } TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]); auto mockTemporaryResources = static_cast(mockWddm.temporaryResources.get()); mockTemporaryResources->resourceHandles.push_back(allocation.handle); @@ -1134,7 +1134,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceThenOtherReso TEST_F(WddmLockWithMakeResidentTests, whenAlllocationNeedsBlockingMakeResidentBeforeLockThenLockWithBlockingMakeResident) { WddmMemoryManager memoryManager(*executionEnvironment); - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); allocation.needsMakeResidentBeforeLock = false; memoryManager.lockResource(&allocation); EXPECT_EQ(1u, wddm->lockResult.called); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp index 3c95f4749b..5fe326003d 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp @@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) { uint64_t gpuPtr = 0u; - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base, wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr); @@ -110,7 +110,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDa } TEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListenerNotifyMakeResidentIsFedWithCorrectParams) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); wddmWithKmDafMock->makeResident(&allocation.handle, 1, false, nullptr, 0x1000); @@ -123,7 +123,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListener } TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyEvictIsFedWithCorrectParams) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); uint64_t sizeToTrim; wddmWithKmDafMock->evict(&allocation.handle, 1, sizeToTrim); @@ -137,7 +137,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE } TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); auto handle = 0u; auto resourceHandle = 0u; auto ptr = reinterpret_cast(0x10000); @@ -152,7 +152,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList } TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); auto handle = 0u; wddmWithKmDafMock->createAllocation(gmm.get(), handle); @@ -167,7 +167,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) { OsHandleStorage storage; OsHandleWin osHandle; - auto gmm = std::unique_ptr(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + auto gmm = std::unique_ptr(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); storage.fragmentStorageData[0].osHandleStorage = &osHandle; storage.fragmentStorageData[0].fragmentSize = 100; static_cast(storage.fragmentStorageData[0].osHandleStorage)->gmm = gmm.get(); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index ab3325a114..95f02bdf61 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -95,7 +95,7 @@ TEST(WddmMemoryManager, WhenWddmMemoryManagerIsCreatedThenItIsNonAssignable) { TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { auto executionEnvironment = std::unique_ptr(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u)); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext()); + MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper()); MockOsContext osContext(1u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo))); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); @@ -106,7 +106,7 @@ TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGetting TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCreatedThenMaxOsContextCountIsUsedInstead) { auto executionEnvironment = std::unique_ptr(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u)); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext()); + MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper()); allocation.setTrimCandidateListPosition(1u, 700u); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); @@ -115,7 +115,7 @@ TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCrea TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) { auto executionEnvironment = std::unique_ptr(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u)); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext()); + MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper()); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u)); } @@ -302,7 +302,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); auto osHandle = 1u; gdi->getQueryResourceInfoArgOut().NumAllocations = 1; - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); D3DDDI_OPENALLOCATIONINFO allocationInfo; allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); @@ -322,7 +322,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); auto osHandle = 1u; gdi->getQueryResourceInfoArgOut().NumAllocations = 1; - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); D3DDDI_OPENALLOCATIONINFO allocationInfo; allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); @@ -348,7 +348,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); auto osHandle = 1u; gdi->getQueryResourceInfoArgOut().NumAllocations = 1; - auto gmm = std::make_unique(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); D3DDDI_OPENALLOCATIONINFO allocationInfo; allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); @@ -556,7 +556,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT size_t size = 0x1000; uint64_t gpuPtr = 0x123; - MockWddmAllocation gfxAllocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation gfxAllocation(rootDeviceEnvironment->getGmmHelper()); HostPtrEntryKey key{cpuPtr, gfxAllocation.getRootDeviceIndex()}; gfxAllocation.cpuPtr = cpuPtr; gfxAllocation.size = size; @@ -623,7 +623,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs auto osHandle = 1u; void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield); @@ -639,7 +639,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestroyedThenDestroyAllocationFromGdiIsNotInvoked) { gdi->getQueryResourceInfoArgOut().NumAllocations = 1; - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); D3DDDI_OPENALLOCATIONINFO allocationInfo; allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); @@ -666,7 +666,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) { void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast(1), 0, AllocationType::SHARED_IMAGE); @@ -698,7 +698,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness auto osHandle = 1u; void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); memoryManager->setForce32BitAllocations(true); @@ -721,7 +721,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit auto osHandle = 1u; void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); memoryManager->setForce32BitAllocations(true); @@ -743,7 +743,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl auto osHandle = 1u; void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0); @@ -765,7 +765,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared auto size = 4096u; void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0); @@ -871,7 +871,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa auto size = 4096u; void *pSysMem = reinterpret_cast(0x1000); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); wddm->failOpenSharedHandle = true; @@ -1018,7 +1018,7 @@ TEST_F(WddmMemoryManagerTest, GivenOffsetsWhenAllocatingGpuMemHostThenAllocatedO if (memoryManager->isLimitedGPU(0)) { GTEST_SKIP(); } - MockWddmAllocation alloc(rootDeviceEnvironment->getGmmClientContext()), allocOffseted(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation alloc(rootDeviceEnvironment->getGmmHelper()), allocOffseted(rootDeviceEnvironment->getGmmHelper()); // three pages void *ptr = alignedMalloc(4 * 4096, 4096); ASSERT_NE(nullptr, ptr); @@ -1074,7 +1074,7 @@ TEST_F(WddmMemoryManagerTest, WhenAllocatingGpuMemThenOsInternalStorageIsPopulat if (memoryManager->isLimitedGPU(0)) { GTEST_SKIP(); } - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); // three pages void *ptr = alignedMalloc(3 * 4096, 4096); auto *gpuAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, false, 3 * MemoryConstants::pageSize}, ptr); @@ -1092,7 +1092,7 @@ TEST_F(WddmMemoryManagerTest, WhenAllocatingGpuMemThenOsInternalStorageIsPopulat } TEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); uint32_t size = 4096; void *ptr = reinterpret_cast(4096); auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, AllocationType::BUFFER); @@ -1102,7 +1102,7 @@ TEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmC } TEST_F(WddmMemoryManagerTest, GivenUnAlignedPointerAndSizeWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); uint32_t size = 0x1001; void *ptr = reinterpret_cast(0x1001); auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, AllocationType::BUFFER); @@ -1200,7 +1200,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT osHandle0->handle = ALLOCATION_HANDLE; storage.fragmentStorageData[0].freeTheFragment = true; - osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); storage.fragmentStorageData[1].osHandleStorage = osHandle1; osHandle1->handle = ALLOCATION_HANDLE; @@ -1211,7 +1211,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT storage.fragmentStorageData[2].osHandleStorage = osHandle2; osHandle2->handle = ALLOCATION_HANDLE; storage.fragmentStorageData[2].freeTheFragment = true; - osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); storage.fragmentStorageData[2].residency = new ResidencyData(maxOsContextCount); memoryManager->cleanOsHandles(storage, 0); @@ -1259,7 +1259,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestriction TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) { void *ptr = reinterpret_cast(0x1000); size_t size = 0x1000; - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); memoryManager->setDeferredDeleter(nullptr); setMapGpuVaFailConfigFcn(0, 1); @@ -1273,7 +1273,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) { void *ptr = reinterpret_cast(0x10000); size_t size = 0x1000; - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); MockDeferredDeleter *deleter = new MockDeferredDeleter; memoryManager->setDeferredDeleter(deleter); @@ -1289,7 +1289,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) { void *ptr = reinterpret_cast(0x1000); size_t size = 0x1000; - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); MockDeferredDeleter *deleter = new MockDeferredDeleter; memoryManager->setDeferredDeleter(deleter); @@ -1459,7 +1459,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount); handleStorage.fragmentStorageData[0].freeTheFragment = true; auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); - osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); handleStorage.fragmentCount = 1; FragmentStorage fragment = {}; @@ -1497,7 +1497,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount); handleStorage.fragmentStorageData[0].freeTheFragment = true; auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); - osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); handleStorage.fragmentCount = 1; FragmentStorage fragment = {}; @@ -1929,7 +1929,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag GTEST_SKIP(); } auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->isCompressionEnabled = true; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get()); @@ -1961,7 +1961,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag GTEST_SKIP(); } auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->isCompressionEnabled = true; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get()); @@ -2062,7 +2062,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenReleaseingThen TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) { auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->isCompressionEnabled = false; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; WddmMock wddm(*rootDeviceEnvironment); @@ -2088,7 +2088,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThe TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) { auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); - std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + std::unique_ptr gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); gmm->isCompressionEnabled = false; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; WddmMock wddm(*rootDeviceEnvironment); @@ -2117,7 +2117,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsUnsetThenD engine.commandStreamReceiver->pageTableManager.reset(mockMngr); } - auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto myGmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); myGmm->isCompressionEnabled = false; myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1; @@ -2154,7 +2154,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsSetThenUpd engine.commandStreamReceiver->pageTableManager.reset(mockMngr); } - auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto myGmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); myGmm->isCompressionEnabled = true; myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1; @@ -2274,7 +2274,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingAllocationWithReservedGpuVirtu } TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), 1); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), 1); allocation.setAllocationType(AllocationType::KERNEL_ISA); uint64_t gpuAddress = 0x123; uint64_t sizeForFree = 0x1234; @@ -2296,7 +2296,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationAndPreferredGpuVaI } uint32_t numGmms = 10; - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), numGmms); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), numGmms); allocation.setAllocationType(AllocationType::BUFFER); allocation.storageInfo.multiStorage = true; @@ -2600,7 +2600,7 @@ TEST(WddmMemoryManagerCopyMemoryToAllocationBanksTest, givenAllocationWithMultiT wddm->init(); MemoryManagerCreate memoryManager(true, true, executionEnvironment); - MockWddmAllocation mockAllocation(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext()); + MockWddmAllocation mockAllocation(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper()); mockAllocation.storageInfo.memoryBanks = 0b1111; DeviceBitfield memoryBanksToCopy = 0b1010; @@ -2634,7 +2634,7 @@ class WddmMemoryManagerMock : public MockWddmMemoryManagerFixture, public ::test }; TEST_F(WddmMemoryManagerMock, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), 4); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), 4); allocation.setAllocationType(AllocationType::KERNEL_ISA); uint64_t gpuAddress = 0x123; uint64_t sizeForFree = 0x1234; diff --git a/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp index 307d4f8feb..69de1f0e89 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp @@ -137,7 +137,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT osContext->incRefInternal(); residencyController = &static_cast(osContext)->getResidencyController(); - gmmClientContext = executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(); + gmmHelper = executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(); } void TearDown() { @@ -150,7 +150,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT WddmMock *wddm = nullptr; OsContext *osContext; WddmResidencyController *residencyController; - GmmClientContext *gmmClientContext = nullptr; + GmmHelper *gmmHelper = nullptr; }; struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { @@ -176,7 +176,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { osContext->incRefInternal(); residencyController = &static_cast(osContext)->getResidencyController(); - gmmClientContext = executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(); + gmmHelper = executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(); } void TearDown() { @@ -191,7 +191,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { OsContext *osContext = nullptr; MockGdi *gdi = nullptr; WddmResidencyController *residencyController = nullptr; - GmmClientContext *gmmClientContext = nullptr; + GmmHelper *gmmHelper = nullptr; }; TEST(WddmResidencyController, givenWddmResidencyControllerWhenItIsConstructedThenDoNotRegisterTrimCallback) { @@ -271,7 +271,7 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenWddmResidencyControllerWhenItIsD } TEST_F(WddmResidencyControllerTest, givenUsedAllocationWhenCallingRemoveFromTrimCandidateListIfUsedThenRemoveIt) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation); residencyController->removeFromTrimCandidateListIfUsed(&allocation, false); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContextId)); @@ -284,13 +284,13 @@ TEST_F(WddmResidencyControllerTest, givenWddmResidencyControllerWhenIsMemoryExha } TEST_F(WddmResidencyControllerTest, givenUnusedAllocationWhenCallingRemoveFromTrimCandidateListIfUsedThenIgnore) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->removeFromTrimCandidateListIfUsed(&allocation, false); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContextId)); } TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenAllocationIsPlacedInContainerAndAssignedPosition) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation); EXPECT_NE(0u, residencyController->trimCandidateList.size()); @@ -303,7 +303,7 @@ TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenAllocationI } TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenDoNotInsertAllocationAlreadyOnTheList) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->trimCandidateList.resize(0); @@ -324,7 +324,7 @@ TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenDoNotInsert } TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenUnusedPositionIsAssigned) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation); residencyController->removeFromTrimCandidateList(&allocation, false); @@ -333,7 +333,7 @@ TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenUnusedP } TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenAllocationInAssignedPositionIsRemoved) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation); size_t position = allocation.getTrimCandidateListPosition(osContextId); @@ -346,7 +346,7 @@ TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenAllocat } TEST_F(WddmResidencyControllerTest, GivenOneAllocationWhenRemovingFromTrimCandidateListThenTrimCandidateListIsEmpty) { - MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper()); residencyController->trimCandidateList.resize(0); @@ -358,8 +358,8 @@ TEST_F(WddmResidencyControllerTest, GivenOneAllocationWhenRemovingFromTrimCandid } TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenLastAllocationAndAllPreviousEmptyEntriesAreRemoved) { - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); residencyController->trimCandidateList.resize(0); @@ -379,9 +379,9 @@ TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenLastAll } TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenSuccessivePositionIsAssigned) { - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation1); residencyController->addToTrimCandidateList(&allocation2); @@ -393,9 +393,9 @@ TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenSuccessiveP } TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFromTrimCandidateListAndCompactingThenRemoveEntry) { - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation1); residencyController->addToTrimCandidateList(&allocation2); @@ -411,9 +411,9 @@ TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFrom } TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFromTrimCandidateListThenReplaceWithNullEntry) { - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation1); residencyController->addToTrimCandidateList(&allocation2); @@ -429,10 +429,10 @@ TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFrom } TEST_F(WddmResidencyControllerTest, WhenCompactingTrimCandidateListThenInitialNullEntriesAreRemovedAndPositionsAreUpdated) { - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation1); residencyController->addToTrimCandidateList(&allocation2); @@ -459,10 +459,10 @@ TEST_F(WddmResidencyControllerTest, WhenCompactingTrimCandidateListThenInitialNu } TEST_F(WddmResidencyControllerTest, WhenCompactingTrimCandidateListThenNonNullEntriesAreNotRemoved) { - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmHelper()); residencyController->addToTrimCandidateList(&allocation1); residencyController->addToTrimCandidateList(&allocation2); @@ -501,8 +501,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenNotUsedAllocationsFromPreviousPe trimNotification.NumBytesToTrim = 0; // allocations have fence value == 0 by default - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); allocation1.getResidencyData().updateCompletionData(0, osContextId); allocation2.getResidencyData().updateCompletionData(0, osContextId); @@ -537,8 +537,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenOneUsedAllocationFromPreviousPer trimNotification.NumBytesToTrim = 0; // allocations have fence value == 0 by default - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); allocation1.getResidencyData().resident[osContextId] = true; // mark allocation used from last periodic trim allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -654,9 +654,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, GivenZeroWhenTrimmingToBudgetThenTrue TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenAllDoneAllocationsAreTrimmed) { gdi->setNonZeroNumBytesToTrimInEvict(); - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -693,7 +693,7 @@ TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenAllDoneAlloca TEST_F(WddmResidencyControllerWithGdiTest, GivenNumBytesToTrimIsNotZeroWhenTrimmingToBudgetThenFalseIsReturned) { gdi->setNonZeroNumBytesToTrimInEvict(); - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -751,9 +751,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, GivenNumBytesToTrimIsZeroWhenTrimming TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenEvictedAllocationIsMarkedNonResident) { gdi->setNonZeroNumBytesToTrimInEvict(); - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext()); - MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper()); + MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper()); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -784,7 +784,7 @@ TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenEvictedAlloca TEST_F(WddmResidencyControllerWithGdiTest, GivenLastFenceIsGreaterThanMonitoredWhenTrimmingToBudgetThenWaitForCpu) { gdi->setNonZeroNumBytesToTrimInEvict(); - MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext()); + MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper()); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(2, osContextId); @@ -935,10 +935,10 @@ TEST_F(WddmResidencyControllerLockTest, givenPeriodicTrimAndTrimToBudgetWhenTrim } TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenMakingResidentResidencyAllocationsThenAllAllocationsAreMarked) { - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); - MockWddmAllocation allocation3(gmmClientContext); - MockWddmAllocation allocation4(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); + MockWddmAllocation allocation3(gmmHelper); + MockWddmAllocation allocation4(gmmHelper); ResidencyContainer residencyPack{&allocation1, &allocation2, &allocation3, &allocation4}; residencyController->makeResidentResidencyAllocations(residencyPack); @@ -950,10 +950,10 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenMakingResidentRes } TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenMakingResidentResidencyAllocationsThenLastFenceIsUpdated) { - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); - MockWddmAllocation allocation3(gmmClientContext); - MockWddmAllocation allocation4(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); + MockWddmAllocation allocation3(gmmHelper); + MockWddmAllocation allocation4(gmmHelper); ResidencyContainer residencyPack{&allocation1, &allocation2, &allocation3, &allocation4}; residencyController->getMonitoredFence().currentFenceValue = 20; @@ -970,8 +970,8 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocation if (executionEnvironment->memoryManager.get()->isLimitedGPU(0)) { GTEST_SKIP(); } - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); void *ptr = reinterpret_cast(wddm->virtualAllocAddress + 0x1500); wddm->callBaseMakeResident = true; @@ -990,8 +990,8 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocation } TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocationsWhenMakingResidentResidencyAllocationsThenLastFencePlusOneIsSet) { - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); WddmAllocation *allocationTriple = static_cast(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, 2 * MemoryConstants::pageSize}, reinterpret_cast(0x1500))); @@ -1008,10 +1008,10 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocation } TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenDontMarkAllocationsAsResident) { - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); - MockWddmAllocation allocation3(gmmClientContext); - MockWddmAllocation allocation4(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); + MockWddmAllocation allocation3(gmmHelper); + MockWddmAllocation allocation4(gmmHelper); wddm->makeResidentNumberOfBytesToTrim = 4 * 4096; wddm->makeResidentStatus = false; @@ -1029,8 +1029,8 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin } TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenDontMarkTripleAllocationsAsResident) { - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); wddm->callBaseCreateAllocationsAndMapGpuVa = true; void *ptr = reinterpret_cast(wddm->getWddmMinAddress() + 0x1500); WddmAllocation *allocationTriple = static_cast(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, 2 * MemoryConstants::pageSize}, ptr)); @@ -1053,7 +1053,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin } TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenCallItAgainWithCantTrimFurtherSetToTrue) { - MockWddmAllocation allocation1(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); wddm->makeResidentNumberOfBytesToTrim = 4 * 4096; wddm->makeResidentStatus = false; @@ -1067,8 +1067,8 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin } TEST_F(WddmResidencyControllerWithMockWddmTest, givenAllocationPackPassedWhenCallingMakeResidentResidencyAllocationsThenItIsUsed) { - MockWddmAllocation allocation1(gmmClientContext); - MockWddmAllocation allocation2(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); + MockWddmAllocation allocation2(gmmHelper); allocation1.handle = 1; allocation2.handle = 2; ResidencyContainer residencyPack{&allocation1, &allocation2}; @@ -1083,7 +1083,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenAllocationPackPassedWhenCal } TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToBudgetSuceedsWhenCallingMakeResidentResidencyAllocationsThenSucceed) { - MockWddmAllocation allocation1(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); void *cpuPtr = reinterpret_cast(wddm->getWddmMinAddress() + 0x1000); size_t allocationSize = 0x1000; WddmAllocation allocationToTrim(0, AllocationType::UNKNOWN, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, 0u, 1u); @@ -1105,7 +1105,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB } TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenMemoryBudgetExhaustedIsSetToTrue) { - MockWddmAllocation allocation1(gmmClientContext); + MockWddmAllocation allocation1(gmmHelper); ResidencyContainer residencyPack{&allocation1}; wddm->makeResidentResults = {false, true}; diff --git a/opencl/test/unit_test/os_interface/windows/wddm_residency_handler_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_residency_handler_tests.cpp index e1404a47dc..5463da13e6 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_residency_handler_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_residency_handler_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -28,8 +28,8 @@ struct WddmMemoryOperationsHandlerTest : public WddmTest { void SetUp() override { WddmTest::SetUp(); wddmMemoryOperationsHandler = std::make_unique(wddm); - wddmAllocation = std::make_unique(rootDeviceEnvironment->getGmmClientContext()); - wddmFragmentedAllocation = std::make_unique(rootDeviceEnvironment->getGmmClientContext()); + wddmAllocation = std::make_unique(rootDeviceEnvironment->getGmmHelper()); + wddmFragmentedAllocation = std::make_unique(rootDeviceEnvironment->getGmmHelper()); wddmAllocation->handle = 0x2u; osHandleStorageFirst = std::make_unique(); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp index 725b9ee5c5..b9c25efaa4 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp @@ -58,7 +58,7 @@ class CreateFromGlTexture : public ::testing::Test { void updateImgInfoAndForceGmm() { imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); - gmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), imgInfo, false); + gmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmHelper(), imgInfo, false); tempMM.forceAllocationSize = imgInfo.size; tempMM.forceGmm = gmm.get(); @@ -70,7 +70,7 @@ class CreateFromGlTexture : public ::testing::Test { mcsImgDesc.imageWidth = 128; mcsImgDesc.imageType = ImageType::Image2D; auto mcsImgInfo = MockGmm::initImgInfo(mcsImgDesc, 0, nullptr); - mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), mcsImgInfo, false); + mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmHelper(), mcsImgInfo, false); tempMM.forceMcsGmm = mcsGmm.get(); } } diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp index ac3461793e..f1121467cd 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp @@ -87,7 +87,7 @@ TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenReleasin TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenCreatingThenReuseGmmResourceToo) { std::unique_ptr glBuffer1(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); - glBuffer1->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), (void *)0x100, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + glBuffer1->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), (void *)0x100, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); std::unique_ptr glBuffer2(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp index 3b600a1102..d4d099bf7c 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp @@ -256,7 +256,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalle TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) { void *ptr = (void *)0x1000; auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex(); - auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); mockGlSharing->m_bufferInfoOutput.pGmmResInfo = gmm->gmmResourceInfo->peekGmmResourceInfo(); mockGlSharing->uploadDataToBufferInfo(); @@ -902,7 +902,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledThenCopyOnGpu auto gfxAllocation = buffer->getGraphicsAllocation(rootDeviceIndex); auto pClDevice = context.getDevice(0); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmHelper()), handleId); } auto commandQueue = CommandQueue::create(&context, pClDevice, 0, false, retVal); @@ -946,7 +946,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledTwiceThenReus auto gfxAllocation = buffer->getGraphicsAllocation(rootDeviceIndex); auto pClDevice = context.getDevice(0); for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) { - gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmClientContext()), handleId); + gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmHelper()), handleId); } auto commandQueue = CommandQueue::create(&context, pClDevice, 0, false, retVal); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp index da4e7c8dc3..3e0c57f39c 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -67,7 +67,7 @@ class GlSharingTextureTests : public ::testing::Test { mockGlSharingFunctions = glSharing->sharingFunctions.release(); clContext->setSharingFunctions(mockGlSharingFunctions); - tempMM->forceGmm = MockGmm::queryImgParams(device->getGmmClientContext(), imgInfo, false); + tempMM->forceGmm = MockGmm::queryImgParams(device->getGmmHelper(), imgInfo, false); tempMM->forceAllocationSize = textureSize; textureSize = imgInfo.size; textureId = 1; diff --git a/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h b/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h index f7e49e79e7..6c05041ce7 100644 --- a/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h +++ b/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h @@ -68,7 +68,7 @@ struct UnifiedSharingMockMemoryManager : MockMemoryManager { rootDeviceIndex, false, false, false); graphicsAllocation->setSharedHandle(static_cast(reinterpret_cast(handle))); graphicsAllocation->set32BitAllocation(false); - graphicsAllocation->setDefaultGmm(new MockGmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext())); + graphicsAllocation->setDefaultGmm(new MockGmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper())); return graphicsAllocation; } }; diff --git a/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp b/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp index 5c3aa65bc5..bf055c87bb 100644 --- a/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp +++ b/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp @@ -565,7 +565,7 @@ XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagSetWhenCompressionIsUsedThe blitCmd.setDestinationX2CoordinateRight(1); blitCmd.setDestinationY2CoordinateBottom(1); - auto gmm = std::make_unique(clDevice->getGmmClientContext()); + auto gmm = std::make_unique(clDevice->getGmmHelper()); gmm->isCompressionEnabled = true; MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); diff --git a/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp b/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp index 334893d9a0..ac4a150878 100644 --- a/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp +++ b/opencl/test/unit_test/xe_hpg_core/test_cmds_programming_xe_hpg_core.cpp @@ -167,7 +167,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = true; auto buffer = castToObject(imageDesc.mem_object); @@ -241,7 +241,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = true; auto buffer = castToObject(imageDesc.mem_object); @@ -284,7 +284,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = false; auto buffer = castToObject(imageDesc.mem_object); @@ -327,7 +327,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); - auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm->isCompressionEnabled = true; gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true; diff --git a/shared/source/gmm_helper/gmm.cpp b/shared/source/gmm_helper/gmm.cpp index 4a5af7d230..fa5eaf8994 100644 --- a/shared/source/gmm_helper/gmm.cpp +++ b/shared/source/gmm_helper/gmm.cpp @@ -20,8 +20,8 @@ #include "shared/source/memory_manager/allocation_type.h" namespace NEO { -Gmm::Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, - bool preferCompressed, StorageInfo storageInfo, bool allowLargePages) : clientContext(clientContext) { +Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, + bool preferCompressed, StorageInfo storageInfo, bool allowLargePages) : gmmHelper(gmmHelper) { resourceParams.Type = RESOURCE_BUFFER; resourceParams.Format = GMM_FORMAT_GENERIC_8BIT; resourceParams.BaseWidth64 = static_cast(alignedSize); @@ -57,24 +57,24 @@ Gmm::Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t aligned applyAppResource(storageInfo); applyDebugOverrides(); - gmmResourceInfo.reset(GmmResourceInfo::create(clientContext, &resourceParams)); + gmmResourceInfo.reset(GmmResourceInfo::create(gmmHelper->getClientContext(), &resourceParams)); } -Gmm::Gmm(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmm) : clientContext(clientContext) { - gmmResourceInfo.reset(GmmResourceInfo::create(clientContext, inputGmm)); +Gmm::Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm) : gmmHelper(gmmHelper) { + gmmResourceInfo.reset(GmmResourceInfo::create(gmmHelper->getClientContext(), inputGmm)); applyDebugOverrides(); } Gmm::~Gmm() = default; -Gmm::Gmm(GmmClientContext *clientContext, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed) : clientContext(clientContext) { +Gmm::Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed) : gmmHelper(gmmHelper) { this->resourceParams = {}; setupImageResourceParams(inputOutputImgInfo, preferCompressed); applyMemoryFlags(storageInfo); applyAppResource(storageInfo); applyDebugOverrides(); - this->gmmResourceInfo.reset(GmmResourceInfo::create(clientContext, &this->resourceParams)); + this->gmmResourceInfo.reset(GmmResourceInfo::create(gmmHelper->getClientContext(), &this->resourceParams)); UNRECOVERABLE_IF(this->gmmResourceInfo == nullptr); queryImageParams(inputOutputImgInfo); @@ -113,11 +113,11 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo, bool preferCompressed) { resourceParams.Flags.Info.Linear = imgInfo.linearStorage; - auto &hwHelper = HwHelper::get(clientContext->getHardwareInfo()->platform.eRenderCoreFamily); + auto &hwHelper = HwHelper::get(gmmHelper->getClientContext()->getHardwareInfo()->platform.eRenderCoreFamily); resourceParams.NoGfxMemory = 1; // dont allocate, only query for params - resourceParams.Usage = CacheSettingsHelper::getGmmUsageType(AllocationType::IMAGE, false, *clientContext->getHardwareInfo()); + resourceParams.Usage = CacheSettingsHelper::getGmmUsageType(AllocationType::IMAGE, false, *gmmHelper->getClientContext()->getHardwareInfo()); resourceParams.Format = imgInfo.surfaceFormat->GMMSurfaceFormat; resourceParams.Flags.Gpu.Texture = 1; @@ -136,7 +136,7 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo, bool preferCompressed) { } void Gmm::applyAuxFlagsForBuffer(bool preferCompression) { - auto hardwareInfo = clientContext->getHardwareInfo(); + auto hardwareInfo = gmmHelper->getClientContext()->getHardwareInfo(); bool allowCompression = HwHelper::compressedBuffersSupported(*hardwareInfo) && preferCompression; @@ -153,13 +153,13 @@ void Gmm::applyAuxFlagsForBuffer(bool preferCompression) { void Gmm::applyAuxFlagsForImage(ImageInfo &imgInfo, bool preferCompressed) { uint8_t compressionFormat; if (this->resourceParams.Flags.Info.MediaCompressed) { - compressionFormat = clientContext->getMediaSurfaceStateCompressionFormat(imgInfo.surfaceFormat->GMMSurfaceFormat); + compressionFormat = gmmHelper->getClientContext()->getMediaSurfaceStateCompressionFormat(imgInfo.surfaceFormat->GMMSurfaceFormat); } else { - compressionFormat = clientContext->getSurfaceStateCompressionFormat(imgInfo.surfaceFormat->GMMSurfaceFormat); + compressionFormat = gmmHelper->getClientContext()->getSurfaceStateCompressionFormat(imgInfo.surfaceFormat->GMMSurfaceFormat); } bool compressionFormatSupported = false; - if (clientContext->getHardwareInfo()->featureTable.flags.ftrFlatPhysCCS) { + if (gmmHelper->getClientContext()->getHardwareInfo()->featureTable.flags.ftrFlatPhysCCS) { compressionFormatSupported = compressionFormat != GMM_FLATCCS_FORMAT::GMM_FLATCCS_FORMAT_INVALID; } else { compressionFormatSupported = compressionFormat != GMM_E2ECOMP_FORMAT::GMM_E2ECOMP_FORMAT_INVALID; @@ -170,7 +170,7 @@ void Gmm::applyAuxFlagsForImage(ImageInfo &imgInfo, bool preferCompressed) { imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_YVYU || imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_VYUY; - auto hwInfo = clientContext->getHardwareInfo(); + auto hwInfo = gmmHelper->getClientContext()->getHardwareInfo(); bool allowCompression = HwHelper::compressedImagesSupported(*hwInfo) && preferCompressed && @@ -248,7 +248,7 @@ void Gmm::queryImageParams(ImageInfo &imgInfo) { } uint32_t Gmm::queryQPitch(GMM_RESOURCE_TYPE resType) { - if (clientContext->getHardwareInfo()->platform.eRenderCoreFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) { + if (gmmHelper->getClientContext()->getHardwareInfo()->platform.eRenderCoreFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) { return 0; } return gmmResourceInfo->getQPitch(); @@ -332,7 +332,7 @@ uint32_t Gmm::getAuxQPitch() { } void Gmm::applyMemoryFlags(StorageInfo &storageInfo) { - auto hardwareInfo = clientContext->getHardwareInfo(); + auto hardwareInfo = gmmHelper->getClientContext()->getHardwareInfo(); if (hardwareInfo->featureTable.flags.ftrLocalMemory) { if (storageInfo.systemMemoryPlacement) { diff --git a/shared/source/gmm_helper/gmm.h b/shared/source/gmm_helper/gmm.h index 795c363fd8..58062ec73c 100644 --- a/shared/source/gmm_helper/gmm.h +++ b/shared/source/gmm_helper/gmm.h @@ -18,16 +18,16 @@ enum class ImagePlane; struct HardwareInfo; struct ImageInfo; class GmmResourceInfo; -class GmmClientContext; +class GmmHelper; class Gmm { public: virtual ~Gmm(); Gmm() = delete; - Gmm(GmmClientContext *clientContext, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed); - Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, size_t alignment, + Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed); + Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, bool preferCompressed, StorageInfo storageInfo, bool allowLargePages); - Gmm(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmm); + Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm); void queryImageParams(ImageInfo &inputOutputImgInfo); @@ -57,6 +57,6 @@ class Gmm { bool extraMemoryFlagsRequired(); void applyExtraMemoryFlags(const StorageInfo &storageInfo); void applyDebugOverrides(); - GmmClientContext *clientContext = nullptr; + GmmHelper *gmmHelper = nullptr; }; } // namespace NEO diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 508c4562f0..73ee8bd17d 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -572,7 +572,7 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData & } GraphicsAllocation *MemoryManager::allocateGraphicsMemoryForImage(const AllocationData &allocationData) { - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), *allocationData.imgInfo, allocationData.storageInfo, allocationData.flags.preferCompressed); // AllocationData needs to be reconfigured for System Memory paths diff --git a/shared/source/memory_manager/os_agnostic_memory_manager.cpp b/shared/source/memory_manager/os_agnostic_memory_manager.cpp index 420a012f87..d7b7b7eda2 100644 --- a/shared/source/memory_manager/os_agnostic_memory_manager.cpp +++ b/shared/source/memory_manager/os_agnostic_memory_manager.cpp @@ -109,7 +109,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment auto pHwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); if (HwHelper::get(pHwInfo->platform.eRenderCoreFamily).compressedBuffersSupported(*pHwInfo) && allocationData.flags.preferCompressed) { - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, sizeAligned, alignment, @@ -160,7 +160,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(const Al if (memoryAllocation) { static_cast(memoryAllocation)->overrideMemoryPool(MemoryPool::System64KBPages); if (memoryAllocation->getDefaultGmm() == nullptr) { - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, allocationDataAlign.size, allocationDataAlign.alignment, @@ -231,7 +231,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocationFromSharedH graphicsAllocation->set32BitAllocation(requireSpecificBitness); if (properties.imgInfo) { - Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getGmmClientContext(), *properties.imgInfo, createStorageInfoFromProperties(properties), false); + Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getGmmHelper(), *properties.imgInfo, createStorageInfoFromProperties(properties), false); graphicsAllocation->setDefaultGmm(gmm); } @@ -356,7 +356,7 @@ void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uin GraphicsAllocation *OsAgnosticMemoryManager::allocateMemoryByKMD(const AllocationData &allocationData) { auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable, *hwInfo), allocationData.flags.preferCompressed, allocationData.storageInfo, true); @@ -479,7 +479,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool( if (allocationData.type == AllocationType::IMAGE || allocationData.type == AllocationType::SHARED_RESOURCE_COPY) { allocationData.imgInfo->useLocalMemory = true; - gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, + gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), *allocationData.imgInfo, allocationData.storageInfo, allocationData.flags.preferCompressed); sizeAligned64k = alignUp(allocationData.imgInfo->size, MemoryConstants::pageSize64k); } else { @@ -487,7 +487,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool( if (DebugManager.flags.RenderCompressedBuffersEnabled.get() && allocationData.flags.preferCompressed) { auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), + gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, sizeAligned64k, MemoryConstants::pageSize64k, diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 21474e37e4..f9f94a86de 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -506,7 +506,7 @@ GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData & auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); StorageInfo systemMemoryStorageInfo = {}; - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable, *hwInfo), false, systemMemoryStorageInfo, true); size_t bufferSize = allocationData.size; uint64_t gpuRange = acquireGpuRange(bufferSize, allocationData.rootDeviceIndex, HeapIndex::HEAP_STANDARD64KB); @@ -723,7 +723,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o } } - Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getGmmClientContext(), *properties.imgInfo, + Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getGmmHelper(), *properties.imgInfo, createStorageInfoFromProperties(properties), properties.flags.preferCompressed); drmAllocation->setDefaultGmm(gmm); @@ -1222,7 +1222,7 @@ void DrmMemoryManager::unlockResourceInLocalMemoryImpl(BufferObject *bo) { bo->setLockedAddress(nullptr); } -void createColouredGmms(GmmClientContext *clientContext, DrmAllocation &allocation, const StorageInfo &storageInfo, bool compression) { +void createColouredGmms(GmmHelper *gmmHelper, DrmAllocation &allocation, const StorageInfo &storageInfo, bool compression) { DEBUG_BREAK_IF(storageInfo.colouringPolicy == ColouringPolicy::DeviceCountBased && storageInfo.colouringGranularity != MemoryConstants::pageSize64k); auto remainingSize = alignUp(allocation.getUnderlyingBufferSize(), storageInfo.colouringGranularity); @@ -1251,11 +1251,11 @@ void createColouredGmms(GmmClientContext *clientContext, DrmAllocation &allocati remainingSize -= currentSize; StorageInfo limitedStorageInfo = storageInfo; limitedStorageInfo.memoryBanks &= (1u << (handleId % banksCnt)); - auto gmm = new Gmm(clientContext, + auto gmm = new Gmm(gmmHelper, nullptr, currentSize, 0u, - CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, *clientContext->getHardwareInfo()), + CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, *gmmHelper->getHardwareInfo()), compression, limitedStorageInfo, true); @@ -1263,14 +1263,14 @@ void createColouredGmms(GmmClientContext *clientContext, DrmAllocation &allocati } } -void fillGmmsInAllocation(GmmClientContext *clientContext, DrmAllocation *allocation, const StorageInfo &storageInfo) { +void fillGmmsInAllocation(GmmHelper *gmmHelper, DrmAllocation *allocation, const StorageInfo &storageInfo) { auto alignedSize = alignUp(allocation->getUnderlyingBufferSize(), MemoryConstants::pageSize64k); for (auto handleId = 0u; handleId < storageInfo.getNumBanks(); handleId++) { StorageInfo limitedStorageInfo = storageInfo; limitedStorageInfo.memoryBanks &= 1u << handleId; limitedStorageInfo.pageTablesVisibility &= 1u << handleId; - auto gmm = new Gmm(clientContext, nullptr, alignedSize, 0u, - CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), false, *clientContext->getHardwareInfo()), false, limitedStorageInfo, true); + auto gmm = new Gmm(gmmHelper, nullptr, alignedSize, 0u, + CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), false, *gmmHelper->getHardwareInfo()), false, limitedStorageInfo, true); allocation->setGmm(gmm, handleId); } } @@ -1337,7 +1337,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A bool createSingleHandle = 1 == numHandles; if (allocationData.type == AllocationType::IMAGE) { allocationData.imgInfo->useLocalMemory = true; - gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, + gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), *allocationData.imgInfo, allocationData.storageInfo, allocationData.flags.preferCompressed); sizeAligned = alignUp(allocationData.imgInfo->size, MemoryConstants::pageSize64k); } else { @@ -1348,7 +1348,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A } if (createSingleHandle) { - gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), + gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), nullptr, sizeAligned, 0u, @@ -1372,12 +1372,12 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A if (createSingleHandle) { allocation->setDefaultGmm(gmm.release()); } else if (allocationData.storageInfo.multiStorage) { - createColouredGmms(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), + createColouredGmms(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), *allocation, allocationData.storageInfo, allocationData.flags.preferCompressed); } else { - fillGmmsInAllocation(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocation.get(), allocationData.storageInfo); + fillGmmsInAllocation(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocation.get(), allocationData.storageInfo); } allocation->storageInfo = allocationData.storageInfo; allocation->setFlushL3Required(allocationData.flags.flushL3); diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 65c9e75d71..732c6495ad 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -706,7 +706,7 @@ bool Wddm::openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc) { alloc->resourceHandle = OpenResource.hResource; auto resourceInfo = const_cast(allocationInfo[0].pPrivateDriverData); - alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), static_cast(resourceInfo))); + alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), static_cast(resourceInfo))); return true; } @@ -751,7 +751,7 @@ bool Wddm::openNTHandle(HANDLE handle, WddmAllocation *alloc) { alloc->resourceHandle = openResourceFromNtHandle.hResource; auto resourceInfo = const_cast(allocationInfo2[0].pPrivateDriverData); - alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), static_cast(resourceInfo))); + alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), static_cast(resourceInfo))); return true; } diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index bb9868cca2..c8e936a61b 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -74,7 +74,7 @@ GraphicsAllocation *WddmMemoryManager::allocateMemoryByKMD(const AllocationData auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); StorageInfo systemMemoryStorageInfo = {}; - auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, allocationData.size, 0u, + auto gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), allocationData.hostPtr, allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, !!allocationData.flags.uncacheable, *hwInfo), false, systemMemoryStorageInfo, true); auto allocation = std::make_unique(allocationData.rootDeviceIndex, 1u, // numGmms @@ -126,7 +126,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToC auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), nullptr, + auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), nullptr, sizeAligned, 0u, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable, *hwInfo), allocationData.flags.preferCompressed, @@ -194,7 +194,7 @@ GraphicsAllocation *WddmMemoryManager::allocateHugeGraphicsMemory(const Allocati auto sizeRemaining = alignedSize; for (auto gmmId = 0u; gmmId < numGmms; ++gmmId) { auto size = sizeRemaining > chunkSize ? chunkSize : sizeRemaining; - auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), + auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), static_cast(alignedPtr) + gmmId * chunkSize, size, 0u, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!uncacheable, *hwInfo), false, {}, true); wddmAllocation->setGmm(gmm, gmmId); @@ -251,7 +251,7 @@ GraphicsAllocation *WddmMemoryManager::allocateSystemMemoryAndCreateGraphicsAllo auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), pSysMem, sizeAligned, 0u, + gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), pSysMem, sizeAligned, 0u, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable, *hwInfo), allocationData.flags.preferCompressed, allocationData.storageInfo, true); @@ -299,7 +299,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(co auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), alignedPtr, alignedSize, 0u, + auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), alignedPtr, alignedSize, 0u, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable, *hwInfo), false, {}, true); wddmAllocation->setDefaultGmm(gmm); @@ -338,7 +338,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithHostPtr(const A auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, 0u, + Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), ptrAligned, sizeAligned, 0u, CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), !!allocationData.flags.uncacheable, *hwInfo), false, {}, true); allocation->setDefaultGmm(gmm); if (createWddmAllocation(allocation, reserve)) { @@ -385,7 +385,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); - gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, 0u, + gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), ptrAligned, sizeAligned, 0u, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable, *hwInfo), false, {}, true); wddmAllocation->setDefaultGmm(gmm); @@ -620,7 +620,7 @@ MemoryManager::AllocationStatus WddmMemoryManager::populateOsHandles(OsHandleSto handleStorage.fragmentStorageData[i].osHandleStorage = osHandle; handleStorage.fragmentStorageData[i].residency = new ResidencyData(maxOsContextCount); - osHandle->gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext(), handleStorage.fragmentStorageData[i].cpuPtr, + osHandle->gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper(), handleStorage.fragmentStorageData[i].cpuPtr, handleStorage.fragmentStorageData[i].fragmentSize, 0u, CacheSettingsHelper::getGmmUsageType(AllocationType::EXTERNAL_HOST_PTR, false, *hwInfo), false, {}, true); allocatedFragmentIndexes[allocatedFragmentsCounter] = i; @@ -920,7 +920,7 @@ bool WddmMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphics return true; } -void createColouredGmms(GmmClientContext *clientContext, WddmAllocation &allocation, const StorageInfo &storageInfo, bool compression) { +void createColouredGmms(GmmHelper *gmmHelper, WddmAllocation &allocation, const StorageInfo &storageInfo, bool compression) { auto remainingSize = allocation.getAlignedSize(); auto handles = storageInfo.getNumBanks(); /* This logic is to colour resource as equally as possible. @@ -941,34 +941,34 @@ void createColouredGmms(GmmClientContext *clientContext, WddmAllocation &allocat remainingSize -= currentSize; StorageInfo limitedStorageInfo = storageInfo; limitedStorageInfo.memoryBanks &= static_cast(1u << handleId); - auto gmm = new Gmm(clientContext, + auto gmm = new Gmm(gmmHelper, nullptr, currentSize, 0u, - CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, *clientContext->getHardwareInfo()), + CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, *gmmHelper->getHardwareInfo()), compression, limitedStorageInfo, true); allocation.setGmm(gmm, handleId); } } -void fillGmmsInAllocation(GmmClientContext *clientContext, WddmAllocation *allocation, const StorageInfo &storageInfo) { +void fillGmmsInAllocation(GmmHelper *gmmHelper, WddmAllocation *allocation, const StorageInfo &storageInfo) { for (auto handleId = 0u; handleId < storageInfo.getNumBanks(); handleId++) { StorageInfo limitedStorageInfo = storageInfo; limitedStorageInfo.memoryBanks &= static_cast(1u << handleId); limitedStorageInfo.pageTablesVisibility &= static_cast(1u << handleId); - auto gmm = new Gmm(clientContext, nullptr, allocation->getAlignedSize(), 0u, - CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), false, *clientContext->getHardwareInfo()), false, limitedStorageInfo, true); + auto gmm = new Gmm(gmmHelper, nullptr, allocation->getAlignedSize(), 0u, + CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), false, *gmmHelper->getHardwareInfo()), false, limitedStorageInfo, true); allocation->setGmm(gmm, handleId); } } -void splitGmmsInAllocation(GmmClientContext *clientContext, WddmAllocation *wddmAllocation, size_t alignment, size_t chunkSize, StorageInfo &storageInfo) { +void splitGmmsInAllocation(GmmHelper *gmmHelper, WddmAllocation *wddmAllocation, size_t alignment, size_t chunkSize, StorageInfo &storageInfo) { auto sizeRemaining = wddmAllocation->getAlignedSize(); for (auto gmmId = 0u; gmmId < wddmAllocation->getNumGmms(); ++gmmId) { auto size = sizeRemaining > chunkSize ? chunkSize : sizeRemaining; - auto gmm = new Gmm(clientContext, nullptr, size, alignment, - CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), false, *clientContext->getHardwareInfo()), false, storageInfo, true); + auto gmm = new Gmm(gmmHelper, nullptr, size, alignment, + CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), false, *gmmHelper->getHardwareInfo()), false, storageInfo, true); wddmAllocation->setGmm(gmm, gmmId); sizeRemaining -= size; } @@ -995,6 +995,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const } auto gmmClientContext = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(); + auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(); std::unique_ptr gmm; size_t sizeAligned = 0; @@ -1004,7 +1005,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const if (allocationData.type == AllocationType::IMAGE || allocationData.type == AllocationType::SHARED_RESOURCE_COPY) { allocationData.imgInfo->useLocalMemory = true; - gmm = std::make_unique(gmmClientContext, *allocationData.imgInfo, allocationData.storageInfo, allocationData.flags.preferCompressed); + gmm = std::make_unique(gmmHelper, *allocationData.imgInfo, allocationData.storageInfo, allocationData.flags.preferCompressed); alignment = MemoryConstants::pageSize64k; sizeAligned = allocationData.imgInfo->size; } else { @@ -1012,7 +1013,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const sizeAligned = alignUp(allocationData.size, alignment); if (singleBankAllocation) { - gmm = std::make_unique(gmmClientContext, + gmm = std::make_unique(gmmHelper, nullptr, sizeAligned, alignment, @@ -1030,14 +1031,14 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const allocationData.type, nullptr, sizeAligned, nullptr, MemoryPool::LocalMemory, allocationData.flags.shareable, maxOsContextCount); if (singleBankAllocation) { if (numGmms > 1) { - splitGmmsInAllocation(gmmClientContext, wddmAllocation.get(), alignment, chunkSize, const_cast(allocationData.storageInfo)); + splitGmmsInAllocation(gmmHelper, wddmAllocation.get(), alignment, chunkSize, const_cast(allocationData.storageInfo)); } else { wddmAllocation->setDefaultGmm(gmm.release()); } } else if (allocationData.storageInfo.multiStorage) { - createColouredGmms(gmmClientContext, *wddmAllocation, allocationData.storageInfo, allocationData.flags.preferCompressed); + createColouredGmms(gmmHelper, *wddmAllocation, allocationData.storageInfo, allocationData.flags.preferCompressed); } else { - fillGmmsInAllocation(gmmClientContext, wddmAllocation.get(), allocationData.storageInfo); + fillGmmsInAllocation(gmmHelper, wddmAllocation.get(), allocationData.storageInfo); } wddmAllocation->storageInfo = allocationData.storageInfo; wddmAllocation->setFlushL3Required(allocationData.flags.flushL3); diff --git a/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp b/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp index d6ed15d5b9..fe1bf16588 100644 --- a/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp +++ b/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp @@ -24,7 +24,7 @@ void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment auto osEnvironment = new OsEnvironmentWin(); osEnvironment->gdi.reset(gdi); for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) { - gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[i]->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[i]->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); auto wddm = static_cast(executionEnvironment.rootDeviceEnvironments[i]->osInterface->getDriverModel()->as()); wddm->hwDeviceId = std::make_unique(ADAPTER_HANDLE, LUID{}, osEnvironment, std::make_unique()); wddm->callBaseMapGpuVa = false; 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 f95db05029..d9c345097e 100644 --- a/shared/test/common/helpers/blit_commands_helper_tests_gen12lp.cpp +++ b/shared/test/common/helpers/blit_commands_helper_tests_gen12lp.cpp @@ -77,7 +77,7 @@ HWTEST2_F(BlitTests, givenIncorrectBytePerPixelWhenAppendColorDepthThenAbortIsTh HWTEST2_F(BlitTests, givenSrcAndDestinationImagesWhenAppendSliceOffsetsThenAdressAreCorectOffseted, IsGen12LP) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages); @@ -174,7 +174,7 @@ struct MyMockResourecInfo : public GmmResourceInfo { HWTEST2_F(BlitTests, givenTiledSrcAndDestinationImagesWhenAppendImageCommandsThenPitchIsValueFromGmm, IsGen12LP) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); GMM_RESCREATE_PARAMS gmmParams = {}; auto myResourecInfo = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams); myResourecInfo->pitch = 0x100; @@ -205,7 +205,7 @@ HWTEST2_F(BlitTests, givenTiledSrcAndDestinationImagesWhenAppendImageCommandsThe HWTEST2_F(BlitTests, givenLinearSrcAndDestinationImagesWhenAppendImageCommandsThenPitchIsValueFromProperties, IsGen12LP) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); GMM_RESCREATE_PARAMS gmmParams = {}; auto myResourecInfo = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams); myResourecInfo->pitch = 0x100; diff --git a/shared/test/common/helpers/test_blit_commands_helper_pvc_and_later.cpp b/shared/test/common/helpers/test_blit_commands_helper_pvc_and_later.cpp index 0ee2aab1c0..3163beb32c 100644 --- a/shared/test/common/helpers/test_blit_commands_helper_pvc_and_later.cpp +++ b/shared/test/common/helpers/test_blit_commands_helper_pvc_and_later.cpp @@ -52,7 +52,7 @@ HWTEST2_F(BlitTests, givenDeviceWithoutDefaultGmmWhenAppendBlitCommandsForVillBu HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForVillBufferThenDstCompressionDisabled, IsPVC) { using MEM_SET = typename FamilyType::MEM_SET; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); gmm->isCompressionEnabled = false; uint32_t pattern = 1; @@ -76,7 +76,7 @@ HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForVill HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForVillBufferThenDstCompressionEnabled, IsPVC) { using MEM_SET = typename FamilyType::MEM_SET; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); gmm->isCompressionEnabled = true; uint32_t pattern = 1; 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 f5c41cc951..766ed203c4 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 @@ -47,7 +47,7 @@ HWTEST2_F(BlitTests, givenDeviceWithoutDefaultGmmWhenAppendBlitCommandsForFillBu HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForFillBufferThenDstCompressionDisabled, CompressionParamsSupportedMatcher) { using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT; auto blitCmd = FamilyType::cmdInitXyColorBlt; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); gmm->isCompressionEnabled = false; MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), @@ -61,7 +61,7 @@ HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForFill HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForFillBufferThenDstCompressionEnabled, CompressionParamsSupportedMatcher) { using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT; auto blitCmd = FamilyType::cmdInitXyColorBlt; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + 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), @@ -76,14 +76,14 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForFillB using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT; auto blitCmd = FamilyType::cmdInitXyColorBlt; - auto gmmContext = pDevice->getGmmClientContext(); + auto gmmContext = pDevice->getGmmHelper(); 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); mockAllocation.setGmm(gmm.get(), 0); - uint32_t compressionFormat = gmmContext->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); + uint32_t compressionFormat = gmmContext->getClientContext()->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); EXPECT_EQ(compressionFormat, blitCmd.getDestinationCompressionFormat()); @@ -97,7 +97,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionAndDebugFlagSetWhenAppendBlitC uint32_t newCompressionFormat = 1; DebugManager.flags.ForceBufferCompressionFormat.set(static_cast(newCompressionFormat)); - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + 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); @@ -418,7 +418,7 @@ HWTEST2_F(BlitTests, givenTiled64SrcAndDestinationAppendTilingTypeThenCorrectTil HWTEST2_F(BlitTests, givenTiled4SrcAndDestinationAppendImageCommandsThenCorrectTiledIsSet, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto flags = gmm->gmmResourceInfo->getResourceFlags(); flags->Info.Tile4 = true; MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, @@ -446,7 +446,7 @@ HWTEST2_F(BlitTests, givenTiled4SrcAndDestinationAppendImageCommandsThenCorrectT HWTEST2_F(BlitTests, givenNotTiled64SrcAndDestinationAppendImageCommandsThenCorrectTiledIsSet, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto flags = gmm->gmmResourceInfo->getResourceFlags(); flags->Info.Tile64 = true; MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, @@ -474,7 +474,7 @@ HWTEST2_F(BlitTests, givenNotTiled64SrcAndDestinationAppendImageCommandsThenCorr HWTEST2_F(BlitTests, givenNotTiledSrcAndDestinationAppendImageCommandsThenCorrectTiledIsSet, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto flags = gmm->gmmResourceInfo->getResourceFlags(); flags->Info.Tile64 = false; MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, @@ -510,7 +510,7 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenAppendSurfaceTypeThenCorrectSurfaceTypeIs {GMM_RESOURCE_TYPE::RESOURCE_1D, XY_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_2D, 10u}}; for (const auto &[resourceType, expectedSurfaceType, arraySize] : testParams) { - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); resourceInfo->mockResourceCreateParams.Type = resourceType; resourceInfo->mockResourceCreateParams.ArraySize = arraySize; @@ -535,7 +535,7 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenAppendSurfaceTypeThenCorrectSurfaceTypeIs HWTEST2_F(BlitTests, givenInvalidResourceWhenAppendSurfaceTypeThenSurfaceTypeDoesNotChange, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); resourceInfo->mockResourceCreateParams.Type = GMM_RESOURCE_TYPE::RESOURCE_INVALID; @@ -591,7 +591,7 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCo {true, false, true}}; for (auto &[mediaCompressed, renderCompressed, compressionExpected] : params) { - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); auto &resInfo = resourceInfo->getResourceFlags()->Info; resInfo.MediaCompressed = mediaCompressed; @@ -647,13 +647,13 @@ HWTEST2_F(BlitTests, givenPlaneWhenGetBlitAllocationPropertiesIsCalledThenCompre {0x1F, 0x1F, GMM_PLANE_V}, }; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); auto &resInfo = static_cast(gmm->gmmResourceInfo.get())->getResourceFlags()->Info; resInfo.MediaCompressed = true; MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); - auto gmmClientContext = static_cast(pDevice->getGmmHelper()->getClientContext()); + auto gmmClientContext = static_cast(pDevice->getGmmClientContext()); mockAllocationSrc.setGmm(gmm.get(), 0); BlitProperties properties = {}; properties.srcAllocation = &mockAllocationSrc; @@ -781,7 +781,7 @@ HWTEST2_F(BlitTests, givenInputAndDefaultSlicePitchWhenAppendBlitCommandsForImag HWTEST2_F(BlitTests, givenResourceInfoWithZeroPitchWhenAppendImageCommandsThenPitchEqualPropertiesValue, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); GMM_RESCREATE_PARAMS gmmParams = {}; gmm->gmmResourceInfo.reset(new MyMockResourecInfo(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams)); MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, @@ -812,7 +812,7 @@ HWTEST2_F(BlitTests, givenResourceInfoWithZeroPitchWhenAppendImageCommandsThenPi HWTEST2_F(BlitTests, givenTiledAllocationWhenAppendBlitCommandsForImagesThenBlitCmdIsCorrect, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); GMM_RESCREATE_PARAMS gmmParams = {}; auto myResourecInfo = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams); myResourecInfo->pitch = 0x100; @@ -849,7 +849,7 @@ HWTEST2_F(BlitTests, givenTiledAllocationWhenAppendBlitCommandsForImagesThenBlit HWTEST2_F(BlitTests, givenAlocationsWhenAppendBlitCommandsForImagesThenSurfaceSizesAreProgrammedCorrectly, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); @@ -882,7 +882,7 @@ HWTEST2_F(BlitTests, givenAlocationsWhenAppendBlitCommandsForImagesThenSurfaceSi HWTEST2_F(BlitTests, givenLinearResourceInfoWithNotZeroPitchWhenAppendImageCommandsThenPitchEqualValueFromProperties, IsXeHpCore) { using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto gmm = std::make_unique(pDevice->getGmmHelper()); GMM_RESCREATE_PARAMS gmmParams = {}; auto myResourecInfo = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams); myResourecInfo->pitch = 0x100; diff --git a/shared/test/common/mocks/mock_gmm.h b/shared/test/common/mocks/mock_gmm.h index df38131d99..970ea8f4b1 100644 --- a/shared/test/common/mocks/mock_gmm.h +++ b/shared/test/common/mocks/mock_gmm.h @@ -23,10 +23,10 @@ class MockGmm : public Gmm { using Gmm::Gmm; using Gmm::setupImageResourceParams; - MockGmm(GmmClientContext *clientContext) : Gmm(clientContext, nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true){}; + MockGmm(GmmHelper *gmmHelper) : Gmm(gmmHelper, nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true){}; - static std::unique_ptr queryImgParams(GmmClientContext *clientContext, ImageInfo &imgInfo, bool preferCompression) { - return std::unique_ptr(new Gmm(clientContext, imgInfo, {}, preferCompression)); + static std::unique_ptr queryImgParams(GmmHelper *gmmHelper, ImageInfo &imgInfo, bool preferCompression) { + return std::unique_ptr(new Gmm(gmmHelper, imgInfo, {}, preferCompression)); } static ImageInfo initImgInfo(ImageDescriptor &imgDesc, int baseMipLevel, const SurfaceFormatInfo *surfaceFormat) { diff --git a/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp b/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp index b511fb9a2e..a3a5baa6a8 100644 --- a/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/shared/test/unit_test/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -279,7 +279,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndNotLockableAllocationWhe allocation.overrideMemoryPool(MemoryPool::LocalMemory); aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, initSize, initSize, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, initSize, initSize, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); mockGmm.resourceParams.Flags.Info.NotLockable = true; allocation.setDefaultGmm(&mockGmm); @@ -314,7 +314,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndLockableAllocationWhenGe allocation.overrideMemoryPool(MemoryPool::LocalMemory); aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, initSize, initSize, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, initSize, initSize, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); mockGmm.resourceParams.Flags.Info.NotLockable = false; allocation.setDefaultGmm(&mockGmm); @@ -799,7 +799,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); aubCsr->setAubWritable(true, *gfxAllocation); - auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + auto gmm = new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gfxAllocation->setDefaultGmm(gmm); for (bool compressed : {false, true}) { diff --git a/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp b/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp index 4094a1f25f..b7818385a8 100644 --- a/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp +++ b/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp @@ -327,7 +327,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedAllocationWhenCloningPageTa csr->setupContext(osContext); auto mockHardwareContext = static_cast(csr->hardwareContextController->hardwareContexts[0].get()); - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.isCompressionEnabled = true; int dummy = 1; @@ -357,7 +357,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenUncachedAllocationWhenCloningPageTabl csr->setupContext(osContext); auto mockHardwareContext = static_cast(csr->hardwareContextController->hardwareContexts[0].get()); - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); + MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); gmm.isCompressionEnabled = false; int dummy = 1; @@ -417,7 +417,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedTileInstancedAllocationWhen csr->multiOsContextCapable = true; - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.isCompressionEnabled = true; int dummy = 1; @@ -456,7 +456,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenUncachedTileInstancedAllocationWhenWr csr->multiOsContextCapable = true; - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); + MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); gmm.isCompressionEnabled = false; int dummy = 1; diff --git a/shared/test/unit_test/image/image_surface_state_fixture.h b/shared/test/unit_test/image/image_surface_state_fixture.h index 1da52640c8..a45e4c4812 100644 --- a/shared/test/unit_test/image/image_surface_state_fixture.h +++ b/shared/test/unit_test/image/image_surface_state_fixture.h @@ -26,8 +26,8 @@ class ImageSurfaceStateTests : public DeviceFixture, ImageSurfaceStateTests() = default; void SetUp() override { DeviceFixture::SetUp(); - mockGmm = std::make_unique(pDevice->getGmmClientContext()); gmmHelper = pDevice->getGmmHelper(); + mockGmm = std::make_unique(gmmHelper); } void TearDown() override { diff --git a/shared/test/unit_test/os_interface/aub_memory_operations_handler_tests.cpp b/shared/test/unit_test/os_interface/aub_memory_operations_handler_tests.cpp index c258e2fdfe..66c537ceee 100644 --- a/shared/test/unit_test/os_interface/aub_memory_operations_handler_tests.cpp +++ b/shared/test/unit_test/os_interface/aub_memory_operations_handler_tests.cpp @@ -35,7 +35,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledOnC auto memoryOperationsInterface = getMemoryOperationsHandler(); auto executionEnvironment = std::unique_ptr(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u)); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockGmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext()); + MockGmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper()); gmm.isCompressionEnabled = true; allocPtr->setDefaultGmm(&gmm); @@ -56,7 +56,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenMakeResidentCalledOnU auto memoryOperationsInterface = getMemoryOperationsHandler(); auto executionEnvironment = std::unique_ptr(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u)); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - MockGmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); + MockGmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); gmm.isCompressionEnabled = false; allocPtr->setDefaultGmm(&gmm); diff --git a/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp b/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp index 02708cd602..48d2bb59ed 100644 --- a/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp +++ b/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp @@ -257,7 +257,7 @@ HWTEST2_F(GmmTestsDG2, givenGmmForImageWithForceLocalMemThenNonLocalIsSetToFalse storageInfo.memoryBanks = 2; storageInfo.systemMemoryPlacement = false; - std::unique_ptr gmm(new NEO::Gmm(mockExecEnv.rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo, storageInfo, false)); + std::unique_ptr gmm(new NEO::Gmm(mockExecEnv.rootDeviceEnvironments[0]->getGmmHelper(), imgInfo, storageInfo, false)); EXPECT_EQ(gmm->resourceParams.Flags.Info.NonLocalOnly, 0u); EXPECT_EQ(gmm->resourceParams.Flags.Info.LocalOnly, 1u); diff --git a/shared/test/unit_test/os_interface/windows/wddm_shared_allocations_test.cpp b/shared/test/unit_test/os_interface/windows/wddm_shared_allocations_test.cpp index a5384a01fb..5451f0a171 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_shared_allocations_test.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_shared_allocations_test.cpp @@ -68,7 +68,7 @@ TEST_F(WdmmSharedTests, WhenCreatingSharedAllocationAndGetNTHandleFailedThenAllo D3DKMT_HANDLE handle = 32u; D3DKMT_HANDLE resourceHandle = 32u; uint64_t ntHandle = 0u; - Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 20, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true); + Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 20, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true); EXPECT_NE(STATUS_SUCCESS, wddm->createAllocation(nullptr, &gmm, handle, resourceHandle, &ntHandle)); EXPECT_EQ(wddm->destroyAllocationResult.called++, 1u); diff --git a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp index 54ddb4301d..e64ebbd741 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp @@ -17,7 +17,7 @@ TEST_F(WddmTests, whenCreatingAllocation64kThenDoNotCreateResource) { init(); D3DKMT_HANDLE handle; - Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 20, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true); + Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 20, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true); EXPECT_TRUE(wddm->createAllocation(&gmm, handle)); auto gdiParam = getMockAllocationFcn();