diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index 93e9545b19..403b2a0b8a 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -369,6 +369,10 @@ struct CommandList : _ze_command_list_handle_t { return taskCountUpdateFenceRequired; } + bool isStatelessBuiltinsEnabled() const { + return statelessBuiltinsEnabled; + } + void registerCsrDcFlushForDcMitigation(NEO::CommandStreamReceiver &csr); protected: @@ -458,6 +462,7 @@ struct CommandList : _ze_command_list_handle_t { bool scratchAddressPatchingEnabled = false; bool taskCountUpdateFenceRequired = false; bool requiresDcFlushForDcMitigation = false; + bool statelessBuiltinsEnabled = false; }; using CommandListAllocatorFn = CommandList *(*)(uint32_t); diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index dbc3350327..e20d107756 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -255,6 +255,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO if (NEO::debugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) { this->defaultPipelinedThreadArbitrationPolicy = NEO::debugManager.flags.OverrideThreadArbitrationPolicy.get(); } + this->statelessBuiltinsEnabled = compilerProductHelper.isForceToStatelessRequired(); this->commandContainer.doubleSbaWaRef() = this->doubleSbaWa; this->commandContainer.l1CachePolicyDataRef() = &this->l1CachePolicyData; @@ -1472,10 +1473,8 @@ ze_result_t CommandListCoreFamily::appendMemoryCopy(void *dstptr, uintptr_t leftSize = 0; uintptr_t rightSize = 0; uintptr_t middleSizeBytes = 0; - bool isStateless = this->cmdListHeapAddressModel == NEO::HeapAddressModel::globalStateless; - if (neoDevice->getCompilerProductHelper().isForceToStatelessRequired()) { - isStateless = true; - } + bool isStateless = (this->cmdListHeapAddressModel == NEO::HeapAddressModel::globalStateless) || this->isStatelessBuiltinsEnabled(); + const bool isHeapless = this->isHeaplessModeEnabled(); if (!isCopyOnlyEnabled) { diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h index b843f90f09..59cb62d2f8 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -306,6 +306,7 @@ struct WhiteBox<::L0::CommandListImp> : public ::L0::CommandListImp { using BaseClass::signalAllEventPackets; using BaseClass::stateBaseAddressTracking; using BaseClass::stateComputeModeTracking; + using BaseClass::statelessBuiltinsEnabled; using CommandList::flags; using CommandList::internalUsage; using CommandList::kernelWithAssertAppended; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index ec331e4e24..f7b581bc05 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -3034,6 +3034,7 @@ TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDef auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); auto &productHelper = rootDeviceEnvironment.getHelper(); + auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); ze_result_t returnValue; std::unique_ptr commandList(CommandList::whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false))); @@ -3062,6 +3063,7 @@ TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDef EXPECT_EQ(expectedDispatchCmdListBatchBufferAsPrimary, commandList->getCmdListBatchBufferFlag()); EXPECT_EQ(commandList->heaplessModeEnabled, commandList->scratchAddressPatchingEnabled); + EXPECT_EQ(commandList->statelessBuiltinsEnabled, compilerProductHelper.isForceToStatelessRequired()); } TEST(BuiltinTypeHelperTest, givenNonStatelessAndNonHeaplessWhenAdjustBuiltinTypeIsCalledThenCorrectBuiltinTypeIsReturned) {