refactor: improve PVC unit tests

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2023-10-16 14:20:47 +00:00
committed by Compute-Runtime-Automation
parent af7bcbf99c
commit 2e9a7d7dca
12 changed files with 455 additions and 144 deletions

View File

@@ -133,6 +133,10 @@ void CmdListPipelineSelectStateFixture::testBody() {
size_t sizeAfter = 0;
auto result = ZE_RESULT_SUCCESS;
bool systolicModeSupported = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->csr)->pipelineSupportFlags.systolicMode;
PIPELINE_SELECT *pipelineSelectCmd = nullptr;
{
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.usesSystolicPipelineSelectMode = 0;
@@ -141,8 +145,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(0, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(0, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -160,7 +169,11 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = cmdQueueStream.getUsed();
EXPECT_EQ(0, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(0, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(cmdQueueStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -169,7 +182,7 @@ void CmdListPipelineSelectStateFixture::testBody() {
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_FALSE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
cmdList.clear();
@@ -184,8 +197,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
@@ -204,8 +222,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
@@ -213,10 +236,15 @@ void CmdListPipelineSelectStateFixture::testBody() {
currentBuffer,
(sizeAfter - sizeBefore)));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_FALSE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
if (systolicModeSupported) {
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_FALSE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
} else {
EXPECT_EQ(0u, pipelineSelectList.size());
}
cmdList.clear();
pipelineSelectList.clear();
@@ -227,17 +255,27 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = cmdQueueStream.getUsed();
EXPECT_EQ(0, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(0, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(cmdQueueStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
currentBuffer,
(sizeAfter - sizeBefore)));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
if (systolicModeSupported) {
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
} else {
EXPECT_EQ(0u, pipelineSelectList.size());
}
cmdList.clear();
pipelineSelectList.clear();
@@ -251,8 +289,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
@@ -271,8 +314,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
@@ -280,10 +328,15 @@ void CmdListPipelineSelectStateFixture::testBody() {
currentBuffer,
(sizeAfter - sizeBefore)));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_FALSE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
if (systolicModeSupported) {
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_FALSE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
} else {
EXPECT_EQ(0u, pipelineSelectList.size());
}
cmdList.clear();
pipelineSelectList.clear();
@@ -294,8 +347,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
@@ -303,10 +361,15 @@ void CmdListPipelineSelectStateFixture::testBody() {
currentBuffer,
(sizeAfter - sizeBefore)));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
if (systolicModeSupported) {
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
} else {
EXPECT_EQ(0u, pipelineSelectList.size());
}
cmdList.clear();
pipelineSelectList.clear();
@@ -317,17 +380,26 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = cmdQueueStream.getUsed();
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(cmdQueueStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
currentBuffer,
(sizeAfter - sizeBefore)));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
if (systolicModeSupported) {
ASSERT_EQ(1u, pipelineSelectList.size());
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
} else {
EXPECT_EQ(0u, pipelineSelectList.size());
}
cmdList.clear();
pipelineSelectList.clear();
@@ -340,8 +412,13 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = commandListStream.getUsed();
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, cmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(commandListStream.getCpuBase(), sizeBefore);
@@ -360,7 +437,11 @@ void CmdListPipelineSelectStateFixture::testBody() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = cmdQueueStream.getUsed();
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(cmdQueueStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -402,8 +483,15 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateRegularImmediate() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = regularCommandListStream.getUsed();
EXPECT_EQ(1, regularCmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, regularCmdListFinalState.pipelineSelect.systolicMode.value);
bool systolicModeSupported = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->csr)->pipelineSupportFlags.systolicMode;
if (systolicModeSupported) {
EXPECT_EQ(1, regularCmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, regularCmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, regularCmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, regularCmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(regularCommandListStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -421,17 +509,24 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateRegularImmediate() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = cmdQueueStream.getUsed();
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(cmdQueueStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
currentBuffer,
(sizeAfter - sizeBefore)));
pipelineSelectList = findAll<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(1u, pipelineSelectList.size());
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
EXPECT_EQ(systolicModeSupported, NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
cmdList.clear();
pipelineSelectList.clear();
@@ -451,7 +546,11 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateRegularImmediate() {
auto &immediateCmdListRequiredState = commandListImmediate->getRequiredStreamState();
EXPECT_EQ(1, immediateCmdListRequiredState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, immediateCmdListRequiredState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, immediateCmdListRequiredState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(immediateCmdListStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -463,7 +562,11 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateRegularImmediate() {
cmdList.clear();
pipelineSelectList.clear();
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(csrStream.getCpuBase(), csrUsedBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -508,7 +611,13 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateImmediateRegular() {
sizeAfter = immediateCmdListStream.getUsed();
size_t csrUsedAfter = csrStream.getUsed();
EXPECT_EQ(1, immediateCmdListRequiredState.pipelineSelect.systolicMode.value);
bool systolicModeSupported = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->csr)->pipelineSupportFlags.systolicMode;
if (systolicModeSupported) {
EXPECT_EQ(1, immediateCmdListRequiredState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, immediateCmdListRequiredState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(immediateCmdListStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -520,7 +629,11 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateImmediateRegular() {
cmdList.clear();
pipelineSelectList.clear();
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(csrStream.getCpuBase(), csrUsedBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -530,7 +643,7 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateImmediateRegular() {
ASSERT_EQ(1u, pipelineSelectList.size());
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*pipelineSelectList[0]);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
EXPECT_EQ(systolicModeSupported, NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
cmdList.clear();
pipelineSelectList.clear();
@@ -548,8 +661,13 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateImmediateRegular() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = regularCommandListStream.getUsed();
EXPECT_EQ(1, regularCmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, regularCmdListFinalState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, regularCmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, regularCmdListFinalState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, regularCmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(-1, regularCmdListFinalState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(regularCommandListStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -567,7 +685,11 @@ void CmdListPipelineSelectStateFixture::testBodyShareStateImmediateRegular() {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
sizeAfter = cmdQueueStream.getUsed();
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, csrState.pipelineSelect.systolicMode.value);
}
currentBuffer = ptrOffset(cmdQueueStream.getCpuBase(), sizeBefore);
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
@@ -636,13 +758,23 @@ void CmdListPipelineSelectStateFixture::testBodySystolicAndScratchOnSecondComman
// 3rd is pipeline select before systolic kernel
auto iterPsCmd = find<PIPELINE_SELECT *>(iterBbStartCmd, cmdList.end());
ASSERT_NE(cmdList.end(), iterPsCmd);
auto pipelineSelectCmd = reinterpret_cast<PIPELINE_SELECT *>(*iterPsCmd);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
bool systolicModeSupported = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->csr)->pipelineSupportFlags.systolicMode;
if (systolicModeSupported) {
ASSERT_NE(cmdList.end(), iterPsCmd);
auto pipelineSelectCmd = reinterpret_cast<PIPELINE_SELECT *>(*iterPsCmd);
EXPECT_TRUE(NEO::UnitTestHelper<FamilyType>::getSystolicFlagValueFromPipelineSelectCommand(*pipelineSelectCmd));
iterBbStartCmd = find<MI_BATCH_BUFFER_START *>(iterPsCmd, cmdList.end());
} else {
EXPECT_EQ(cmdList.end(), iterPsCmd);
iterBbStartCmd = find<MI_BATCH_BUFFER_START *>(cmdList.begin(), cmdList.end());
iterBbStartCmd = find<MI_BATCH_BUFFER_START *>(++iterBbStartCmd, cmdList.end());
}
// find bb start jumping to second command list
iterBbStartCmd = find<MI_BATCH_BUFFER_START *>(iterPsCmd, cmdList.end());
ASSERT_NE(cmdList.end(), iterBbStartCmd);
bbStart = reinterpret_cast<MI_BATCH_BUFFER_START *>(*iterBbStartCmd);

View File

@@ -1144,6 +1144,12 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh
const void **ranges = reinterpret_cast<const void **>(&dstPtr[0]);
verifyFlags(commandList->appendMemoryRangesBarrier(1, &rangeSizes, ranges, nullptr, 0, nullptr), true, true);
const auto &productHelper = device->getProductHelper();
bool stallingCmdRequired = productHelper.isComputeDispatchAllWalkerEnableInCfeStateRequired(device->getHwInfo());
verifyFlags(commandList->appendLaunchCooperativeKernel(kernel.toHandle(), groupCount, nullptr, 0, nullptr, false), false, stallingCmdRequired);
verifyFlags(commandList->appendLaunchCooperativeKernel(kernel.toHandle(), groupCount, nullptr, 0, nullptr, false), false, false);
driverHandle->releaseImportedPointer(dstPtr);

View File

@@ -314,16 +314,19 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenVariousKernelsAndPatchingDisallowe
const ze_group_count_t launchKernelArgs = {};
pCommandList->updateStreamProperties(defaultKernel, false, launchKernelArgs, false);
pCommandList->updateStreamProperties(cooperativeKernel, true, launchKernelArgs, false);
EXPECT_EQ(0u, pCommandList->commandsToPatch.size());
const auto &productHelper = device->getProductHelper();
size_t expectedCmdsToPatch = productHelper.isComputeDispatchAllWalkerEnableInCfeStateRequired(device->getHwInfo()) ? 1 : 0;
EXPECT_EQ(expectedCmdsToPatch, pCommandList->commandsToPatch.size());
pCommandList->reset();
DebugManager.flags.AllowPatchingVfeStateInCommandLists.set(1);
pCommandList->updateStreamProperties(defaultKernel, false, launchKernelArgs, false);
pCommandList->updateStreamProperties(cooperativeKernel, true, launchKernelArgs, false);
const auto &productHelper = device->getProductHelper();
size_t expectedCmdsToPatch = productHelper.isComputeDispatchAllWalkerEnableInCfeStateRequired(device->getHwInfo()) ? 1 : 0;
EXPECT_EQ(expectedCmdsToPatch, pCommandList->commandsToPatch.size());
pCommandList->reset();
}

View File

@@ -15,13 +15,10 @@
template <typename FamilyType>
void CommandStreamReceiverSystolicFixture::testBody() {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (!commandStreamReceiver.pipelineSupportFlags.systolicMode) {
GTEST_SKIP();
}
StreamProperties &streamProperties = commandStreamReceiver.getStreamProperties();
bool systolicModeSupported = commandStreamReceiver.pipelineSupportFlags.systolicMode;
commandStreamReceiver.isPreambleSent = true;
commandStreamReceiver.lastMediaSamplerConfig = false;
@@ -36,8 +33,13 @@ void CommandStreamReceiverSystolicFixture::testBody() {
taskLevel,
flushTaskFlags,
*pDevice);
EXPECT_EQ(true, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(1, streamProperties.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(true, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(1, streamProperties.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(false, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(-1, streamProperties.pipelineSelect.systolicMode.value);
}
flushTaskFlags.pipelineSelectArgs.systolicPipelineSelectMode = false;
@@ -50,5 +52,10 @@ void CommandStreamReceiverSystolicFixture::testBody() {
flushTaskFlags,
*pDevice);
EXPECT_EQ(false, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(0, streamProperties.pipelineSelect.systolicMode.value);
if (systolicModeSupported) {
EXPECT_EQ(0, streamProperties.pipelineSelect.systolicMode.value);
} else {
EXPECT_EQ(-1, streamProperties.pipelineSelect.systolicMode.value);
}
}

View File

@@ -362,7 +362,7 @@ TEST(UnpackSingleDeviceBinaryZebin, WhenMachineIsIntelGTAndIntelGTNoteSectionIsV
targetDevice.maxPointerSizeInBytes = 8;
targetDevice.productFamily = productFamily;
targetDevice.coreFamily = renderCoreFamily;
targetDevice.stepping = NEO::hardwareInfoTable[productFamily]->platform.usRevId;
targetDevice.stepping = NEO::hardwareInfoTable[productFamily]->platform.usRevId & 0x1F; // mask to 5 bits (minHwRevisionId and maxHwRevisionId size)
NEO::Zebin::Elf::ZebinTargetFlags targetMetadata;
targetMetadata.validateRevisionId = true;

View File

@@ -5534,7 +5534,7 @@ TEST_F(IntelGTNotesFixture, WhenValidatingTargetDeviceGivenValidTargetDeviceAndV
targetDevice.productFamily = productFamily;
targetDevice.coreFamily = renderCoreFamily;
targetDevice.maxPointerSizeInBytes = 8;
targetDevice.stepping = hardwareInfoTable[productFamily]->platform.usRevId;
targetDevice.stepping = hardwareInfoTable[productFamily]->platform.usRevId & 0x1F; // mask to 5 bits (minHwRevisionId and maxHwRevisionId size)
std::vector<NEO::Elf::ElfNoteSection> elfNoteSections;
for (int i = 0; i < 3; i++) {
@@ -5619,7 +5619,7 @@ TEST(ValidateTargetDevice32BitZebin, Given32BitZebinAndValidIntelGTNotesWhenVali
targetDevice.productFamily = productFamily;
targetDevice.coreFamily = renderCoreFamily;
targetDevice.maxPointerSizeInBytes = 4;
targetDevice.stepping = hardwareInfoTable[productFamily]->platform.usRevId;
targetDevice.stepping = hardwareInfoTable[productFamily]->platform.usRevId & 0x1F; // mask to 5 bits (minHwRevisionId and maxHwRevisionId size)
ZebinTestData::ValidEmptyProgram<NEO::Elf::EI_CLASS_32> zebin;
zebin.elfHeader->type = NEO::Elf::ET_REL;
@@ -5648,7 +5648,7 @@ TEST(ValidateTargetDeviceGeneratorZebin, GivenZebinAndValidIntelGTNotesWithGener
targetDevice.productFamily = productFamily;
targetDevice.coreFamily = renderCoreFamily;
targetDevice.maxPointerSizeInBytes = 4;
targetDevice.stepping = hardwareInfoTable[productFamily]->platform.usRevId;
targetDevice.stepping = hardwareInfoTable[productFamily]->platform.usRevId & 0x1F; // mask to 5 bits (minHwRevisionId and maxHwRevisionId size)
ZebinTestData::ValidEmptyProgram<NEO::Elf::EI_CLASS_32> zebin;
zebin.elfHeader->type = NEO::Elf::ET_REL;

View File

@@ -20,6 +20,7 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_l0_debugger.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -1427,10 +1428,15 @@ HWTEST2_F(CommandEncodeStatesTest,
cmdContainer->getCommandStream()->getUsed());
auto itorCmd = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
ASSERT_NE(itorCmd, commands.end());
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorCmd);
EXPECT_EQ(cmd->getSystolicModeEnable(), dpasModeRequired);
if (pDevice->getUltCommandStreamReceiver<FamilyType>().pipelineSupportFlags.systolicMode) {
ASSERT_NE(itorCmd, commands.end());
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorCmd);
EXPECT_EQ(cmd->getSystolicModeEnable(), dpasModeRequired);
} else {
EXPECT_EQ(itorCmd, commands.end());
}
}
HWTEST2_F(CommandEncodeStatesTest,
@@ -1457,10 +1463,15 @@ HWTEST2_F(CommandEncodeStatesTest,
cmdContainer->getCommandStream()->getUsed());
auto itorCmd = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
ASSERT_NE(itorCmd, commands.end());
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorCmd);
EXPECT_EQ(cmd->getSystolicModeEnable(), !dpasModeRequired);
if (pDevice->getUltCommandStreamReceiver<FamilyType>().pipelineSupportFlags.systolicMode) {
ASSERT_NE(itorCmd, commands.end());
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorCmd);
EXPECT_EQ(cmd->getSystolicModeEnable(), !dpasModeRequired);
} else {
EXPECT_EQ(itorCmd, commands.end());
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest,

View File

@@ -11,6 +11,7 @@
#include "shared/source/kernel/grf_config.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
@@ -60,10 +61,11 @@ HWTEST2_F(CommandEncodeStatesTest, givenCommandContainerWithKernelDpasThenSystol
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
auto itorCmd = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
ASSERT_NE(itorCmd, commands.end());
ASSERT_NE(itorCmd, commands.end());
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorCmd);
EXPECT_TRUE(cmd->getSystolicModeEnable());
EXPECT_EQ(pDevice->getUltCommandStreamReceiver<FamilyType>().pipelineSupportFlags.systolicMode, cmd->getSystolicModeEnable());
}
HWTEST2_F(CommandEncodeStatesTest, givenCommandContainerWithNoKernelDpasThenSystolicModeIsNotEnabled, IsWithinXeGfxFamily) {

View File

@@ -20,6 +20,8 @@
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "hw_cmds.h"
using namespace NEO;
TEST(MemoryManagerTest, givenSetUseSytemMemoryWhenGraphicsAllocationInDevicePoolIsAllocatedThenNullptrIsReturned) {
@@ -870,39 +872,3 @@ HWTEST2_F(MemoryManagerDirectSubmissionImplicitScalingTest, givenDirectSubmissio
}
}
}
HWTEST2_F(MemoryManagerDirectSubmissionImplicitScalingTest, givenDirectSubmissionForceLocalMemoryStorageEnabledForAllEnginesWhenAllocatingMemoryForCommandOrRingOrSemaphoreBufferThenFirstBankIsSelected, IsPVC) {
DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.set(2);
for (auto &multiTile : ::testing::Bool()) {
for (auto &allocationType : {AllocationType::COMMAND_BUFFER, AllocationType::RING_BUFFER, AllocationType::SEMAPHORE_BUFFER}) {
allocationProperties->allocationType = allocationType;
allocationProperties->flags.multiOsContextCapable = multiTile;
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(*allocationProperties, nullptr);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_EQ(firstTileMask, allocation->storageInfo.getMemoryBanks());
memoryManager->freeGraphicsMemory(allocation);
}
}
}
HWTEST2_F(MemoryManagerDirectSubmissionImplicitScalingTest, givenDirectSubmissionForceLocalMemoryStorageDefaultModeWhenAllocatingMemoryForCommandOrRingOrSemaphoreBufferThenFirstBankIsSelected, IsPVC) {
DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.set(-1);
for (auto &multiTile : ::testing::Bool()) {
for (auto &allocationType : {AllocationType::COMMAND_BUFFER, AllocationType::RING_BUFFER, AllocationType::SEMAPHORE_BUFFER}) {
allocationProperties->allocationType = allocationType;
allocationProperties->flags.multiOsContextCapable = multiTile;
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(*allocationProperties, nullptr);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_EQ(firstTileMask, allocation->storageInfo.getMemoryBanks());
memoryManager->freeGraphicsMemory(allocation);
}
}
}

View File

@@ -1,20 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/memory_manager/local_memory_usage.h"
#include "shared/source/xe_hpc_core/hw_cmds_pvc.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using DeviceTestsPvc = ::testing::Test;
@@ -43,3 +45,103 @@ PVCTEST_F(DeviceTestsPvc, WhenDeviceIsCreatedThenOnlyOneCcsEngineIsExposed) {
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
EXPECT_EQ(1u, computeEngineGroup.engines.size());
}
struct MemoryManagerDirectSubmissionImplicitScalingPvcTest : public ::testing::Test {
void SetUp() override {
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
executionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get());
auto allTilesMask = executionEnvironment->rootDeviceEnvironments[mockRootDeviceIndex]->deviceAffinityMask.getGenericSubDevicesMask();
allocationProperties = std::make_unique<AllocationProperties>(mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::UNKNOWN, allTilesMask);
allocationProperties->flags.multiOsContextCapable = true;
constexpr auto enableLocalMemory = true;
memoryManager = std::make_unique<MockMemoryManager>(false, enableLocalMemory, *executionEnvironment);
memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->reserveOnBanks(1u, MemoryConstants::pageSize2M);
EXPECT_NE(0u, memoryManager->internalLocalMemoryUsageBankSelector[mockRootDeviceIndex]->getLeastOccupiedBank(allTilesMask));
}
DebugManagerStateRestore restorer{};
constexpr static DeviceBitfield firstTileMask{1u};
constexpr static auto numSubDevices = 2u;
std::unique_ptr<MockExecutionEnvironment> executionEnvironment{};
std::unique_ptr<AllocationProperties> allocationProperties{};
std::unique_ptr<MockMemoryManager> memoryManager{};
};
PVCTEST_F(MemoryManagerDirectSubmissionImplicitScalingPvcTest, givenDirectSubmissionForceLocalMemoryStorageEnabledForAllEnginesWhenAllocatingMemoryForCommandOrRingOrSemaphoreBufferThenFirstBankIsSelected) {
DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.set(2);
HardwareInfo hwInfo = *defaultHwInfo;
for (auto bdA0 : ::testing::Bool()) {
uint32_t expectedPlacement = 0b10;
if (bdA0) {
hwInfo.platform.usRevId &= ~PVC::pvcBaseDieRevMask;
} else {
hwInfo.platform.usRevId |= PVC::pvcBaseDieRevMask;
}
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
for (auto &multiTile : ::testing::Bool()) {
if (multiTile || bdA0) {
expectedPlacement = static_cast<uint32_t>(firstTileMask.to_ulong());
}
for (auto &allocationType : {AllocationType::COMMAND_BUFFER, AllocationType::RING_BUFFER, AllocationType::SEMAPHORE_BUFFER}) {
allocationProperties->allocationType = allocationType;
allocationProperties->flags.multiOsContextCapable = multiTile;
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(*allocationProperties, nullptr);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_EQ(expectedPlacement, allocation->storageInfo.getMemoryBanks());
memoryManager->freeGraphicsMemory(allocation);
}
}
}
}
PVCTEST_F(MemoryManagerDirectSubmissionImplicitScalingPvcTest, givenDirectSubmissionForceLocalMemoryStorageDefaultModeWhenAllocatingMemoryForCommandOrRingOrSemaphoreBufferThenFirstBankIsSelected) {
DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.set(-1);
HardwareInfo hwInfo = *defaultHwInfo;
for (auto bdA0 : ::testing::Bool()) {
uint32_t expectedPlacement = 0b10;
if (bdA0) {
hwInfo.platform.usRevId &= ~PVC::pvcBaseDieRevMask;
} else {
hwInfo.platform.usRevId |= PVC::pvcBaseDieRevMask;
}
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
for (auto &multiTile : ::testing::Bool()) {
if (multiTile || bdA0) {
expectedPlacement = static_cast<uint32_t>(firstTileMask.to_ulong());
}
for (auto &allocationType : {AllocationType::COMMAND_BUFFER, AllocationType::RING_BUFFER, AllocationType::SEMAPHORE_BUFFER}) {
allocationProperties->allocationType = allocationType;
allocationProperties->flags.multiOsContextCapable = multiTile;
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(*allocationProperties, nullptr);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_EQ(expectedPlacement, allocation->storageInfo.getMemoryBanks());
memoryManager->freeGraphicsMemory(allocation);
}
}
}
}

View File

@@ -82,6 +82,7 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenPvcBaseDieA0AndTile1WhenGettingBcsEngin
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
auto pHwInfo = rootDeviceEnvironment.getMutableHardwareInfo();
pHwInfo->featureTable.ftrBcsInfo = 0b11111;
pHwInfo->platform.usRevId &= ~PVC::pvcBaseDieRevMask;
auto deviceBitfield = 0b10;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
@@ -108,24 +109,50 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledButDebugVariableSetWhenGetG
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
auto productHelper = ProductHelper::create(hwInfo.platform.eProductFamily);
DebugManagerStateRestore restorer;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS));
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(9u, device->allEngines.size());
auto &engines = gfxCoreHelper.getGpgpuEngineInstances(device->getRootDeviceEnvironment());
EXPECT_EQ(9u, engines.size());
for (uint32_t stepping : {REVISION_A0, REVISION_B}) {
hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hwInfo);
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first);
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first);
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first);
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first);
EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[4].first);
EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[5].first); // low priority
EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[6].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[8].first);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
bool cooperativeDispatchSupported = productHelper->isCooperativeEngineSupported(hwInfo);
EXPECT_EQ((stepping == REVISION_B), cooperativeDispatchSupported);
EXPECT_EQ(cooperativeDispatchSupported ? 13u : 9u, device->allEngines.size());
auto &engines = gfxCoreHelper.getGpgpuEngineInstances(device->getRootDeviceEnvironment());
EXPECT_EQ(cooperativeDispatchSupported ? 13u : 9u, engines.size());
uint32_t index = 0;
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[++index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[++index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[++index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[++index].first);
EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[++index].first); // low priority
EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[++index].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[++index].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[++index].first);
}
}
PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledWhenGetGpgpuEnginesCalledThenDontSetCccs) {
@@ -137,20 +164,45 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledWhenGetGpgpuEnginesCalledTh
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(8u, device->allEngines.size());
auto &engines = gfxCoreHelper.getGpgpuEngineInstances(device->getRootDeviceEnvironment());
EXPECT_EQ(8u, engines.size());
auto productHelper = ProductHelper::create(hwInfo.platform.eProductFamily);
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first);
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first);
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first);
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first);
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[4].first); // low priority
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[5].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[6].first);
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first);
for (uint32_t stepping : {REVISION_A0, REVISION_B}) {
hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
bool cooperativeDispatchSupported = productHelper->isCooperativeEngineSupported(hwInfo);
EXPECT_EQ((stepping == REVISION_B), cooperativeDispatchSupported);
EXPECT_EQ(cooperativeDispatchSupported ? 12u : 8u, device->allEngines.size());
auto &engines = gfxCoreHelper.getGpgpuEngineInstances(device->getRootDeviceEnvironment());
EXPECT_EQ(cooperativeDispatchSupported ? 12u : 8u, engines.size());
uint32_t index = 0;
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[++index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[++index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[++index].first);
}
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[++index].first);
if (cooperativeDispatchSupported) {
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[++index].first);
}
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[++index].first); // low priority
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[++index].first); // internal
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[++index].first);
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[++index].first);
}
}
PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) {
@@ -159,8 +211,7 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispat
auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
auto engineGroupType = gfxCoreHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(),
pDevice->getDefaultEngine().getEngineUsage(), hwInfo);
auto engineGroupType = gfxCoreHelper.getEngineGroupType(aub_stream::ENGINE_CCS, EngineUsage::Cooperative, hwInfo);
auto retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment);
EXPECT_TRUE(retVal);
}
@@ -172,9 +223,9 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCoop
auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto engineGroupType = gfxCoreHelper.getEngineGroupType(pDevice->getDefaultEngine().getEngineType(),
pDevice->getDefaultEngine().getEngineUsage(), hwInfo);
auto engineGroupType = gfxCoreHelper.getEngineGroupType(aub_stream::ENGINE_CCCS, EngineUsage::Cooperative, hwInfo);
auto retVal = gfxCoreHelper.isCooperativeDispatchSupported(engineGroupType, rootDeviceEnvironment);
EXPECT_TRUE(retVal);
@@ -184,6 +235,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCoop
}
PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDontCreateAnyBcs) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 7;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -192,6 +245,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDont
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());
@@ -222,6 +277,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDont
}
PVCTEST_F(EngineNodeHelperPvcTests, givenOneBcsEnabledWhenGetEnginesCalledThenCreateOnlyOneBcs) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 9;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -231,6 +288,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenOneBcsEnabledWhenGetEnginesCalledThenCr
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());
@@ -263,6 +322,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenOneBcsEnabledWhenGetEnginesCalledThenCr
}
PVCTEST_F(EngineNodeHelperPvcTests, givenNotAllCopyEnginesWhenSettingEngineTableThenDontAddUnsupported) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 9;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -276,6 +337,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenNotAllCopyEnginesWhenSettingEngineTable
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());
@@ -308,6 +371,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenNotAllCopyEnginesWhenSettingEngineTable
}
PVCTEST_F(EngineNodeHelperPvcTests, givenOneCcsEnabledWhenGetEnginesCalledThenCreateOnlyOneCcs) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 15;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -317,6 +382,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenOneCcsEnabledWhenGetEnginesCalledThenCr
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());
@@ -355,6 +422,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenOneCcsEnabledWhenGetEnginesCalledThenCr
}
PVCTEST_F(EngineNodeHelperPvcTests, givenCccsAsDefaultEngineWhenGetEnginesCalledThenChangeDefaultEngine) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 18;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -364,6 +433,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsAsDefaultEngineWhenGetEnginesCalled
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());
@@ -405,6 +476,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsAsDefaultEngineWhenGetEnginesCalled
}
PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndEightLinkCopyEngines) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 18;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -414,6 +487,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesA
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());
@@ -455,6 +530,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesA
}
PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndLinkCopyEngines) {
const auto &productHelper = getHelper<ProductHelper>();
const size_t numEngines = 18;
HardwareInfo hwInfo = *defaultHwInfo;
@@ -464,6 +541,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesA
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();
EXPECT_EQ(numEngines, device->allEngines.size());

View File

@@ -145,6 +145,9 @@ PVCTEST_F(PvcProductHelper, givenPvcWhenCallingGetDeviceMemoryNameThenHbmIsRetur
PVCTEST_F(PvcProductHelper, givenProductHelperWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) {
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_FALSE(productHelper->isDisableOverdispatchAvailable(hwInfo));
FrontEndPropertiesSupport fePropertiesSupport{};