mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Enable prepatcher DirectSubmission WA
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
79fedd59e4
commit
c6e27bdc18
@ -1405,7 +1405,7 @@ HWTEST_F(BcsTests, givenBlitterDirectSubmissionEnabledWhenProgrammingBlitterThen
|
||||
MI_BATCH_BUFFER_START *bbStart = hwParser.getCommand<MI_BATCH_BUFFER_START>();
|
||||
ASSERT_NE(nullptr, bbStart);
|
||||
EXPECT_EQ(csr.latestFlushedBatchBuffer.endCmdPtr, bbStart);
|
||||
EXPECT_EQ(0ull, bbStart->getBatchBufferStartAddress());
|
||||
EXPECT_NE(0ull, bbStart->getBatchBufferStartAddress());
|
||||
}
|
||||
|
||||
HWTEST_F(BcsTests, givenBlitterDirectSubmissionEnabledWhenFlushTagUpdateThenBatchBufferStartIsProgrammed) {
|
||||
|
@ -94,9 +94,9 @@ inline void CommandStreamReceiverHw<GfxFamily>::addBatchBufferEnd(LinearStream &
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programEndingCmd(LinearStream &commandStream, Device &device, void **patchLocation, bool directSubmissionEnabled) {
|
||||
if (directSubmissionEnabled) {
|
||||
uint64_t startAddress = 0;
|
||||
if (DebugManager.flags.BatchBufferStartPrepatchingWaEnabled.get() == 1) {
|
||||
startAddress = commandStream.getGraphicsAllocation()->getGpuAddress() + commandStream.getUsed();
|
||||
uint64_t startAddress = commandStream.getGraphicsAllocation()->getGpuAddress() + commandStream.getUsed();
|
||||
if (DebugManager.flags.BatchBufferStartPrepatchingWaEnabled.get() == 0) {
|
||||
startAddress = 0;
|
||||
}
|
||||
|
||||
*patchLocation = commandStream.getSpace(sizeof(MI_BATCH_BUFFER_START));
|
||||
|
@ -602,39 +602,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionAvailableWhenProgrammingEndi
|
||||
bool ret = mockCsr->isDirectSubmissionEnabled();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
void *location = nullptr;
|
||||
uint8_t buffer[128];
|
||||
mockCsr->commandStream.replaceBuffer(&buffer[0], 128u);
|
||||
auto &device = *pDevice;
|
||||
mockCsr->programEndingCmd(mockCsr->commandStream, device, &location, ret);
|
||||
EXPECT_EQ(sizeof(MI_BATCH_BUFFER_START), mockCsr->commandStream.getUsed());
|
||||
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
dispatchFlags.epilogueRequired = true;
|
||||
size_t expectedSize = sizeof(MI_BATCH_BUFFER_START) +
|
||||
mockCsr->getCmdSizeForEpilogueCommands(dispatchFlags);
|
||||
expectedSize = alignUp(expectedSize, MemoryConstants::cacheLineSize);
|
||||
EXPECT_EQ(expectedSize, mockCsr->getCmdSizeForEpilogue(dispatchFlags));
|
||||
}
|
||||
|
||||
HWTEST_F(DirectSubmissionTest, givenDebugFlagSetWhenProgrammingEndingCommandThenUseNonZeroBatchBufferStart) {
|
||||
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
DebugManager.flags.BatchBufferStartPrepatchingWaEnabled.set(1);
|
||||
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
|
||||
int32_t executionStamp = 0;
|
||||
std::unique_ptr<MockCsr<FamilyType>> mockCsr = std::make_unique<MockCsr<FamilyType>>(executionStamp, *pDevice->executionEnvironment,
|
||||
pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
mockCsr->setupContext(*osContext);
|
||||
mockCsr->directSubmissionAvailable = true;
|
||||
bool ret = mockCsr->isDirectSubmissionEnabled();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
void *location = nullptr;
|
||||
uint8_t buffer[128];
|
||||
mockCsr->commandStream.replaceBuffer(&buffer[0], 128u);
|
||||
@ -650,13 +619,51 @@ HWTEST_F(DirectSubmissionTest, givenDebugFlagSetWhenProgrammingEndingCommandThen
|
||||
expectedSize = alignUp(expectedSize, MemoryConstants::cacheLineSize);
|
||||
EXPECT_EQ(expectedSize, mockCsr->getCmdSizeForEpilogue(dispatchFlags));
|
||||
|
||||
auto bbStartCmd = reinterpret_cast<MI_BATCH_BUFFER_START *>(mockCsr->commandStream.getCpuBase());
|
||||
|
||||
EXPECT_EQ(mockCsr->commandStream.getGraphicsAllocation()->getGpuAddress(), bbStartCmd->getBatchBufferStartAddress());
|
||||
|
||||
mockCsr->commandStream.replaceGraphicsAllocation(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(DirectSubmissionTest, givenDebugFlagSetWhenProgrammingEndingCommandThenUseCorrectBatchBufferStartValue) {
|
||||
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
int32_t executionStamp = 0;
|
||||
|
||||
std::unique_ptr<MockCsr<FamilyType>> mockCsr = std::make_unique<MockCsr<FamilyType>>(executionStamp, *pDevice->executionEnvironment,
|
||||
pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
mockCsr->setupContext(*osContext);
|
||||
mockCsr->directSubmissionAvailable = true;
|
||||
bool ret = mockCsr->isDirectSubmissionEnabled();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
void *location = nullptr;
|
||||
|
||||
uint8_t buffer[256] = {};
|
||||
auto &cmdStream = mockCsr->commandStream;
|
||||
cmdStream.replaceBuffer(&buffer[0], 256);
|
||||
cmdStream.replaceGraphicsAllocation(&mockAllocation);
|
||||
auto &device = *pDevice;
|
||||
|
||||
for (int32_t value : {-1, 0, 1}) {
|
||||
DebugManager.flags.BatchBufferStartPrepatchingWaEnabled.set(value);
|
||||
|
||||
auto currectBbStartCmd = reinterpret_cast<MI_BATCH_BUFFER_START *>(cmdStream.getSpace(0));
|
||||
uint64_t expectedGpuVa = cmdStream.getGraphicsAllocation()->getGpuAddress() + cmdStream.getUsed();
|
||||
|
||||
mockCsr->programEndingCmd(cmdStream, device, &location, ret);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cmdStream);
|
||||
|
||||
if (value == 0) {
|
||||
EXPECT_EQ(0u, currectBbStartCmd->getBatchBufferStartAddress());
|
||||
} else {
|
||||
EXPECT_EQ(expectedGpuVa, currectBbStartCmd->getBatchBufferStartAddress());
|
||||
}
|
||||
}
|
||||
|
||||
cmdStream.replaceGraphicsAllocation(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(DirectSubmissionTest,
|
||||
givenDirectSubmissionDiagnosticNotAvailableWhenDiagnosticRegistryIsUsedThenDoNotEnableDiagnostic) {
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
Reference in New Issue
Block a user