Skip to content

Commit 515130d

Browse files
Fail on blitMemoryToAllocation when blitter is not supported
Related-To: NEO-6325 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 93e3d94 commit 515130d

File tree

4 files changed

+5
-31
lines changed

4 files changed

+5
-31
lines changed

opencl/test/unit_test/context/context_tests.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ContextCreateTests, givenLocalMemoryAllocationWhenB
563563
auto executionEnv = testedDevice->getExecutionEnvironment();
564564
executionEnv->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = false;
565565

566-
const auto &hwInfo = testedDevice->getHardwareInfo();
567-
auto isBlitterRequired = HwHelper::get(hwInfo.platform.eRenderCoreFamily).isBlitCopyRequiredForLocalMemory(hwInfo, *memory);
568-
569-
auto expectedStatus = isBlitterRequired ? BlitOperationResult::Success : BlitOperationResult::Unsupported;
570-
571-
EXPECT_EQ(expectedStatus, BlitHelper::blitMemoryToAllocation(buffer->getContext()->getDevice(0)->getDevice(), memory, buffer->getOffset(), hostMemory, {1, 1, 1}));
566+
EXPECT_EQ(BlitOperationResult::Unsupported, BlitHelper::blitMemoryToAllocation(buffer->getContext()->getDevice(0)->getDevice(), memory, buffer->getOffset(), hostMemory, {1, 1, 1}));
572567

573568
executionEnv->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
574569
EXPECT_EQ(BlitOperationResult::Success, BlitHelper::blitMemoryToAllocation(buffer->getContext()->getDevice(0)->getDevice(), memory, buffer->getOffset(), hostMemory, {1, 1, 1}));

opencl/test/unit_test/memory_manager/memory_manager_tests.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,26 +3017,6 @@ TEST(MemoryTransferHelperTest, givenBlitOperationSupportedWhenBcsEngineNotAvaila
30173017
EXPECT_EQ(BlitOperationResult::Unsupported, BlitHelperFunctions::blitMemoryToAllocation(*device, &graphicsAllocation, 0, srcData, {dataSize, 1, 1}));
30183018
}
30193019

3020-
TEST(MemoryTransferHelperTest, givenBlitOperationSupportedDisabledWhenBlitMemoryToAllocationThenReturnUnsupported) {
3021-
DebugManagerStateRestore restorer;
3022-
constexpr uint32_t dataSize = 16;
3023-
uint8_t destData[dataSize] = {};
3024-
uint8_t srcData[dataSize] = {};
3025-
3026-
MockGraphicsAllocation graphicsAllocation{destData, sizeof(destData)};
3027-
graphicsAllocation.storageInfo.memoryBanks = 1;
3028-
graphicsAllocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
3029-
3030-
auto hwInfo = *defaultHwInfo;
3031-
hwInfo.capabilityTable.blitterOperationsSupported = true;
3032-
hwInfo.featureTable.ftrBcsInfo = 1;
3033-
DebugManager.flags.EnableBlitterOperationsSupport.set(false);
3034-
3035-
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
3036-
3037-
EXPECT_EQ(BlitOperationResult::Unsupported, BlitHelperFunctions::blitMemoryToAllocation(*device, &graphicsAllocation, 0, srcData, {dataSize, 1, 1}));
3038-
}
3039-
30403020
TEST(MemoryManagerTest, givenMemoryManagerWithLocalMemoryWhenCreatingMultiGraphicsAllocationInSystemMemoryThenForceSystemMemoryPlacement) {
30413021
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
30423022
executionEnvironment.initGmm();

shared/source/helpers/blit_commands_helper.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,7 @@ BlitOperationResult BlitHelper::blitMemoryToAllocation(const Device &device, Gra
174174
BlitOperationResult BlitHelper::blitMemoryToAllocationBanks(const Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
175175
const Vec3<size_t> &size, DeviceBitfield memoryBanks) {
176176
const auto &hwInfo = device.getHardwareInfo();
177-
auto isBlitterRequired = HwHelper::get(hwInfo.platform.eRenderCoreFamily).isBlitCopyRequiredForLocalMemory(hwInfo, *memory);
178-
if (!hwInfo.capabilityTable.blitterOperationsSupported && !isBlitterRequired) {
179-
return BlitOperationResult::Unsupported;
180-
}
181-
if (0 == DebugManager.flags.EnableBlitterOperationsSupport.get()) {
177+
if (!hwInfo.capabilityTable.blitterOperationsSupported) {
182178
return BlitOperationResult::Unsupported;
183179
}
184180

shared/source/memory_manager/memory_manager.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,9 @@ bool MemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAllocatio
684684
for (auto i = 0u; i < graphicsAllocation->storageInfo.getNumBanks(); ++i) {
685685
memcpy_s(ptrOffset(static_cast<uint8_t *>(graphicsAllocation->getUnderlyingBuffer()) + i * graphicsAllocation->getUnderlyingBufferSize(), destinationOffset),
686686
(graphicsAllocation->getUnderlyingBufferSize() - destinationOffset), memoryToCopy, sizeToCopy);
687+
if (graphicsAllocation->getAllocationType() != GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
688+
break;
689+
}
687690
}
688691
return true;
689692
}

0 commit comments

Comments
 (0)