@@ -509,9 +509,10 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
509509 void *cacheAlignedHostPtr = alignedMalloc (MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
510510
511511 buffer.reset (Buffer::create (context.get (), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
512- EXPECT_EQ (cacheAlignedHostPtr, buffer->getGraphicsAllocation ()->getUnderlyingBuffer ());
512+ auto allocation = buffer->getGraphicsAllocation (device->getRootDeviceIndex ());
513+ EXPECT_EQ (cacheAlignedHostPtr, allocation->getUnderlyingBuffer ());
513514 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
514- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
515+ EXPECT_EQ (allocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
515516
516517 uint32_t pattern[2 ] = {0 , 0 };
517518 pattern[0 ] = 0xdeadbeef ;
@@ -527,26 +528,27 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
527528
528529 hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
529530 buffer.reset (Buffer::create (context.get (), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
530- EXPECT_EQ (cacheAlignedHostPtr, buffer->getGraphicsAllocation ()->getUnderlyingBuffer ());
531+ allocation = buffer->getGraphicsAllocation (device->getRootDeviceIndex ());
532+ EXPECT_EQ (cacheAlignedHostPtr, allocation->getUnderlyingBuffer ());
531533 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
532- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
534+ EXPECT_EQ (allocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
533535
534- EXPECT_THAT (buffer-> getGraphicsAllocation () ->getUnderlyingBuffer (), MemCompare (&pattern[0 ], sizeof (pattern)));
536+ EXPECT_THAT (allocation ->getUnderlyingBuffer (), MemCompare (&pattern[0 ], sizeof (pattern)));
535537
536538 alignedFree (cacheAlignedHostPtr);
537539}
538540
539541TEST_F (RenderCompressedBuffersTests, givenAllocationCreatedWithForceSharedPhysicalMemoryWhenItIsCreatedItIsZeroCopy) {
540542 buffer.reset (Buffer::create (context.get (), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 1u , nullptr , retVal));
541- EXPECT_EQ (buffer->getGraphicsAllocation ()->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
543+ EXPECT_EQ (buffer->getGraphicsAllocation (device-> getRootDeviceIndex () )->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
542544 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
543545 EXPECT_EQ (1u , buffer->getSize ());
544546}
545547
546548TEST_F (RenderCompressedBuffersTests, givenRenderCompressedBuffersAndAllocationCreatedWithForceSharedPhysicalMemoryWhenItIsCreatedItIsZeroCopy) {
547549 hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
548550 buffer.reset (Buffer::create (context.get (), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 1u , nullptr , retVal));
549- EXPECT_EQ (buffer->getGraphicsAllocation ()->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
551+ EXPECT_EQ (buffer->getGraphicsAllocation (device-> getRootDeviceIndex () )->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
550552 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
551553 EXPECT_EQ (1u , buffer->getSize ());
552554}
@@ -555,21 +557,23 @@ TEST_F(RenderCompressedBuffersTests, givenBufferNotCompressedAllocationAndNoHost
555557 hwInfo->capabilityTable .ftrRenderCompressedBuffers = false ;
556558
557559 buffer.reset (Buffer::create (context.get (), 0 , bufferSize, nullptr , retVal));
560+ auto allocation = buffer->getGraphicsAllocation (device->getRootDeviceIndex ());
558561 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
559- if (MemoryPool::isSystemMemoryPool (buffer-> getGraphicsAllocation () ->getMemoryPool ())) {
560- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
562+ if (MemoryPool::isSystemMemoryPool (allocation ->getMemoryPool ())) {
563+ EXPECT_EQ (allocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
561564 } else {
562- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER);
565+ EXPECT_EQ (allocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER);
563566 }
564567
565568 hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
566569 buffer.reset (Buffer::create (context.get (), 0 , bufferSize, nullptr , retVal));
570+ allocation = buffer->getGraphicsAllocation (device->getRootDeviceIndex ());
567571 if (HwHelper::get (context->getDevice (0 )->getHardwareInfo ().platform .eRenderCoreFamily ).obtainRenderBufferCompressionPreference (context->getDevice (0 )->getHardwareInfo (), bufferSize)) {
568572 EXPECT_FALSE (buffer->isMemObjZeroCopy ());
569- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
573+ EXPECT_EQ (allocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
570574 } else {
571575 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
572- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
576+ EXPECT_EQ (allocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
573577 }
574578}
575579
@@ -578,14 +582,16 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationWhenSharedCo
578582 context->isSharedContext = false ;
579583
580584 buffer.reset (Buffer::create (context.get (), CL_MEM_READ_WRITE, bufferSize, nullptr , retVal));
585+ auto graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
581586 if (HwHelper::get (context->getDevice (0 )->getHardwareInfo ().platform .eRenderCoreFamily ).obtainRenderBufferCompressionPreference (context->getDevice (0 )->getHardwareInfo (), bufferSize)) {
582- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
587+ EXPECT_EQ (graphicsAllocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
583588 } else {
584- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
589+ EXPECT_EQ (graphicsAllocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
585590 }
586591 context->isSharedContext = true ;
587592 buffer.reset (Buffer::create (context.get (), CL_MEM_USE_HOST_PTR, bufferSize, hostPtr, retVal));
588- EXPECT_EQ (buffer->getGraphicsAllocation ()->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
593+ graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
594+ EXPECT_EQ (graphicsAllocation->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
589595}
590596
591597TEST_F (RenderCompressedBuffersTests, givenDebugVariableSetWhenHwFlagIsNotSetThenSelectOptionFromDebugFlag) {
@@ -595,15 +601,17 @@ TEST_F(RenderCompressedBuffersTests, givenDebugVariableSetWhenHwFlagIsNotSetThen
595601
596602 DebugManager.flags .RenderCompressedBuffersEnabled .set (1 );
597603 buffer.reset (Buffer::create (context.get (), 0 , bufferSize, nullptr , retVal));
604+ auto graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
598605 if (HwHelper::get (context->getDevice (0 )->getHardwareInfo ().platform .eRenderCoreFamily ).obtainRenderBufferCompressionPreference (context->getDevice (0 )->getHardwareInfo (), bufferSize)) {
599- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
606+ EXPECT_EQ (graphicsAllocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
600607 } else {
601- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
608+ EXPECT_EQ (graphicsAllocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
602609 }
603610
604611 DebugManager.flags .RenderCompressedBuffersEnabled .set (0 );
605612 buffer.reset (Buffer::create (context.get (), 0 , bufferSize, nullptr , retVal));
606- EXPECT_NE (buffer->getGraphicsAllocation ()->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
613+ graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
614+ EXPECT_NE (graphicsAllocation->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
607615}
608616
609617struct RenderCompressedBuffersSvmTests : public RenderCompressedBuffersTests {
@@ -622,7 +630,7 @@ TEST_F(RenderCompressedBuffersSvmTests, givenSvmAllocationWhenCreatingBufferThen
622630 auto svmPtr = context->getSVMAllocsManager ()->createSVMAlloc (device->getRootDeviceIndex (), sizeof (uint32_t ), {}, device->getDeviceBitfield ());
623631 auto expectedAllocationType = context->getSVMAllocsManager ()->getSVMAlloc (svmPtr)->gpuAllocation ->getAllocationType ();
624632 buffer.reset (Buffer::create (context.get (), CL_MEM_USE_HOST_PTR, sizeof (uint32_t ), svmPtr, retVal));
625- EXPECT_EQ (expectedAllocationType, buffer->getGraphicsAllocation ()->getAllocationType ());
633+ EXPECT_EQ (expectedAllocationType, buffer->getGraphicsAllocation (device-> getRootDeviceIndex () )->getAllocationType ());
626634
627635 context->getSVMAllocsManager ()->freeSVMAlloc (svmPtr);
628636}
@@ -646,15 +654,16 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWh
646654 hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
647655
648656 buffer.reset (Buffer::create (context.get (), CL_MEM_COPY_HOST_PTR, bufferSize, hostPtr, retVal));
657+ auto graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
649658 if (HwHelper::get (context->getDevice (0 )->getHardwareInfo ().platform .eRenderCoreFamily ).obtainRenderBufferCompressionPreference (context->getDevice (0 )->getHardwareInfo (), bufferSize)) {
650- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
659+ EXPECT_EQ (graphicsAllocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
651660 EXPECT_EQ (1u , mockCmdQ->writeBufferCounter );
652661 EXPECT_TRUE (mockCmdQ->writeBufferBlocking );
653662 EXPECT_EQ (0u , mockCmdQ->writeBufferOffset );
654663 EXPECT_EQ (bufferSize, mockCmdQ->writeBufferSize );
655664 EXPECT_EQ (hostPtr, mockCmdQ->writeBufferPtr );
656665 } else {
657- EXPECT_EQ (buffer-> getGraphicsAllocation () ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
666+ EXPECT_EQ (graphicsAllocation ->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
658667 EXPECT_EQ (0u , mockCmdQ->writeBufferCounter );
659668 EXPECT_FALSE (mockCmdQ->writeBufferBlocking );
660669 EXPECT_EQ (0u , mockCmdQ->writeBufferOffset );
@@ -954,8 +963,8 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBuffersWhenCopyBufferCalledThenUseBcs) {
954963 EXPECT_NE (hwParser.cmdList .end (), commandItor);
955964 auto copyBltCmd = genCmdCast<XY_COPY_BLT *>(*commandItor);
956965
957- EXPECT_EQ (bufferForBlt0->getGraphicsAllocation ()->getGpuAddress (), copyBltCmd->getSourceBaseAddress ());
958- EXPECT_EQ (bufferForBlt1->getGraphicsAllocation ()->getGpuAddress (), copyBltCmd->getDestinationBaseAddress ());
966+ EXPECT_EQ (bufferForBlt0->getGraphicsAllocation (device-> getRootDeviceIndex () )->getGpuAddress (), copyBltCmd->getSourceBaseAddress ());
967+ EXPECT_EQ (bufferForBlt1->getGraphicsAllocation (device-> getRootDeviceIndex () )->getGpuAddress (), copyBltCmd->getDestinationBaseAddress ());
959968}
960969
961970HWTEST_TEMPLATED_F (BcsBufferTests, givenBuffersWhenCopyBufferRectCalledThenUseBcs) {
@@ -979,8 +988,8 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBuffersWhenCopyBufferRectCalledThenUseBc
979988 EXPECT_NE (hwParser.cmdList .end (), commandItor);
980989 auto copyBltCmd = genCmdCast<XY_COPY_BLT *>(*commandItor);
981990
982- EXPECT_EQ (bufferForBlt0->getGraphicsAllocation ()->getGpuAddress (), copyBltCmd->getSourceBaseAddress ());
983- EXPECT_EQ (bufferForBlt1->getGraphicsAllocation ()->getGpuAddress (), copyBltCmd->getDestinationBaseAddress ());
991+ EXPECT_EQ (bufferForBlt0->getGraphicsAllocation (device-> getRootDeviceIndex () )->getGpuAddress (), copyBltCmd->getSourceBaseAddress ());
992+ EXPECT_EQ (bufferForBlt1->getGraphicsAllocation (device-> getRootDeviceIndex () )->getGpuAddress (), copyBltCmd->getDestinationBaseAddress ());
984993}
985994
986995HWTEST_TEMPLATED_F (BcsBufferTests, givenDstHostPtrWhenEnqueueSVMMemcpyThenEnqueuReadBufferIsCalledAndBcs) {
@@ -1931,7 +1940,7 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenNonRenderCompressedBuffe
19311940 hwInfo->capabilityTable .ftrRenderCompressedBuffers = false ;
19321941
19331942 buffer.reset (Buffer::create (context.get (), CL_MEM_COPY_HOST_PTR, sizeof (uint32_t ), &hostPtr, retVal));
1934- EXPECT_NE (buffer->getGraphicsAllocation ()-> getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
1943+ EXPECT_NE (buffer->getMultiGraphicsAllocation (). getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
19351944
19361945 EXPECT_EQ (CL_SUCCESS, retVal);
19371946
@@ -2134,7 +2143,7 @@ TEST_P(ValidHostPtr, isResident_defaultsToFalseAfterCreate) {
21342143 buffer = createBuffer ();
21352144 ASSERT_NE (nullptr , buffer);
21362145
2137- EXPECT_FALSE (buffer->getGraphicsAllocation ()->isResident (pDevice->getDefaultEngine ().osContext ->getContextId ()));
2146+ EXPECT_FALSE (buffer->getGraphicsAllocation (pDevice-> getRootDeviceIndex () )->isResident (pDevice->getDefaultEngine ().osContext ->getContextId ()));
21382147}
21392148
21402149TEST_P (ValidHostPtr, getAddress) {
@@ -2657,15 +2666,15 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatAddressIsForcedTo32bitW
26572666 retVal);
26582667 EXPECT_EQ (CL_SUCCESS, retVal);
26592668
2660- EXPECT_TRUE (is64bit ? buffer->getGraphicsAllocation ()->is32BitAllocation () : true );
2669+ EXPECT_TRUE (is64bit ? buffer->getGraphicsAllocation (context. getDevice ( 0 )-> getRootDeviceIndex () )->is32BitAllocation () : true );
26612670
26622671 using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
26632672 RENDER_SURFACE_STATE surfaceState = {};
26642673
26652674 buffer->setArgStateful (&surfaceState, false , false , false , false );
26662675
26672676 auto surfBaseAddress = surfaceState.getSurfaceBaseAddress ();
2668- auto bufferAddress = buffer->getGraphicsAllocation ()->getGpuAddress ();
2677+ auto bufferAddress = buffer->getGraphicsAllocation (context. getDevice ( 0 )-> getRootDeviceIndex () )->getGpuAddress ();
26692678 EXPECT_EQ (bufferAddress, surfBaseAddress);
26702679
26712680 delete buffer;
@@ -2700,7 +2709,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferWithOffsetWhenSetArgStatefulIsCalledT
27002709 subBuffer->setArgStateful (&surfaceState, false , false , false , false );
27012710
27022711 auto surfBaseAddress = surfaceState.getSurfaceBaseAddress ();
2703- auto bufferAddress = buffer->getGraphicsAllocation ()->getGpuAddress ();
2712+ auto bufferAddress = buffer->getGraphicsAllocation (context. getDevice ( 0 )-> getRootDeviceIndex () )->getGpuAddress ();
27042713 EXPECT_EQ (bufferAddress + region.origin , surfBaseAddress);
27052714
27062715 subBuffer->release ();
@@ -2751,7 +2760,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferThatIsMisalignedButIsAReadOnlyArgumen
27512760 using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
27522761 RENDER_SURFACE_STATE surfaceState = {};
27532762
2754- buffer->getGraphicsAllocation ()->setSize (127 );
2763+ buffer->getGraphicsAllocation (context. getDevice ( 0 )-> getRootDeviceIndex () )->setSize (127 );
27552764
27562765 buffer->setArgStateful (&surfaceState, false , false , false , true );
27572766
@@ -2821,9 +2830,10 @@ HWTEST_F(BufferSetSurfaceTests, givenRenderCompressedGmmResourceWhenSurfaceState
28212830 auto retVal = CL_SUCCESS;
28222831
28232832 std::unique_ptr<Buffer> buffer (Buffer::create (&context, CL_MEM_READ_WRITE, 1 , nullptr , retVal));
2824- buffer->getGraphicsAllocation ()->setAllocationType (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
2833+ auto graphicsAllocation = buffer->getGraphicsAllocation (context.getDevice (0 )->getRootDeviceIndex ());
2834+ graphicsAllocation->setAllocationType (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
28252835 auto gmm = new Gmm (context.getDevice (0 )->getGmmClientContext (), nullptr , 1 , false );
2826- buffer-> getGraphicsAllocation () ->setDefaultGmm (gmm);
2836+ graphicsAllocation ->setDefaultGmm (gmm);
28272837 gmm->isRenderCompressed = true ;
28282838
28292839 buffer->setArgStateful (&surfaceState, false , false , false , false );
@@ -2832,7 +2842,7 @@ HWTEST_F(BufferSetSurfaceTests, givenRenderCompressedGmmResourceWhenSurfaceState
28322842 EXPECT_TRUE (AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E == surfaceState.getAuxiliarySurfaceMode ());
28332843 EXPECT_TRUE (RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT == surfaceState.getCoherencyType ());
28342844
2835- buffer-> getGraphicsAllocation () ->setAllocationType (GraphicsAllocation::AllocationType::BUFFER);
2845+ graphicsAllocation ->setAllocationType (GraphicsAllocation::AllocationType::BUFFER);
28362846 buffer->setArgStateful (&surfaceState, false , false , false , false );
28372847 EXPECT_TRUE (AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE == surfaceState.getAuxiliarySurfaceMode ());
28382848}
@@ -2847,7 +2857,7 @@ HWTEST_F(BufferSetSurfaceTests, givenNonRenderCompressedGmmResourceWhenSurfaceSt
28472857
28482858 std::unique_ptr<Buffer> buffer (Buffer::create (&context, CL_MEM_READ_WRITE, 1 , nullptr , retVal));
28492859 auto gmm = new Gmm (context.getDevice (0 )->getGmmClientContext (), nullptr , 1 , false );
2850- buffer->getGraphicsAllocation ()->setDefaultGmm (gmm);
2860+ buffer->getGraphicsAllocation (context. getDevice ( 0 )-> getRootDeviceIndex () )->setDefaultGmm (gmm);
28512861 gmm->isRenderCompressed = false ;
28522862
28532863 buffer->setArgStateful (&surfaceState, false , false , false , false );
0 commit comments