From 44af85b49243072543faa89bbaf3d7d17ecb2780 Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Thu, 22 Oct 2020 11:25:32 +0200 Subject: [PATCH] Return correct maxFillSize property Related-To: NEO-5205 Change-Id: I62b7fec89451c640f70028b8d3ecb81f7655225d Signed-off-by: Maciej Plewka --- level_zero/core/source/cmdlist/cmdlist_hw.h | 1 - level_zero/core/source/cmdlist/cmdlist_hw.inl | 20 +--------- .../core/source/cmdlist/cmdlist_hw_base.inl | 5 --- level_zero/core/source/device/device_imp.cpp | 6 ++- .../gen12lp/test_device_gen12lp.cpp | 16 +++++--- .../test/unit_tests/gen9/test_device_gen9.cpp | 4 +- .../sources/cmdlist/test_cmdlist_2.cpp | 22 +++++++++++ .../sources/cmdlist/test_cmdlist_blit.cpp | 23 +++-------- shared/source/gen11/hw_helper_gen11.cpp | 2 + shared/source/gen12lp/hw_helper_gen12lp.cpp | 1 + shared/source/gen8/hw_helper_gen8.cpp | 2 + shared/source/gen9/hw_helper_gen9.cpp | 2 + shared/source/helpers/CMakeLists.txt | 1 + shared/source/helpers/hw_helper.h | 2 + shared/source/helpers/hw_helper_base.inl | 10 ----- shared/source/helpers/hw_helper_bdw_plus.inl | 14 +------ .../source/helpers/hw_helper_bdw_to_icllp.inl | 38 +++++++++++++++++++ .../source/helpers/hw_helper_tgllp_plus.inl | 20 +++++++--- 18 files changed, 110 insertions(+), 79 deletions(-) create mode 100644 shared/source/helpers/hw_helper_bdw_to_icllp.inl diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.h b/level_zero/core/source/cmdlist/cmdlist_hw.h index 07ed3b0eab..ef21872c1e 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.h +++ b/level_zero/core/source/cmdlist/cmdlist_hw.h @@ -202,7 +202,6 @@ struct CommandListCoreFamily : CommandListImp { void appendEventForProfiling(ze_event_handle_t hEvent, bool beforeWalker); void appendEventForProfilingCopyCommand(ze_event_handle_t hEvent, bool beforeWalker); void appendSignalEventPostWalker(ze_event_handle_t hEvent); - bool useMemCopyToBlitFill(size_t patternSize); void programStateBaseAddress(NEO::CommandContainer &container, bool genericMediaStateClearRequired); void programThreadArbitrationPolicy(Device *device); diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 098b98d6ca..19fd8f0ec0 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -1207,24 +1207,8 @@ ze_result_t CommandListCoreFamily::appendBlitFill(void *ptr, size_t size, ze_event_handle_t hEvent) { auto neoDevice = device->getNEODevice(); - if (useMemCopyToBlitFill(patternSize)) { - NEO::AllocationProperties properties = {neoDevice->getRootDeviceIndex(), - false, - size, - NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, - false, - neoDevice->getDeviceBitfield()}; - properties.flags.allocateMemory = 1; - auto internalAlloc = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties); - size_t offset = 0; - for (uint32_t i = 0; i < size / patternSize; i++) { - memcpy_s(ptrOffset(internalAlloc->getUnderlyingBuffer(), offset), (internalAlloc->getUnderlyingBufferSize() - offset), pattern, patternSize); - offset += patternSize; - } - memcpy_s(ptrOffset(internalAlloc->getUnderlyingBuffer(), offset), (internalAlloc->getUnderlyingBufferSize() - offset), pattern, size - offset); - auto ret = CommandListCoreFamily::appendMemoryCopy(ptr, internalAlloc->getUnderlyingBuffer(), size, hEvent, 0, nullptr); - commandContainer.getDeallocationContainer().push_back(internalAlloc); - return ret; + if (NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily).getMaxFillPaternSizeForCopyEngine() < patternSize) { + return ZE_RESULT_ERROR_INVALID_SIZE; } else { appendEventForProfiling(hEvent, true); NEO::SvmAllocationData *allocData = nullptr; diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_base.inl b/level_zero/core/source/cmdlist/cmdlist_hw_base.inl index 9935ec6a09..92da65a144 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_base.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_base.inl @@ -105,9 +105,4 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(z return ZE_RESULT_SUCCESS; } - -template -bool CommandListCoreFamily::useMemCopyToBlitFill(size_t patternSize) { - return patternSize > sizeof(uint32_t); -} } // namespace L0 diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 8537f4ac38..381fc4c4d9 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -155,15 +155,19 @@ ze_result_t DeviceImp::getCommandQueueGroupProperties(uint32_t *pCount, ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY | ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS | ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS; + pCommandQueueGroupProperties[engineGroupCount].maxMemoryFillPatternSize = std::numeric_limits::max(); } if (i == static_cast(NEO::EngineGroupType::Compute)) { pCommandQueueGroupProperties[engineGroupCount].flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE | ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY; + pCommandQueueGroupProperties[engineGroupCount].maxMemoryFillPatternSize = std::numeric_limits::max(); } if (i == static_cast(NEO::EngineGroupType::Copy)) { pCommandQueueGroupProperties[engineGroupCount].flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY; + const auto &hardwareInfo = this->neoDevice->getHardwareInfo(); + auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); + pCommandQueueGroupProperties[engineGroupCount].maxMemoryFillPatternSize = hwHelper.getMaxFillPaternSizeForCopyEngine(); } - pCommandQueueGroupProperties[engineGroupCount].maxMemoryFillPatternSize = sizeof(uint32_t); pCommandQueueGroupProperties[engineGroupCount].numQueues = static_cast(engines[i].size()); engineGroupCount++; } diff --git a/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp index 0b38ff4d37..a5d9ca4ed3 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp @@ -124,15 +124,17 @@ HWTEST2_F(DeviceQueueGroupTest, } else { EXPECT_EQ(properties[i].numQueues, 1u); } + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); } else if (i == static_cast(NEO::EngineGroupType::Compute)) { EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE); EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); EXPECT_EQ(properties[i].numQueues, 1u); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); } else if (i == static_cast(NEO::EngineGroupType::Copy)) { EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); EXPECT_EQ(properties[i].numQueues, 1u); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t)); } - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint32_t)); } } @@ -171,15 +173,17 @@ HWTEST2_F(DeviceQueueGroupTest, } else { EXPECT_EQ(properties[i].numQueues, 1u); } + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); } else if (i == static_cast(NEO::EngineGroupType::Compute)) { EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE); EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); EXPECT_EQ(properties[i].numQueues, 1u); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); } else if (i == static_cast(NEO::EngineGroupType::Copy)) { EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); EXPECT_EQ(properties[i].numQueues, 1u); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t)); } - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint32_t)); } } @@ -209,11 +213,11 @@ HWTEST2_F(DeviceQueueGroupTest, EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS); EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS); - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint32_t)); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); EXPECT_EQ(properties[i].numQueues, 1u); } else if (i == static_cast(NEO::EngineGroupType::Copy)) { EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint32_t)); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t)); EXPECT_EQ(properties[i].numQueues, 1u); } } @@ -251,11 +255,11 @@ HWTEST2_F(DeviceQueueGroupTest, EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS); EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS); - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint32_t)); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); EXPECT_EQ(properties[i].numQueues, 1u); } else if (i == static_cast(NEO::EngineGroupType::Copy)) { EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY); - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint32_t)); + EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t)); EXPECT_EQ(properties[i].numQueues, 1u); } diff --git a/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp index ee65f0379f..5b436a2926 100644 --- a/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp @@ -54,7 +54,7 @@ HWTEST2_F(DeviceQueueGroupTest, givenCommandQueuePropertiesCallThenCorrectNumber EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS); EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS); EXPECT_EQ(properties.numQueues, 1u); - EXPECT_EQ(properties.maxMemoryFillPatternSize, sizeof(uint32_t)); + EXPECT_EQ(properties.maxMemoryFillPatternSize, std::numeric_limits::max()); } HWTEST2_F(DeviceQueueGroupTest, givenQueueGroupsReturnedThenCommandListIsCreatedCorrectly, IsGen9) { @@ -72,7 +72,7 @@ HWTEST2_F(DeviceQueueGroupTest, givenQueueGroupsReturnedThenCommandListIsCreated EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS); EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS); EXPECT_EQ(properties.numQueues, 1u); - EXPECT_EQ(properties.maxMemoryFillPatternSize, sizeof(uint32_t)); + EXPECT_EQ(properties.maxMemoryFillPatternSize, std::numeric_limits::max()); ze_context_handle_t hContext; ze_context_desc_t contextDesc; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index 12bffefe27..6b418ce7c8 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -1035,5 +1035,27 @@ HWTEST2_F(CommandListCreate, givenCommandList, SupportedPlatforms) { auto size = helper.getRenderSurfaceStateSize(); EXPECT_EQ(commandList.getReserveSshSize(), size); } + +HWTEST_F(CommandListCreate, GivenCommandListWhenUnalignedPtrThenLeftMiddleAndRightCopyAdded) { + using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; + ze_result_t returnValue; + std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, returnValue)); + ASSERT_NE(nullptr, commandList); + + EXPECT_EQ(device, commandList->device); + + void *srcPtr = reinterpret_cast(0x4321); + void *dstPtr = reinterpret_cast(0x2345); + auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 2 * MemoryConstants::cacheLineSize, nullptr, 0, nullptr); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + GenCmdList cmdList; + + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( + cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + auto itor = find(cmdList.begin(), cmdList.end()); + for (uint32_t i = 0; i < 3u; i++, itor++) { + EXPECT_NE(itor++, cmdList.end()); + } +} } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp index d35cecc5a4..8f4d09b52d 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp @@ -160,8 +160,8 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillCalledWithL cmdList.initialize(device, NEO::EngineGroupType::Copy); uint64_t pattern[4] = {1, 2, 3, 4}; void *ptr = reinterpret_cast(0x1234); - cmdList.appendMemoryFill(ptr, reinterpret_cast(&pattern), sizeof(pattern), 0x1000, nullptr); - EXPECT_GT(cmdList.appendMemoryCopyBlitCalledTimes, 0u); + auto ret = cmdList.appendMemoryFill(ptr, reinterpret_cast(&pattern), sizeof(pattern), 0x1000, nullptr); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_SIZE, ret); } HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillToNotDeviceMemThenInvalidArgumentReturned, Platforms) { @@ -173,7 +173,9 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillToNotDevice EXPECT_EQ(ret, ZE_RESULT_ERROR_INVALID_ARGUMENT); } -HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBltIsProgrammed, Platforms) { +using MemFillPlatforms = IsWithinProducts; + +HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBltIsProgrammed, MemFillPlatforms) { using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT; MockCommandListForMemFill commandList; @@ -191,21 +193,6 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBlt device->setDriverHandle(driverHandle.get()); } -HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppendBlitFillCalledWithLargePatternSizeThenInternalAllocHasPattern, Platforms) { - MockCommandListForMemFill cmdList; - cmdList.initialize(device, NEO::EngineGroupType::Copy); - uint64_t pattern[4] = {1, 2, 3, 4}; - void *ptr = reinterpret_cast(0x1234); - uint32_t fillElements = 0x101; - auto size = fillElements * sizeof(uint64_t); - cmdList.appendMemoryFill(ptr, reinterpret_cast(&pattern), sizeof(pattern), size, nullptr); - auto internalAlloc = cmdList.commandContainer.getDeallocationContainer()[0]; - for (uint32_t i = 0; i < fillElements; i++) { - auto allocValue = reinterpret_cast(internalAlloc->getUnderlyingBuffer())[i]; - EXPECT_EQ(allocValue, pattern[i % 4]); - } -} - HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListAndHostPointersWhenMemoryCopyCalledThenPipeControlWithDcFlushAddedIsNotAddedAfterBlitCopy, Platforms) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; diff --git a/shared/source/gen11/hw_helper_gen11.cpp b/shared/source/gen11/hw_helper_gen11.cpp index 4a2f4a31a8..76bfa762f3 100644 --- a/shared/source/gen11/hw_helper_gen11.cpp +++ b/shared/source/gen11/hw_helper_gen11.cpp @@ -7,7 +7,9 @@ #include "shared/source/gen11/aub_mapper.h" #include "shared/source/helpers/flat_batch_buffer_helper_hw.inl" +#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_bdw_plus.inl" +#include "shared/source/helpers/hw_helper_bdw_to_icllp.inl" namespace NEO { typedef ICLFamily Family; diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 337514d3c5..4e336f2a1d 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -12,6 +12,7 @@ using Family = NEO::TGLLPFamily; #include "shared/source/gen12lp/helpers_gen12lp.h" #include "shared/source/helpers/flat_batch_buffer_helper_hw.inl" +#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_bdw_plus.inl" #include "shared/source/helpers/hw_helper_tgllp_plus.inl" #include "shared/source/os_interface/hw_info_config.h" diff --git a/shared/source/gen8/hw_helper_gen8.cpp b/shared/source/gen8/hw_helper_gen8.cpp index 9c75c9cf41..1f89b481fc 100644 --- a/shared/source/gen8/hw_helper_gen8.cpp +++ b/shared/source/gen8/hw_helper_gen8.cpp @@ -8,7 +8,9 @@ #include "shared/source/gen8/aub_mapper.h" #include "shared/source/helpers/constants.h" #include "shared/source/helpers/flat_batch_buffer_helper_hw.inl" +#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_bdw_plus.inl" +#include "shared/source/helpers/hw_helper_bdw_to_icllp.inl" namespace NEO { typedef BDWFamily Family; diff --git a/shared/source/gen9/hw_helper_gen9.cpp b/shared/source/gen9/hw_helper_gen9.cpp index c42c9d3ce5..b81b629ed2 100644 --- a/shared/source/gen9/hw_helper_gen9.cpp +++ b/shared/source/gen9/hw_helper_gen9.cpp @@ -7,7 +7,9 @@ #include "shared/source/gen9/aub_mapper.h" #include "shared/source/helpers/flat_batch_buffer_helper_hw.inl" +#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_bdw_plus.inl" +#include "shared/source/helpers/hw_helper_bdw_to_icllp.inl" namespace NEO { typedef SKLFamily Family; diff --git a/shared/source/helpers/CMakeLists.txt b/shared/source/helpers/CMakeLists.txt index 0e2a2c19f7..82d7cbd8e2 100644 --- a/shared/source/helpers/CMakeLists.txt +++ b/shared/source/helpers/CMakeLists.txt @@ -55,6 +55,7 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_base.inl ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_bdw_plus.inl + ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_bdw_to_icllp.inl ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/hw_helper_extended.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tgllp_plus.inl ${CMAKE_CURRENT_SOURCE_DIR}/hw_info.cpp diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 9eb6b8e6ba..23f84cd1f6 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -127,6 +127,7 @@ class HwHelper { virtual bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const = 0; virtual bool packedFormatsSupported() const = 0; virtual bool isCooperativeDispatchSupported(const aub_stream::EngineType engine, const PRODUCT_FAMILY productFamily) const = 0; + virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0; static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo); static uint32_t getEnginesCount(const HardwareInfo &hwInfo); @@ -310,6 +311,7 @@ class HwHelperHw : public HwHelper { bool packedFormatsSupported() const override; bool isCooperativeDispatchSupported(const aub_stream::EngineType engine, const PRODUCT_FAMILY productFamily) const override; + size_t getMaxFillPaternSizeForCopyEngine() const override; protected: LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 17a7710111..beb60b579b 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -394,11 +394,6 @@ uint32_t HwHelperHw::getMaxThreadsForWorkgroup(const HardwareInfo &hw return HwHelper::getMaxThreadsForWorkgroup(hwInfo, maxNumEUsPerSubSlice); } -template -inline bool HwHelperHw::isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const { - return false; -} - template inline bool HwHelperHw::isSpecialWorkgroupSizeRequired(const HardwareInfo &hwInfo, bool isSimulation) const { return false; @@ -494,11 +489,6 @@ bool HwHelperHw::useSystemMemoryPlacementForISA(const HardwareInfo &h return !getEnableLocalMemory(hwInfo); } -template -bool HwHelperHw::packedFormatsSupported() const { - return false; -} - template bool MemorySynchronizationCommands::isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo) { return false; diff --git a/shared/source/helpers/hw_helper_bdw_plus.inl b/shared/source/helpers/hw_helper_bdw_plus.inl index 01df9da547..33478a5c42 100644 --- a/shared/source/helpers/hw_helper_bdw_plus.inl +++ b/shared/source/helpers/hw_helper_bdw_plus.inl @@ -5,8 +5,8 @@ * */ -#include "shared/source/gmm_helper/gmm_helper.h" -#include "shared/source/helpers/hw_helper_base.inl" +#include "shared/source/helpers/hw_helper.h" +#include "shared/source/helpers/hw_info.h" namespace NEO { @@ -113,14 +113,4 @@ inline void MemorySynchronizationCommands::setPipeControlExtraPropert template bool MemorySynchronizationCommands::isPipeControlWArequired(const HardwareInfo &hwInfo) { return false; } -template -void LriHelper::program(LinearStream *cmdStream, uint32_t address, uint32_t value, bool remap) { - MI_LOAD_REGISTER_IMM cmd = GfxFamily::cmdInitLoadRegisterImm; - cmd.setRegisterOffset(address); - cmd.setDataDword(value); - - auto lri = cmdStream->getSpaceForCmd(); - *lri = cmd; -} - } // namespace NEO diff --git a/shared/source/helpers/hw_helper_bdw_to_icllp.inl b/shared/source/helpers/hw_helper_bdw_to_icllp.inl new file mode 100644 index 0000000000..622f4c3db1 --- /dev/null +++ b/shared/source/helpers/hw_helper_bdw_to_icllp.inl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2019-2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/hw_helper.h" +#include "shared/source/helpers/hw_info.h" + +namespace NEO { + +template +inline bool HwHelperHw::isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const { + return false; +} + +template +void LriHelper::program(LinearStream *cmdStream, uint32_t address, uint32_t value, bool remap) { + MI_LOAD_REGISTER_IMM cmd = GfxFamily::cmdInitLoadRegisterImm; + cmd.setRegisterOffset(address); + cmd.setDataDword(value); + + auto lri = cmdStream->getSpaceForCmd(); + *lri = cmd; +} + +template +bool HwHelperHw::packedFormatsSupported() const { + return false; +} + +template +size_t HwHelperHw::getMaxFillPaternSizeForCopyEngine() const { + return sizeof(uint32_t); +} + +} // namespace NEO diff --git a/shared/source/helpers/hw_helper_tgllp_plus.inl b/shared/source/helpers/hw_helper_tgllp_plus.inl index 16fefcd88a..baeef9ef34 100644 --- a/shared/source/helpers/hw_helper_tgllp_plus.inl +++ b/shared/source/helpers/hw_helper_tgllp_plus.inl @@ -5,10 +5,13 @@ * */ +#include "shared/source/helpers/hw_helper.h" +#include "shared/source/helpers/hw_info.h" + namespace NEO { -template <> -inline bool HwHelperHw::isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const { +template +inline bool HwHelperHw::isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const { auto fusedEuDispatchEnabled = !hwInfo.workaroundTable.waDisableFusedThreadScheduling; if (DebugManager.flags.CFEFusedEUDispatch.get() != -1) { fusedEuDispatchEnabled = (DebugManager.flags.CFEFusedEUDispatch.get() == 0); @@ -16,8 +19,8 @@ inline bool HwHelperHw::isFusedEuDispatchEnabled(const HardwareInfo &hwI return fusedEuDispatchEnabled; } -template <> -void LriHelper::program(LinearStream *cmdStream, uint32_t address, uint32_t value, bool remap) { +template +void LriHelper::program(LinearStream *cmdStream, uint32_t address, uint32_t value, bool remap) { MI_LOAD_REGISTER_IMM cmd = Family::cmdInitLoadRegisterImm; cmd.setRegisterOffset(address); cmd.setDataDword(value); @@ -27,9 +30,14 @@ void LriHelper::program(LinearStream *cmdStream, uint32_t address, uint3 *lri = cmd; } -template <> -bool HwHelperHw::packedFormatsSupported() const { +template +bool HwHelperHw::packedFormatsSupported() const { return true; } +template +size_t HwHelperHw::getMaxFillPaternSizeForCopyEngine() const { + return 4 * sizeof(uint32_t); +} + } // namespace NEO