Skip to content

Commit

Permalink
Rename command list tracking debug flag and variables
Browse files Browse the repository at this point in the history
This change reflects exact nature of debug variable and what is code
actually doing

Related-To: NEO-7187

Signed-off-by: Zbigniew Zdanowicz <[email protected]>
  • Loading branch information
zzdanowicz authored and Compute-Runtime-Automation committed Sep 26, 2022
1 parent 0d23fa1 commit f0888fe
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 62 deletions.
7 changes: 4 additions & 3 deletions level_zero/core/source/cmdlist/cmdlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct CommandList : _ze_command_list_handle_t {
CommandType type = Invalid;
};
using CommandsToPatch = StackVec<CommandToPatch, 16>;
using CmdListReturnPoints = StackVec<CmdListReturnPoint, 32>;

virtual ze_result_t close() = 0;
virtual ze_result_t destroy() = 0;
Expand Down Expand Up @@ -265,7 +266,7 @@ struct CommandList : _ze_command_list_handle_t {
return commandsToPatch;
}

std::vector<CmdListReturnPoint> &getReturnPoints() {
CmdListReturnPoints &getReturnPoints() {
return returnPoints;
}

Expand Down Expand Up @@ -305,7 +306,7 @@ struct CommandList : _ze_command_list_handle_t {
std::map<const void *, NEO::GraphicsAllocation *> hostPtrMap;
std::vector<NEO::GraphicsAllocation *> ownedPrivateAllocations;
std::vector<NEO::GraphicsAllocation *> patternAllocations;
std::vector<CmdListReturnPoint> returnPoints;
CmdListReturnPoints returnPoints;

NEO::StreamProperties requiredStreamState{};
NEO::StreamProperties finalStreamState{};
Expand All @@ -320,7 +321,7 @@ struct CommandList : _ze_command_list_handle_t {
bool containsCooperativeKernelsFlag = false;
bool containsStatelessUncachedResource = false;
bool performMemoryPrefetch = false;
bool multiReturnPointCommandList = false;
bool frontEndStateTracking = false;
bool systolicModeSupport = false;
bool pipelineSelectStateTracking = false;
bool stateComputeModeTracking = false;
Expand Down
6 changes: 2 additions & 4 deletions level_zero/core/source/cmdlist/cmdlist_hw.inl
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
this->commandListPreemptionMode = device->getDevicePreemptionMode();
this->engineGroupType = engineGroupType;
this->flags = flags;
if (this->multiReturnPointCommandList) {
this->returnPoints.reserve(32);
}

auto &hwInfo = device->getHwInfo();
this->systolicModeSupport = NEO::PreambleHelper<GfxFamily>::isSystolicModeConfigurable(hwInfo);

Expand Down Expand Up @@ -2352,7 +2350,7 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState, hwInfo, 0, 0, device->getMaxNumHwThreads(), finalStreamState, nullptr);
commandsToPatch.push_back({pVfeStateAddress, pVfeState, CommandToPatch::FrontEndState});
}
if (this->multiReturnPointCommandList) {
if (this->frontEndStateTracking) {
auto &stream = *commandContainer.getCommandStream();
NEO::EncodeBatchBufferStartOrEnd<GfxFamily>::programBatchBufferEnd(stream);

Expand Down
2 changes: 1 addition & 1 deletion level_zero/core/source/cmdlist/cmdlist_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace L0 {

CommandList::CommandList(uint32_t numIddsPerBlock) : commandContainer(numIddsPerBlock) {
multiReturnPointCommandList = L0HwHelper::enableMultiReturnPointCommandList();
frontEndStateTracking = L0HwHelper::enableFrontEndStateTracking();
pipelineSelectStateTracking = L0HwHelper::enablePipelineSelectStateTracking();
stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking();
}
Expand Down
4 changes: 2 additions & 2 deletions level_zero/core/source/cmdqueue/cmdqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace L0 {
CommandQueueAllocatorFn commandQueueFactory[IGFX_MAX_PRODUCT] = {};

bool CommandQueue::frontEndTrackingEnabled() const {
return NEO::DebugManager.flags.AllowPatchingVfeStateInCommandLists.get() || this->multiReturnPointCommandList;
return NEO::DebugManager.flags.AllowPatchingVfeStateInCommandLists.get() || this->frontEndStateTracking;
}

CommandQueueImp::CommandQueueImp(Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc)
Expand All @@ -44,7 +44,7 @@ CommandQueueImp::CommandQueueImp(Device *device, NEO::CommandStreamReceiver *csr
useKmdWaitFunction = !!(overrideUseKmdWaitFunction);
}

multiReturnPointCommandList = L0HwHelper::enableMultiReturnPointCommandList();
frontEndStateTracking = L0HwHelper::enableFrontEndStateTracking();
pipelineSelectStateTracking = L0HwHelper::enablePipelineSelectStateTracking();
stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking();
}
Expand Down
2 changes: 1 addition & 1 deletion level_zero/core/source/cmdqueue/cmdqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct CommandQueue : _ze_command_queue_handle_t {
bool commandQueueDebugCmdsProgrammed = false;
bool isCopyOnlyCommandQueue = false;
bool internalUsage = false;
bool multiReturnPointCommandList = false;
bool frontEndStateTracking = false;
bool pipelineSelectStateTracking = false;
bool stateComputeModeTracking = false;
};
Expand Down
18 changes: 10 additions & 8 deletions level_zero/core/source/cmdqueue/cmdqueue_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ struct CommandQueueHw : public CommandQueueImp {

inline bool isNEODebuggerActive(Device *device);

NEO::StreamProperties cmdListBeginState{};

size_t spaceForResidency = 0;
NEO::PreemptionMode preemptionMode{};
NEO::PreemptionMode statePreemption{};
uint32_t perThreadScratchSpaceSize = 0;
uint32_t perThreadPrivateScratchSize = 0;
int32_t engineInstanced = -1;
UnifiedMemoryControls unifiedMemoryControls{};

bool anyCommandListWithCooperativeKernels = false;
bool anyCommandListWithoutCooperativeKernels = false;
bool anyCommandListRequiresDisabledEUFusion = false;
Expand All @@ -78,13 +88,6 @@ struct CommandQueueHw : public CommandQueueImp {
bool containsAnyRegularCmdList = false;
bool gsbaStateDirty = false;
bool frontEndStateDirty = false;
size_t spaceForResidency = 0;
NEO::StreamProperties cmdListBeginState{};
NEO::PreemptionMode preemptionMode{};
NEO::PreemptionMode statePreemption{};
uint32_t perThreadScratchSpaceSize = 0;
uint32_t perThreadPrivateScratchSize = 0;
int32_t engineInstanced = -1;
const bool isPreemptionModeInitial{false};
bool isDevicePreemptionModeMidThread{};
bool isDebugEnabled{};
Expand All @@ -94,7 +97,6 @@ struct CommandQueueHw : public CommandQueueImp {
bool isDirectSubmissionEnabled{};
bool isDispatchTaskCountPostSyncRequired{};
bool hasIndirectAccess{};
UnifiedMemoryControls unifiedMemoryControls;
};

ze_result_t validateCommandListsParams(CommandListExecutionContext &ctx,
Expand Down
5 changes: 3 additions & 2 deletions level_zero/core/source/cmdqueue/cmdqueue_hw.inl
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ size_t CommandQueueHw<gfxCoreFamily>::estimateFrontEndCmdSizeForMultipleCommandL
estimatedSize += singleFrontEndCmdSize;
isFrontEndStateDirty = false;
}
if (this->multiReturnPointCommandList) {
if (this->frontEndStateTracking) {
uint32_t frontEndChanges = commandList->getReturnPointsSize();
estimatedSize += (frontEndChanges * singleFrontEndCmdSize);
estimatedSize += (frontEndChanges * NEO::EncodeBatchBufferStartOrEnd<GfxFamily>::getBatchBufferStartSize());
Expand Down Expand Up @@ -1164,8 +1164,9 @@ void CommandQueueHw<gfxCoreFamily>::programOneCmdListPipelineSelect(CommandList
csrState.pipelineSelect.setProperties(cmdListRequired.pipelineSelect);

if (!preambleSet || csrState.pipelineSelect.isDirty()) {
bool systolic = csrState.pipelineSelect.systolicMode.value == 1 ? true : false;
NEO::PipelineSelectArgs args = {
!!csrState.pipelineSelect.systolicMode.value,
systolic,
false,
false,
commandList->getSystolicModeSupport()};
Expand Down
6 changes: 3 additions & 3 deletions level_zero/core/source/hw_helpers/l0_hw_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ L0HwHelper &L0HwHelper::get(GFXCORE_FAMILY gfxCore) {
return *l0HwHelperFactory[gfxCore];
}

bool L0HwHelper::enableMultiReturnPointCommandList() {
bool L0HwHelper::enableFrontEndStateTracking() {
constexpr bool defaultValue = false;
if (NEO::DebugManager.flags.MultiReturnPointCommandList.get() != -1) {
return !!NEO::DebugManager.flags.MultiReturnPointCommandList.get();
if (NEO::DebugManager.flags.EnableFrontEndTracking.get() != -1) {
return !!NEO::DebugManager.flags.EnableFrontEndTracking.get();
}
return defaultValue;
}
Expand Down
2 changes: 1 addition & 1 deletion level_zero/core/source/hw_helpers/l0_hw_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct EventPool;
class L0HwHelper {
public:
static L0HwHelper &get(GFXCORE_FAMILY gfxCore);
static bool enableMultiReturnPointCommandList();
static bool enableFrontEndStateTracking();
static bool enablePipelineSelectStateTracking();
static bool enableStateComputeModeTracking();
virtual void setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void ModuleMutableCommandListFixture::tearDown() {
}

void MultiReturnCommandListFixture::setUp() {
DebugManager.flags.MultiReturnPointCommandList.set(1);
DebugManager.flags.EnableFrontEndTracking.set(1);
ModuleMutableCommandListFixture::setUp(REVISION_B);
}

Expand Down
6 changes: 3 additions & 3 deletions level_zero/core/test/unit_tests/mocks/mock_cmdlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ struct WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>
using BaseClass::estimateBufferSizeMultiTileBarrier;
using BaseClass::finalStreamState;
using BaseClass::flags;
using BaseClass::frontEndStateTracking;
using BaseClass::getAlignedAllocation;
using BaseClass::getAllocationFromHostPtrMap;
using BaseClass::getHostPtrAlloc;
using BaseClass::hostPtrMap;
using BaseClass::indirectAllocationsAllowed;
using BaseClass::initialize;
using BaseClass::multiReturnPointCommandList;
using BaseClass::partitionCount;
using BaseClass::patternAllocations;
using BaseClass::pipelineSelectStateTracking;
Expand Down Expand Up @@ -122,8 +122,8 @@ struct WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>
using BaseClass::commandsToPatch;
using BaseClass::csr;
using BaseClass::finalStreamState;
using BaseClass::frontEndStateTracking;
using BaseClass::isFlushTaskSubmissionEnabled;
using BaseClass::multiReturnPointCommandList;
using BaseClass::partitionCount;
using BaseClass::pipelineSelectStateTracking;
using BaseClass::requiredStreamState;
Expand All @@ -147,9 +147,9 @@ struct WhiteBox<::L0::CommandList> : public ::L0::CommandListImp {
using BaseClass::commandContainer;
using BaseClass::commandListPreemptionMode;
using BaseClass::csr;
using BaseClass::frontEndStateTracking;
using BaseClass::initialize;
using BaseClass::isFlushTaskSubmissionEnabled;
using BaseClass::multiReturnPointCommandList;
using BaseClass::nonImmediateLogicalStateHelper;
using BaseClass::partitionCount;
using BaseClass::pipelineSelectStateTracking;
Expand Down
4 changes: 2 additions & 2 deletions level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ struct WhiteBox<::L0::CommandQueue> : public ::L0::CommandQueueImp {
using BaseClass::synchronizeByPollingForTaskCount;
using BaseClass::taskCount;
using CommandQueue::activeSubDevices;
using CommandQueue::frontEndStateTracking;
using CommandQueue::internalUsage;
using CommandQueue::multiReturnPointCommandList;
using CommandQueue::partitionCount;
using CommandQueue::pipelineSelectStateTracking;
using CommandQueue::stateComputeModeTracking;
Expand Down Expand Up @@ -66,8 +66,8 @@ struct MockCommandQueueHw : public L0::CommandQueueHw<gfxCoreFamily> {
using BaseClass::prepareAndSubmitBatchBuffer;
using BaseClass::printfKernelContainer;
using L0::CommandQueue::activeSubDevices;
using L0::CommandQueue::frontEndStateTracking;
using L0::CommandQueue::internalUsage;
using L0::CommandQueue::multiReturnPointCommandList;
using L0::CommandQueue::partitionCount;
using L0::CommandQueue::pipelineSelectStateTracking;
using L0::CommandQueue::preemptionCmdSyncProgramming;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2001,11 +2001,13 @@ HWTEST2_F(CommandListCreate, givenNullEventWhenAppendEventAfterWalkerThenNothing
EXPECT_EQ(commandList->commandContainer.getCommandStream()->getUsed(), usedBefore);
}

TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingMultiReturnPointFlagThenDefaultValuseIsFalse) {
TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDefaultValuseIsFalse) {
ze_result_t returnValue;
std::unique_ptr<L0::ult::CommandList> commandList(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)));
ASSERT_NE(nullptr, commandList.get());
EXPECT_FALSE(commandList->multiReturnPointCommandList);
EXPECT_FALSE(commandList->frontEndStateTracking);
EXPECT_FALSE(commandList->pipelineSelectStateTracking);
EXPECT_FALSE(commandList->stateComputeModeTracking);
}

} // namespace ult
Expand Down
28 changes: 14 additions & 14 deletions level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,12 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests,

using MultiReturnCommandListTest = Test<MultiReturnCommandListFixture>;

HWTEST2_F(MultiReturnCommandListTest, givenMultiReturnIsUsedWhenPropertyDisableEuFusionSupportedThenExpectReturnPointsAndBbEndProgramming, IsAtLeastSkl) {
HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyDisableEuFusionSupportedThenExpectReturnPointsAndBbEndProgramming, IsAtLeastSkl) {
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
NEO::FrontEndPropertiesSupport fePropertiesSupport = {};
NEO::HwInfoConfig::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo());

EXPECT_TRUE(commandList->multiReturnPointCommandList);
EXPECT_TRUE(commandList->frontEndStateTracking);

auto &cmdStream = *commandList->commandContainer.getCommandStream();
auto &cmdBuffers = commandList->commandContainer.getCmdBufferAllocations();
Expand Down Expand Up @@ -724,12 +724,12 @@ HWTEST2_F(MultiReturnCommandListTest, givenMultiReturnIsUsedWhenPropertyDisableE
}
}

HWTEST2_F(MultiReturnCommandListTest, givenMultiReturnIsUsedWhenPropertyComputeDispatchAllWalkerSupportedThenExpectReturnPointsAndBbEndProgramming, IsAtLeastSkl) {
HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyComputeDispatchAllWalkerSupportedThenExpectReturnPointsAndBbEndProgramming, IsAtLeastSkl) {
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
NEO::FrontEndPropertiesSupport fePropertiesSupport = {};
NEO::HwInfoConfig::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo());

EXPECT_TRUE(commandList->multiReturnPointCommandList);
EXPECT_TRUE(commandList->frontEndStateTracking);

NEO::DebugManager.flags.AllowMixingRegularAndCooperativeKernels.set(1);

Expand Down Expand Up @@ -886,16 +886,16 @@ HWTEST2_F(MultiReturnCommandListTest, givenMultiReturnIsUsedWhenPropertyComputeD
}

HWTEST2_F(MultiReturnCommandListTest,
givenMultiReturnCmdListIsExecutedWhenPropertyDisableEuFusionSupportedThenExpectFrontEndProgrammingInCmdQueue, IsAtLeastSkl) {
givenFrontEndTrackingCmdListIsExecutedWhenPropertyDisableEuFusionSupportedThenExpectFrontEndProgrammingInCmdQueue, IsAtLeastSkl) {
using VFE_STATE_TYPE = typename FamilyType::VFE_STATE_TYPE;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;

NEO::FrontEndPropertiesSupport fePropertiesSupport = {};
NEO::HwInfoConfig::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo());

EXPECT_TRUE(commandList->multiReturnPointCommandList);
EXPECT_TRUE(commandQueue->multiReturnPointCommandList);
EXPECT_TRUE(commandList->frontEndStateTracking);
EXPECT_TRUE(commandQueue->frontEndStateTracking);

auto &cmdListStream = *commandList->commandContainer.getCommandStream();
auto &cmdListBuffers = commandList->commandContainer.getCmdBufferAllocations();
Expand Down Expand Up @@ -1135,7 +1135,7 @@ HWTEST2_F(MultiReturnCommandListTest,
}

HWTEST2_F(MultiReturnCommandListTest,
givenMultiReturnCmdListIsExecutedWhenPropertyComputeDispatchAllWalkerSupportedThenExpectFrontEndProgrammingInCmdQueue, IsAtLeastSkl) {
givenFrontEndTrackingCmdListIsExecutedWhenPropertyComputeDispatchAllWalkerSupportedThenExpectFrontEndProgrammingInCmdQueue, IsAtLeastSkl) {
using VFE_STATE_TYPE = typename FamilyType::VFE_STATE_TYPE;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
Expand All @@ -1145,8 +1145,8 @@ HWTEST2_F(MultiReturnCommandListTest,

NEO::DebugManager.flags.AllowMixingRegularAndCooperativeKernels.set(1);

EXPECT_TRUE(commandList->multiReturnPointCommandList);
EXPECT_TRUE(commandQueue->multiReturnPointCommandList);
EXPECT_TRUE(commandList->frontEndStateTracking);
EXPECT_TRUE(commandQueue->frontEndStateTracking);

auto &cmdListStream = *commandList->commandContainer.getCommandStream();
auto &cmdListBuffers = commandList->commandContainer.getCmdBufferAllocations();
Expand Down Expand Up @@ -1389,8 +1389,8 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr
NEO::FrontEndPropertiesSupport fePropertiesSupport = {};
NEO::HwInfoConfig::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo());

EXPECT_TRUE(commandList->multiReturnPointCommandList);
EXPECT_TRUE(commandListImmediate->multiReturnPointCommandList);
EXPECT_TRUE(commandList->frontEndStateTracking);
EXPECT_TRUE(commandListImmediate->frontEndStateTracking);

auto &regularCmdListStream = *commandList->commandContainer.getCommandStream();

Expand Down Expand Up @@ -1514,8 +1514,8 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr
NEO::FrontEndPropertiesSupport fePropertiesSupport = {};
NEO::HwInfoConfig::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo());

EXPECT_TRUE(commandList->multiReturnPointCommandList);
EXPECT_TRUE(commandListImmediate->multiReturnPointCommandList);
EXPECT_TRUE(commandList->frontEndStateTracking);
EXPECT_TRUE(commandListImmediate->frontEndStateTracking);

auto cmdQueueCsr = commandQueue->getCsr();
auto &csrProperties = cmdQueueCsr->getStreamProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ TEST_F(CommandQueueCreate, givenOverrideCmdQueueSyncModeToSynchronousWhenCommand
commandQueue->destroy();
}

TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingMultiReturnPointFlagThenDefaultValuseIsFalse) {
TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingTrackingFlagsThenDefaultValuseIsFalse) {
const ze_command_queue_desc_t desc{};
ze_result_t returnValue;
auto commandQueue = whiteboxCast(CommandQueue::create(productFamily,
Expand All @@ -1811,7 +1811,9 @@ TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingMultiReturnPointFl

EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS);
ASSERT_NE(nullptr, commandQueue);
EXPECT_FALSE(commandQueue->multiReturnPointCommandList);
EXPECT_FALSE(commandQueue->frontEndStateTracking);
EXPECT_FALSE(commandQueue->pipelineSelectStateTracking);
EXPECT_FALSE(commandQueue->stateComputeModeTracking);

commandQueue->destroy();
}
Expand Down
Loading

0 comments on commit f0888fe

Please sign in to comment.