diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.h b/level_zero/core/source/cmdlist/cmdlist_hw.h index 2e4474c4fa..54d72630d1 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.h +++ b/level_zero/core/source/cmdlist/cmdlist_hw.h @@ -456,6 +456,7 @@ struct CommandListCoreFamily : public CommandListImp { virtual void ensureCmdBufferSpaceForPrefetch() {} bool transferDirectionRequiresBcsSplit(NEO::TransferDirection direction) const; std::optional> emplaceSWTagScope(const char *callName); + size_t getDefaultMinBcsSplitSize() const; template void addResidency(const Container &allocs) { diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 3c51ef4de0..fe8112dbce 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -352,8 +352,18 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO enableImmediateBcsSplit(); + this->minimalSizeForBcsSplit = getDefaultMinBcsSplitSize(); + + if (NEO::debugManager.flags.SplitBcsSize.get() != -1) { + this->minimalSizeForBcsSplit = NEO::debugManager.flags.SplitBcsSize.get() * MemoryConstants::kiloByte; + } + return returnType; } +template +size_t CommandListCoreFamily::getDefaultMinBcsSplitSize() const { + return 4 * MemoryConstants::megaByte; +} template ze_result_t CommandListCoreFamily::close() { diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index c8fe9bb5fa..70dad73769 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -32,11 +32,7 @@ namespace L0 { -CommandList::CommandList(uint32_t numIddsPerBlock) : commandContainer(numIddsPerBlock) { - if (NEO::debugManager.flags.SplitBcsSize.get() != -1) { - this->minimalSizeForBcsSplit = NEO::debugManager.flags.SplitBcsSize.get() * MemoryConstants::kiloByte; - } -} +CommandList::CommandList(uint32_t numIddsPerBlock) : commandContainer(numIddsPerBlock) {} CommandListAllocatorFn commandListFactory[IGFX_MAX_PRODUCT] = {}; CommandListAllocatorFn commandListFactoryImmediate[IGFX_MAX_PRODUCT] = {}; 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 c0eb0e0961..682448d4fa 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -112,6 +112,7 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::l3FlushAfterPostSyncEnabled; using BaseClass::latestOperationRequiredNonWalkerInOrderCmdsChaining; using BaseClass::maxFillPatternSizeForCopyEngine; + using BaseClass::minimalSizeForBcsSplit; using BaseClass::obtainKernelPreemptionMode; using BaseClass::partitionCount; using BaseClass::patternAllocations; 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 f3dec7336c..21908041d6 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 @@ -3352,6 +3352,13 @@ HWTEST2_F(CommandListCreateTests, givenCopyCommandListWhenProfilingBeforeCommand EXPECT_EQ(cmd->getMemoryAddress(), ptrOffset(baseAddr, contextOffset)); } +HWTEST_F(CommandListCreateTests, whenAskingForDefaultSplitSizeThenReturnCorrectValue) { + auto commandList = std::make_unique>>(); + commandList->initialize(device, NEO::EngineGroupType::compute, 0u); + + EXPECT_EQ(4u * MemoryConstants::megaByte, commandList->minimalSizeForBcsSplit); +} + HWTEST2_F(CommandListCreateTests, givenCopyCommandListWhenProfilingBeforeCommandForCopyOnlyThenCommandsHaveCorrectEventOffsets, IsAtLeastXe2HpgCore) { using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;