mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 23:24:53 +08:00
Limit number of pipeline select commands when using multiple command queues
Related-To: NEO-7187 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5a3746df76
commit
469ab367b1
@@ -251,6 +251,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
|||||||
|
|
||||||
gsbaStateDirty |= csr->getGSBAStateDirty();
|
gsbaStateDirty |= csr->getGSBAStateDirty();
|
||||||
frontEndStateDirty |= csr->getMediaVFEStateDirty();
|
frontEndStateDirty |= csr->getMediaVFEStateDirty();
|
||||||
|
bool gpgpuEnabled = csr->getPreambleSetFlag();
|
||||||
if (!isCopyOnlyCommandQueue) {
|
if (!isCopyOnlyCommandQueue) {
|
||||||
|
|
||||||
if (!gpgpuEnabled) {
|
if (!gpgpuEnabled) {
|
||||||
@@ -315,6 +316,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
|||||||
if (!isCopyOnlyCommandQueue) {
|
if (!isCopyOnlyCommandQueue) {
|
||||||
if (!gpgpuEnabled) {
|
if (!gpgpuEnabled) {
|
||||||
programPipelineSelect(child);
|
programPipelineSelect(child);
|
||||||
|
csr->setPreambleSetFlag(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && !commandQueueDebugCmdsProgrammed) {
|
if (NEO::Debugger::isDebugEnabled(internalUsage) && !commandQueueDebugCmdsProgrammed) {
|
||||||
@@ -585,7 +587,6 @@ template <GFXCORE_FAMILY gfxCoreFamily>
|
|||||||
void CommandQueueHw<gfxCoreFamily>::programPipelineSelect(NEO::LinearStream &commandStream) {
|
void CommandQueueHw<gfxCoreFamily>::programPipelineSelect(NEO::LinearStream &commandStream) {
|
||||||
NEO::PipelineSelectArgs args = {0, 0};
|
NEO::PipelineSelectArgs args = {0, 0};
|
||||||
NEO::PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, args, device->getHwInfo());
|
NEO::PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, args, device->getHwInfo());
|
||||||
gpgpuEnabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ struct CommandQueueImp : public CommandQueue {
|
|||||||
|
|
||||||
std::atomic<uint32_t> taskCount{0};
|
std::atomic<uint32_t> taskCount{0};
|
||||||
|
|
||||||
bool gpgpuEnabled = false;
|
|
||||||
bool useKmdWaitFunction = false;
|
bool useKmdWaitFunction = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -121,5 +121,67 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, whenUsingFenceThenLastPipeC
|
|||||||
commandQueue->destroy();
|
commandQueue->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, givenTwoCommandQueuesUsingSingleCsrWhenExecutingFirstTimeOnBothThenPipelineSelectProgrammedOnce, IsAtMostXeHpcCore) {
|
||||||
|
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||||
|
|
||||||
|
bool additionalPipelineSelect = NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily)->is3DPipelineSelectWARequired() &&
|
||||||
|
neoDevice->getDefaultEngine().commandStreamReceiver->isRcs();
|
||||||
|
|
||||||
|
ze_result_t returnValue;
|
||||||
|
|
||||||
|
ze_command_list_handle_t commandList = CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle();
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
|
||||||
|
ze_command_queue_desc_t queueDesc = {};
|
||||||
|
queueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
|
||||||
|
auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue));
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
ASSERT_NE(nullptr, commandQueue->commandStream);
|
||||||
|
|
||||||
|
auto usedSpaceBefore = commandQueue->commandStream->getUsed();
|
||||||
|
returnValue = commandQueue->executeCommandLists(1, &commandList, nullptr, false);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
auto usedSpaceAfter = commandQueue->commandStream->getUsed();
|
||||||
|
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||||
|
|
||||||
|
GenCmdList cmdList;
|
||||||
|
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||||
|
cmdList,
|
||||||
|
ptrOffset(commandQueue->commandStream->getCpuBase(), usedSpaceBefore),
|
||||||
|
usedSpaceAfter - usedSpaceBefore));
|
||||||
|
|
||||||
|
auto pipelineSelect = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
|
||||||
|
size_t expectedFirstPipelineSelectCount = 1u;
|
||||||
|
if (additionalPipelineSelect) {
|
||||||
|
expectedFirstPipelineSelectCount += 2;
|
||||||
|
}
|
||||||
|
EXPECT_EQ(expectedFirstPipelineSelectCount, pipelineSelect.size());
|
||||||
|
|
||||||
|
cmdList.clear();
|
||||||
|
|
||||||
|
auto commandQueue2 = whiteboxCast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue));
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
ASSERT_NE(nullptr, commandQueue2->commandStream);
|
||||||
|
|
||||||
|
usedSpaceBefore = commandQueue2->commandStream->getUsed();
|
||||||
|
returnValue = commandQueue2->executeCommandLists(1, &commandList, nullptr, false);
|
||||||
|
ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
usedSpaceAfter = commandQueue2->commandStream->getUsed();
|
||||||
|
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||||
|
|
||||||
|
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||||
|
cmdList,
|
||||||
|
ptrOffset(commandQueue2->commandStream->getCpuBase(), usedSpaceBefore),
|
||||||
|
usedSpaceAfter - usedSpaceBefore));
|
||||||
|
|
||||||
|
pipelineSelect = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
|
||||||
|
constexpr size_t expectedSecondPipelineSelectCount = 0u;
|
||||||
|
EXPECT_EQ(expectedSecondPipelineSelectCount, pipelineSelect.size());
|
||||||
|
|
||||||
|
CommandList::fromHandle(commandList)->destroy();
|
||||||
|
commandQueue->destroy();
|
||||||
|
commandQueue2->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ult
|
} // namespace ult
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
|
|||||||
@@ -340,6 +340,14 @@ class CommandStreamReceiver {
|
|||||||
|
|
||||||
LogicalStateHelper *getLogicalStateHelper() const;
|
LogicalStateHelper *getLogicalStateHelper() const;
|
||||||
|
|
||||||
|
bool getPreambleSetFlag() const {
|
||||||
|
return isPreambleSent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPreambleSetFlag(bool value) {
|
||||||
|
isPreambleSent = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void cleanupResources();
|
void cleanupResources();
|
||||||
void printDeviceIndex();
|
void printDeviceIndex();
|
||||||
|
|||||||
@@ -2097,3 +2097,9 @@ HWTEST_F(CommandStreamReceiverTest, givenMultipleActivePartitionsWhenWaitLogIsEn
|
|||||||
|
|
||||||
EXPECT_STREQ(expectedOutput.str().c_str(), output.c_str());
|
EXPECT_STREQ(expectedOutput.str().c_str(), output.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(CommandStreamReceiverTest, givenPreambleFlagIsSetWhenGettingFlagStateThenExpectCorrectState) {
|
||||||
|
EXPECT_FALSE(commandStreamReceiver->getPreambleSetFlag());
|
||||||
|
commandStreamReceiver->setPreambleSetFlag(true);
|
||||||
|
EXPECT_TRUE(commandStreamReceiver->getPreambleSetFlag());
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user