diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 412753e8d6..b3c50a3959 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -336,7 +336,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO enableSynchronizedDispatch((NEO::debugManager.flags.ForceSynchronizedDispatchMode.get() == 1) ? NEO::SynchronizedDispatchMode::full : NEO::SynchronizedDispatchMode::disabled); } - const bool copyOffloadSupported = l0GfxCoreHelper.isDefaultCmdListWithCopyOffloadSupported() || (NEO::debugManager.flags.ForceCopyOperationOffloadForComputeCmdList.get() == 2); + const bool copyOffloadSupported = l0GfxCoreHelper.isDefaultCmdListWithCopyOffloadSupported(this->useAdditionalBlitProperties); if (copyOffloadSupported && !this->internalUsage && !isCopyOffloadEnabled()) { enableCopyOperationOffload(); diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index 889cf03afb..3289a06357 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -269,7 +269,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device } void CommandListImp::enableCopyOperationOffload() { - if (isCopyOnly(false)) { + if (isCopyOnly(false) || !static_cast(device)->tryGetCopyEngineOrdinal().has_value()) { return; } @@ -280,11 +280,6 @@ void CommandListImp::enableCopyOperationOffload() { return; } - if (!static_cast(device)->tryGetCopyEngineOrdinal().has_value()) { - this->copyOffloadMode = CopyOffloadModes::disabled; - return; - } - auto &computeOsContext = getCsr(false)->getOsContext(); ze_command_queue_priority_t immediateQueuePriority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL; 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 b88a5311f4..094ebc20e7 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 @@ -115,7 +115,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { NEO::DeviceBitfield deviceBitfield) const = 0; virtual uint64_t getOaTimestampValidBits() const = 0; virtual CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const = 0; - virtual bool isDefaultCmdListWithCopyOffloadSupported() const = 0; + virtual bool isDefaultCmdListWithCopyOffloadSupported(bool additionalBlitPropertiesSupported) const = 0; protected: L0GfxCoreHelper() = default; @@ -173,7 +173,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper { NEO::DeviceBitfield deviceBitfield) const override; uint64_t getOaTimestampValidBits() const override; CopyOffloadMode getDefaultCopyOffloadMode(bool additionalBlitPropertiesSupported) const override; - bool isDefaultCmdListWithCopyOffloadSupported() const override; + bool isDefaultCmdListWithCopyOffloadSupported(bool additionalBlitPropertiesSupported) const override; protected: L0GfxCoreHelperHw() = default; diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl index 0dce5308ec..333bac398f 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_base.inl @@ -105,8 +105,8 @@ CopyOffloadMode L0GfxCoreHelperHw::getDefaultCopyOffloadMode(bool additi } template -bool L0GfxCoreHelperHw::isDefaultCmdListWithCopyOffloadSupported() const { - return false; +bool L0GfxCoreHelperHw::isDefaultCmdListWithCopyOffloadSupported(bool additionalBlitPropertiesSupported) const { + return (NEO::debugManager.flags.ForceCopyOperationOffloadForComputeCmdList.get() == 2); } } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp index 7854f76347..bb8dd5f2f1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp @@ -385,8 +385,9 @@ HWTEST_F(CopyOffloadInOrderTests, givenNonDualStreamOffloadWhenCreatingCmdListTh cmdListDesc.flags = 0; ASSERT_EQ(ZE_RESULT_SUCCESS, zeCommandListCreate(context->toHandle(), device->toHandle(), &cmdListDesc, &hCmdList)); + bool supported = device->getL0GfxCoreHelper().isDefaultCmdListWithCopyOffloadSupported(device->getProductHelper().useAdditionalBlitProperties()); - EXPECT_EQ(CopyOffloadModes::disabled, static_cast(CommandList::fromHandle(hCmdList))->getCopyOffloadModeForOperation(true)); + EXPECT_EQ(!supported, CopyOffloadModes::disabled == static_cast(CommandList::fromHandle(hCmdList))->getCopyOffloadModeForOperation(true)); zeCommandListDestroy(hCmdList); }