mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 06:23:01 +08:00
Queue stall mode for RelaxedOrdering
Related-To: NEO-7458 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bb308c04ed
commit
bc619fcbec
@@ -11,11 +11,11 @@
|
||||
using namespace NEO;
|
||||
|
||||
struct BatchBufferHelper {
|
||||
static BatchBuffer createDefaultBatchBuffer(GraphicsAllocation *commandBufferAllocation, LinearStream *stream, size_t usedSize) {
|
||||
static BatchBuffer createDefaultBatchBuffer(GraphicsAllocation *commandBufferAllocation, LinearStream *stream, size_t usedSize, size_t chainedBatchBufferStartOffset) {
|
||||
return BatchBuffer(
|
||||
commandBufferAllocation, // commandBufferAllocation
|
||||
0, // startOffset
|
||||
0, // chainedBatchBufferStartOffset
|
||||
chainedBatchBufferStartOffset, // chainedBatchBufferStartOffset
|
||||
0, // taskStartAddress
|
||||
nullptr, // chainedBatchBuffer
|
||||
false, // requiresCoherency
|
||||
@@ -25,7 +25,12 @@ struct BatchBufferHelper {
|
||||
usedSize, // usedSize
|
||||
stream, // stream
|
||||
nullptr, // endCmdPtr
|
||||
false // useSingleSubdevice
|
||||
false, // useSingleSubdevice
|
||||
false // hasStallingCmds
|
||||
);
|
||||
}
|
||||
|
||||
static BatchBuffer createDefaultBatchBuffer(GraphicsAllocation *commandBufferAllocation, LinearStream *stream, size_t usedSize) {
|
||||
return createDefaultBatchBuffer(commandBufferAllocation, stream, usedSize, 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,35 +14,36 @@ using namespace NEO;
|
||||
struct DispatchFlagsHelper {
|
||||
static DispatchFlags createDefaultDispatchFlags() {
|
||||
return DispatchFlags(
|
||||
{}, //csrDependencies
|
||||
nullptr, //barrierTimestampPacketNodes
|
||||
{}, //pipelineSelectArgs
|
||||
nullptr, //flushStampReference
|
||||
QueueThrottle::MEDIUM, //throttle
|
||||
PreemptionMode::Disabled, //preemptionMode
|
||||
GrfConfig::DefaultGrfNumber, //numGrfRequired
|
||||
L3CachingSettings::l3CacheOn, //l3CacheSettings
|
||||
ThreadArbitrationPolicy::NotPresent, //threadArbitrationPolicy
|
||||
AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo
|
||||
KernelExecutionType::NotApplicable, //kernelExecutionType
|
||||
MemoryCompressionState::NotApplicable, //memoryCompressionState
|
||||
QueueSliceCount::defaultSliceCount, //sliceCount
|
||||
false, //blocking
|
||||
false, //dcFlush
|
||||
false, //useSLM
|
||||
false, //guardCommandBufferWithPipeControl
|
||||
false, //gsba32BitRequired
|
||||
false, //requiresCoherency
|
||||
false, //lowPriority
|
||||
false, //implicitFlush
|
||||
false, //outOfOrderExecutionAllowed
|
||||
false, //epilogueRequired
|
||||
false, //usePerDssBackedBuffer
|
||||
false, //useSingleSubdevice
|
||||
false, //useGlobalAtomics
|
||||
false, //areMultipleSubDevicesInContext
|
||||
false, //memoryMigrationRequired
|
||||
false //textureCacheFlush
|
||||
{}, // csrDependencies
|
||||
nullptr, // barrierTimestampPacketNodes
|
||||
{}, // pipelineSelectArgs
|
||||
nullptr, // flushStampReference
|
||||
QueueThrottle::MEDIUM, // throttle
|
||||
PreemptionMode::Disabled, // preemptionMode
|
||||
GrfConfig::DefaultGrfNumber, // numGrfRequired
|
||||
L3CachingSettings::l3CacheOn, // l3CacheSettings
|
||||
ThreadArbitrationPolicy::NotPresent, // threadArbitrationPolicy
|
||||
AdditionalKernelExecInfo::NotApplicable, // additionalKernelExecInfo
|
||||
KernelExecutionType::NotApplicable, // kernelExecutionType
|
||||
MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
QueueSliceCount::defaultSliceCount, // sliceCount
|
||||
false, // blocking
|
||||
false, // dcFlush
|
||||
false, // useSLM
|
||||
false, // guardCommandBufferWithPipeControl
|
||||
false, // gsba32BitRequired
|
||||
false, // requiresCoherency
|
||||
false, // lowPriority
|
||||
false, // implicitFlush
|
||||
false, // outOfOrderExecutionAllowed
|
||||
false, // epilogueRequired
|
||||
false, // usePerDssBackedBuffer
|
||||
false, // useSingleSubdevice
|
||||
false, // useGlobalAtomics
|
||||
false, // areMultipleSubDevicesInContext
|
||||
false, // memoryMigrationRequired
|
||||
false, // textureCacheFlush
|
||||
false // hasStallingCmds
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,8 +59,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, chainedBatchBuffer, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
batchBuffer.chainedBatchBuffer = chainedBatchBuffer;
|
||||
size_t sizeBatchBuffer = 0xffffu;
|
||||
|
||||
std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>> flatBatchBuffer(
|
||||
@@ -84,7 +84,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
size_t sizeBatchBuffer = 0xffffu;
|
||||
|
||||
@@ -111,7 +111,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, chainedBatchBuffer, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
size_t sizeBatchBuffer = 0xffffu;
|
||||
|
||||
@@ -133,7 +133,7 @@ HWTEST_F(FlatBatchBufferHelperAubTests, givenAubCommandStreamReceiverWhenRegiste
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
aubCsr->getFlatBatchBufferHelper().registerCommandChunk(batchBuffer, sizeof(MI_BATCH_BUFFER_START));
|
||||
ASSERT_EQ(1u, aubCsr->getFlatBatchBufferHelper().getCommandChunkList().size());
|
||||
@@ -227,7 +227,7 @@ HWTEST_F(FlatBatchBufferHelperAubTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
|
||||
ASSERT_EQ(3u, aubCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size());
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
size_t sizeBatchBuffer = 0u;
|
||||
|
||||
@@ -350,7 +350,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
auto chainedBatchBuffer = aubExecutionEnvironment->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, chainedBatchBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, chainedBatchBuffer, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
aubCsr->makeResident(*chainedBatchBuffer);
|
||||
|
||||
@@ -385,7 +385,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
|
||||
aubCsr->overwriteFlatBatchBufferHelper(mockHelper);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
@@ -408,7 +408,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
aubCsr->overwriteFlatBatchBufferHelper(mockHelper);
|
||||
ResidencyContainer allocationsForResidency;
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed(), 128);
|
||||
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
|
||||
@@ -592,7 +592,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI
|
||||
aubCsr.initializeTagAllocation();
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false, false};
|
||||
ResidencyContainer allocationsForResidency;
|
||||
|
||||
aubCsr.flush(batchBuffer, allocationsForResidency);
|
||||
@@ -761,9 +761,6 @@ HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenNoPatc
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
@@ -781,9 +778,6 @@ HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenFirstA
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
mockAubFileStream->addCommentResult = false;
|
||||
|
||||
@@ -797,9 +791,6 @@ HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenSecond
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
mockAubFileStream->addCommentResults = {true, false};
|
||||
@@ -814,9 +805,6 @@ HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenPatchI
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
PatchInfoData patchInfoData[2] = {{0xAAAAAAAA, 128u, PatchInfoAllocationType::Default, 0xBBBBBBBB, 256u, PatchInfoAllocationType::Default},
|
||||
@@ -879,9 +867,6 @@ HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenSource
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
PatchInfoData patchInfoData = {0x0, 0u, PatchInfoAllocationType::Default, 0xBBBBBBBB, 0u, PatchInfoAllocationType::Default};
|
||||
@@ -926,9 +911,6 @@ HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenTarget
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
PatchInfoData patchInfoData = {0xAAAAAAAA, 0u, PatchInfoAllocationType::Default, 0x0, 0u, PatchInfoAllocationType::Default};
|
||||
|
||||
@@ -2425,4 +2425,14 @@ HWTEST_F(CommandStreamReceiverHwTest, givenOutOfMemoryFailureOnFlushWhenInitiali
|
||||
|
||||
commandStreamReceiver.flushReturnValue = SubmissionStatus::OUT_OF_HOST_MEMORY;
|
||||
EXPECT_EQ(SubmissionStatus::OUT_OF_HOST_MEMORY, commandStreamReceiver.initializeDeviceWithFirstSubmission());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverHwTest, whenFlushTagUpdateThenSetStallingCmdsFlag) {
|
||||
auto &ultCsr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
ultCsr.recordFlusheBatchBuffer = true;
|
||||
|
||||
EXPECT_EQ(SubmissionStatus::SUCCESS, ultCsr.flushTagUpdate());
|
||||
|
||||
EXPECT_TRUE(ultCsr.latestFlushedBatchBuffer.hasStallingCmds);
|
||||
}
|
||||
@@ -95,6 +95,6 @@ struct ComputeModeRequirements : public ::testing::Test {
|
||||
|
||||
CommandStreamReceiver *csr = nullptr;
|
||||
std::unique_ptr<MockDevice> device;
|
||||
DispatchFlags flags{{}, nullptr, {}, nullptr, QueueThrottle::MEDIUM, PreemptionMode::Disabled, GrfConfig::DefaultGrfNumber, L3CachingSettings::l3CacheOn, ThreadArbitrationPolicy::NotPresent, AdditionalKernelExecInfo::NotApplicable, KernelExecutionType::NotApplicable, MemoryCompressionState::NotApplicable, QueueSliceCount::defaultSliceCount, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
DispatchFlags flags{{}, nullptr, {}, nullptr, QueueThrottle::MEDIUM, PreemptionMode::Disabled, GrfConfig::DefaultGrfNumber, L3CachingSettings::l3CacheOn, ThreadArbitrationPolicy::NotPresent, AdditionalKernelExecInfo::NotApplicable, KernelExecutionType::NotApplicable, MemoryCompressionState::NotApplicable, QueueSliceCount::defaultSliceCount, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
};
|
||||
|
||||
@@ -467,7 +467,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
|
||||
auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, pDevice->getDeviceBitfield()});
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false, false};
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
ResidencyContainer allocationsForResidency = {&allocation};
|
||||
|
||||
@@ -493,7 +493,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl
|
||||
auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, pDevice->getDeviceBitfield()});
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false, false};
|
||||
ResidencyContainer allocationsForResidency;
|
||||
|
||||
tbxCsr.flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
@@ -913,7 +913,7 @@ struct DirectSubmissionRelaxedOrderingTests : public DirectSubmissionDispatchBuf
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
bool verifySchedulerProgramming(LinearStream &cs, uint64_t deferredTaskListVa, uint64_t semaphoreGpuVa, uint32_t semaphoreValue, size_t offset);
|
||||
bool verifySchedulerProgramming(LinearStream &cs, uint64_t deferredTaskListVa, uint64_t semaphoreGpuVa, uint32_t semaphoreValue, size_t offset, size_t &endOffset);
|
||||
|
||||
template <typename FamilyType>
|
||||
bool verifyMiPredicate(void *miPredicateCmd, MiPredicateType predicateType);
|
||||
@@ -1187,7 +1187,7 @@ bool DirectSubmissionRelaxedOrderingTests::verifyConditionalDataRegBbStart(void
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
bool DirectSubmissionRelaxedOrderingTests::verifySchedulerProgramming(LinearStream &cs, uint64_t deferredTaskListVa, uint64_t semaphoreGpuVa, uint32_t semaphoreValue, size_t offset) {
|
||||
bool DirectSubmissionRelaxedOrderingTests::verifySchedulerProgramming(LinearStream &cs, uint64_t deferredTaskListVa, uint64_t semaphoreGpuVa, uint32_t semaphoreValue, size_t offset, size_t &endOffset) {
|
||||
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
using MI_SET_PREDICATE = typename FamilyType::MI_SET_PREDICATE;
|
||||
@@ -1501,6 +1501,8 @@ bool DirectSubmissionRelaxedOrderingTests::verifySchedulerProgramming(LinearStre
|
||||
if (!verifyLri<FamilyType>(lriCmd, CS_GPR_R5, 0)) {
|
||||
continue;
|
||||
}
|
||||
lriCmd++;
|
||||
endOffset = ptrDiff(lriCmd, cs.getCpuBase());
|
||||
|
||||
success = true;
|
||||
break;
|
||||
@@ -1704,9 +1706,6 @@ HWTEST_F(DirectSubmissionRelaxedOrderingTests, givenNotEnoughSpaceForTaskStoreSe
|
||||
}
|
||||
|
||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, whenDispatchingWorkThenDispatchScheduler, IsAtLeastXeHpcCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
using MI_MATH = typename FamilyType::MI_MATH;
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
||||
@@ -1717,18 +1716,209 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, whenDispatchingWorkThenDispatchS
|
||||
uint64_t deferredTasksListVa = directSubmission.deferredTasksListAllocation->getGpuAddress();
|
||||
uint64_t semaphoreGpuVa = directSubmission.semaphoreGpuVa;
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, 0));
|
||||
size_t endOffset = 0;
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, 0, endOffset));
|
||||
|
||||
FlushStampTracker flushStamp(true);
|
||||
directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
|
||||
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset));
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset, endOffset));
|
||||
|
||||
offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
|
||||
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset));
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset, endOffset));
|
||||
}
|
||||
|
||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenBbWithStallingCmdsWhenDispatchingThenProgramSchedulerWithR5, IsAtLeastXeHpcCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
||||
|
||||
directSubmission.initialize(true, false);
|
||||
size_t offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
uint64_t deferredTasksListVa = directSubmission.deferredTasksListAllocation->getGpuAddress();
|
||||
uint64_t semaphoreGpuVa = directSubmission.semaphoreGpuVa;
|
||||
|
||||
size_t endOffset = 0;
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, 0, endOffset));
|
||||
|
||||
FlushStampTracker flushStamp(true);
|
||||
batchBuffer.hasStallingCmds = false;
|
||||
directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
|
||||
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset, endOffset));
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, endOffset, endOffset));
|
||||
|
||||
offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
batchBuffer.hasStallingCmds = true;
|
||||
directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, offset);
|
||||
hwParse.findHardwareCommands<FamilyType>();
|
||||
|
||||
bool success = false;
|
||||
MI_LOAD_REGISTER_IMM *lriCmd = nullptr;
|
||||
|
||||
for (auto &it : hwParse.cmdList) {
|
||||
lriCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(it);
|
||||
if (lriCmd) {
|
||||
if (CS_GPR_R5 == lriCmd->getRegisterOffset() && lriCmd->getDataDword() == 1) {
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE(success);
|
||||
offset = ptrDiff(++lriCmd, directSubmission.ringCommandStream.getCpuBase());
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount - 1, offset, endOffset));
|
||||
|
||||
EXPECT_TRUE(endOffset > offset);
|
||||
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, endOffset, endOffset));
|
||||
}
|
||||
|
||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenFirstBbWithStallingCmdsWhenDispatchingThenDontProgramSchedulerWithR5, IsAtLeastXeHpcCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
||||
|
||||
directSubmission.initialize(true, false);
|
||||
size_t offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
uint64_t deferredTasksListVa = directSubmission.deferredTasksListAllocation->getGpuAddress();
|
||||
uint64_t semaphoreGpuVa = directSubmission.semaphoreGpuVa;
|
||||
|
||||
size_t endOffset = 0;
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, 0, endOffset));
|
||||
|
||||
FlushStampTracker flushStamp(true);
|
||||
batchBuffer.hasStallingCmds = true;
|
||||
directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, offset);
|
||||
hwParse.findHardwareCommands<FamilyType>();
|
||||
|
||||
bool success = false;
|
||||
MI_LOAD_REGISTER_IMM *lriCmd = nullptr;
|
||||
|
||||
for (auto &it : hwParse.cmdList) {
|
||||
lriCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(it);
|
||||
if (lriCmd) {
|
||||
if (CS_GPR_R5 == lriCmd->getRegisterOffset() && lriCmd->getDataDword() == 1) {
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_FALSE(success);
|
||||
}
|
||||
|
||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, whenStoppingRingThenProgramSchedulerWithR5, IsAtLeastXeHpcCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
||||
|
||||
directSubmission.initialize(true, false);
|
||||
size_t offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
uint64_t deferredTasksListVa = directSubmission.deferredTasksListAllocation->getGpuAddress();
|
||||
uint64_t semaphoreGpuVa = directSubmission.semaphoreGpuVa;
|
||||
|
||||
size_t endOffset = 0;
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, 0, endOffset));
|
||||
|
||||
FlushStampTracker flushStamp(true);
|
||||
batchBuffer.hasStallingCmds = false;
|
||||
directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
|
||||
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset, endOffset));
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, endOffset, endOffset));
|
||||
|
||||
offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
directSubmission.stopRingBuffer();
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, offset);
|
||||
hwParse.findHardwareCommands<FamilyType>();
|
||||
|
||||
bool success = false;
|
||||
MI_LOAD_REGISTER_IMM *lriCmd = nullptr;
|
||||
|
||||
for (auto &it : hwParse.cmdList) {
|
||||
lriCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(it);
|
||||
if (lriCmd) {
|
||||
if (CS_GPR_R5 == lriCmd->getRegisterOffset() && lriCmd->getDataDword() == 1) {
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE(success);
|
||||
offset = ptrDiff(lriCmd, directSubmission.ringCommandStream.getCpuBase());
|
||||
EXPECT_TRUE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, offset, endOffset));
|
||||
|
||||
EXPECT_TRUE(endOffset > offset);
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, endOffset, endOffset));
|
||||
}
|
||||
|
||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, WhenStoppingRingWithoutSubmissionThenDontProgramSchedulerWithR5, IsAtLeastXeHpcCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
||||
|
||||
directSubmission.initialize(true, false);
|
||||
size_t offset = directSubmission.ringCommandStream.getUsed();
|
||||
|
||||
uint64_t deferredTasksListVa = directSubmission.deferredTasksListAllocation->getGpuAddress();
|
||||
uint64_t semaphoreGpuVa = directSubmission.semaphoreGpuVa;
|
||||
|
||||
size_t endOffset = 0;
|
||||
|
||||
EXPECT_FALSE(verifySchedulerProgramming<FamilyType>(directSubmission.ringCommandStream, deferredTasksListVa, semaphoreGpuVa, directSubmission.currentQueueWorkCount, 0, endOffset));
|
||||
|
||||
directSubmission.stopRingBuffer();
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, offset);
|
||||
hwParse.findHardwareCommands<FamilyType>();
|
||||
|
||||
bool success = false;
|
||||
MI_LOAD_REGISTER_IMM *lriCmd = nullptr;
|
||||
|
||||
for (auto &it : hwParse.cmdList) {
|
||||
lriCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(it);
|
||||
if (lriCmd) {
|
||||
if (CS_GPR_R5 == lriCmd->getRegisterOffset() && lriCmd->getDataDword() == 1) {
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_FALSE(success);
|
||||
}
|
||||
|
||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, whenProgrammingEndingCmdsThenSetReturnRegisters, IsAtLeastXeHpcCore) {
|
||||
|
||||
@@ -212,7 +212,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenLowPriorityContextWhenFlushingThen
|
||||
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0, nullptr, false, true, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
EXPECT_NE(cs.getCpuBase(), nullptr);
|
||||
|
||||
@@ -228,7 +228,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenLowPriorityContextWhenFlushingThen
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenInvalidAddressWhenFlushingThenSucceeds) {
|
||||
//allocate command buffer manually
|
||||
// allocate command buffer manually
|
||||
char *commandBuffer = new (std::nothrow) char[1024];
|
||||
ASSERT_NE(nullptr, commandBuffer); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
|
||||
@@ -300,7 +300,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenNotAlignedWhenFlushingThenSucceeds
|
||||
auto &cs = csr->getCS();
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(cs.getGraphicsAllocation());
|
||||
|
||||
//make sure command buffer with offset is not page aligned
|
||||
// make sure command buffer with offset is not page aligned
|
||||
ASSERT_NE(0u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & (this->alignment - 1));
|
||||
ASSERT_EQ(4u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0x7F);
|
||||
|
||||
@@ -309,7 +309,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenNotAlignedWhenFlushingThenSucceeds
|
||||
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
EXPECT_EQ(1, mock->ioctlCount.gemUserptr);
|
||||
@@ -344,7 +345,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeWhenFlushingThenSuccee
|
||||
auto &cs = csr->getCS();
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(cs.getGraphicsAllocation());
|
||||
|
||||
//make sure command buffer with offset is not page aligned
|
||||
// make sure command buffer with offset is not page aligned
|
||||
ASSERT_NE(0u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & (this->alignment - 1));
|
||||
ASSERT_EQ(4u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0x7F);
|
||||
|
||||
@@ -356,7 +357,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeWhenFlushingThenSuccee
|
||||
csr->makeResident(allocation);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
EXPECT_EQ(1, mock->ioctlCount.gemUserptr);
|
||||
@@ -384,7 +386,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeCloseFailedWhenFlushin
|
||||
auto &cs = csr->getCS();
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(cs.getGraphicsAllocation());
|
||||
|
||||
//make sure command buffer with offset is not page aligned
|
||||
// make sure command buffer with offset is not page aligned
|
||||
ASSERT_NE(0u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & (this->alignment - 1));
|
||||
ASSERT_EQ(4u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0x7F);
|
||||
|
||||
@@ -398,7 +400,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeCloseFailedWhenFlushin
|
||||
csr->makeResident(allocation);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
EXPECT_EQ(1, mock->ioctlCount.gemUserptr);
|
||||
@@ -486,12 +489,12 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSe
|
||||
|
||||
csr->flushTask(cs, 0u, &cs, &cs, &cs, 0u, dispatchFlags, *device);
|
||||
|
||||
//make sure command buffer is recorded
|
||||
// make sure command buffer is recorded
|
||||
auto &cmdBuffers = mockedSubmissionsAggregator->peekCommandBuffers();
|
||||
EXPECT_FALSE(cmdBuffers.peekIsEmpty());
|
||||
EXPECT_NE(nullptr, cmdBuffers.peekHead());
|
||||
|
||||
//preemption allocation
|
||||
// preemption allocation
|
||||
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
|
||||
csrSurfaceCount += testedCsr->globalFenceAllocation ? 1 : 0;
|
||||
csrSurfaceCount += testedCsr->clearColorAllocation ? 1 : 0;
|
||||
@@ -500,7 +503,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSe
|
||||
auto recordedCmdBuffer = cmdBuffers.peekHead();
|
||||
EXPECT_EQ(3u + csrSurfaceCount, recordedCmdBuffer->surfaces.size());
|
||||
|
||||
//try to find all allocations
|
||||
// try to find all allocations
|
||||
auto elementInVector = std::find(recordedCmdBuffer->surfaces.begin(), recordedCmdBuffer->surfaces.end(), dummyAllocation);
|
||||
EXPECT_NE(elementInVector, recordedCmdBuffer->surfaces.end());
|
||||
|
||||
@@ -544,7 +547,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhen
|
||||
csr->setTagAllocation(static_cast<DrmAllocation *>(allocations->getGraphicsAllocation(csr->getRootDeviceIndex())));
|
||||
|
||||
auto &submittedCommandBuffer = csr->getCS(1024);
|
||||
//use some bytes
|
||||
// use some bytes
|
||||
submittedCommandBuffer.getSpace(4);
|
||||
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
@@ -566,13 +569,13 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhen
|
||||
auto commandBufferGraphicsAllocation = submittedCommandBuffer.getGraphicsAllocation();
|
||||
EXPECT_TRUE(commandBufferGraphicsAllocation->isResident(csr->getOsContext().getContextId()));
|
||||
|
||||
//preemption allocation
|
||||
// preemption allocation
|
||||
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
|
||||
csrSurfaceCount += testedCsr->globalFenceAllocation ? 1 : 0;
|
||||
csrSurfaceCount += testedCsr->clearColorAllocation ? 1 : 0;
|
||||
csrSurfaceCount += testedCsr->getKernelArgsBufferAllocation() ? 1 : 0;
|
||||
|
||||
//validate that submited command buffer has what we want
|
||||
// validate that submited command buffer has what we want
|
||||
EXPECT_EQ(3u + csrSurfaceCount, this->mock->execBuffer.getBufferCount());
|
||||
EXPECT_EQ(4u, this->mock->execBuffer.getBatchStartOffset());
|
||||
EXPECT_EQ(submittedCommandBuffer.getUsed(), this->mock->execBuffer.getBatchLen());
|
||||
@@ -813,7 +816,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenDirectSubmissionFa
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
uint8_t bbStart[64];
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
@@ -832,7 +836,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBlitterDirectSubmissionTest, givenBlitterDire
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
uint8_t bbStart[64];
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
@@ -855,7 +860,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
uint8_t bbStart[64];
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
@@ -874,7 +880,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
uint8_t bbStart[64];
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
@@ -892,7 +899,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBlitterDirectSubmissionTest, givenEnabledDire
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.startOffset = 4;
|
||||
uint8_t bbStart[64];
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
|
||||
@@ -351,11 +351,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamForceTileTest, givenForceExecutionTileThenCor
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(),
|
||||
0, 0, 0, nullptr, false, false,
|
||||
QueueThrottle::MEDIUM,
|
||||
QueueSliceCount::defaultSliceCount,
|
||||
cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
}
|
||||
@@ -609,7 +605,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenUseSingle
|
||||
csr->CommandStreamReceiver::makeResident(*allocation);
|
||||
|
||||
auto &cs = csr->getCS();
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, true};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.useSingleSubdevice = true;
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "shared/source/memory_manager/memory_banks.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/allocator_helper.h"
|
||||
#include "shared/test/common/helpers/batch_buffer_helper.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock_helper.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock_prelim_context.h"
|
||||
#include "shared/test/common/libult/linux/drm_query_mock.h"
|
||||
@@ -2270,7 +2271,7 @@ struct DrmCommandStreamEnhancedPrelimTest : public DrmCommandStreamEnhancedTempl
|
||||
LinearStream cs(commandBuffer);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
this->batchBuffer = BatchBuffer{cs.getGraphicsAllocation(), 0, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
this->batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
this->allocation = this->mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
this->csr->makeResident(*this->allocation);
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ TEST_F(WddmCommandStreamTest, GivenOffsetWhenFlushingThenFlushIsSubmittedCorrect
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), offset, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), offset, 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false, false};
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
EXPECT_EQ(1u, wddm->submitResult.called);
|
||||
EXPECT_TRUE(wddm->submitResult.success);
|
||||
@@ -428,7 +428,8 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledWhenEUCountWouldBeOddTh
|
||||
wddm->getGtSysInfo()->EUCount = 9;
|
||||
wddm->getGtSysInfo()->SubSliceCount = 3;
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0, nullptr, false, false, QueueThrottle::LOW, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.throttle = QueueThrottle::LOW;
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
auto commandHeader = wddm->submitResult.commandHeaderSubmitted;
|
||||
|
||||
@@ -446,7 +447,8 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToLowThenS
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0, nullptr, false, false, QueueThrottle::LOW, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.throttle = QueueThrottle::LOW;
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
auto commandHeader = wddm->submitResult.commandHeaderSubmitted;
|
||||
|
||||
@@ -482,7 +484,8 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToHighThen
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0, nullptr, false, false, QueueThrottle::HIGH, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.throttle = QueueThrottle::HIGH;
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
auto commandHeader = wddm->submitResult.commandHeaderSubmitted;
|
||||
|
||||
@@ -881,7 +884,7 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, WhenMakingResidentThenResidency
|
||||
|
||||
HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmittedThenFlushTaskIsProperlyCalled) {
|
||||
auto mockCsr = static_cast<MockWddmCsr<FamilyType> *>(csr);
|
||||
//preemption allocation + sip allocation
|
||||
// preemption allocation + sip allocation
|
||||
size_t csrSurfaceCount = 0;
|
||||
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
csrSurfaceCount = 2;
|
||||
@@ -1120,9 +1123,7 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionFailsThenF
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0,
|
||||
nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(),
|
||||
&cs, commandBuffer->getUnderlyingBuffer(), false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
mockCsr->directSubmission = std::make_unique<MockSubmission>(*device->getDefaultEngine().commandStreamReceiver);
|
||||
auto res = csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
@@ -1155,9 +1156,9 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnR
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0,
|
||||
nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(),
|
||||
&cs, commandBuffer->getUnderlyingBuffer(), false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.endCmdPtr = commandBuffer->getUnderlyingBuffer();
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
auto directSubmission = reinterpret_cast<MockSubmission *>(mockCsr->directSubmission.get());
|
||||
EXPECT_TRUE(directSubmission->ringStart);
|
||||
@@ -1196,9 +1197,9 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnB
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0,
|
||||
nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(),
|
||||
&cs, commandBuffer->getUnderlyingBuffer(), false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
batchBuffer.endCmdPtr = commandBuffer->getUnderlyingBuffer();
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
auto directSubmission = reinterpret_cast<MockSubmission *>(mockCsr->blitterDirectSubmission.get());
|
||||
EXPECT_TRUE(directSubmission->ringStart);
|
||||
@@ -1223,9 +1224,8 @@ TEST_F(WddmCommandStreamTest, givenResidencyLoggingAvailableWhenFlushingCommandB
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, 0,
|
||||
nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(),
|
||||
&cs, nullptr, false};
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.WddmResidencyLogger.set(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user