mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Poll task count indefinitely on high throttle command queue
Resolves: NEO-6781 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0c064ccf4c
commit
a230f267e1
@@ -114,7 +114,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommandListImm
|
||||
|
||||
if (this->isSyncModeQueue) {
|
||||
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(false, timeoutMicroseconds, completionStamp.taskCount);
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(NEO::WaitParams{false, false, timeoutMicroseconds}, completionStamp.taskCount);
|
||||
if (waitStatus == NEO::WaitStatus::GpuHang) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendBarrier(
|
||||
this->csr->flushNonKernelTask(nullptr, 0, 0, args, false, false, false);
|
||||
if (this->isSyncModeQueue) {
|
||||
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(false, timeoutMicroseconds, this->csr->peekTaskCount());
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(NEO::WaitParams{false, false, timeoutMicroseconds}, this->csr->peekTaskCount());
|
||||
if (waitStatus == NEO::WaitStatus::GpuHang) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendSignalEvent(ze_
|
||||
this->csr->flushNonKernelTask(&event->getAllocation(this->device), event->getGpuAddress(this->device), Event::STATE_SIGNALED, args, false, false, false);
|
||||
if (this->isSyncModeQueue) {
|
||||
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(false, timeoutMicroseconds, this->csr->peekTaskCount());
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(NEO::WaitParams{false, false, timeoutMicroseconds}, this->csr->peekTaskCount());
|
||||
if (waitStatus == NEO::WaitStatus::GpuHang) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendEventReset(ze_e
|
||||
this->csr->flushNonKernelTask(&event->getAllocation(this->device), event->getGpuAddress(this->device), Event::STATE_CLEARED, args, false, false, false);
|
||||
if (this->isSyncModeQueue) {
|
||||
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(false, timeoutMicroseconds, this->csr->peekTaskCount());
|
||||
const auto waitStatus = this->csr->waitForCompletionWithTimeout(NEO::WaitParams{false, false, timeoutMicroseconds}, this->csr->peekTaskCount());
|
||||
if (waitStatus == NEO::WaitStatus::GpuHang) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ CommandListAllocatorFn commandListFactoryImmediate[IGFX_MAX_PRODUCT] = {};
|
||||
ze_result_t CommandListImp::destroy() {
|
||||
if (this->cmdListType == CommandListType::TYPE_IMMEDIATE && this->isFlushTaskSubmissionEnabled && !this->isSyncModeQueue) {
|
||||
auto timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
this->csr->waitForCompletionWithTimeout(false, timeoutMicroseconds, this->csr->peekTaskCount());
|
||||
this->csr->waitForCompletionWithTimeout(NEO::WaitParams{false, false, timeoutMicroseconds}, this->csr->peekTaskCount());
|
||||
}
|
||||
delete this;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/csr_definitions.h"
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/queue_throttle.h"
|
||||
#include "shared/source/command_stream/wait_status.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
@@ -101,7 +102,7 @@ NEO::SubmissionStatus CommandQueueImp::submitBatchBuffer(size_t offset, NEO::Res
|
||||
ze_result_t CommandQueueImp::synchronize(uint64_t timeout) {
|
||||
if ((timeout == std::numeric_limits<uint64_t>::max()) && useKmdWaitFunction) {
|
||||
auto &waitPair = buffers.getCurrentFlushStamp();
|
||||
const auto waitStatus = csr->waitForTaskCountWithKmdNotifyFallback(waitPair.first, waitPair.second, false, false);
|
||||
const auto waitStatus = csr->waitForTaskCountWithKmdNotifyFallback(waitPair.first, waitPair.second, false, NEO::QueueThrottle::MEDIUM);
|
||||
if (waitStatus == NEO::WaitStatus::GpuHang) {
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
@@ -124,7 +125,7 @@ ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint64_t timeout)
|
||||
timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
}
|
||||
|
||||
const auto waitStatus = csr->waitForCompletionWithTimeout(enableTimeout, timeoutMicroseconds, taskCountToWait);
|
||||
const auto waitStatus = csr->waitForCompletionWithTimeout(NEO::WaitParams{false, enableTimeout, timeoutMicroseconds}, taskCountToWait);
|
||||
if (waitStatus == NEO::WaitStatus::NotReady) {
|
||||
return ZE_RESULT_NOT_READY;
|
||||
}
|
||||
@@ -239,7 +240,7 @@ void CommandQueueImp::CommandBufferManager::switchBuffers(NEO::CommandStreamRece
|
||||
auto completionId = flushId[bufferUse];
|
||||
if (completionId.second != 0u) {
|
||||
UNRECOVERABLE_IF(csr == nullptr);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(completionId.first, completionId.second, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(completionId.first, completionId.second, false, NEO::QueueThrottle::MEDIUM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,16 +145,16 @@ struct SynchronizeCsr : public NEO::UltCommandStreamReceiver<GfxFamily> {
|
||||
memset(const_cast<uint32_t *>(CommandStreamReceiver::tagAddress), 0xFFFFFFFF, tagSize * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
|
||||
enableTimeoutSet = enableTimeout;
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
enableTimeoutSet = params.enableTimeout;
|
||||
waitForComplitionCalledTimes++;
|
||||
partitionCountSet = this->activePartitions;
|
||||
return waitForCompletionWithTimeoutResult;
|
||||
}
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) override {
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, NEO::QueueThrottle throttle) override {
|
||||
waitForTaskCountWithKmdNotifyFallbackCalled++;
|
||||
return NEO::UltCommandStreamReceiver<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, quickKmdSleep, forcePowerSavingMode);
|
||||
return NEO::UltCommandStreamReceiver<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, quickKmdSleep, throttle);
|
||||
}
|
||||
|
||||
static constexpr size_t tagSize = 128;
|
||||
@@ -407,7 +407,7 @@ struct TestCmdQueueCsr : public NEO::UltCommandStreamReceiver<GfxFamily> {
|
||||
: NEO::UltCommandStreamReceiver<GfxFamily>(const_cast<NEO::ExecutionEnvironment &>(executionEnvironment), 0, deviceBitfield) {
|
||||
}
|
||||
|
||||
ADDMETHOD_NOBASE(waitForCompletionWithTimeout, NEO::WaitStatus, NEO::WaitStatus::NotReady, (bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
|
||||
ADDMETHOD_NOBASE(waitForCompletionWithTimeout, NEO::WaitStatus, NEO::WaitStatus::NotReady, (const WaitParams ¶ms, uint32_t taskCountToWait));
|
||||
};
|
||||
|
||||
HWTEST_F(CommandQueueSynchronizeTest, givenSinglePartitionCountWhenWaitFunctionFailsThenReturnNotReady) {
|
||||
|
||||
@@ -256,12 +256,10 @@ WaitStatus CommandQueue::waitUntilComplete(uint32_t gpgpuTaskCountToWait, Range<
|
||||
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "Current taskCount:", getHwTag());
|
||||
|
||||
if (!skipWait) {
|
||||
bool forcePowerSavingMode = this->throttle == QueueThrottle::LOW;
|
||||
|
||||
waitStatus = getGpgpuCommandStreamReceiver().waitForTaskCountWithKmdNotifyFallback(gpgpuTaskCountToWait,
|
||||
flushStampToWait,
|
||||
useQuickKmdSleep,
|
||||
forcePowerSavingMode);
|
||||
this->getThrottle());
|
||||
if (waitStatus == WaitStatus::GpuHang) {
|
||||
return WaitStatus::GpuHang;
|
||||
}
|
||||
@@ -276,7 +274,7 @@ WaitStatus CommandQueue::waitUntilComplete(uint32_t gpgpuTaskCountToWait, Range<
|
||||
for (const CopyEngineState ©Engine : copyEnginesToWait) {
|
||||
auto bcsCsr = getBcsCommandStreamReceiver(copyEngine.engineType);
|
||||
|
||||
waitStatus = bcsCsr->waitForTaskCountWithKmdNotifyFallback(copyEngine.taskCount, 0, false, false);
|
||||
waitStatus = bcsCsr->waitForTaskCountWithKmdNotifyFallback(copyEngine.taskCount, 0, false, this->getThrottle());
|
||||
if (waitStatus == WaitStatus::GpuHang) {
|
||||
return WaitStatus::GpuHang;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenDstHostPtrWhenBlitC
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
expectMemoryNotEqual<FamilyType>(getGpuAddress(*srcCompressedBuffer), compressiblePattern.get(), bufferSize, 0, 0);
|
||||
expectMemory<FamilyType>(dstHostPtr.get(), compressiblePattern.get(), bufferSize, 0, 0);
|
||||
@@ -275,7 +275,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenDstHostPtrWhenBlitC
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
expectMemory<FamilyType>(getGpuAddress(*srcNotCompressedLocalBuffer), compressiblePattern.get(), bufferSize, 0, 0);
|
||||
expectMemory<FamilyType>(dstHostPtr.get(), compressiblePattern.get(), bufferSize, 0, 0);
|
||||
@@ -326,7 +326,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenBufferWithOffsetWhe
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
expectMemoryNotEqual<FamilyType>(dstHostPtr.get(), writePattern.get(), offset, 0, 0);
|
||||
expectMemoryNotEqual<FamilyType>(ptrOffset(dstHostPtr.get(), 1), ptrOffset(writePattern.get(), offset), bufferSize - offset - 1, 0, 0);
|
||||
@@ -409,7 +409,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenCompressedBufferWhe
|
||||
bcsCsr->getClearColorAllocation());
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
expectMemory<FamilyType>(getGpuAddress(*buffer), compressiblePattern.get(), bufferSize, 0, 0);
|
||||
}
|
||||
@@ -421,7 +421,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenCompressedBufferWhe
|
||||
bcsCsr->getClearColorAllocation());
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
expectMemoryNotEqual<FamilyType>(getGpuAddress(*buffer), compressiblePattern.get(), bufferSize, 0, 0);
|
||||
}
|
||||
@@ -492,7 +492,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenReadBufferRectWithO
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
pSrcMemory = ptrOffset(pSrcMemory, 0);
|
||||
int *destGpuAddress = reinterpret_cast<int *>(allocation->getGpuAddress());
|
||||
@@ -550,7 +550,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenWriteBufferRectWith
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
pSrcMemory = ptrOffset(pSrcMemory, 0);
|
||||
int *destGpuAddress = reinterpret_cast<int *>(allocation->getGpuAddress());
|
||||
@@ -598,7 +598,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenCopyBufferRectWithO
|
||||
|
||||
executeBlitCommand(blitProperties, false);
|
||||
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
pSrcMemory = ptrOffset(pSrcMemory, 0);
|
||||
|
||||
@@ -647,7 +647,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenCopyBufferRectWithB
|
||||
dstSlicePitch, //dstSlicePitch
|
||||
clearColorAllocation); //clearColorAllocation
|
||||
executeBlitCommand(blitProperties, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
bcsCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
|
||||
size_t dstOffset = dstOrigin[0] + dstOrigin[1] * dstRowPitch + dstOrigin[2] * dstSlicePitch;
|
||||
|
||||
|
||||
@@ -960,7 +960,7 @@ class CommandStreamReceiverHwMock : public CommandStreamReceiverHw<GfxFamily> {
|
||||
const DeviceBitfield deviceBitfield)
|
||||
: CommandStreamReceiverHw<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield) {}
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override {
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override {
|
||||
waitForTaskCountWithKmdNotifyFallbackCounter++;
|
||||
return waitForTaskCountWithKmdNotifyFallbackReturnValue;
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenWaitForT
|
||||
auto cmdBuffer = cmdBufferList.peekHead();
|
||||
EXPECT_EQ(1u, cmdBuffer->taskCount);
|
||||
|
||||
mockCsr->waitForCompletionWithTimeout(false, 1, 1);
|
||||
mockCsr->waitForCompletionWithTimeout(WaitParams{false, false, 1}, 1);
|
||||
|
||||
EXPECT_EQ(1u, mockCsr->peekLatestFlushedTaskCount());
|
||||
|
||||
@@ -1889,5 +1889,5 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenWaitForCompletionWithTimeoutI
|
||||
mockCsr.latestSentTaskCount = 1;
|
||||
auto cmdBuffer = std::make_unique<CommandBuffer>(*pDevice);
|
||||
mockCsr.submissionAggregator->recordCommandBuffer(cmdBuffer.release());
|
||||
EXPECT_EQ(NEO::WaitStatus::NotReady, mockCsr.waitForCompletionWithTimeout(false, 0, 1));
|
||||
EXPECT_EQ(NEO::WaitStatus::NotReady, mockCsr.waitForCompletionWithTimeout(WaitParams{false, false, 0}, 1));
|
||||
}
|
||||
|
||||
@@ -739,6 +739,24 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenTagValueNotMeetingTaskCountTo
|
||||
CpuIntrinsicsTests::pauseAddress = mockCsr->tagAddress;
|
||||
CpuIntrinsicsTests::pauseValue = taskCountToWait;
|
||||
|
||||
const auto ret = mockCsr->waitForCompletionWithTimeout(false, 1, taskCountToWait);
|
||||
const auto ret = mockCsr->waitForCompletionWithTimeout(WaitParams{false, false, 1}, taskCountToWait);
|
||||
EXPECT_EQ(NEO::WaitStatus::Ready, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenTagValueNotMeetingTaskCountToWaitAndIndefinitelyPollWhenWaitForCompletionThenDoNotCallWaitUtils) {
|
||||
VariableBackup<volatile uint32_t *> backupPauseAddress(&CpuIntrinsicsTests::pauseAddress);
|
||||
VariableBackup<uint32_t> backupPauseValue(&CpuIntrinsicsTests::pauseValue);
|
||||
|
||||
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
pDevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
||||
uint32_t taskCountToWait = 2u;
|
||||
|
||||
*mockCsr->tagAddress = 1u;
|
||||
|
||||
CpuIntrinsicsTests::pauseAddress = mockCsr->tagAddress;
|
||||
CpuIntrinsicsTests::pauseValue = taskCountToWait;
|
||||
|
||||
const auto ret = mockCsr->waitForCompletionWithTimeout(WaitParams{true, true, 10}, taskCountToWait);
|
||||
EXPECT_EQ(NEO::WaitStatus::NotReady, ret);
|
||||
}
|
||||
@@ -471,7 +471,7 @@ HWTEST_F(UltCommandStreamReceiverTest, givenSinglePartitionWhenCallingWaitKmdNot
|
||||
commandStreamReceiver.callBaseWaitForCompletionWithTimeout = false;
|
||||
commandStreamReceiver.returnWaitForCompletionWithTimeout = NEO::WaitStatus::NotReady;
|
||||
|
||||
commandStreamReceiver.waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
commandStreamReceiver.waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(2u, commandStreamReceiver.waitForCompletionWithTimeoutTaskCountCalled);
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ HWTEST_F(UltCommandStreamReceiverTest, givenMultiplePartitionsWhenCallingWaitKmd
|
||||
commandStreamReceiver.callBaseWaitForCompletionWithTimeout = false;
|
||||
commandStreamReceiver.returnWaitForCompletionWithTimeout = NEO::WaitStatus::NotReady;
|
||||
|
||||
commandStreamReceiver.waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
commandStreamReceiver.waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(2u, commandStreamReceiver.waitForCompletionWithTimeoutTaskCountCalled);
|
||||
}
|
||||
|
||||
|
||||
@@ -612,12 +612,12 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) {
|
||||
using UltCommandStreamReceiver<FamilyType>::UltCommandStreamReceiver;
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait,
|
||||
bool useQuickKmdSleep, bool forcePowerSavingMode) override {
|
||||
bool useQuickKmdSleep, QueueThrottle throttle) override {
|
||||
waitForTaskCountWithKmdNotifyFallbackCalled++;
|
||||
taskCountToWaitPassed = taskCountToWait;
|
||||
flushStampToWaitPassed = flushStampToWait;
|
||||
useQuickKmdSleepPassed = useQuickKmdSleep;
|
||||
forcePowerSavingModePassed = forcePowerSavingMode;
|
||||
throttlePassed = throttle;
|
||||
return WaitStatus::Ready;
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) {
|
||||
uint32_t taskCountToWaitPassed = 0;
|
||||
uint32_t waitForTaskCountWithKmdNotifyFallbackCalled = 0;
|
||||
bool useQuickKmdSleepPassed = false;
|
||||
bool forcePowerSavingModePassed = false;
|
||||
QueueThrottle throttlePassed = QueueThrottle::MEDIUM;
|
||||
};
|
||||
|
||||
auto myMockCsr = std::make_unique<MyMockCsr>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
@@ -658,7 +658,7 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) {
|
||||
EXPECT_EQ(myMockCsr->taskCount, myMockCsr->taskCountToWaitPassed);
|
||||
EXPECT_EQ(myMockCsr->flushStamp->peekStamp(), myMockCsr->flushStampToWaitPassed);
|
||||
EXPECT_FALSE(myMockCsr->useQuickKmdSleepPassed);
|
||||
EXPECT_FALSE(myMockCsr->forcePowerSavingModePassed);
|
||||
EXPECT_EQ(myMockCsr->throttlePassed, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, myMockCsr->activePartitions);
|
||||
}
|
||||
|
||||
|
||||
@@ -248,11 +248,11 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenWait
|
||||
csrWithAubDump.aubCSR.reset(mockAubCsr);
|
||||
|
||||
EXPECT_FALSE(mockAubCsr->pollForCompletionCalled);
|
||||
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, false);
|
||||
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_TRUE(mockAubCsr->pollForCompletionCalled);
|
||||
|
||||
csrWithAubDump.aubCSR.reset(nullptr);
|
||||
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, false);
|
||||
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, QueueThrottle::MEDIUM);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenPollForCompletionCalledThenAubCsrPollForCompletionCalled) {
|
||||
|
||||
@@ -1513,9 +1513,9 @@ struct TestEventCsr : public UltCommandStreamReceiver<GfxFamily> {
|
||||
TestEventCsr(const ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
|
||||
: UltCommandStreamReceiver<GfxFamily>(const_cast<ExecutionEnvironment &>(executionEnvironment), 0, deviceBitfield) {}
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
waitForCompletionWithTimeoutCalled++;
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({enableTimeout, timeoutMs, taskCountToWait});
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({params.enableTimeout, params.waitTimeout, taskCountToWait});
|
||||
return waitForCompletionWithTimeoutResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,9 +89,9 @@ struct KmdNotifyTests : public ::testing::Test {
|
||||
bool waitForFlushStampResult = true;
|
||||
StackVec<WaitForFlushStampParams, 1> waitForFlushStampParamsPassed{};
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
waitForCompletionWithTimeoutCalled++;
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({enableTimeout, timeoutMs, taskCountToWait});
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({params.enableTimeout, params.waitTimeout, taskCountToWait});
|
||||
return waitForCompletionWithTimeoutResult;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ HWTEST_F(KmdNotifyTests, givenZeroFlushStampWhenWaitIsCalledThenDisableTimeout)
|
||||
|
||||
EXPECT_TRUE(device->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 0, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(0u, csr->waitForFlushStampCalled);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(false, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
|
||||
@@ -242,7 +242,7 @@ HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsSporadicWaitThenOverrid
|
||||
int64_t timeSinceLastWait = mockKmdNotifyHelper->properties->delayQuickKmdSleepForSporadicWaitsMicroseconds + 1;
|
||||
|
||||
mockKmdNotifyHelper->lastWaitForCompletionTimestampUs = mockKmdNotifyHelper->getMicrosecondsSinceEpoch() - timeSinceLastWait;
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(expectedDelay, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsNotSporadicWaitThenOver
|
||||
|
||||
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(expectedDelay, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ HWTEST_F(KmdNotifyTests, givenKmdNotifyDisabledWhenPowerSavingModeIsRequestedThe
|
||||
overrideKmdNotifyParams(false, 3, false, 2, false, 9999999, false, 0);
|
||||
auto csr = createMockCsr<FamilyType>();
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, true);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, QueueThrottle::LOW);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
|
||||
EXPECT_EQ(1, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
@@ -298,7 +298,7 @@ HWTEST_F(KmdNotifyTests, givenQuickSleepRequestWhenItsSporadicWaitOptimizationIs
|
||||
|
||||
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, true, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, true, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(expectedDelay, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ HWTEST_F(KmdNotifyTests, givenTaskCountEqualToHwTagWhenWaitCalledThenDontMultipl
|
||||
|
||||
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
|
||||
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
@@ -321,7 +321,7 @@ HWTEST_F(KmdNotifyTests, givenTaskCountLowerThanHwTagWhenWaitCalledThenDontMulti
|
||||
|
||||
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, csr->waitForCompletionWithTimeoutCalled);
|
||||
EXPECT_EQ(true, csr->waitForCompletionWithTimeoutParamsPassed[0].enableTimeout);
|
||||
EXPECT_EQ(expectedTimeout, csr->waitForCompletionWithTimeoutParamsPassed[0].timeoutMs);
|
||||
@@ -334,7 +334,7 @@ HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenWaitCalledThenUpda
|
||||
EXPECT_NE(0, mockKmdNotifyHelper->lastWaitForCompletionTimestampUs.load());
|
||||
|
||||
EXPECT_EQ(1u, mockKmdNotifyHelper->updateLastWaitForCompletionTimestampCalled);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(2u, mockKmdNotifyHelper->updateLastWaitForCompletionTimestampCalled);
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWithDisabledSporadicWa
|
||||
auto csr = createMockCsr<FamilyType>();
|
||||
EXPECT_EQ(0, mockKmdNotifyHelper->lastWaitForCompletionTimestampUs.load());
|
||||
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(0u, mockKmdNotifyHelper->updateLastWaitForCompletionTimestampCalled);
|
||||
}
|
||||
|
||||
@@ -366,8 +366,7 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffLowerThanMinimumToCheckAcLineWhenObtain
|
||||
EXPECT_TRUE(taskCountToWait - hwTag < KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine);
|
||||
EXPECT_EQ(10u, KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine);
|
||||
|
||||
int64_t timeout = 0;
|
||||
helper.obtainTimeoutParams(timeout, false, hwTag, taskCountToWait, 1, false, true, false);
|
||||
helper.obtainTimeoutParams(false, hwTag, taskCountToWait, 1, QueueThrottle::MEDIUM, true, false);
|
||||
|
||||
EXPECT_EQ(0u, helper.updateAcLineStatusCalled);
|
||||
}
|
||||
@@ -381,8 +380,7 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndDisab
|
||||
EXPECT_TRUE(taskCountToWait - hwTag > KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine);
|
||||
EXPECT_EQ(10u, KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine);
|
||||
|
||||
int64_t timeout = 0;
|
||||
helper.obtainTimeoutParams(timeout, false, hwTag, taskCountToWait, 1, false, true, false);
|
||||
helper.obtainTimeoutParams(false, hwTag, taskCountToWait, 1, QueueThrottle::MEDIUM, true, false);
|
||||
|
||||
EXPECT_EQ(1u, helper.updateAcLineStatusCalled);
|
||||
}
|
||||
@@ -390,11 +388,20 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndDisab
|
||||
TEST_F(KmdNotifyTests, givenKmdWaitModeNotActiveWhenObtainTimeoutParamsThenFalseIsReturned) {
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
|
||||
int64_t timeout = 0;
|
||||
auto enableTimeout = helper.obtainTimeoutParams(timeout, false, 1, 1, 1, false, false, false);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 1, 1, QueueThrottle::MEDIUM, false, false);
|
||||
|
||||
EXPECT_FALSE(enableTimeout);
|
||||
EXPECT_FALSE(timeout);
|
||||
EXPECT_FALSE(params.enableTimeout);
|
||||
EXPECT_FALSE(params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenHighThrottleWhenObtainTimeoutParamsThenIndefinitelyPollSetToTrue) {
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 1, 1, QueueThrottle::HIGH, false, false);
|
||||
|
||||
EXPECT_FALSE(params.enableTimeout);
|
||||
EXPECT_FALSE(params.waitTimeout);
|
||||
EXPECT_TRUE(params.indefinitelyPoll);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndEnabledKmdNotifyWhenObtainingTimeoutPropertiesThenDontCheck) {
|
||||
@@ -406,8 +413,7 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndEnabl
|
||||
EXPECT_TRUE(taskCountToWait - hwTag > KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine);
|
||||
EXPECT_EQ(10u, KmdNotifyConstants::minimumTaskCountDiffToCheckAcLine);
|
||||
|
||||
int64_t timeout = 0;
|
||||
helper.obtainTimeoutParams(timeout, false, hwTag, taskCountToWait, 1, false, true, false);
|
||||
helper.obtainTimeoutParams(false, hwTag, taskCountToWait, 1, QueueThrottle::MEDIUM, true, false);
|
||||
|
||||
EXPECT_EQ(0u, helper.updateAcLineStatusCalled);
|
||||
}
|
||||
@@ -417,11 +423,10 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenAcLineIsDisconnectedTh
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
helper.acLineConnected = false;
|
||||
|
||||
int64_t timeout = 0;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, 2, false, true, false);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, 2, QueueThrottle::MEDIUM, true, false);
|
||||
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine, timeout);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine, params.waitTimeout);
|
||||
EXPECT_EQ(10000, KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine);
|
||||
}
|
||||
|
||||
@@ -431,11 +436,10 @@ TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenAcLineIsDisconnectedThe
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
helper.acLineConnected = false;
|
||||
|
||||
int64_t timeout = 0;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, 2, false, true, false);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, 2, QueueThrottle::MEDIUM, true, false);
|
||||
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, timeout);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismAndFlushStampIsZeroWhenAcLineIsDisconnectedThenDontForceEnableTimeout) {
|
||||
@@ -443,11 +447,10 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismAndFlushStampIsZeroWhenAcL
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
helper.acLineConnected = false;
|
||||
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 0;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, false, true, false);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::MEDIUM, true, false);
|
||||
|
||||
EXPECT_FALSE(timeoutEnabled);
|
||||
EXPECT_FALSE(params.enableTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsSetThenKmdNotifyMechanismIsUsedAndReturnsShortestWaitingTimePossible) {
|
||||
@@ -457,22 +460,20 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsSetTh
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
helper.acLineConnected = false;
|
||||
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 1;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, false, true, false);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(1, timeout);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::MEDIUM, true, false);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(1, params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsRequestedThenKmdNotifyMechanismIsUsedAndReturnsShortestWaitingTimePossible) {
|
||||
hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false;
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 1;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, true, true, false);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(1, timeout);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::LOW, true, false);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(1, params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenPowerSavingModeIsSetAndNoFlushStampProvidedWhenParametersAreObtainedThenFalseIsReturned) {
|
||||
@@ -482,11 +483,10 @@ TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenPowerSavingModeIsSetAnd
|
||||
MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties));
|
||||
helper.acLineConnected = false;
|
||||
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 0;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, false, true, false);
|
||||
EXPECT_FALSE(timeoutEnabled);
|
||||
EXPECT_EQ(0, timeout);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::MEDIUM, true, false);
|
||||
EXPECT_FALSE(params.enableTimeout);
|
||||
EXPECT_EQ(0, params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenEnabledKmdDirectSubmissionNotifyMechanismWhenDirectSubmissionIsEnabledThenSelectDelayTimeoutForDirectSubmission) {
|
||||
@@ -496,11 +496,10 @@ TEST_F(KmdNotifyTests, givenEnabledKmdDirectSubmissionNotifyMechanismWhenDirectS
|
||||
|
||||
constexpr int64_t expectedTimeout = 20;
|
||||
constexpr bool directSubmission = true;
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 1;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, false, true, directSubmission);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(expectedTimeout, timeout);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::MEDIUM, true, directSubmission);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(expectedTimeout, params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenEnabledKmdDirectSubmissionNotifyMechanismWhenDirectSubmissionIsDisabledThenSelectBaseDelayTimeout) {
|
||||
@@ -510,11 +509,10 @@ TEST_F(KmdNotifyTests, givenEnabledKmdDirectSubmissionNotifyMechanismWhenDirectS
|
||||
|
||||
constexpr int64_t expectedTimeout = 150;
|
||||
constexpr bool directSubmission = false;
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 1;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, false, true, directSubmission);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(expectedTimeout, timeout);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::MEDIUM, true, directSubmission);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(expectedTimeout, params.waitTimeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenDisabledKmdDirectSubmissionNotifyMechanismWhenDirectSubmissionIsEnabledThenSelectBaseDelayTimeout) {
|
||||
@@ -524,9 +522,8 @@ TEST_F(KmdNotifyTests, givenDisabledKmdDirectSubmissionNotifyMechanismWhenDirect
|
||||
|
||||
constexpr int64_t expectedTimeout = 150;
|
||||
constexpr bool directSubmission = true;
|
||||
int64_t timeout = 0;
|
||||
FlushStamp flushStampToWait = 1;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, flushStampToWait, false, true, directSubmission);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(expectedTimeout, timeout);
|
||||
auto params = helper.obtainTimeoutParams(false, 1, 2, flushStampToWait, QueueThrottle::MEDIUM, true, directSubmission);
|
||||
EXPECT_TRUE(params.enableTimeout);
|
||||
EXPECT_EQ(expectedTimeout, params.waitTimeout);
|
||||
}
|
||||
@@ -508,7 +508,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
|
||||
return NEO::SubmissionStatus::SUCCESS;
|
||||
}
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) override {
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, QueueThrottle throttle) override {
|
||||
return WaitStatus::Ready;
|
||||
}
|
||||
uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override { return taskCount; };
|
||||
|
||||
@@ -38,11 +38,11 @@ struct BcsBufferTests : public ::testing::Test {
|
||||
using UltCommandStreamReceiver<FamilyType>::UltCommandStreamReceiver;
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait,
|
||||
bool useQuickKmdSleep, bool forcePowerSavingMode) override {
|
||||
bool useQuickKmdSleep, QueueThrottle throttle) override {
|
||||
EXPECT_EQ(this->latestFlushedTaskCount, taskCountToWait);
|
||||
EXPECT_EQ(0u, flushStampToWait);
|
||||
EXPECT_FALSE(useQuickKmdSleep);
|
||||
EXPECT_FALSE(forcePowerSavingMode);
|
||||
EXPECT_EQ(throttle, QueueThrottle::MEDIUM);
|
||||
EXPECT_EQ(1u, this->activePartitions);
|
||||
waitForTaskCountWithKmdNotifyFallbackCalled++;
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ class MyCsr : public UltCommandStreamReceiver<Family> {
|
||||
MyCsr(const ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
|
||||
: UltCommandStreamReceiver<Family>(const_cast<ExecutionEnvironment &>(executionEnvironment), 0, deviceBitfield) {}
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) override {
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
waitForCompletionWithTimeoutCalled++;
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({enableTimeout, timeoutMs, taskCountToWait});
|
||||
waitForCompletionWithTimeoutParamsPassed.push_back({params.enableTimeout, params.waitTimeout, taskCountToWait});
|
||||
*this->getTagAddress() = getTagAddressValue;
|
||||
return waitForCompletionWithTimeoutResult;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
||||
MOCKABLE_VIRTUAL void submitBatchBufferAub(uint64_t batchBufferGpuAddress, const void *batchBuffer, size_t batchBufferSize, uint32_t memoryBank, uint64_t entryBits);
|
||||
void pollForCompletion() override;
|
||||
void pollForCompletionImpl() override;
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override;
|
||||
|
||||
uint32_t getDumpHandle();
|
||||
MOCKABLE_VIRTUAL void addContextToken(uint32_t dumpHandle);
|
||||
|
||||
@@ -607,8 +607,8 @@ void AUBCommandStreamReceiverHw<GfxFamily>::pollForCompletionImpl() {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline WaitStatus AUBCommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) {
|
||||
const auto result = CommandStreamReceiverSimulatedHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, forcePowerSavingMode);
|
||||
inline WaitStatus AUBCommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) {
|
||||
const auto result = CommandStreamReceiverSimulatedHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, throttle);
|
||||
pollForCompletion();
|
||||
|
||||
return result;
|
||||
|
||||
@@ -169,7 +169,7 @@ void CommandStreamReceiver::makeResidentHostPtrAllocation(GraphicsAllocation *gf
|
||||
WaitStatus CommandStreamReceiver::waitForTaskCount(uint32_t requiredTaskCount) {
|
||||
auto address = getTagAddress();
|
||||
if (address) {
|
||||
return baseWaitFunction(address, false, 0, requiredTaskCount);
|
||||
return baseWaitFunction(address, WaitParams{false, false, 0}, requiredTaskCount);
|
||||
}
|
||||
|
||||
return WaitStatus::Ready;
|
||||
@@ -316,7 +316,7 @@ void CommandStreamReceiver::cleanupResources() {
|
||||
}
|
||||
}
|
||||
|
||||
WaitStatus CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
|
||||
WaitStatus CommandStreamReceiver::waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) {
|
||||
uint32_t latestSentTaskCount = this->latestFlushedTaskCount;
|
||||
if (latestSentTaskCount < taskCountToWait) {
|
||||
if (!this->flushBatchedSubmissions()) {
|
||||
@@ -325,10 +325,10 @@ WaitStatus CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeou
|
||||
}
|
||||
}
|
||||
|
||||
return baseWaitFunction(getTagAddress(), enableTimeout, timeoutMicroseconds, taskCountToWait);
|
||||
return baseWaitFunction(getTagAddress(), params, taskCountToWait);
|
||||
}
|
||||
|
||||
WaitStatus CommandStreamReceiver::baseWaitFunction(volatile uint32_t *pollAddress, bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
|
||||
WaitStatus CommandStreamReceiver::baseWaitFunction(volatile uint32_t *pollAddress, const WaitParams ¶ms, uint32_t taskCountToWait) {
|
||||
std::chrono::microseconds elapsedTimeSinceGpuHangCheck{0};
|
||||
std::chrono::high_resolution_clock::time_point waitStartTime, lastHangCheckTime, currentTime;
|
||||
int64_t timeDiff = 0;
|
||||
@@ -337,14 +337,13 @@ WaitStatus CommandStreamReceiver::baseWaitFunction(volatile uint32_t *pollAddres
|
||||
if (latestSentTaskCount < taskCountToWait) {
|
||||
this->flushTagUpdate();
|
||||
}
|
||||
|
||||
volatile uint32_t *partitionAddress = pollAddress;
|
||||
|
||||
waitStartTime = std::chrono::high_resolution_clock::now();
|
||||
lastHangCheckTime = waitStartTime;
|
||||
for (uint32_t i = 0; i < activePartitions; i++) {
|
||||
while (*partitionAddress < taskCountToWait && timeDiff <= timeoutMicroseconds) {
|
||||
if (WaitUtils::waitFunction(partitionAddress, taskCountToWait)) {
|
||||
while (*partitionAddress < taskCountToWait && timeDiff <= params.waitTimeout) {
|
||||
if (!params.indefinitelyPoll && WaitUtils::waitFunction(partitionAddress, taskCountToWait)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -358,7 +357,7 @@ WaitStatus CommandStreamReceiver::baseWaitFunction(volatile uint32_t *pollAddres
|
||||
}
|
||||
}
|
||||
|
||||
if (enableTimeout) {
|
||||
if (params.enableTimeout) {
|
||||
timeDiff = std::chrono::duration_cast<std::chrono::microseconds>(currentTime - waitStartTime).count();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +160,9 @@ class CommandStreamReceiver {
|
||||
void requestStallingCommandsOnNextFlush() { stallingCommandsOnNextFlushRequired = true; }
|
||||
bool isStallingCommandsOnNextFlushRequired() const { return stallingCommandsOnNextFlushRequired; }
|
||||
|
||||
virtual WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) = 0;
|
||||
virtual WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait);
|
||||
WaitStatus baseWaitFunction(volatile uint32_t *pollAddress, bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait);
|
||||
virtual WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) = 0;
|
||||
virtual WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait);
|
||||
WaitStatus baseWaitFunction(volatile uint32_t *pollAddress, const WaitParams ¶ms, uint32_t taskCountToWait);
|
||||
MOCKABLE_VIRTUAL bool testTaskCountReady(volatile uint32_t *pollAddress, uint32_t taskCountToWait);
|
||||
virtual void downloadAllocations(){};
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
bool isPipelineSelectAlreadyProgrammed() const;
|
||||
void programComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags, const HardwareInfo &hwInfo);
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override;
|
||||
|
||||
void collectStateBaseAddresPatchInfo(
|
||||
uint64_t commandBufferAddress,
|
||||
|
||||
@@ -861,22 +861,19 @@ inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPipelineSelect()
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline WaitStatus CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) {
|
||||
int64_t waitTimeout = 0;
|
||||
bool enableTimeout = false;
|
||||
|
||||
enableTimeout = kmdNotifyHelper->obtainTimeoutParams(waitTimeout, useQuickKmdSleep, *getTagAddress(), taskCountToWait, flushStampToWait, forcePowerSavingMode, this->isKmdWaitModeActive(),
|
||||
this->isAnyDirectSubmissionEnabled());
|
||||
inline WaitStatus CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) {
|
||||
const auto params = kmdNotifyHelper->obtainTimeoutParams(useQuickKmdSleep, *getTagAddress(), taskCountToWait, flushStampToWait, throttle, this->isKmdWaitModeActive(),
|
||||
this->isAnyDirectSubmissionEnabled());
|
||||
|
||||
PRINT_DEBUG_STRING(DebugManager.flags.LogWaitingForCompletion.get(), stdout,
|
||||
"\nWaiting for task count %u at location %p. Current value: %u\n",
|
||||
taskCountToWait, getTagAddress(), *getTagAddress());
|
||||
|
||||
auto status = waitForCompletionWithTimeout(enableTimeout, waitTimeout, taskCountToWait);
|
||||
auto status = waitForCompletionWithTimeout(params, taskCountToWait);
|
||||
if (status == WaitStatus::NotReady) {
|
||||
waitForFlushStamp(flushStampToWait);
|
||||
//now call blocking wait, this is to ensure that task count is reached
|
||||
status = waitForCompletionWithTimeout(false, 0, taskCountToWait);
|
||||
status = waitForCompletionWithTimeout(WaitParams{false, false, 0}, taskCountToWait);
|
||||
}
|
||||
|
||||
// If GPU hang occured, then propagate it to the caller.
|
||||
@@ -1120,7 +1117,7 @@ uint32_t CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropertiesCo
|
||||
|
||||
lock.unlock();
|
||||
if (blocking) {
|
||||
waitForTaskCountWithKmdNotifyFallback(newTaskCount, flushStampToWait, false, false);
|
||||
waitForTaskCountWithKmdNotifyFallback(newTaskCount, flushStampToWait, false, QueueThrottle::MEDIUM);
|
||||
internalAllocationStorage->cleanAllocationList(newTaskCount, TEMPORARY_ALLOCATION);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class CommandStreamReceiverWithAUBDump : public BaseCSR {
|
||||
}
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait,
|
||||
bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
||||
bool useQuickKmdSleep, QueueThrottle throttle) override;
|
||||
|
||||
size_t getPreferredTagPoolSize() const override { return 1; }
|
||||
|
||||
|
||||
@@ -79,12 +79,12 @@ void CommandStreamReceiverWithAUBDump<BaseCSR>::setupContext(OsContext &osContex
|
||||
|
||||
template <typename BaseCSR>
|
||||
WaitStatus CommandStreamReceiverWithAUBDump<BaseCSR>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait,
|
||||
bool useQuickKmdSleep, bool forcePowerSavingMode) {
|
||||
bool useQuickKmdSleep, QueueThrottle throttle) {
|
||||
if (aubCSR) {
|
||||
aubCSR->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, forcePowerSavingMode);
|
||||
aubCSR->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, throttle);
|
||||
}
|
||||
|
||||
return BaseCSR::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, forcePowerSavingMode);
|
||||
return BaseCSR::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, throttle);
|
||||
}
|
||||
|
||||
template <typename BaseCSR>
|
||||
|
||||
@@ -43,8 +43,8 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
||||
|
||||
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) override;
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override;
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override;
|
||||
void downloadAllocations() override;
|
||||
void downloadAllocation(GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
|
||||
@@ -493,15 +493,15 @@ void TbxCommandStreamReceiverHw<GfxFamily>::flushSubmissionsAndDownloadAllocatio
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
WaitStatus TbxCommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) {
|
||||
WaitStatus TbxCommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) {
|
||||
flushSubmissionsAndDownloadAllocations(taskCountToWait);
|
||||
return BaseClass::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, forcePowerSavingMode);
|
||||
return BaseClass::waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, throttle);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
WaitStatus TbxCommandStreamReceiverHw<GfxFamily>::waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
|
||||
WaitStatus TbxCommandStreamReceiverHw<GfxFamily>::waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) {
|
||||
flushSubmissionsAndDownloadAllocations(taskCountToWait);
|
||||
return BaseClass::waitForCompletionWithTimeout(enableTimeout, timeoutMicroseconds, taskCountToWait);
|
||||
return BaseClass::waitForCompletionWithTimeout(params, taskCountToWait);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
enum class WaitStatus {
|
||||
@@ -15,4 +17,10 @@ enum class WaitStatus {
|
||||
GpuHang = 2,
|
||||
};
|
||||
|
||||
struct WaitParams {
|
||||
bool indefinitelyPoll = false;
|
||||
bool enableTimeout = false;
|
||||
int64_t waitTimeout = 0;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,25 +13,27 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
bool KmdNotifyHelper::obtainTimeoutParams(int64_t &timeoutValueOutput,
|
||||
bool quickKmdSleepRequest,
|
||||
uint32_t currentHwTag,
|
||||
uint32_t taskCountToWait,
|
||||
FlushStamp flushStampToWait,
|
||||
bool forcePowerSavingMode,
|
||||
bool kmdWaitModeActive,
|
||||
bool directSubmissionEnabled) {
|
||||
WaitParams KmdNotifyHelper::obtainTimeoutParams(bool quickKmdSleepRequest,
|
||||
uint32_t currentHwTag,
|
||||
uint32_t taskCountToWait,
|
||||
FlushStamp flushStampToWait,
|
||||
QueueThrottle throttle,
|
||||
bool kmdWaitModeActive,
|
||||
bool directSubmissionEnabled) {
|
||||
if (throttle == QueueThrottle::HIGH) {
|
||||
return WaitParams{true};
|
||||
}
|
||||
|
||||
if (flushStampToWait == 0) {
|
||||
return false;
|
||||
return WaitParams{};
|
||||
}
|
||||
|
||||
if (!kmdWaitModeActive) {
|
||||
return false;
|
||||
return WaitParams{};
|
||||
}
|
||||
|
||||
if (DebugManager.flags.PowerSavingMode.get() || forcePowerSavingMode) {
|
||||
timeoutValueOutput = 1;
|
||||
return true;
|
||||
if (DebugManager.flags.PowerSavingMode.get() || throttle == QueueThrottle::LOW) {
|
||||
return WaitParams{false, true, 1};
|
||||
}
|
||||
|
||||
int64_t multiplier = (currentHwTag < taskCountToWait) ? static_cast<int64_t>(taskCountToWait - currentHwTag) : 1;
|
||||
@@ -40,18 +42,21 @@ bool KmdNotifyHelper::obtainTimeoutParams(int64_t &timeoutValueOutput,
|
||||
}
|
||||
|
||||
quickKmdSleepRequest |= applyQuickKmdSleepForSporadicWait();
|
||||
WaitParams params;
|
||||
|
||||
if (!properties->enableKmdNotify && !acLineConnected) {
|
||||
timeoutValueOutput = KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine;
|
||||
params.waitTimeout = KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine;
|
||||
} else if (quickKmdSleepRequest && properties->enableQuickKmdSleep) {
|
||||
timeoutValueOutput = properties->delayQuickKmdSleepMicroseconds;
|
||||
params.waitTimeout = properties->delayQuickKmdSleepMicroseconds;
|
||||
} else if (directSubmissionEnabled && properties->enableQuickKmdSleepForDirectSubmission) {
|
||||
timeoutValueOutput = properties->delayQuickKmdSleepForDirectSubmissionMicroseconds;
|
||||
params.waitTimeout = properties->delayQuickKmdSleepForDirectSubmissionMicroseconds;
|
||||
} else {
|
||||
timeoutValueOutput = getBaseTimeout(multiplier);
|
||||
params.waitTimeout = getBaseTimeout(multiplier);
|
||||
}
|
||||
|
||||
return (properties->enableKmdNotify || !acLineConnected);
|
||||
params.enableTimeout = (properties->enableKmdNotify || !acLineConnected);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
bool KmdNotifyHelper::applyQuickKmdSleepForSporadicWait() const {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/queue_throttle.h"
|
||||
#include "shared/source/command_stream/wait_status.h"
|
||||
#include "shared/source/helpers/completion_stamp.h"
|
||||
|
||||
#include <atomic>
|
||||
@@ -39,14 +41,13 @@ class KmdNotifyHelper {
|
||||
KmdNotifyHelper(const KmdNotifyProperties *properties) : properties(properties){};
|
||||
MOCKABLE_VIRTUAL ~KmdNotifyHelper() = default;
|
||||
|
||||
bool obtainTimeoutParams(int64_t &timeoutValueOutput,
|
||||
bool quickKmdSleepRequest,
|
||||
uint32_t currentHwTag,
|
||||
uint32_t taskCountToWait,
|
||||
FlushStamp flushStampToWait,
|
||||
bool forcePowerSavingMode,
|
||||
bool kmdWaitModeActive,
|
||||
bool directSubmissionEnabled);
|
||||
WaitParams obtainTimeoutParams(bool quickKmdSleepRequest,
|
||||
uint32_t currentHwTag,
|
||||
uint32_t taskCountToWait,
|
||||
FlushStamp flushStampToWait,
|
||||
QueueThrottle throttle,
|
||||
bool kmdWaitModeActive,
|
||||
bool directSubmissionEnabled);
|
||||
|
||||
bool quickKmdSleepForSporadicWaitsEnabled() const { return properties->enableQuickKmdSleepForSporadicWaits; }
|
||||
MOCKABLE_VIRTUAL void updateLastWaitForCompletionTimestamp();
|
||||
|
||||
@@ -709,7 +709,7 @@ void MemoryManager::waitForEnginesCompletion(GraphicsAllocation &graphicsAllocat
|
||||
if (graphicsAllocation.isUsedByOsContext(osContextId) &&
|
||||
engine.commandStreamReceiver->getTagAllocation() != nullptr &&
|
||||
allocationTaskCount > *engine.commandStreamReceiver->getTagAddress()) {
|
||||
engine.commandStreamReceiver->waitForCompletionWithTimeout(false, TimeoutControls::maxTimeout, allocationTaskCount);
|
||||
engine.commandStreamReceiver->waitForCompletionWithTimeout(WaitParams{false, false, TimeoutControls::maxTimeout}, allocationTaskCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,7 +718,7 @@ void MemoryManager::cleanTemporaryAllocationListOnAllEngines(bool waitForComplet
|
||||
for (auto &engine : getRegisteredEngines()) {
|
||||
auto csr = engine.commandStreamReceiver;
|
||||
if (waitForCompletion) {
|
||||
csr->waitForCompletionWithTimeout(false, 0, csr->peekLatestSentTaskCount());
|
||||
csr->waitForCompletionWithTimeout(WaitParams{false, false, 0}, csr->peekLatestSentTaskCount());
|
||||
}
|
||||
csr->getInternalAllocationStorage()->cleanAllocationList(*csr->getTagAddress(), AllocationUsage::TEMPORARY_ALLOCATION);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void DrmMemoryOperationsHandlerBind::evictUnusedAllocationsImpl(std::vector<Grap
|
||||
}
|
||||
|
||||
if (waitForCompletion) {
|
||||
engine.commandStreamReceiver->waitForCompletionWithTimeout(false, 0, engine.commandStreamReceiver->peekLatestFlushedTaskCount());
|
||||
engine.commandStreamReceiver->waitForCompletionWithTimeout(WaitParams{false, false, 0}, engine.commandStreamReceiver->peekLatestFlushedTaskCount());
|
||||
}
|
||||
|
||||
if (allocation->isUsedByOsContext(engine.osContext->getContextId()) &&
|
||||
|
||||
@@ -174,14 +174,17 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
downloadAllocationCalled = true;
|
||||
}
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) override {
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
latestWaitForCompletionWithTimeoutTaskCount.store(taskCountToWait);
|
||||
waitForCompletionWithTimeoutTaskCountCalled++;
|
||||
if (callBaseWaitForCompletionWithTimeout) {
|
||||
return BaseClass::waitForCompletionWithTimeout(enableTimeout, timeoutMicroseconds, taskCountToWait);
|
||||
return BaseClass::waitForCompletionWithTimeout(params, taskCountToWait);
|
||||
}
|
||||
return returnWaitForCompletionWithTimeout;
|
||||
}
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
|
||||
return waitForCompletionWithTimeout(WaitParams{false, enableTimeout, timeoutMicroseconds}, taskCountToWait);
|
||||
}
|
||||
|
||||
void overrideCsrSizeReqFlags(CsrSizeRequestFlags &flags) { this->csrSizeRequestFlags = flags; }
|
||||
GraphicsAllocation *getPreemptionAllocation() const { return this->preemptionAllocation; }
|
||||
|
||||
@@ -122,7 +122,7 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
expectMemoryCompressedCalled = true;
|
||||
return AUBCommandStreamReceiverHw<GfxFamily>::expectMemoryCompressed(gfxAddress, srcAddress, length);
|
||||
}
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) override {
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
return NEO::WaitStatus::Ready;
|
||||
}
|
||||
void addAubComment(const char *message) override {
|
||||
|
||||
@@ -52,7 +52,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||
memset(const_cast<uint32_t *>(CommandStreamReceiver::tagAddress), 0xFFFFFFFF, tagSize * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) override {
|
||||
WaitStatus waitForCompletionWithTimeout(const WaitParams ¶ms, uint32_t taskCountToWait) override {
|
||||
waitForCompletionWithTimeoutCalled++;
|
||||
return waitForCompletionWithTimeoutReturnValue;
|
||||
}
|
||||
@@ -104,7 +104,11 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||
return true;
|
||||
}
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) override {
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, QueueThrottle throttle) override {
|
||||
return WaitStatus::Ready;
|
||||
}
|
||||
|
||||
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) {
|
||||
return WaitStatus::Ready;
|
||||
}
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCallingInsertAubWa
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
ASSERT_FALSE(aubCsr->pollForCompletionCalled);
|
||||
aubCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
|
||||
aubCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, QueueThrottle::MEDIUM);
|
||||
EXPECT_TRUE(aubCsr->pollForCompletionCalled);
|
||||
}
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForTaskCountWithKm
|
||||
|
||||
tbxCsr.allocationsForDownload = {&allocation1, &allocation2, &allocation3};
|
||||
|
||||
tbxCsr.waitForTaskCountWithKmdNotifyFallback(0u, 0u, false, false);
|
||||
tbxCsr.waitForTaskCountWithKmdNotifyFallback(0u, 0u, false, QueueThrottle::MEDIUM);
|
||||
|
||||
std::set<GraphicsAllocation *> expectedDownloadedAllocations = {tbxCsr.getTagAllocation(), &allocation1, &allocation2, &allocation3};
|
||||
EXPECT_EQ(expectedDownloadedAllocations, tbxCsr.downloadedAllocations);
|
||||
@@ -376,7 +376,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForCompletionWithT
|
||||
|
||||
tbxCsr.allocationsForDownload = {&allocation1, &allocation2, &allocation3};
|
||||
|
||||
tbxCsr.waitForCompletionWithTimeout(true, 0, 0);
|
||||
tbxCsr.waitForCompletionWithTimeout(WaitParams{false, true, 0}, 0);
|
||||
|
||||
std::set<GraphicsAllocation *> expectedDownloadedAllocations = {tbxCsr.getTagAllocation(), &allocation1, &allocation2, &allocation3};
|
||||
EXPECT_EQ(expectedDownloadedAllocations, tbxCsr.downloadedAllocations);
|
||||
|
||||
Reference in New Issue
Block a user