Skip to content

Commit 595f374

Browse files
Dont use blitter for local memory transfer if not available
Change-Id: I5f43113498b59e3f1b8cb280c9feeccae8ff6140 Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 0848d62 commit 595f374

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

opencl/source/program/kernel_info.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,14 +433,14 @@ bool KernelInfo::createKernelAllocation(const Device &device) {
433433
auto &hwInfo = device.getHardwareInfo();
434434
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
435435

436+
bool status = false;
436437
if (kernelAllocation->isAllocatedInLocalMemoryPool() && hwHelper.isBlitCopyRequiredForLocalMemory(hwInfo)) {
437-
auto status = BlitHelperFunctions::blitMemoryToAllocation(device, kernelAllocation, 0, heapInfo.pKernelHeap, {kernelIsaSize, 1, 1});
438-
if (status != BlitOperationResult::Unsupported) {
439-
return status == BlitOperationResult::Success;
440-
}
438+
status = (BlitHelperFunctions::blitMemoryToAllocation(device, kernelAllocation, 0, heapInfo.pKernelHeap, {kernelIsaSize, 1, 1}) == BlitOperationResult::Success);
439+
} else {
440+
status = device.getMemoryManager()->copyMemoryToAllocation(kernelAllocation, heapInfo.pKernelHeap, kernelIsaSize);
441441
}
442442

443-
return device.getMemoryManager()->copyMemoryToAllocation(kernelAllocation, heapInfo.pKernelHeap, kernelIsaSize);
443+
return status;
444444
}
445445

446446
void KernelInfo::apply(const DeviceInfoKernelPayloadConstants &constants) {

opencl/test/unit_test/helpers/hw_helper_tests.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,16 +905,21 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8Is
905905
HWTEST_F(HwHelperTest, whenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
906906
DebugManagerStateRestore restore{};
907907
auto &helper = HwHelper::get(renderCoreFamily);
908+
HardwareInfo hwInfo = *defaultHwInfo;
909+
hwInfo.capabilityTable.blitterOperationsSupported = true;
908910

909-
auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(*defaultHwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
910-
EXPECT_EQ(expectedDefaultValue, helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo));
911+
auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
912+
EXPECT_EQ(expectedDefaultValue, helper.isBlitCopyRequiredForLocalMemory(hwInfo));
911913

912914
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
913-
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo));
915+
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo));
914916
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
915-
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo));
917+
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo));
918+
916919
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
917-
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo));
920+
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo));
921+
hwInfo.capabilityTable.blitterOperationsSupported = false;
922+
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo));
918923
}
919924

920925
HWTEST_F(HwHelperTest, whenPatchingGlobalBuffersThenDontForceBlitter) {

shared/source/helpers/hw_helper_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ inline bool HwHelperHw<GfxFamily>::allowRenderCompression(const HardwareInfo &hw
422422
template <typename GfxFamily>
423423
inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo) const {
424424
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
425-
return (hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
425+
return (hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) && hwInfo.capabilityTable.blitterOperationsSupported;
426426
}
427427

428428
template <typename GfxFamily>

shared/test/unit_test/program/program_initialization_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ TEST(AllocateGlobalSurfaceTest, GivenAllocationInLocalMemoryWhichRequiresBlitter
235235
for (auto isLocalMemorySupported : ::testing::Bool()) {
236236
DebugManager.flags.EnableLocalMemory.set(isLocalMemorySupported);
237237
MockDevice device;
238+
device.getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
238239
MockSVMAllocsManager svmAllocsManager(device.getMemoryManager());
239240

240241
auto pAllocation = allocateGlobalsSurface(&svmAllocsManager, device, initData.size(), true /* constant */,

0 commit comments

Comments
 (0)