performance: Signal inOrder counter with pipe control, part 3

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk 2024-12-27 10:40:01 +00:00 committed by Compute-Runtime-Automation
parent 9991945c66
commit b5f3b0eba9
3 changed files with 57 additions and 6 deletions

View File

@ -284,7 +284,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
std::list<void *> additionalCommands;
if (compactEvent && (!compactEvent->isCounterBased() || !this->isImmediateType())) {
if (compactEvent && (!compactEvent->isCounterBased() || this->asMutable())) {
appendEventForProfilingAllWalkers(compactEvent, nullptr, launchParams.outListCommands, true, true, launchParams.omitAddingEventResidency, false);
}
@ -299,12 +299,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
inOrderNonWalkerSignalling = isInOrderNonWalkerSignalingRequired(eventForInOrderExec);
if (inOrderExecSignalRequired) {
if (!compactEvent || !this->isImmediateType() || !compactEvent->isCounterBased() || compactEvent->isUsingContextEndOffset()) {
if (!compactEvent || this->asMutable() || !compactEvent->isCounterBased() || compactEvent->isUsingContextEndOffset()) {
if (inOrderNonWalkerSignalling) {
if (!eventForInOrderExec->getAllocation(this->device) && Event::standaloneInOrderTimestampAllocationEnabled()) {
eventForInOrderExec->resetInOrderTimestampNode(device->getInOrderTimestampAllocator()->getTag());
}
if (!compactEvent || !this->isImmediateType() || !compactEvent->isCounterBased()) {
if (!compactEvent || this->asMutable() || !compactEvent->isCounterBased()) {
dispatchEventPostSyncOperation(eventForInOrderExec, nullptr, launchParams.outListCommands, Event::STATE_CLEARED, false, false, false, false, false);
} else {
eventAddress = eventForInOrderExec->getPacketAddress(this->device);
@ -392,7 +392,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
}
if (!launchParams.makeKernelCommandView) {
if ((compactEvent && (!compactEvent->isCounterBased() || !this->isImmediateType()))) {
if (compactEvent && (!compactEvent->isCounterBased() || this->asMutable())) {
void **syncCmdBuffer = nullptr;
if (launchParams.outSyncCommand != nullptr) {
launchParams.outSyncCommand->type = CommandToPatch::SignalEventPostSyncPipeControl;
@ -416,8 +416,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
if (inOrderExecSignalRequired) {
if (inOrderNonWalkerSignalling) {
if (!launchParams.skipInOrderNonWalkerSignaling) {
if ((compactEvent && (compactEvent->isCounterBased() && this->isImmediateType()))) {
if (compactEvent && (compactEvent->isCounterBased() && !this->asMutable())) {
auto pcCmdPtr = this->commandContainer.getCommandStream()->getSpace(0u);
inOrderCounterValue = this->inOrderExecInfo->getCounterValue() + getInOrderIncrementValue();
appendSignalInOrderDependencyCounter(eventForInOrderExec, false, true);
addCmdForPatching(nullptr, pcCmdPtr, nullptr, inOrderCounterValue, NEO::InOrderPatchCommandHelpers::PatchCmdType::pipeControl);
} else {
appendWaitOnSingleEvent(eventForInOrderExec, launchParams.outListCommands, false, false, CommandToPatch::CbEventTimestampPostSyncSemaphoreWait);
appendSignalInOrderDependencyCounter(eventForInOrderExec, false, false);

View File

@ -1681,6 +1681,45 @@ HWTEST2_F(InOrderRegularCmdListTests, givenAddedCmdForPatchWhenUpdateNewInOrderI
EXPECT_EQ(5u, semaphoreCmd.getSemaphoreDataDword());
}
HWTEST2_F(InOrderRegularCmdListTests, givenPipeControlCmdAddedForPatchWhenUpdateNewInOrderInfoThenNewInfoIsSet, IsAtLeastXeHpCore) {
auto pcCmd = FamilyType::cmdInitPipeControl;
auto inOrderRegularCmdList = createRegularCmdList<gfxCoreFamily>(false);
auto &inOrderExecInfo = inOrderRegularCmdList->inOrderExecInfo;
inOrderExecInfo->addRegularCmdListSubmissionCounter(4);
inOrderExecInfo->addCounterValue(1);
auto inOrderRegularCmdList2 = createRegularCmdList<gfxCoreFamily>(false);
auto &inOrderExecInfo2 = inOrderRegularCmdList2->inOrderExecInfo;
inOrderExecInfo2->addRegularCmdListSubmissionCounter(6);
inOrderExecInfo2->addCounterValue(1);
inOrderRegularCmdList->addCmdForPatching(&inOrderExecInfo, &pcCmd, nullptr, 1, NEO::InOrderPatchCommandHelpers::PatchCmdType::pipeControl);
ASSERT_EQ(1u, inOrderRegularCmdList->inOrderPatchCmds.size());
inOrderRegularCmdList->disablePatching(0);
inOrderRegularCmdList->inOrderPatchCmds[0].patch(3);
EXPECT_EQ(0u, pcCmd.getImmediateData());
inOrderRegularCmdList->enablePatching(0);
inOrderRegularCmdList->inOrderPatchCmds[0].patch(3);
EXPECT_EQ(4u, pcCmd.getImmediateData());
inOrderRegularCmdList->updateInOrderExecInfo(0, &inOrderExecInfo2, false);
inOrderRegularCmdList->inOrderPatchCmds[0].patch(3);
EXPECT_EQ(4u, pcCmd.getImmediateData());
inOrderExecInfo->addRegularCmdListSubmissionCounter(1);
inOrderRegularCmdList->updateInOrderExecInfo(0, &inOrderExecInfo, true);
inOrderRegularCmdList->inOrderPatchCmds[0].patch(3);
EXPECT_EQ(4u, pcCmd.getImmediateData());
inOrderRegularCmdList->enablePatching(0);
inOrderRegularCmdList->inOrderPatchCmds[0].patch(3);
EXPECT_EQ(4u, pcCmd.getImmediateData());
}
struct StandaloneInOrderTimestampAllocationTests : public InOrderCmdListFixture {
void SetUp() override {
InOrderCmdListFixture::SetUp();

View File

@ -139,7 +139,8 @@ enum class PatchCmdType {
lri64b,
sdi,
semaphore,
walker
walker,
pipeControl
};
template <typename GfxFamily>
@ -168,6 +169,9 @@ struct PatchCmd {
case PatchCmdType::lri64b:
patchLri64b(appendCounterValue);
break;
case PatchCmdType::pipeControl:
patchPipeControl(appendCounterValue);
break;
default:
UNRECOVERABLE_IF(true);
break;
@ -214,6 +218,11 @@ struct PatchCmd {
void patchComputeWalker(uint64_t appendCounterValue);
void patchPipeControl(uint64_t appendCounterValue) {
auto pcCmd = reinterpret_cast<typename GfxFamily::PIPE_CONTROL *>(cmd1);
pcCmd->setImmediateData(static_cast<uint64_t>(baseCounterValue + appendCounterValue));
}
void patchLri64b(uint64_t appendCounterValue) {
if (isExternalDependency()) {
appendCounterValue = InOrderPatchCommandHelpers::getAppendCounterValue(*inOrderExecInfo);