Use root device index when accessing graphics allocation from buffer

Related-To: NEO-4672
Change-Id: I31ed0aa567276b606f4b09733ca2a8d678f9786f
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-06-08 19:17:23 +02:00
committed by sys_ocldev
parent 9e8945ca83
commit 87596d2387
27 changed files with 253 additions and 227 deletions

View File

@@ -32,6 +32,7 @@ TEST_F(EnqueueKernelTest, givenKernelWithSharedObjArgsWhenEnqueueIsCalledThenRes
pContext->setSharingFunctions(glSharing.sharingFunctions.release());
auto retVal = CL_SUCCESS;
auto sharedBuffer = GlBuffer::createSharedGlBuffer(pContext, CL_MEM_READ_WRITE, 1, &retVal);
auto graphicsAllocation = sharedBuffer->getGraphicsAllocation(pContext->getDevice(0)->getRootDeviceIndex());
auto sharedMem = static_cast<cl_mem>(sharedBuffer);
auto nonSharedMem = static_cast<cl_mem>(nonSharedBuffer);
@@ -45,8 +46,8 @@ TEST_F(EnqueueKernelTest, givenKernelWithSharedObjArgsWhenEnqueueIsCalledThenRes
auto address1 = static_cast<uint64_t>(*pKernelArg);
auto sharedBufferGpuAddress =
pKernel->isBuiltIn ? sharedBuffer->getGraphicsAllocation()->getGpuAddress()
: sharedBuffer->getGraphicsAllocation()->getGpuAddressToPatch();
pKernel->isBuiltIn ? graphicsAllocation->getGpuAddress()
: graphicsAllocation->getGpuAddressToPatch();
EXPECT_EQ(sharedBufferGpuAddress, address1);
// update address
@@ -58,8 +59,8 @@ TEST_F(EnqueueKernelTest, givenKernelWithSharedObjArgsWhenEnqueueIsCalledThenRes
auto address2 = static_cast<uint64_t>(*pKernelArg);
EXPECT_NE(address1, address2);
sharedBufferGpuAddress =
pKernel->isBuiltIn ? sharedBuffer->getGraphicsAllocation()->getGpuAddress()
: sharedBuffer->getGraphicsAllocation()->getGpuAddressToPatch();
pKernel->isBuiltIn ? graphicsAllocation->getGpuAddress()
: graphicsAllocation->getGpuAddressToPatch();
EXPECT_EQ(sharedBufferGpuAddress, address2);
delete sharedBuffer;