diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index c3fb0b5551..cc1e883719 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -255,7 +255,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO this->dummyBlitWa.rootDeviceEnvironment = &(neoDevice->getRootDeviceEnvironmentRef()); this->dispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(!(this->internalUsage && isImmediateType())); this->useOnlyGlobalTimestamps = gfxCoreHelper.useOnlyGlobalTimestamps(); - this->maxFillPatternSizeForCopyEngine = productHelper.getMaxFillPatternSizeForCopyEngine(); + this->maxFillPatternSizeForCopyEngine = l0GfxCoreHelper.getMaxFillPatternSizeForCopyEngine(); this->heaplessModeEnabled = compilerProductHelper.isHeaplessModeEnabled(hwInfo); this->heaplessStateInitEnabled = compilerProductHelper.isHeaplessStateInitEnabled(this->heaplessModeEnabled); this->requiredStreamState.initSupport(rootDeviceEnvironment); diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index dc2ff16541..b6c36d2ed7 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -336,14 +336,11 @@ uint32_t DeviceImp::getCopyQueueGroupsFromSubDevice(uint32_t numberOfSubDeviceCo auto &rootDeviceEnv = this->neoDevice->getRootDeviceEnvironment(); auto &l0GfxCoreHelper = rootDeviceEnv.getHelper(); - auto &productHelper = rootDeviceEnv.getHelper(); uint32_t subDeviceQueueGroupsIter = 0; for (; subDeviceQueueGroupsIter < std::min(numSubDeviceCopyEngineGroups, numberOfSubDeviceCopyEngineGroupsRequested); subDeviceQueueGroupsIter++) { pCommandQueueGroupProperties[subDeviceQueueGroupsIter].flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY; - pCommandQueueGroupProperties[subDeviceQueueGroupsIter].maxMemoryFillPatternSize = productHelper.getMaxFillPatternSizeForCopyEngine(); - - l0GfxCoreHelper.setAdditionalGroupProperty(pCommandQueueGroupProperties[subDeviceQueueGroupsIter], this->subDeviceCopyEngineGroups[subDeviceQueueGroupsIter]); + pCommandQueueGroupProperties[subDeviceQueueGroupsIter].maxMemoryFillPatternSize = l0GfxCoreHelper.getMaxFillPatternSizeForCopyEngine(); pCommandQueueGroupProperties[subDeviceQueueGroupsIter].numQueues = static_cast(this->subDeviceCopyEngineGroups[subDeviceQueueGroupsIter].engines.size()); } @@ -391,7 +388,6 @@ ze_result_t DeviceImp::getCommandQueueGroupProperties(uint32_t *pCount, auto &rootDeviceEnv = this->neoDevice->getRootDeviceEnvironment(); auto &l0GfxCoreHelper = rootDeviceEnv.getHelper(); - auto &productHelper = rootDeviceEnv.getHelper(); *pCount = std::min(totalEngineGroups, *pCount); for (uint32_t i = 0; i < std::min(numEngineGroups, *pCount); i++) { @@ -408,11 +404,11 @@ ze_result_t DeviceImp::getCommandQueueGroupProperties(uint32_t *pCount, ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS; pCommandQueueGroupProperties[i].maxMemoryFillPatternSize = std::numeric_limits::max(); } - if (engineGroups[i].engineGroupType == NEO::EngineGroupType::copy) { + if (engineGroups[i].engineGroupType == NEO::EngineGroupType::copy || engineGroups[i].engineGroupType == NEO::EngineGroupType::linkedCopy) { pCommandQueueGroupProperties[i].flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY; - pCommandQueueGroupProperties[i].maxMemoryFillPatternSize = productHelper.getMaxFillPatternSizeForCopyEngine(); + pCommandQueueGroupProperties[i].maxMemoryFillPatternSize = l0GfxCoreHelper.getMaxFillPatternSizeForCopyEngine(); } - l0GfxCoreHelper.setAdditionalGroupProperty(pCommandQueueGroupProperties[i], engineGroups[i]); + pCommandQueueGroupProperties[i].numQueues = static_cast(engineGroups[i].engines.size()); } diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h index 4d5a9e88e9..3f67b16773 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h @@ -72,7 +72,6 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { static ze_mutable_command_exp_flags_t getCmdListUpdateCapabilities(const NEO::RootDeviceEnvironment &rootDeviceEnvironment); static ze_record_replay_graph_exp_flags_t getRecordReplayGraphCapabilities(const NEO::RootDeviceEnvironment &rootDeviceEnvironment); - virtual void setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const = 0; virtual L0::Event *createEvent(L0::EventPool *eventPool, const ze_event_desc_t *desc, L0::Device *device, ze_result_t &result) const = 0; virtual L0::Event *createStandaloneEvent(const EventDescriptor &desc, L0::Device *device, ze_result_t &result) const = 0; @@ -119,6 +118,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { virtual bool isDefaultCmdListWithCopyOffloadSupported(bool additionalBlitPropertiesSupported) const = 0; virtual bool bcsSplitAggregatedModeEnabled() const = 0; virtual bool supportMetricsAggregation() const = 0; + virtual size_t getMaxFillPatternSizeForCopyEngine() const = 0; protected: L0GfxCoreHelper() = default; @@ -132,7 +132,6 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper { return std::unique_ptr(new L0GfxCoreHelperHw()); } - void setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const override; L0::Event *createEvent(L0::EventPool *eventPool, const ze_event_desc_t *desc, L0::Device *device, ze_result_t &result) const override; L0::Event *createStandaloneEvent(const EventDescriptor &desc, L0::Device *device, ze_result_t &result) const override; @@ -178,6 +177,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper { bool isDefaultCmdListWithCopyOffloadSupported(bool additionalBlitPropertiesSupported) const override; bool bcsSplitAggregatedModeEnabled() const override; bool supportMetricsAggregation() const override; + size_t getMaxFillPatternSizeForCopyEngine() const override; protected: L0GfxCoreHelperHw() = default; diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_pvc_and_later.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_pvc_and_later.inl index 5daeb345d8..e45b171dc3 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_pvc_and_later.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_pvc_and_later.inl @@ -15,28 +15,6 @@ #include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h" namespace L0 { -template -void L0GfxCoreHelperHw::setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const { - if (group.engineGroupType == NEO::EngineGroupType::linkedCopy) { - groupProperty.flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY; - groupProperty.maxMemoryFillPatternSize = sizeof(uint8_t); - } - - if (group.engineGroupType == NEO::EngineGroupType::copy) { - groupProperty.flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY; - - bool virtualEnginesEnabled = true; - for (const auto &engine : group.engines) { - if (engine.osContext) { - virtualEnginesEnabled &= NEO::EngineHelpers::isBcsVirtualEngineEnabled(engine.getEngineType()); - } - } - if (virtualEnginesEnabled) { - groupProperty.maxMemoryFillPatternSize = sizeof(uint8_t); - } - } -} - template bool L0GfxCoreHelperHw::isResumeWARequired() { return false; @@ -47,4 +25,9 @@ bool L0GfxCoreHelperHw::synchronizedDispatchSupported() const { return true; } +template +size_t L0GfxCoreHelperHw::getMaxFillPatternSizeForCopyEngine() const { + return sizeof(uint8_t); +} + } // namespace L0 diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_tgllp_to_dg2.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_tgllp_to_dg2.inl index f132a7178a..d1022db910 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_tgllp_to_dg2.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_tgllp_to_dg2.inl @@ -13,10 +13,6 @@ namespace L0 { -template -void L0GfxCoreHelperHw::setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const { -} - template void L0GfxCoreHelperHw::getAttentionBitmaskForSingleThreads(const std::vector &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr &bitmask, size_t &bitmaskSize) const { @@ -154,4 +150,9 @@ bool L0GfxCoreHelperHw::supportMetricsAggregation() const { return false; } +template +size_t L0GfxCoreHelperHw::getMaxFillPatternSizeForCopyEngine() const { + return 4 * sizeof(uint32_t); +} + } // namespace L0 diff --git a/level_zero/core/test/black_box_tests/common/zello_common.cpp b/level_zero/core/test/black_box_tests/common/zello_common.cpp index 2a5632ec9a..6e20d481b8 100644 --- a/level_zero/core/test/black_box_tests/common/zello_common.cpp +++ b/level_zero/core/test/black_box_tests/common/zello_common.cpp @@ -336,6 +336,17 @@ uint32_t getCopyOnlyCommandQueueOrdinal(ze_device_handle_t &device) { return copyOnlyQueueGroupOrdinal; } +size_t getQueueMaxFillPatternSize(ze_device_handle_t &device, uint32_t queueQroupOrdinal) { + std::vector &queueProperties = getDeviceQueueProperties(device); + + size_t maxFillPatternSize = 0; + if (queueProperties.size() > queueQroupOrdinal) { + maxFillPatternSize = queueProperties[queueQroupOrdinal].maxMemoryFillPatternSize; + } + + return maxFillPatternSize; +} + ze_command_queue_handle_t createCommandQueue(ze_context_handle_t &context, ze_device_handle_t &device, uint32_t *ordinal, ze_command_queue_mode_t mode, ze_command_queue_priority_t priority, bool useCooperativeFlag) { diff --git a/level_zero/core/test/black_box_tests/common/zello_common.h b/level_zero/core/test/black_box_tests/common/zello_common.h index 099d9b3b19..208d784642 100644 --- a/level_zero/core/test/black_box_tests/common/zello_common.h +++ b/level_zero/core/test/black_box_tests/common/zello_common.h @@ -110,6 +110,8 @@ std::vector getComputeQueueOrdinals(ze_device_handle_t &device); uint32_t getCopyOnlyCommandQueueOrdinal(ze_device_handle_t &device); +size_t getQueueMaxFillPatternSize(ze_device_handle_t &device, uint32_t queueQroupOrdinal); + ze_command_queue_handle_t createCommandQueue(ze_context_handle_t &context, ze_device_handle_t &device, uint32_t *ordinal, ze_command_queue_mode_t mode, ze_command_queue_priority_t priority, bool useCooperativeFlag); diff --git a/level_zero/core/test/black_box_tests/zello_copy_only.cpp b/level_zero/core/test/black_box_tests/zello_copy_only.cpp index 6c1a869008..4b60d68f7f 100644 --- a/level_zero/core/test/black_box_tests/zello_copy_only.cpp +++ b/level_zero/core/test/black_box_tests/zello_copy_only.cpp @@ -237,7 +237,7 @@ void testRegionCopyOf2DSharedMem(ze_context_handle_t &context, ze_device_handle_ } } - int value = 0; + uint8_t value = 0; SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryFill(cmdList, dstBuffer, reinterpret_cast(&value), sizeof(value), dstSize, nullptr, 0, nullptr)); @@ -307,6 +307,12 @@ void testSharedMemDataAccessWithoutCopy(ze_context_handle_t &context, ze_device_ return; } + if (LevelZeroBlackBoxTests::getQueueMaxFillPatternSize(device, copyQueueGroup) < pattern1Size) { + std::cout << "The maxMemoryFillPatternSize supported by the device is too small. Skipping test run\n"; + validRet = true; + return; + } + cmdQueueDesc.pNext = nullptr; cmdQueueDesc.flags = 0; cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; @@ -486,7 +492,7 @@ void testRegionCopyOf3DSharedMem(ze_context_handle_t &context, ze_device_handle_ } } - int value = 0; + uint8_t value = 0; SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryFill(cmdList, dstBuffer, reinterpret_cast(&value), sizeof(value), dstSize, nullptr, 0, nullptr)); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp index 50c5fa7351..a2462f4dfc 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp @@ -997,7 +997,7 @@ HWTEST_F(HostPointerManagerCommandListTest, givenImmediateCommandListWhenMemoryF ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize); EXPECT_EQ(ZE_RESULT_SUCCESS, ret); - int one = 1; + uint8_t one = 1; size_t size = 16; ze_event_pool_desc_t eventPoolDesc = {}; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index 9896150871..d5ed83a4a4 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -366,10 +366,10 @@ HWTEST_F(CommandListTest, givenCopyCommandListWhenAppendFillWithDependenciesThen eventDesc.index = 0; auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device, result)); void *srcPtr = reinterpret_cast(0x1234); - uint32_t patter = 1; + uint8_t pattern = 1; auto zeEvent = event->toHandle(); - cmdList.appendMemoryFill(srcPtr, &patter, 1, sizeof(uint32_t), nullptr, 1, &zeEvent, copyParams); + cmdList.appendMemoryFill(srcPtr, &pattern, sizeof(pattern), sizeof(uint32_t), nullptr, 1, &zeEvent, copyParams); EXPECT_EQ(device->getNEODevice()->getDefaultEngine().commandStreamReceiver->peekBarrierCount(), 0u); } 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 5257488a9f..b6e4afb1d0 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 @@ -73,12 +73,21 @@ class MockDriverHandle : public L0::DriverHandleImp { using AppendMemoryCopyTests = Test; -HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillCalledWithLargePatternSizeThenMemCopyWasCalled) { +HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillCalledWithLargePatternSizeThenInvalidSizeReturned) { MockCommandListForMemFill cmdList; cmdList.initialize(device, NEO::EngineGroupType::copy, 0u); - uint64_t pattern[4] = {1, 2, 3, 4}; + uint64_t pattern32bytes[4] = {1, 2, 3, 4}; void *ptr = reinterpret_cast(0x1234); - auto ret = cmdList.appendMemoryFill(ptr, reinterpret_cast(&pattern), sizeof(pattern), 0x1000, nullptr, 0, nullptr, copyParams); + auto ret = cmdList.appendMemoryFill(ptr, reinterpret_cast(&pattern32bytes), sizeof(pattern32bytes), 0x1000, nullptr, 0, nullptr, copyParams); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_SIZE, ret); +} + +HWTEST2_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillCalledWithLargePatternSizeThenInvalidSizeReturned, IsAtLeastXeHpcCore) { + MockCommandListForMemFill cmdList; + cmdList.initialize(device, NEO::EngineGroupType::copy, 0u); + uint8_t pattern2bytes[2] = {1, 2}; + void *ptr = reinterpret_cast(0x1234); + auto ret = cmdList.appendMemoryFill(ptr, reinterpret_cast(&pattern2bytes), sizeof(pattern2bytes), 0x1000, nullptr, 0, nullptr, copyParams); EXPECT_EQ(ZE_RESULT_ERROR_INVALID_SIZE, ret); } @@ -111,9 +120,7 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillToShare free(ptr); } -using MemFillPlatforms = IsGen12LP; - -HWTEST2_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBltIsProgrammed, MemFillPlatforms) { +HWTEST2_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBltIsProgrammed, IsAtMostDg2) { using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT; MockCommandListForMemFill commandList; @@ -134,7 +141,31 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillThenCo device->setDriverHandle(driverHandle.get()); } -HWTEST_F(AppendMemoryCopyTests, givenExternalHostPointerAllocationWhenPassedToAppendBlitFillThenProgramDestinationAddressCorrectly) { +HWTEST2_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBltIsProgrammed, IsAtLeastXeHpcCore) { + using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; + using MEM_SET = typename GfxFamily::MEM_SET; + DebugManagerStateRestore restorer; + debugManager.flags.EnableDeviceUsmAllocationPool.set(0); + debugManager.flags.EnableHostUsmAllocationPool.set(0); + MockCommandListForMemFill commandList; + MockDriverHandle driverHandleMock; + NEO::DeviceVector neoDevices; + neoDevices.push_back(std::unique_ptr(neoDevice)); + driverHandleMock.initialize(std::move(neoDevices)); + device->setDriverHandle(&driverHandleMock); + commandList.initialize(device, NEO::EngineGroupType::copy, 0u); + uint8_t pattern = 1; + void *ptr = reinterpret_cast(0x1234); + commandList.appendMemoryFill(ptr, reinterpret_cast(&pattern), sizeof(pattern), 0x1000, nullptr, 0, nullptr, copyParams); + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer( + cmdList, ptrOffset(commandList.getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList.getCmdContainer().getCommandStream()->getUsed())); + auto itor = find(cmdList.begin(), cmdList.end()); + EXPECT_NE(cmdList.end(), itor); + device->setDriverHandle(driverHandle.get()); +} + +HWTEST2_F(AppendMemoryCopyTests, givenExternalHostPointerAllocationWhenPassedToAppendBlitFillThenProgramDestinationAddressCorrectly, IsAtMostDg2) { using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT; @@ -170,6 +201,42 @@ HWTEST_F(AppendMemoryCopyTests, givenExternalHostPointerAllocationWhenPassedToAp EXPECT_EQ(ZE_RESULT_SUCCESS, ret); } +HWTEST2_F(AppendMemoryCopyTests, givenExternalHostPointerAllocationWhenPassedToAppendBlitFillThenProgramDestinationAddressCorrectly, IsAtLeastXeHpcCore) { + using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; + using MEM_SET = typename GfxFamily::MEM_SET; + + L0::Device *device = driverHandle->devices[0]; + + size_t size = 1024; + auto hostPointer = std::make_unique(size); + auto ret = driverHandle->importExternalPointer(hostPointer.get(), MemoryConstants::pageSize); + EXPECT_EQ(ZE_RESULT_SUCCESS, ret); + + auto gpuAllocation = device->getDriverHandle()->findHostPointerAllocation(hostPointer.get(), size, 0); + ASSERT_NE(nullptr, gpuAllocation); + EXPECT_EQ(NEO::AllocationType::externalHostPtr, gpuAllocation->getAllocationType()); + + MockCommandListForMemFill commandList; + commandList.initialize(device, NEO::EngineGroupType::copy, 0u); + + uint8_t pattern = 1; + ze_result_t result = commandList.appendMemoryFill(hostPointer.get(), reinterpret_cast(&pattern), sizeof(pattern), size, nullptr, 0, nullptr, copyParams); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); + + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer( + cmdList, ptrOffset(commandList.getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList.getCmdContainer().getCommandStream()->getUsed())); + auto itor = find(cmdList.begin(), cmdList.end()); + EXPECT_NE(cmdList.end(), itor); + + auto cmd = genCmdCast(*itor); + uint64_t offset = commandList.getAllocationOffsetForAppendBlitFill(hostPointer.get(), *gpuAllocation); + EXPECT_EQ(cmd->getDestinationStartAddress(), ptrOffset(gpuAllocation->getGpuAddress(), offset)); + + ret = driverHandle->releaseImportedPointer(hostPointer.get()); + EXPECT_EQ(ZE_RESULT_SUCCESS, ret); +} + HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListAndHostPointersWhenMemoryCopyCalledThenPipeControlWithDcFlushAddedIsNotAddedAfterBlitCopy) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; diff --git a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp index 8355ad98d8..960750f3b8 100644 --- a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp @@ -1294,5 +1294,21 @@ TEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingDefaultRecordReplayGr EXPECT_EQ(l0GfxCoreHelper.getPlatformRecordReplayGraphCapabilities(), L0GfxCoreHelper::getRecordReplayGraphCapabilities(rootDeviceEnvironment)); } +HWTEST2_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingMaxFillPatternSizeForCopyEngineThenReturnCorrectValue, IsAtMostDg2) { + MockExecutionEnvironment executionEnvironment; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + + EXPECT_EQ(4 * sizeof(uint32_t), l0GfxCoreHelper.getMaxFillPatternSizeForCopyEngine()); +} + +HWTEST2_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingMaxFillPatternSizeForCopyEngineThenReturnCorrectValue, IsAtLeastXeHpcCore) { + MockExecutionEnvironment executionEnvironment; + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + + EXPECT_EQ(sizeof(uint8_t), l0GfxCoreHelper.getMaxFillPatternSizeForCopyEngine()); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_device_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_device_xe_hpc_core.cpp index df1603e0e4..459b648ec9 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_device_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_device_xe_hpc_core.cpp @@ -530,66 +530,6 @@ HWTEST2_F(DeviceTestXeHpc, givenReturnedDevicePropertiesThenExpectedPropertyFlag using CommandQueueGroupTest = Test; -HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportWithBcsVirtualEnginesEnabledThenOneByteFillPatternReturned, IsXeHpcCore) { - DebugManagerStateRestore restore; - debugManager.flags.UseDrmVirtualEnginesForBcs.set(1); - const uint32_t rootDeviceIndex = 0u; - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.featureTable.ftrBcsInfo.set(); - auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex); - MockDeviceImp deviceImp(neoMockDevice); - - uint32_t count = 0; - ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_GE(count, 4u); - - std::vector properties(count); - res = deviceImp.getCommandQueueGroupProperties(&count, properties.data()); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - - auto &engineGroups = neoMockDevice->getRegularEngineGroups(); - for (uint32_t i = 0; i < count; i++) { - if (engineGroups[i].engineGroupType == 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, sizeof(uint8_t)); - } - } -} - -HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportWithBcsVirtualEnginesDisabledThenCorrectFillPatternReturned, IsXeHpcCore) { - DebugManagerStateRestore restore; - debugManager.flags.UseDrmVirtualEnginesForBcs.set(0); - const uint32_t rootDeviceIndex = 0u; - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.featureTable.ftrBcsInfo.set(); - auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex); - MockDeviceImp deviceImp(neoMockDevice); - - uint32_t count = 0; - ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_GE(count, 4u); - - std::vector properties(count); - res = deviceImp.getCommandQueueGroupProperties(&count, properties.data()); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - - auto &engineGroups = neoMockDevice->getRegularEngineGroups(); - for (uint32_t i = 0; i < count; i++) { - if (engineGroups[i].engineGroupType == 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)); - } - } -} - HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportAndCCSThenFourQueueGroupsAreReturned, IsXeHpcCore) { const uint32_t rootDeviceIndex = 0u; NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); @@ -636,48 +576,6 @@ HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportAndCCSThenFourQueueGroupsAre } } -HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportCCSAndLinkedBcsDisabledThenThreeQueueGroupsAreReturned, IsXeHpcCore) { - const uint32_t rootDeviceIndex = 0u; - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.featureTable.ftrBcsInfo.set(0); - auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex); - MockDeviceImp deviceImp(neoMockDevice); - - uint32_t count = 0; - ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_GE(count, 3u); - - std::vector properties(count); - res = deviceImp.getCommandQueueGroupProperties(&count, properties.data()); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - - auto &engineGroups = neoMockDevice->getRegularEngineGroups(); - for (uint32_t i = 0; i < count; i++) { - if (engineGroups[i].engineGroupType == NEO::EngineGroupType::renderCompute) { - 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_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].numQueues, 1u); - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); - } else if (engineGroups[i].engineGroupType == 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_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS); - uint32_t numerOfCCSEnabled = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled; - EXPECT_EQ(properties[i].numQueues, numerOfCCSEnabled); - EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits::max()); - } else if (engineGroups[i].engineGroupType == 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, sizeof(uint8_t)); - } - } -} - class CommandQueueGroupTestXeHpc : public DeviceFixture, public testing::TestWithParam { public: void SetUp() override { diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index 38f376b749..cdd5d98be0 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -134,7 +134,6 @@ class GfxCoreHelper { virtual uint32_t adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual uint32_t adjustMaxWorkGroupSize(const uint32_t grfCount, const uint32_t simd, const uint32_t defaultMaxGroupSize, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0; - virtual size_t getMaxFillPatternSizeForCopyEngine() const = 0; virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0; virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0; virtual bool isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const = 0; @@ -399,7 +398,6 @@ class GfxCoreHelperHw : public GfxCoreHelper { const RootDeviceEnvironment &rootDeviceEnvironment) const override; uint32_t adjustMaxWorkGroupSize(const uint32_t grfCount, const uint32_t simd, const uint32_t defaultMaxGroupSize, const RootDeviceEnvironment &rootDeviceEnvironment) const override; - size_t getMaxFillPatternSizeForCopyEngine() const override; bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/gfx_core_helper_tgllp_and_later.inl b/shared/source/helpers/gfx_core_helper_tgllp_and_later.inl index 7d69f95a1e..257cef86c1 100644 --- a/shared/source/helpers/gfx_core_helper_tgllp_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_tgllp_and_later.inl @@ -39,9 +39,4 @@ bool GfxCoreHelperHw::packedFormatsSupported() const { return true; } -template -size_t GfxCoreHelperHw::getMaxFillPatternSizeForCopyEngine() const { - return 4 * sizeof(uint32_t); -} - } // namespace NEO diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 6b0672cbb7..dbd92ff453 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -251,7 +251,6 @@ class ProductHelper { virtual bool localDispatchSizeQuerySupported() const = 0; virtual bool supportReadOnlyAllocations() const = 0; virtual bool isDeviceToHostCopySignalingFenceRequired() const = 0; - virtual size_t getMaxFillPatternSizeForCopyEngine() const = 0; virtual bool isAvailableExtendedScratch() const = 0; virtual std::optional isCoherentAllocation(uint64_t patIndex) const = 0; virtual bool isStagingBuffersEnabled() const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 59f8c5029d..cd0768ee18 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -899,11 +899,6 @@ bool ProductHelperHw::isDeviceToHostCopySignalingFenceRequired() con return false; } -template -size_t ProductHelperHw::getMaxFillPatternSizeForCopyEngine() const { - return 4 * sizeof(uint32_t); -} - template bool ProductHelperHw::isAvailableExtendedScratch() const { return false; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 015be95a4a..d99b70ad56 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -188,7 +188,6 @@ class ProductHelperHw : public ProductHelper { uint32_t getMaxLocalSubRegionSize(const HardwareInfo &hwInfo) const override; bool localDispatchSizeQuerySupported() const override; bool isDeviceToHostCopySignalingFenceRequired() const override; - size_t getMaxFillPatternSizeForCopyEngine() const override; bool isAvailableExtendedScratch() const override; std::optional isCoherentAllocation(uint64_t patIndex) const override; bool isStagingBuffersEnabled() const override;