From 52b4c75f685d6cdba16023b1c8606f0cb50d8b7d Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 15 Apr 2024 18:00:26 +0000 Subject: [PATCH] refactor: optimize checking if heapless state init is enabled Related-To: NEO-7824 Signed-off-by: Kamil Kopryk --- level_zero/core/source/cmdlist/cmdlist_hw_skl_to_tgllp.inl | 1 + level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl | 1 + .../sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp | 1 + .../sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp | 1 + shared/source/command_container/command_encoder.h | 1 + .../command_container/command_encoder_xehp_and_later.inl | 4 +--- shared/test/unit_test/fixtures/command_container_fixture.cpp | 1 + 7 files changed, 7 insertions(+), 3 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_skl_to_tgllp.inl b/level_zero/core/source/cmdlist/cmdlist_hw_skl_to_tgllp.inl index 5dd196248b..d86eaa94fc 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_skl_to_tgllp.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_skl_to_tgllp.inl @@ -218,6 +218,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K engineGroupType == NEO::EngineGroupType::renderCompute, // isRcs this->dcFlushSupport, // dcFlushEnable this->heaplessModeEnabled, // isHeaplessModeEnabled + this->heaplessStateInitEnabled, // isHeaplessStateInitEnabled false, // interruptEvent !this->scratchAddressPatchingEnabled, // immediateScratchAddressPatching }; diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index e630714c5f..484f50ceaa 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -345,6 +345,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K engineGroupType == NEO::EngineGroupType::renderCompute, // isRcs this->dcFlushSupport, // dcFlushEnable this->heaplessModeEnabled, // isHeaplessModeEnabled + this->heaplessStateInitEnabled, // isHeaplessStateInitEnabled interruptEvent, // interruptEvent !this->scratchAddressPatchingEnabled, // immediateScratchAddressPatching }; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index 2986de3605..8ab7fda263 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -213,6 +213,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA false, // isRcs commandList->getDcFlushRequired(true), // dcFlushEnable false, // isHeaplessModeEnabled + false, // isHeaplessStateInitEnabled false, // interruptEvent false, // immediateScratchAddressPatching }; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp index f1044109bc..c46bf168b5 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp @@ -710,6 +710,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA false, // isRcs commandList->getDcFlushRequired(true), // dcFlushEnable false, // isHeaplessModeEnabled + false, // isHeaplessStateInitEnabled false, // interruptEvent false, // immediateScratchAddressPatching }; diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index 62f50f1347..ace8cb6093 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -72,6 +72,7 @@ struct EncodeDispatchKernelArgs { bool isRcs = false; bool dcFlushEnable = false; bool isHeaplessModeEnabled = false; + bool isHeaplessStateInitEnabled = false; bool interruptEvent = false; bool immediateScratchAddressPatching = false; diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index 35cc79efb5..c807df8ee2 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -283,9 +283,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis } } - bool heaplessStateInitEnabled = rootDeviceEnvironment.getHelper().isHeaplessStateInitEnabled(heaplessModeEnabled); - - if (heaplessStateInitEnabled == false) { + if (args.isHeaplessStateInitEnabled == false) { if (container.isAnyHeapDirty() || args.requiresUncachedMocs) { diff --git a/shared/test/unit_test/fixtures/command_container_fixture.cpp b/shared/test/unit_test/fixtures/command_container_fixture.cpp index 0a8c224507..d105f46ddc 100644 --- a/shared/test/unit_test/fixtures/command_container_fixture.cpp +++ b/shared/test/unit_test/fixtures/command_container_fixture.cpp @@ -67,6 +67,7 @@ EncodeDispatchKernelArgs CommandEncodeStatesFixture::createDefaultDispatchKernel false, // isRcs false, // dcFlushEnable false, // isHeaplessModeEnabled + false, // isHeaplessStateInitEnabled false, // interruptEvent false, // immediateScratchAddressPatching };