Skip to content

Commit 7fcc1bc

Browse files
kgibalaCompute-Runtime-Automation
authored andcommitted
Use first device for blit transfer when buffer is creating
Related-To: NEO-4589 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
1 parent e060536 commit 7fcc1bc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

opencl/source/mem_obj/buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ Buffer *Buffer::create(Context *context,
381381
bool gpuCopyRequired = (gmm && gmm->isRenderCompressed) || !MemoryPool::isSystemMemoryPool(allocationInfo[rootDeviceIndex].memory->getMemoryPool());
382382

383383
if (gpuCopyRequired) {
384-
auto blitMemoryToAllocationResult = BlitHelperFunctions::blitMemoryToAllocation(pBuffer->getContext()->getDevice(rootDeviceIndex)->getDevice(), allocationInfo[rootDeviceIndex].memory, pBuffer->getOffset(), hostPtr, {size, 1, 1});
384+
auto blitMemoryToAllocationResult = BlitHelperFunctions::blitMemoryToAllocation(pBuffer->getContext()->getDevice(0u)->getDevice(), allocationInfo[rootDeviceIndex].memory, pBuffer->getOffset(), hostPtr, {size, 1, 1});
385385

386386
if (blitMemoryToAllocationResult != BlitOperationResult::Success) {
387387
auto cmdQ = context->getSpecialQueue(rootDeviceIndex);

opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBufferWithInitializationDataAndBcsCsrWhe
139139
EXPECT_EQ(1u, bcsCsr->blitBufferCalled);
140140
}
141141

142+
HWTEST_TEMPLATED_F(BcsBufferTests, givenBufferWithNotDefaultRootDeviceIndexAndBcsCsrWhenCreatingThenUseBlitOperation) {
143+
144+
std::unique_ptr<MockClDevice> newDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr, 1u));
145+
std::unique_ptr<BcsMockContext> newBcsMockContext = std::make_unique<BcsMockContext>(newDevice.get());
146+
147+
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(newBcsMockContext->bcsCsr.get());
148+
auto newMemoryManager = new MockMemoryManager(true, true, *newDevice->getExecutionEnvironment());
149+
150+
newDevice->getExecutionEnvironment()->memoryManager.reset(newMemoryManager);
151+
newBcsMockContext->memoryManager = newMemoryManager;
152+
153+
EXPECT_EQ(0u, bcsCsr->blitBufferCalled);
154+
auto bufferForBlt = clUniquePtr(Buffer::create(newBcsMockContext.get(), CL_MEM_COPY_HOST_PTR, 2000, &hostPtr, retVal));
155+
EXPECT_EQ(1u, bcsCsr->blitBufferCalled);
156+
}
157+
142158
HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIsCalledThenUseBcsCsr) {
143159
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
144160
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->getBcsCommandStreamReceiver());

0 commit comments

Comments
 (0)