diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp index d5ae54ba68..25eeeb4585 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_aub_tests.cpp @@ -62,7 +62,7 @@ HWTEST_P(AUBCopyBuffer, simple) { cl_event *eventWaitList = nullptr; cl_event *event = nullptr; - auto pDstMemory = (cl_float *)(dstBuffer->getGraphicsAllocation()->getGpuAddress()); + auto pDstMemory = reinterpret_cast(dstBuffer->getGraphicsAllocation(pDevice->getRootDeviceIndex())->getGpuAddress()); retVal = pCmdQ->enqueueCopyBuffer( srcBuffer, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp index 1a6ed71b6c..772ccca8f5 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_buffer_rect_aub_tests.cpp @@ -76,7 +76,7 @@ HWTEST_P(AUBCopyBufferRect, simple) { auto pSrcMemory = &srcMemory[0]; - auto pDestMemory = (cl_uchar *)(dstBuffer->getGraphicsAllocation()->getGpuAddress()); + auto pDestMemory = reinterpret_cast(dstBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()); size_t regionX = std::min(rowPitch / 2, rowPitch - std::max(srcOrigin0, dstOrigin0)); size_t regionY = std::min(rowPitch / 2, rowPitch - std::max(srcOrigin1, dstOrigin1)); diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp index aee23e0f74..08288cee1e 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_buffer_aub_tests.cpp @@ -66,7 +66,7 @@ HWTEST_P(AUBFillBuffer, simple) { pCmdQ->flush(); - pDestMemory = reinterpret_cast((destBuffer->getGraphicsAllocation()->getGpuAddress())); + pDestMemory = reinterpret_cast((destBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress())); // The memory under offset should be untouched if (offset) { @@ -134,7 +134,7 @@ HWTEST_F(AUBFillBuffer, givenFillBufferWhenSeveralSubmissionsWithoutPollForCompl AUBCommandStreamFixture::pollForCompletion(); - pDestMemory = reinterpret_cast((destBuffer->getGraphicsAllocation()->getGpuAddress())); + pDestMemory = reinterpret_cast((destBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress())); auto pEndMemory = ptrOffset(pDestMemory, numWrites * size); while (pDestMemory < pEndMemory) { AUBCommandStreamFixture::expectMemory(pDestMemory, pattern, patternSize); diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp index e4e480744f..edd0d763ff 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp @@ -163,8 +163,8 @@ HWTEST_P(AUBHelloWorldIntegrateTest, simple) { cl_event *eventWaitList = nullptr; cl_event *event = nullptr; - writeMemory(destBuffer->getGraphicsAllocation()); - writeMemory(srcBuffer->getGraphicsAllocation()); + writeMemory(destBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())); + writeMemory(srcBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())); auto retVal = this->pCmdQ->enqueueKernel( this->pKernel, @@ -183,7 +183,7 @@ HWTEST_P(AUBHelloWorldIntegrateTest, simple) { auto globalWorkItems = globalWorkSize[0] * globalWorkSize[1] * globalWorkSize[2]; auto sizeWritten = globalWorkItems * sizeof(float); - auto pDestGpuAddress = reinterpret_cast((destBuffer->getGraphicsAllocation()->getGpuAddress())); + auto pDestGpuAddress = reinterpret_cast((destBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress())); AUBCommandStreamFixture::expectMemory(pDestGpuAddress, this->pSrcMemory, sizeWritten); @@ -411,7 +411,7 @@ struct AUBSimpleArgNonUniformFixture : public KernelAUBFixture(outBuffer->getGraphicsAllocation()->getGpuAddress()); + bufferGpuAddress = reinterpret_cast(outBuffer->getGraphicsAllocation(device->getRootDeviceIndex())->getGpuAddress()); kernel->setArg(1, outBuffer.get()); sizeWrittenMemory = maxId * typeSize; @@ -514,7 +514,7 @@ HWTEST_F(AUBSimpleKernelStatelessTest, givenSimpleKernelWhenStatelessPathIsUsedT EXPECT_TRUE(this->kernel->getKernelInfo().patchInfo.executionEnvironment->CompiledForGreaterThan4GBBuffers); this->pCmdQ->flush(); - expectMemory(reinterpret_cast(pBuffer->getGraphicsAllocation()->getGpuAddress()), + expectMemory(reinterpret_cast(pBuffer->getGraphicsAllocation(device->getRootDeviceIndex())->getGpuAddress()), bufferExpected, bufferSize); } diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp index c0aac47025..230128069e 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_aub_tests.cpp @@ -75,7 +75,7 @@ HWTEST_P(AUBWriteBuffer, simple) { eventWaitList, event); - auto pDestMemory = reinterpret_cast((dstBuffer->getGraphicsAllocation()->getGpuAddress())); + auto pDestMemory = reinterpret_cast((dstBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress())); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal); @@ -156,7 +156,7 @@ struct AUBWriteBufferUnaligned EXPECT_EQ(CL_SUCCESS, retVal); // Check the memory - auto bufferGPUPtr = reinterpret_cast((buffer->getGraphicsAllocation()->getGpuAddress())); + auto bufferGPUPtr = reinterpret_cast((buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress())); AUBCommandStreamFixture::expectMemory(ptrOffset(bufferGPUPtr, offset), ptrOffset(srcMemory, offset), size); } }; diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp index 2f209cf934..a295ca0a9d 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_buffer_rect_aub_tests.cpp @@ -66,7 +66,7 @@ HWTEST_P(AUBWriteBufferRect, simple3D) { retVal)); ASSERT_NE(nullptr, dstBuffer); - uint8_t *pDestMemory = (uint8_t *)dstBuffer->getGraphicsAllocation()->getGpuAddress(); + uint8_t *pDestMemory = reinterpret_cast(dstBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()); cl_bool blockingWrite = CL_TRUE; @@ -145,7 +145,7 @@ struct AUBWriteBufferRectUnaligned buffer->forceDisallowCPUCopy = true; - uint8_t *pDestMemory = (uint8_t *)buffer->getGraphicsAllocation()->getGpuAddress(); + uint8_t *pDestMemory = reinterpret_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()); cl_bool blockingWrite = CL_TRUE; diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_copy_read_buffer_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_copy_read_buffer_aub_tests.cpp index 76320fa3b1..548467b375 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_copy_read_buffer_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_copy_read_buffer_aub_tests.cpp @@ -46,11 +46,11 @@ void AubWriteCopyReadBuffer::runTest() { retVal)); ASSERT_NE(nullptr, dstBuffer); - simulatedCsr->writeMemory(*srcBuffer->getGraphicsAllocation()); - simulatedCsr->writeMemory(*dstBuffer->getGraphicsAllocation()); + simulatedCsr->writeMemory(*srcBuffer->getGraphicsAllocation(device->getRootDeviceIndex())); + simulatedCsr->writeMemory(*dstBuffer->getGraphicsAllocation(device->getRootDeviceIndex())); - expectMemory(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation()), srcMemoryInitial, bufferSize); - expectMemory(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), dstMemoryInitial, bufferSize); + expectMemory(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation(device->getRootDeviceIndex())), srcMemoryInitial, bufferSize); + expectMemory(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation(device->getRootDeviceIndex())), dstMemoryInitial, bufferSize); cl_uint numEventsInWaitList = 0; cl_event *eventWaitList = nullptr; @@ -82,8 +82,8 @@ void AubWriteCopyReadBuffer::runTest() { EXPECT_EQ(CL_SUCCESS, retVal); - expectMemory(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation()), srcMemoryToWrite, bufferSize); - expectMemory(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), dstMemoryToWrite, bufferSize); + expectMemory(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation(device->getRootDeviceIndex())), srcMemoryToWrite, bufferSize); + expectMemory(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation(device->getRootDeviceIndex())), dstMemoryToWrite, bufferSize); retVal = pCmdQ->enqueueCopyBuffer( srcBuffer.get(), @@ -100,7 +100,7 @@ void AubWriteCopyReadBuffer::runTest() { pCmdQ->flush(); // Destination buffer should have src buffer content - expectMemory(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), srcMemoryToWrite, bufferSize); + expectMemory(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation(device->getRootDeviceIndex())), srcMemoryToWrite, bufferSize); char hostPtrMemory[] = {0, 0, 0, 0, 0, 0, 0, 0}; ASSERT_EQ(bufferSize, sizeof(hostPtrMemory)); diff --git a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h index 5d37d637f2..450934c00d 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h @@ -31,7 +31,6 @@ class AUBFixture : public CommandQueueHwFixture { public: void SetUp(const HardwareInfo *hardwareInfo) { const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *defaultHwInfo; - uint32_t deviceIndex = 0; auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); auto engineType = getChosenEngineType(hwInfo); @@ -44,7 +43,7 @@ class AUBFixture : public CommandQueueHwFixture { executionEnvironment->prepareRootDeviceEnvironments(1u); executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo); - device = std::make_unique(MockDevice::create(executionEnvironment, deviceIndex)); + device = std::make_unique(MockDevice::create(executionEnvironment, rootDeviceIndex)); if (testMode == TestMode::AubTestsWithTbx) { this->csr = TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0); @@ -103,6 +102,7 @@ class AUBFixture : public CommandQueueHwFixture { return reinterpret_cast(allocation->getGpuAddress()); } + const uint32_t rootDeviceIndex = 0; CommandStreamReceiver *csr = nullptr; volatile uint32_t *pTagMemory = nullptr; std::unique_ptr device; diff --git a/opencl/test/unit_test/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp b/opencl/test/unit_test/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp index 26df247a3c..bd42daf620 100644 --- a/opencl/test/unit_test/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp +++ b/opencl/test/unit_test/aub_tests/gen11/execution_model/enqueue_parent_kernel_tests_gen11.cpp @@ -107,8 +107,8 @@ GEN11TEST_F(GEN11AUBParentKernelFixture, EnqueueParentKernel) { uint32_t expectedNumberOfEnqueues = 1; uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t)); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(gpuAddress), &expectedNumberOfEnqueues, sizeof(uint32_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()), &argScalar, sizeof(size_t)); delete devQueue; delete image; diff --git a/opencl/test/unit_test/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp b/opencl/test/unit_test/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp index 797a2562e1..17b5711f6f 100644 --- a/opencl/test/unit_test/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp +++ b/opencl/test/unit_test/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.cpp @@ -42,7 +42,8 @@ GEN12LPTEST_F(Gen12LPTimestampTests, DISABLED_GivenCommandQueueWithProfilingEnab const uint32_t bufferSize = 4; std::unique_ptr buffer(Buffer::create(pContext, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal)); - memset(buffer->getGraphicsAllocation()->getUnderlyingBuffer(), 0, buffer->getGraphicsAllocation()->getUnderlyingBufferSize()); + memset(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getUnderlyingBuffer(), 0, + buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getUnderlyingBufferSize()); buffer->forceDisallowCPUCopy = true; uint8_t writeData[bufferSize] = {0x11, 0x22, 0x33, 0x44}; @@ -51,7 +52,7 @@ GEN12LPTEST_F(Gen12LPTimestampTests, DISABLED_GivenCommandQueueWithProfilingEnab ASSERT_NE(event, nullptr); auto eventObject = castToObject(event); ASSERT_NE(eventObject, nullptr); - expectMemory(buffer->getGraphicsAllocation()->getUnderlyingBuffer(), writeData, bufferSize); + expectMemory(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getUnderlyingBuffer(), writeData, bufferSize); uint64_t expectedTimestampValues[2] = {0, 0}; TagNode &hwTimeStamps = *(eventObject->getHwTimeStampNode()); diff --git a/opencl/test/unit_test/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp b/opencl/test/unit_test/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp index 1dbd9e1f5d..2f87e601fa 100644 --- a/opencl/test/unit_test/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp +++ b/opencl/test/unit_test/aub_tests/gen12lp/execution_model/enqueue_parent_kernel_tests_gen12lp.cpp @@ -107,8 +107,8 @@ GEN12LPTEST_F(GEN12LPAUBParentKernelFixture, EnqueueParentKernel) { uint32_t expectedNumberOfEnqueues = 1; uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t)); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(gpuAddress), &expectedNumberOfEnqueues, sizeof(uint32_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()), &argScalar, sizeof(size_t)); delete devQueue; delete image; diff --git a/opencl/test/unit_test/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp b/opencl/test/unit_test/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp index 2d56bc9881..f839bf16e5 100644 --- a/opencl/test/unit_test/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp +++ b/opencl/test/unit_test/aub_tests/gen8/execution_model/enqueue_parent_kernel_tests_gen8.cpp @@ -107,6 +107,6 @@ GEN8TEST_F(GEN8AUBParentKernelFixture, EnqueueParentKernel) { uint32_t expectedNumberOfEnqueues = 1; uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t)); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(gpuAddress), &expectedNumberOfEnqueues, sizeof(uint32_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()), &argScalar, sizeof(size_t)); } diff --git a/opencl/test/unit_test/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp b/opencl/test/unit_test/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp index 5739f1f8b3..6d61ad9bf8 100644 --- a/opencl/test/unit_test/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp +++ b/opencl/test/unit_test/aub_tests/gen9/execution_model/enqueue_parent_kernel_tests_gen9.cpp @@ -105,8 +105,8 @@ GEN9TEST_F(AUBParentKernelFixture, EnqueueParentKernel) { uint32_t expectedNumberOfEnqueues = 1; uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t)); - AUBCommandStreamFixture::expectMemory((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(gpuAddress), &expectedNumberOfEnqueues, sizeof(uint32_t)); + AUBCommandStreamFixture::expectMemory(reinterpret_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()), &argScalar, sizeof(size_t)); delete devQueue; delete image; diff --git a/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp b/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp index 071e350db4..a79028db23 100644 --- a/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp +++ b/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp @@ -127,7 +127,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, ooqExecution) { ASSERT_NE(nullptr, destinationBuffer1); //buffer may not be zero copied - pDestinationMemory1 = reinterpret_cast(destinationBuffer1->getGraphicsAllocation()->getGpuAddress()); + pDestinationMemory1 = reinterpret_cast(destinationBuffer1->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()); auto destinationBuffer2 = Buffer::create( context, @@ -138,7 +138,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, ooqExecution) { ASSERT_NE(nullptr, destinationBuffer2); //buffer may not be zero copied - pDestinationMemory2 = reinterpret_cast(destinationBuffer2->getGraphicsAllocation()->getGpuAddress()); + pDestinationMemory2 = reinterpret_cast(destinationBuffer2->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()); cl_mem arg2 = intermediateBuffer; cl_mem arg4 = destinationBuffer1; 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 e885fcce73..e1f3a8f1d8 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 @@ -607,7 +607,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, gicenEnqueueReadBufferCalledWhenLockedPtrInT ctx.memoryManager = &memoryManager; auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); - static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::System4KBPages); + static_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()))->overrideMemoryPool(MemoryPool::System4KBPages); void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); retVal = mockCmdQ->enqueueReadBuffer(buffer.get(), @@ -628,7 +628,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferBlockingWhenAUBDumpAll DebugManagerStateRestore dbgRestore; DebugManager.flags.AUBDumpAllocsOnEnqueueReadOnly.set(true); - ASSERT_FALSE(srcBuffer->getGraphicsAllocation()->isAllocDumpable()); + ASSERT_FALSE(srcBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->isAllocDumpable()); cl_int retVal = CL_SUCCESS; void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); retVal = pCmdQ->enqueueReadBuffer(srcBuffer.get(), @@ -642,7 +642,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferBlockingWhenAUBDumpAll nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_TRUE(srcBuffer->getGraphicsAllocation()->isAllocDumpable()); + EXPECT_TRUE(srcBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->isAllocDumpable()); EXPECT_TRUE(srcBuffer->forceDisallowCPUCopy); } @@ -650,7 +650,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferNonBlockingWhenAUBDump DebugManagerStateRestore dbgRestore; DebugManager.flags.AUBDumpAllocsOnEnqueueReadOnly.set(true); - ASSERT_FALSE(srcBuffer->getGraphicsAllocation()->isAllocDumpable()); + ASSERT_FALSE(srcBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->isAllocDumpable()); cl_int retVal = CL_SUCCESS; void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); retVal = pCmdQ->enqueueReadBuffer(srcBuffer.get(), @@ -664,7 +664,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferNonBlockingWhenAUBDump nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_FALSE(srcBuffer->getGraphicsAllocation()->isAllocDumpable()); + EXPECT_FALSE(srcBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->isAllocDumpable()); EXPECT_FALSE(srcBuffer->forceDisallowCPUCopy); } diff --git a/opencl/test/unit_test/command_queue/enqueue_unmap_memobject_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_unmap_memobject_tests.cpp index 01f8517d1d..a3606e7eb9 100644 --- a/opencl/test/unit_test/command_queue/enqueue_unmap_memobject_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_unmap_memobject_tests.cpp @@ -197,8 +197,9 @@ TEST_F(EnqueueUnmapMemObjTest, WhenUnmappingMemoryObjectThenWaitEventIsUpdated) HWTEST_F(EnqueueUnmapMemObjTest, givenEnqueueUnmapMemObjectWhenNonAubWritableBufferObjectMappedToHostPtrForWritingThenItShouldBeResetToAubAndTbxWritable) { auto buffer = std::unique_ptr(BufferHelper<>::create()); ASSERT_NE(nullptr, buffer); - buffer->getGraphicsAllocation()->setAubWritable(false, GraphicsAllocation::defaultBank); - buffer->getGraphicsAllocation()->setTbxWritable(false, GraphicsAllocation::defaultBank); + auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()); + graphicsAllocation->setAubWritable(false, GraphicsAllocation::defaultBank); + graphicsAllocation->setTbxWritable(false, GraphicsAllocation::defaultBank); auto mappedForWritingPtr = pCmdQ->enqueueMapBuffer(buffer.get(), CL_TRUE, CL_MAP_WRITE, 0, 8, 0, nullptr, nullptr, retVal); ASSERT_NE(nullptr, mappedForWritingPtr); @@ -211,8 +212,8 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenEnqueueUnmapMemObjectWhenNonAubWritableBuf nullptr); ASSERT_EQ(CL_SUCCESS, retVal); - EXPECT_TRUE(buffer->getGraphicsAllocation()->isAubWritable(GraphicsAllocation::defaultBank)); - EXPECT_TRUE(buffer->getGraphicsAllocation()->isTbxWritable(GraphicsAllocation::defaultBank)); + EXPECT_TRUE(graphicsAllocation->isAubWritable(GraphicsAllocation::defaultBank)); + EXPECT_TRUE(graphicsAllocation->isTbxWritable(GraphicsAllocation::defaultBank)); } HWTEST_F(EnqueueUnmapMemObjTest, givenWriteBufferIsServicedOnCPUWhenBufferIsNonAubTbxWriteableThanFlagsChange) { @@ -220,21 +221,22 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenWriteBufferIsServicedOnCPUWhenBufferIsNonA DebugManager.flags.DoCpuCopyOnWriteBuffer.set(1); auto buffer = std::unique_ptr(BufferHelper<>::create()); ASSERT_NE(nullptr, buffer); - buffer->getGraphicsAllocation()->setAubWritable(false, GraphicsAllocation::defaultBank); - buffer->getGraphicsAllocation()->setTbxWritable(false, GraphicsAllocation::defaultBank); + auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()); + graphicsAllocation->setAubWritable(false, GraphicsAllocation::defaultBank); + graphicsAllocation->setTbxWritable(false, GraphicsAllocation::defaultBank); - EXPECT_FALSE(buffer->getGraphicsAllocation()->isAubWritable(GraphicsAllocation::defaultBank)); - EXPECT_FALSE(buffer->getGraphicsAllocation()->isTbxWritable(GraphicsAllocation::defaultBank)); + EXPECT_FALSE(graphicsAllocation->isAubWritable(GraphicsAllocation::defaultBank)); + EXPECT_FALSE(graphicsAllocation->isTbxWritable(GraphicsAllocation::defaultBank)); auto ptr = allocateAlignedMemory(buffer->getSize(), MemoryConstants::cacheLineSize); retVal = pCmdQ->enqueueWriteBuffer(buffer.get(), true, 0u, buffer->getSize(), ptr.get(), nullptr, 0u, nullptr, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_EQ(0, memcmp(ptr.get(), buffer->getGraphicsAllocation()->getUnderlyingBuffer(), buffer->getSize())); + EXPECT_EQ(0, memcmp(ptr.get(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize())); - EXPECT_TRUE(buffer->getGraphicsAllocation()->isAubWritable(GraphicsAllocation::defaultBank)); - EXPECT_TRUE(buffer->getGraphicsAllocation()->isTbxWritable(GraphicsAllocation::defaultBank)); + EXPECT_TRUE(graphicsAllocation->isAubWritable(GraphicsAllocation::defaultBank)); + EXPECT_TRUE(graphicsAllocation->isTbxWritable(GraphicsAllocation::defaultBank)); } HWTEST_F(EnqueueUnmapMemObjTest, givenMemObjWhenUnmappingThenSetAubWritableBeforeEnqueueWrite) { 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 d757ed4f5e..841cc54508 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 @@ -383,7 +383,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenEnqueueWriteBufferCalledWhenLockedPtrI ctx.memoryManager = &memoryManager; auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); - static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); + static_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()))->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(), @@ -411,9 +411,11 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse ctx.memoryManager = &memoryManager; auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); - static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); + auto allocation = static_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())); + + allocation->overrideMemoryPool(MemoryPool::SystemCpuInaccessible); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); - buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); + allocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(), CL_FALSE, @@ -426,10 +428,10 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_FALSE(buffer->getGraphicsAllocation()->isLocked()); + EXPECT_FALSE(allocation->isLocked()); EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled); - buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); + allocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(), CL_FALSE, @@ -442,7 +444,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_TRUE(buffer->getGraphicsAllocation()->isLocked()); + EXPECT_TRUE(allocation->isLocked()); EXPECT_TRUE(mockCmdQ->cpuDataTransferHandlerCalled); } @@ -457,7 +459,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenEnqueueWriteBufferCalledWhenLockedPtrI ctx.memoryManager = &memoryManager; auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); std::unique_ptr buffer(Buffer::create(&ctx, 0, 1, nullptr, retVal)); - static_cast(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::System4KBPages); + static_cast(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()))->overrideMemoryPool(MemoryPool::System4KBPages); void *ptr = srcBuffer->getCpuAddressForMemoryTransfer(); retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(), 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 cf7e7322c8..0226a8d299 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -213,11 +213,12 @@ class HwHelperTestsGen12LpBuffer : public ::testing::Test { public: void SetUp() override { ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); - device = std::make_unique(Device::create(executionEnvironment, 0u)); + device = std::make_unique(Device::create(executionEnvironment, rootDeviceIndex)); context = std::make_unique(device.get(), true); context->contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; } + const uint32_t rootDeviceIndex = 0u; cl_int retVal = CL_SUCCESS; std::unique_ptr device; std::unique_ptr context; @@ -229,9 +230,9 @@ GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenCompressedBufferThenCheckResource buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal)); - buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); + buffer->getGraphicsAllocation(rootDeviceIndex)->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); - EXPECT_FALSE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation())); + EXPECT_FALSE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation(rootDeviceIndex))); } GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenBufferThenCheckResourceCompatibilityReturnsTrue) { @@ -239,9 +240,9 @@ GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenBufferThenCheckResourceCompatibil buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal)); - buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); + buffer->getGraphicsAllocation(rootDeviceIndex)->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); - EXPECT_TRUE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation())); + EXPECT_TRUE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation(rootDeviceIndex))); } using LriHelperTestsGen12Lp = ::testing::Test; diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp index 4b5daca4b5..b5dd2b595b 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp @@ -1459,23 +1459,23 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, BufferResidency) { std::unique_ptr buffer(DrmMockBuffer::create()); auto osContextId = csr->getOsContext().getContextId(); - - ASSERT_FALSE(buffer->getGraphicsAllocation()->isResident(osContextId)); + auto graphicsAlocation = buffer->getGraphicsAllocation(rootDeviceIndex); + ASSERT_FALSE(graphicsAlocation->isResident(osContextId)); ASSERT_GT(buffer->getSize(), 0u); //make it resident 8 times for (int c = 0; c < 8; c++) { - csr->makeResident(*buffer->getGraphicsAllocation()); + csr->makeResident(*graphicsAlocation); csr->processResidency(csr->getResidencyAllocations(), 0u); - EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(osContextId)); - EXPECT_EQ(buffer->getGraphicsAllocation()->getResidencyTaskCount(osContextId), csr->peekTaskCount() + 1); + EXPECT_TRUE(graphicsAlocation->isResident(osContextId)); + EXPECT_EQ(graphicsAlocation->getResidencyTaskCount(osContextId), csr->peekTaskCount() + 1); } - csr->makeNonResident(*buffer->getGraphicsAllocation()); - EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(osContextId)); + csr->makeNonResident(*graphicsAlocation); + EXPECT_FALSE(graphicsAlocation->isResident(osContextId)); - csr->makeNonResident(*buffer->getGraphicsAllocation()); - EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(osContextId)); + csr->makeNonResident(*graphicsAlocation); + EXPECT_FALSE(graphicsAlocation->isResident(osContextId)); } HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmCommandStreamReceiverWhenMemoryManagerIsCreatedThenItHasHostMemoryValidationEnabledByDefault) { 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 b0a84dc54b..7a726f0f6d 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 @@ -971,8 +971,8 @@ TEST_F(DrmMemoryManagerTest, Given32bitAllocatorWhenAskedForBufferAllocationThen EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_TRUE(buffer->isMemObjZeroCopy()); - auto bufferAddress = buffer->getGraphicsAllocation()->getGpuAddress(); - auto baseAddress = buffer->getGraphicsAllocation()->getGpuBaseAddress(); + auto bufferAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuAddress(); + auto baseAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuBaseAddress(); EXPECT_LT(ptrDiff(bufferAddress, baseAddress), MemoryConstants::max32BitAddress); @@ -1004,10 +1004,10 @@ TEST_F(DrmMemoryManagerTest, Given32bitAllocatorWhenAskedForBufferCreatedFromHos EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_TRUE(buffer->isMemObjZeroCopy()); - auto bufferAddress = buffer->getGraphicsAllocation()->getGpuAddress(); - auto drmAllocation = static_cast(buffer->getGraphicsAllocation()); + auto bufferAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuAddress(); + auto drmAllocation = static_cast(buffer->getGraphicsAllocation(rootDeviceIndex)); - auto baseAddress = buffer->getGraphicsAllocation()->getGpuBaseAddress(); + auto baseAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuBaseAddress(); EXPECT_LT(ptrDiff(bufferAddress, baseAddress), MemoryConstants::max32BitAddress); EXPECT_TRUE(drmAllocation->is32BitAllocation()); @@ -1064,12 +1064,12 @@ TEST_F(DrmMemoryManagerTest, Given32bitAllocatorWhenAskedForBufferCreatedFrom64B EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_TRUE(buffer->isMemObjZeroCopy()); - auto bufferAddress = buffer->getGraphicsAllocation()->getGpuAddress(); + auto bufferAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuAddress(); - auto baseAddress = buffer->getGraphicsAllocation()->getGpuBaseAddress(); + auto baseAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuBaseAddress(); EXPECT_LT(ptrDiff(bufferAddress, baseAddress), MemoryConstants::max32BitAddress); - auto drmAllocation = static_cast(buffer->getGraphicsAllocation()); + auto drmAllocation = static_cast(buffer->getGraphicsAllocation(rootDeviceIndex)); EXPECT_TRUE(drmAllocation->is32BitAllocation()); @@ -1193,10 +1193,10 @@ TEST_F(DrmMemoryManagerTest, GivenSizeAbove2GBWhenUseHostPtrAndAllocHostPtrAreCr EXPECT_EQ(nullptr, buffer2); if (buffer) { - auto bufferPtr = buffer->getGraphicsAllocation()->getGpuAddress(); + auto bufferPtr = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuAddress(); - EXPECT_TRUE(buffer->getGraphicsAllocation()->is32BitAllocation()); - auto baseAddress = buffer->getGraphicsAllocation()->getGpuBaseAddress(); + EXPECT_TRUE(buffer->getGraphicsAllocation(rootDeviceIndex)->is32BitAllocation()); + auto baseAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuBaseAddress(); EXPECT_LT(ptrDiff(bufferPtr, baseAddress), MemoryConstants::max32BitAddress); } @@ -1234,10 +1234,10 @@ TEST_F(DrmMemoryManagerTest, GivenSizeAbove2GBWhenAllocHostPtrAndUseHostPtrAreCr EXPECT_EQ(nullptr, buffer2); if (buffer) { - auto bufferPtr = buffer->getGraphicsAllocation()->getGpuAddress(); + auto bufferPtr = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuAddress(); - EXPECT_TRUE(buffer->getGraphicsAllocation()->is32BitAllocation()); - auto baseAddress = buffer->getGraphicsAllocation()->getGpuBaseAddress(); + EXPECT_TRUE(buffer->getGraphicsAllocation(rootDeviceIndex)->is32BitAllocation()); + auto baseAddress = buffer->getGraphicsAllocation(rootDeviceIndex)->getGpuBaseAddress(); EXPECT_LT(ptrDiff(bufferPtr, baseAddress), MemoryConstants::max32BitAddress); } 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 b4efc06f36..560c8b82de 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 @@ -44,6 +44,7 @@ bool MockGLSharingFunctions::SharingEnabled = false; class glSharingTests : public ::testing::Test { public: void SetUp() override { + rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex(); mockGlSharingFunctions = mockGlSharing->sharingFunctions.release(); context.setSharingFunctions(mockGlSharingFunctions); @@ -52,6 +53,7 @@ class glSharingTests : public ::testing::Test { mockGlSharing->uploadDataToBufferInfo(); } + uint32_t rootDeviceIndex; MockContext context; std::unique_ptr mockGlSharing = std::make_unique(); GlSharingFunctionsMock *mockGlSharingFunctions; @@ -74,9 +76,9 @@ TEST_F(glSharingTests, givenMockGlWhenGlBufferIsCreatedThenMemObjectHasGlHandler auto glBuffer = GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, &retVal); EXPECT_NE(nullptr, glBuffer); - EXPECT_NE(nullptr, glBuffer->getGraphicsAllocation()); + EXPECT_NE(nullptr, glBuffer->getGraphicsAllocation(rootDeviceIndex)); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_EQ(4096u, glBuffer->getGraphicsAllocation()->getUnderlyingBufferSize()); + EXPECT_EQ(4096u, glBuffer->getGraphicsAllocation(rootDeviceIndex)->getUnderlyingBufferSize()); EXPECT_EQ(1, mockGlSharing->dllParam->getParam("GLAcquireSharedBufferCalled")); EXPECT_EQ(bufferId, mockGlSharing->dllParam->getBufferInfo().bufferName); @@ -154,7 +156,7 @@ TEST_F(glSharingTests, givenContextAnd32BitAddressingWhenClCreateFromGlBufferIsC ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, glBuffer); - EXPECT_TRUE(castToObject(glBuffer)->getGraphicsAllocation()->is32BitAllocation()); + EXPECT_TRUE(castToObject(glBuffer)->getGraphicsAllocation(rootDeviceIndex)->is32BitAllocation()); retVal = clReleaseMemObject(glBuffer); EXPECT_EQ(CL_SUCCESS, retVal); @@ -214,13 +216,13 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredThenAcuqireCountIsIncremen EXPECT_FALSE(memObject->isMemObjZeroCopy()); EXPECT_FALSE(memObject->isReadWriteOnCpuAllowed()); - auto currentGraphicsAllocation = memObject->getGraphicsAllocation(); + auto currentGraphicsAllocation = memObject->getGraphicsAllocation(rootDeviceIndex); - memObject->peekSharingHandler()->acquire(memObject, context.getDevice(0)->getRootDeviceIndex()); + memObject->peekSharingHandler()->acquire(memObject, rootDeviceIndex); EXPECT_EQ(2, mockGlSharing->dllParam->getParam("GLAcquireSharedBufferCalled")); EXPECT_EQ(1, mockGlSharing->dllParam->getParam("GLGetCurrentContextCalled")); - auto currentGraphicsAllocation2 = memObject->getGraphicsAllocation(); + auto currentGraphicsAllocation2 = memObject->getGraphicsAllocation(rootDeviceIndex); EXPECT_EQ(currentGraphicsAllocation2, currentGraphicsAllocation); @@ -1281,8 +1283,8 @@ TEST_F(glSharingTests, whenGetGlContextHandleIsCalledThenProperHandleIsReturned) TEST_F(glSharingTests, givenClGLBufferWhenCreatedThenSharedBufferAllocatoinTypeIsSet) { std::unique_ptr buffer(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, nullptr)); - ASSERT_NE(nullptr, buffer->getGraphicsAllocation()); - EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_BUFFER, buffer->getGraphicsAllocation()->getAllocationType()); + ASSERT_NE(nullptr, buffer->getGraphicsAllocation(rootDeviceIndex)); + EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_BUFFER, buffer->getGraphicsAllocation(rootDeviceIndex)->getAllocationType()); } using clGetSupportedGLTextureFormatsINTELTests = glSharingTests;