refactor: improve bcs split size selection

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-10-07 07:53:33 +00:00
committed by Compute-Runtime-Automation
parent d1a2ec4590
commit 40dd9221ca
5 changed files with 20 additions and 5 deletions

View File

@@ -456,6 +456,7 @@ struct CommandListCoreFamily : public CommandListImp {
virtual void ensureCmdBufferSpaceForPrefetch() {}
bool transferDirectionRequiresBcsSplit(NEO::TransferDirection direction) const;
std::optional<SWTagScope<GfxFamily>> emplaceSWTagScope(const char *callName);
size_t getDefaultMinBcsSplitSize() const;
template <typename Container>
void addResidency(const Container &allocs) {

View File

@@ -352,8 +352,18 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::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 <GFXCORE_FAMILY gfxCoreFamily>
size_t CommandListCoreFamily<gfxCoreFamily>::getDefaultMinBcsSplitSize() const {
return 4 * MemoryConstants::megaByte;
}
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::close() {

View File

@@ -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] = {};

View File

@@ -112,6 +112,7 @@ struct WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>
using BaseClass::l3FlushAfterPostSyncEnabled;
using BaseClass::latestOperationRequiredNonWalkerInOrderCmdsChaining;
using BaseClass::maxFillPatternSizeForCopyEngine;
using BaseClass::minimalSizeForBcsSplit;
using BaseClass::obtainKernelPreemptionMode;
using BaseClass::partitionCount;
using BaseClass::patternAllocations;

View File

@@ -3352,6 +3352,13 @@ HWTEST2_F(CommandListCreateTests, givenCopyCommandListWhenProfilingBeforeCommand
EXPECT_EQ(cmd->getMemoryAddress(), ptrOffset(baseAddr, contextOffset));
}
HWTEST_F(CommandListCreateTests, whenAskingForDefaultSplitSizeThenReturnCorrectValue) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
EXPECT_EQ(4u * MemoryConstants::megaByte, commandList->minimalSizeForBcsSplit);
}
HWTEST2_F(CommandListCreateTests, givenCopyCommandListWhenProfilingBeforeCommandForCopyOnlyThenCommandsHaveCorrectEventOffsets, IsAtLeastXe2HpgCore) {
using GfxFamily = typename NEO::GfxFamilyMapper<FamilyType::gfxCoreFamily>::GfxFamily;
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;