mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
fix: Dispatch residency fence when stopping ulls on windows
Related-To: NEO-14396, HSD-18041496023, HSD-13012953666, NEO-14611 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
092291ce08
commit
286acf30a3
@@ -191,6 +191,10 @@ class DirectSubmissionHw {
|
|||||||
void dispatchDiagnosticModeSection();
|
void dispatchDiagnosticModeSection();
|
||||||
size_t getDiagnosticModeSection();
|
size_t getDiagnosticModeSection();
|
||||||
void setImmWritePostSyncOffset();
|
void setImmWritePostSyncOffset();
|
||||||
|
virtual void dispatchStopRingBufferSection(){};
|
||||||
|
virtual size_t dispatchStopRingBufferSectionSize() {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
virtual bool isCompleted(uint32_t ringBufferIndex) = 0;
|
virtual bool isCompleted(uint32_t ringBufferIndex) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -537,9 +537,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer(bool blocking) {
|
|||||||
void *flushPtr = ringCommandStream.getSpace(0);
|
void *flushPtr = ringCommandStream.getSpace(0);
|
||||||
Dispatcher::dispatchCacheFlush(ringCommandStream, this->rootDeviceEnvironment, gpuVaForMiFlush);
|
Dispatcher::dispatchCacheFlush(ringCommandStream, this->rootDeviceEnvironment, gpuVaForMiFlush);
|
||||||
if (disableMonitorFence) {
|
if (disableMonitorFence) {
|
||||||
TagData currentTagData = {};
|
dispatchStopRingBufferSection();
|
||||||
getTagAddressValueForRingSwitch(currentTagData);
|
|
||||||
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
|
|
||||||
}
|
}
|
||||||
Dispatcher::dispatchStopCommandBuffer(ringCommandStream);
|
Dispatcher::dispatchStopCommandBuffer(ringCommandStream);
|
||||||
|
|
||||||
@@ -647,7 +645,7 @@ inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeEnd(bool relaxed
|
|||||||
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
|
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
|
||||||
MemoryConstants::cacheLineSize;
|
MemoryConstants::cacheLineSize;
|
||||||
if (disableMonitorFence) {
|
if (disableMonitorFence) {
|
||||||
size += Dispatcher::getSizeMonitorFence(rootDeviceEnvironment);
|
size += dispatchStopRingBufferSectionSize();
|
||||||
}
|
}
|
||||||
if (this->relaxedOrderingEnabled && relaxedOrderingSchedulerRequired) {
|
if (this->relaxedOrderingEnabled && relaxedOrderingSchedulerRequired) {
|
||||||
size += getSizeDispatchRelaxedOrderingQueueStall();
|
size += getSizeDispatchRelaxedOrderingQueueStall();
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class DrmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
|||||||
|
|
||||||
void ensureRingCompletion() override;
|
void ensureRingCompletion() override;
|
||||||
void handleSwitchRingBuffers(ResidencyContainer *allocationsForResidency) override;
|
void handleSwitchRingBuffers(ResidencyContainer *allocationsForResidency) override;
|
||||||
|
void dispatchStopRingBufferSection() override;
|
||||||
|
size_t dispatchStopRingBufferSectionSize() override;
|
||||||
uint64_t updateTagValue(bool requireMonitorFence) override;
|
uint64_t updateTagValue(bool requireMonitorFence) override;
|
||||||
void getTagAddressValue(TagData &tagData) override;
|
void getTagAddressValue(TagData &tagData) override;
|
||||||
void getTagAddressValueForRingSwitch(TagData &tagData) override;
|
void getTagAddressValueForRingSwitch(TagData &tagData) override;
|
||||||
|
|||||||
@@ -242,6 +242,18 @@ void DrmDirectSubmission<GfxFamily, Dispatcher>::handleStopRingBuffer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily, typename Dispatcher>
|
||||||
|
void DrmDirectSubmission<GfxFamily, Dispatcher>::dispatchStopRingBufferSection() {
|
||||||
|
TagData currentTagData = {};
|
||||||
|
getTagAddressValue(currentTagData);
|
||||||
|
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily, typename Dispatcher>
|
||||||
|
size_t DrmDirectSubmission<GfxFamily, Dispatcher>::dispatchStopRingBufferSectionSize() {
|
||||||
|
return Dispatcher::getSizeMonitorFence(this->rootDeviceEnvironment);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename GfxFamily, typename Dispatcher>
|
template <typename GfxFamily, typename Dispatcher>
|
||||||
void DrmDirectSubmission<GfxFamily, Dispatcher>::handleSwitchRingBuffers(ResidencyContainer *allocationsForResidency) {
|
void DrmDirectSubmission<GfxFamily, Dispatcher>::handleSwitchRingBuffers(ResidencyContainer *allocationsForResidency) {
|
||||||
if (this->disableMonitorFence) {
|
if (this->disableMonitorFence) {
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
|||||||
bool isCompleted(uint32_t ringBufferIndex) override;
|
bool isCompleted(uint32_t ringBufferIndex) override;
|
||||||
MOCKABLE_VIRTUAL void updateMonitorFenceValueForResidencyList(ResidencyContainer *allocationsForResidency);
|
MOCKABLE_VIRTUAL void updateMonitorFenceValueForResidencyList(ResidencyContainer *allocationsForResidency);
|
||||||
void makeGlobalFenceAlwaysResident() override;
|
void makeGlobalFenceAlwaysResident() override;
|
||||||
|
void dispatchStopRingBufferSection() override;
|
||||||
|
size_t dispatchStopRingBufferSectionSize() override;
|
||||||
|
|
||||||
TagData ringBufferEndCompletionTagData{};
|
TagData ringBufferEndCompletionTagData{};
|
||||||
OsContextWin *osContextWin;
|
OsContextWin *osContextWin;
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ template <typename GfxFamily, typename Dispatcher>
|
|||||||
void WddmDirectSubmission<GfxFamily, Dispatcher>::handleStopRingBuffer() {
|
void WddmDirectSubmission<GfxFamily, Dispatcher>::handleStopRingBuffer() {
|
||||||
if (this->disableMonitorFence) {
|
if (this->disableMonitorFence) {
|
||||||
updateTagValueImplForSwitchRingBuffer(this->currentRingBuffer);
|
updateTagValueImplForSwitchRingBuffer(this->currentRingBuffer);
|
||||||
|
updateTagValueImpl(this->currentRingBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +199,19 @@ void WddmDirectSubmission<GfxFamily, Dispatcher>::getTagAddressValueForRingSwitc
|
|||||||
tagData.tagValue = this->ringBufferEndCompletionTagData.tagValue + 1;
|
tagData.tagValue = this->ringBufferEndCompletionTagData.tagValue + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily, typename Dispatcher>
|
||||||
|
void WddmDirectSubmission<GfxFamily, Dispatcher>::dispatchStopRingBufferSection() {
|
||||||
|
TagData currentTagData = {};
|
||||||
|
getTagAddressValueForRingSwitch(currentTagData);
|
||||||
|
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
|
||||||
|
getTagAddressValue(currentTagData);
|
||||||
|
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily, typename Dispatcher>
|
||||||
|
size_t WddmDirectSubmission<GfxFamily, Dispatcher>::dispatchStopRingBufferSectionSize() {
|
||||||
|
return 2 * Dispatcher::getSizeMonitorFence(this->rootDeviceEnvironment);
|
||||||
|
}
|
||||||
template <typename GfxFamily, typename Dispatcher>
|
template <typename GfxFamily, typename Dispatcher>
|
||||||
inline bool WddmDirectSubmission<GfxFamily, Dispatcher>::isCompleted(uint32_t ringBufferIndex) {
|
inline bool WddmDirectSubmission<GfxFamily, Dispatcher>::isCompleted(uint32_t ringBufferIndex) {
|
||||||
auto taskCount = this->ringBuffers[ringBufferIndex].completionFenceForSwitch;
|
auto taskCount = this->ringBuffers[ringBufferIndex].completionFenceForSwitch;
|
||||||
|
|||||||
@@ -454,55 +454,6 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionStopWhenStopRingIsCalledThen
|
|||||||
EXPECT_EQ(oldQueueCount + 1, directSubmission.semaphoreData->queueWorkCount);
|
EXPECT_EQ(oldQueueCount + 1, directSubmission.semaphoreData->queueWorkCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(DirectSubmissionTest,
|
|
||||||
givenDirectSubmissionDisableMonitorFenceWhenStopRingIsCalledThenExpectStopCommandAndMonitorFenceDispatched) {
|
|
||||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
|
||||||
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
|
||||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
|
||||||
|
|
||||||
MockDirectSubmissionHw<FamilyType, Dispatcher> regularDirectSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
|
||||||
regularDirectSubmission.disableMonitorFence = false;
|
|
||||||
size_t regularSizeEnd = regularDirectSubmission.getSizeEnd(false);
|
|
||||||
|
|
||||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
|
||||||
|
|
||||||
bool ret = directSubmission.allocateResources();
|
|
||||||
directSubmission.ringStart = true;
|
|
||||||
|
|
||||||
EXPECT_TRUE(ret);
|
|
||||||
|
|
||||||
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment);
|
|
||||||
|
|
||||||
size_t disabledSizeEnd = directSubmission.getSizeEnd(false);
|
|
||||||
EXPECT_EQ(disabledSizeEnd, regularSizeEnd + tagUpdateSize);
|
|
||||||
|
|
||||||
directSubmission.tagValueSetValue = 0x4343123ull;
|
|
||||||
directSubmission.tagAddressSetValue = 0xBEEF00000ull;
|
|
||||||
directSubmission.stopRingBuffer(false);
|
|
||||||
size_t expectedDispatchSize = disabledSizeEnd;
|
|
||||||
EXPECT_LE(directSubmission.ringCommandStream.getUsed(), expectedDispatchSize);
|
|
||||||
EXPECT_GE(directSubmission.ringCommandStream.getUsed() + MemoryConstants::cacheLineSize, expectedDispatchSize);
|
|
||||||
|
|
||||||
HardwareParse hwParse;
|
|
||||||
hwParse.parsePipeControl = true;
|
|
||||||
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, 0);
|
|
||||||
hwParse.findHardwareCommands<FamilyType>();
|
|
||||||
MI_BATCH_BUFFER_END *bbEnd = hwParse.getCommand<MI_BATCH_BUFFER_END>();
|
|
||||||
EXPECT_NE(nullptr, bbEnd);
|
|
||||||
|
|
||||||
bool foundFenceUpdate = false;
|
|
||||||
for (auto it = hwParse.pipeControlList.begin(); it != hwParse.pipeControlList.end(); it++) {
|
|
||||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
|
|
||||||
uint64_t data = pipeControl->getImmediateData();
|
|
||||||
if ((directSubmission.tagAddressSetValue == NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*pipeControl)) &&
|
|
||||||
(directSubmission.tagValueSetValue == data)) {
|
|
||||||
foundFenceUpdate = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXPECT_TRUE(foundFenceUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchSemaphoreThenExpectCorrectSizeUsed) {
|
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchSemaphoreThenExpectCorrectSizeUsed) {
|
||||||
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
||||||
|
|
||||||
|
|||||||
@@ -2730,34 +2730,6 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenBbWithNonStallingCmdsAndWit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenRelaxedOrderingSchedulerRequiredWhenAskingForCmdsSizeThenReturnCorrectValue, IsAtLeastXeHpcCore) {
|
|
||||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
|
||||||
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
|
|
||||||
|
|
||||||
size_t expectedBaseSemaphoreSectionSize = directSubmission.getSizePrefetchMitigation();
|
|
||||||
if (directSubmission.isDisablePrefetcherRequired) {
|
|
||||||
expectedBaseSemaphoreSectionSize += 2 * directSubmission.getSizeDisablePrefetcher();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (directSubmission.miMemFenceRequired) {
|
|
||||||
expectedBaseSemaphoreSectionSize += MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronizationForDirectSubmission(pDevice->getRootDeviceEnvironment());
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPECT_EQ(expectedBaseSemaphoreSectionSize + RelaxedOrderingHelper::DynamicSchedulerSizeAndOffsetSection<FamilyType>::totalSize, directSubmission.getSizeSemaphoreSection(true));
|
|
||||||
EXPECT_EQ(expectedBaseSemaphoreSectionSize + EncodeSemaphore<FamilyType>::getSizeMiSemaphoreWait(), directSubmission.getSizeSemaphoreSection(false));
|
|
||||||
|
|
||||||
size_t expectedBaseEndSize = Dispatcher::getSizeStopCommandBuffer() +
|
|
||||||
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
|
|
||||||
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
|
|
||||||
MemoryConstants::cacheLineSize;
|
|
||||||
if (directSubmission.disableMonitorFence) {
|
|
||||||
expectedBaseEndSize += Dispatcher::getSizeMonitorFence(pDevice->getRootDeviceEnvironment());
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPECT_EQ(expectedBaseEndSize + directSubmission.getSizeDispatchRelaxedOrderingQueueStall(), directSubmission.getSizeEnd(true));
|
|
||||||
EXPECT_EQ(expectedBaseEndSize, directSubmission.getSizeEnd(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenSchedulerRequiredWhenDispatchingReturnPtrsThenAddOffset, IsAtLeastXeHpcCore) {
|
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenSchedulerRequiredWhenDispatchingReturnPtrsThenAddOffset, IsAtLeastXeHpcCore) {
|
||||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
|
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
|
||||||
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
|
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
|
||||||
#include "shared/source/direct_submission/linux/drm_direct_submission.h"
|
#include "shared/source/direct_submission/linux/drm_direct_submission.h"
|
||||||
|
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
|
||||||
#include "shared/source/helpers/compiler_product_helper.h"
|
#include "shared/source/helpers/compiler_product_helper.h"
|
||||||
#include "shared/source/helpers/flush_stamp.h"
|
#include "shared/source/helpers/flush_stamp.h"
|
||||||
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
||||||
@@ -82,7 +83,12 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
|
|||||||
using BaseClass::dispatchMonitorFenceRequired;
|
using BaseClass::dispatchMonitorFenceRequired;
|
||||||
using BaseClass::dispatchSwitchRingBufferSection;
|
using BaseClass::dispatchSwitchRingBufferSection;
|
||||||
using BaseClass::DrmDirectSubmission;
|
using BaseClass::DrmDirectSubmission;
|
||||||
|
using BaseClass::getSizeDisablePrefetcher;
|
||||||
|
using BaseClass::getSizeDispatchRelaxedOrderingQueueStall;
|
||||||
|
using BaseClass::getSizeEnd;
|
||||||
using BaseClass::getSizeNewResourceHandler;
|
using BaseClass::getSizeNewResourceHandler;
|
||||||
|
using BaseClass::getSizePrefetchMitigation;
|
||||||
|
using BaseClass::getSizeSemaphoreSection;
|
||||||
using BaseClass::getSizeSwitchRingBufferSection;
|
using BaseClass::getSizeSwitchRingBufferSection;
|
||||||
using BaseClass::getTagAddressValue;
|
using BaseClass::getTagAddressValue;
|
||||||
using BaseClass::gpuHangCheckPeriod;
|
using BaseClass::gpuHangCheckPeriod;
|
||||||
@@ -92,6 +98,7 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
|
|||||||
using BaseClass::immWritePostSyncOffset;
|
using BaseClass::immWritePostSyncOffset;
|
||||||
using BaseClass::inputMonitorFenceDispatchRequirement;
|
using BaseClass::inputMonitorFenceDispatchRequirement;
|
||||||
using BaseClass::isCompleted;
|
using BaseClass::isCompleted;
|
||||||
|
using BaseClass::isDisablePrefetcherRequired;
|
||||||
using BaseClass::isNewResourceHandleNeeded;
|
using BaseClass::isNewResourceHandleNeeded;
|
||||||
using BaseClass::lastUllsLightExecTimestamp;
|
using BaseClass::lastUllsLightExecTimestamp;
|
||||||
using BaseClass::miMemFenceRequired;
|
using BaseClass::miMemFenceRequired;
|
||||||
@@ -99,8 +106,10 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
|
|||||||
using BaseClass::partitionConfigSet;
|
using BaseClass::partitionConfigSet;
|
||||||
using BaseClass::partitionedMode;
|
using BaseClass::partitionedMode;
|
||||||
using BaseClass::pciBarrierPtr;
|
using BaseClass::pciBarrierPtr;
|
||||||
|
using BaseClass::relaxedOrderingEnabled;
|
||||||
using BaseClass::ringBuffers;
|
using BaseClass::ringBuffers;
|
||||||
using BaseClass::ringStart;
|
using BaseClass::ringStart;
|
||||||
|
using BaseClass::rootDeviceEnvironment;
|
||||||
using BaseClass::sfenceMode;
|
using BaseClass::sfenceMode;
|
||||||
using BaseClass::submit;
|
using BaseClass::submit;
|
||||||
using BaseClass::switchRingBuffers;
|
using BaseClass::switchRingBuffers;
|
||||||
@@ -116,8 +125,19 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
|
|||||||
std::chrono::steady_clock::time_point getCpuTimePoint() override {
|
std::chrono::steady_clock::time_point getCpuTimePoint() override {
|
||||||
return this->callBaseGetCpuTimePoint ? BaseClass::getCpuTimePoint() : cpuTimePointReturnValue;
|
return this->callBaseGetCpuTimePoint ? BaseClass::getCpuTimePoint() : cpuTimePointReturnValue;
|
||||||
}
|
}
|
||||||
|
void getTagAddressValue(TagData &tagData) override {
|
||||||
|
if (setTagAddressValue) {
|
||||||
|
tagData.tagAddress = tagAddressSetValue;
|
||||||
|
tagData.tagValue = tagValueSetValue;
|
||||||
|
} else {
|
||||||
|
BaseClass::getTagAddressValue(tagData);
|
||||||
|
}
|
||||||
|
}
|
||||||
std::chrono::steady_clock::time_point cpuTimePointReturnValue{};
|
std::chrono::steady_clock::time_point cpuTimePointReturnValue{};
|
||||||
bool callBaseGetCpuTimePoint = true;
|
bool callBaseGetCpuTimePoint = true;
|
||||||
|
uint64_t tagAddressSetValue = MemoryConstants::pageSize;
|
||||||
|
uint64_t tagValueSetValue = 1ull;
|
||||||
|
bool setTagAddressValue = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
@@ -1325,4 +1345,82 @@ HWTEST_F(DrmDirectSubmissionTest, givenGpuHangWhenWaitCalledThenGpuHangDetected)
|
|||||||
EXPECT_EQ(0, drm->ioctlCount.getResetStats);
|
EXPECT_EQ(0, drm->ioctlCount.getResetStats);
|
||||||
directSubmission.wait(1);
|
directSubmission.wait(1);
|
||||||
EXPECT_EQ(1, drm->ioctlCount.getResetStats);
|
EXPECT_EQ(1, drm->ioctlCount.getResetStats);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(DrmDirectSubmissionTest,
|
||||||
|
givenDirectSubmissionDisableMonitorFenceWhenStopRingIsCalledThenExpectStopCommandAndMonitorFenceDispatched) {
|
||||||
|
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||||
|
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
||||||
|
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||||
|
|
||||||
|
MockDrmDirectSubmission<FamilyType, Dispatcher> regularDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
|
||||||
|
regularDirectSubmission.disableMonitorFence = false;
|
||||||
|
size_t regularSizeEnd = regularDirectSubmission.getSizeEnd(false);
|
||||||
|
|
||||||
|
MockDrmDirectSubmission<FamilyType, Dispatcher> directSubmission(*device->getDefaultEngine().commandStreamReceiver);
|
||||||
|
directSubmission.setTagAddressValue = true;
|
||||||
|
bool ret = directSubmission.allocateResources();
|
||||||
|
directSubmission.ringStart = true;
|
||||||
|
|
||||||
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
|
size_t tagUpdateSize = Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment);
|
||||||
|
|
||||||
|
size_t disabledSizeEnd = directSubmission.getSizeEnd(false);
|
||||||
|
EXPECT_EQ(disabledSizeEnd, regularSizeEnd + tagUpdateSize);
|
||||||
|
|
||||||
|
directSubmission.tagValueSetValue = 0x4343123ull;
|
||||||
|
directSubmission.tagAddressSetValue = 0xBEEF00000ull;
|
||||||
|
directSubmission.stopRingBuffer(false);
|
||||||
|
size_t expectedDispatchSize = disabledSizeEnd;
|
||||||
|
EXPECT_LE(directSubmission.ringCommandStream.getUsed(), expectedDispatchSize);
|
||||||
|
EXPECT_GE(directSubmission.ringCommandStream.getUsed() + MemoryConstants::cacheLineSize, expectedDispatchSize);
|
||||||
|
|
||||||
|
HardwareParse hwParse;
|
||||||
|
hwParse.parsePipeControl = true;
|
||||||
|
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, 0);
|
||||||
|
hwParse.findHardwareCommands<FamilyType>();
|
||||||
|
MI_BATCH_BUFFER_END *bbEnd = hwParse.getCommand<MI_BATCH_BUFFER_END>();
|
||||||
|
EXPECT_NE(nullptr, bbEnd);
|
||||||
|
|
||||||
|
bool foundFenceUpdate = false;
|
||||||
|
for (auto it = hwParse.pipeControlList.begin(); it != hwParse.pipeControlList.end(); it++) {
|
||||||
|
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
|
||||||
|
uint64_t data = pipeControl->getImmediateData();
|
||||||
|
if ((directSubmission.tagAddressSetValue == NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*pipeControl)) &&
|
||||||
|
(directSubmission.tagValueSetValue == data)) {
|
||||||
|
foundFenceUpdate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(foundFenceUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(DrmDirectSubmissionTest, givenRelaxedOrderingSchedulerRequiredWhenAskingForCmdsSizeThenReturnCorrectValue, IsAtLeastXeHpcCore) {
|
||||||
|
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||||
|
MockDrmDirectSubmission<FamilyType, Dispatcher> directSubmission(*device->getDefaultEngine().commandStreamReceiver);
|
||||||
|
|
||||||
|
size_t expectedBaseSemaphoreSectionSize = directSubmission.getSizePrefetchMitigation();
|
||||||
|
if (directSubmission.isDisablePrefetcherRequired) {
|
||||||
|
expectedBaseSemaphoreSectionSize += 2 * directSubmission.getSizeDisablePrefetcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
directSubmission.relaxedOrderingEnabled = true;
|
||||||
|
if (directSubmission.miMemFenceRequired) {
|
||||||
|
expectedBaseSemaphoreSectionSize += MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronizationForDirectSubmission(device->getRootDeviceEnvironment());
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQ(expectedBaseSemaphoreSectionSize + RelaxedOrderingHelper::DynamicSchedulerSizeAndOffsetSection<FamilyType>::totalSize, directSubmission.getSizeSemaphoreSection(true));
|
||||||
|
EXPECT_EQ(expectedBaseSemaphoreSectionSize + EncodeSemaphore<FamilyType>::getSizeMiSemaphoreWait(), directSubmission.getSizeSemaphoreSection(false));
|
||||||
|
|
||||||
|
size_t expectedBaseEndSize = Dispatcher::getSizeStopCommandBuffer() +
|
||||||
|
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
|
||||||
|
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
|
||||||
|
MemoryConstants::cacheLineSize;
|
||||||
|
if (directSubmission.disableMonitorFence) {
|
||||||
|
expectedBaseEndSize += Dispatcher::getSizeMonitorFence(device->getRootDeviceEnvironment());
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQ(expectedBaseEndSize + directSubmission.getSizeDispatchRelaxedOrderingQueueStall(), directSubmission.getSizeEnd(true));
|
||||||
|
EXPECT_EQ(expectedBaseEndSize, directSubmission.getSizeEnd(false));
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "shared/source/command_stream/submissions_aggregator.h"
|
#include "shared/source/command_stream/submissions_aggregator.h"
|
||||||
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
|
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
|
||||||
|
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
|
||||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||||
#include "shared/source/helpers/compiler_product_helper.h"
|
#include "shared/source/helpers/compiler_product_helper.h"
|
||||||
#include "shared/source/helpers/flush_stamp.h"
|
#include "shared/source/helpers/flush_stamp.h"
|
||||||
@@ -1220,4 +1221,81 @@ TEST(DirectSubmissionControllerWindowsTest, givenDirectSubmissionControllerWhenC
|
|||||||
EXPECT_EQ(1u, SysCalls::timeBeginPeriodLastValue);
|
EXPECT_EQ(1u, SysCalls::timeBeginPeriodLastValue);
|
||||||
EXPECT_EQ(1u, SysCalls::timeEndPeriodLastValue);
|
EXPECT_EQ(1u, SysCalls::timeEndPeriodLastValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(WddmDirectSubmissionTest,
|
||||||
|
givenDirectSubmissionDisableMonitorFenceWhenStopRingIsCalledThenExpectStopCommandAndMonitorFenceDispatched) {
|
||||||
|
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||||
|
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
||||||
|
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||||
|
|
||||||
|
MockWddmDirectSubmission<FamilyType, Dispatcher> regularDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
|
||||||
|
regularDirectSubmission.disableMonitorFence = false;
|
||||||
|
size_t regularSizeEnd = regularDirectSubmission.getSizeEnd(false);
|
||||||
|
|
||||||
|
MockWddmDirectSubmission<FamilyType, Dispatcher> directSubmission(*device->getDefaultEngine().commandStreamReceiver);
|
||||||
|
directSubmission.setTagAddressValue = true;
|
||||||
|
bool ret = directSubmission.allocateResources();
|
||||||
|
directSubmission.ringStart = true;
|
||||||
|
|
||||||
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
|
size_t tagUpdateSize = 2 * Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment);
|
||||||
|
|
||||||
|
size_t disabledSizeEnd = directSubmission.getSizeEnd(false);
|
||||||
|
EXPECT_EQ(disabledSizeEnd, regularSizeEnd + tagUpdateSize);
|
||||||
|
|
||||||
|
directSubmission.tagValueSetValue = 0x4343123ull;
|
||||||
|
directSubmission.tagAddressSetValue = 0xBEEF00000ull;
|
||||||
|
directSubmission.stopRingBuffer(false);
|
||||||
|
size_t expectedDispatchSize = disabledSizeEnd;
|
||||||
|
EXPECT_LE(directSubmission.ringCommandStream.getUsed(), expectedDispatchSize);
|
||||||
|
EXPECT_GE(directSubmission.ringCommandStream.getUsed() + MemoryConstants::cacheLineSize, expectedDispatchSize);
|
||||||
|
|
||||||
|
HardwareParse hwParse;
|
||||||
|
hwParse.parsePipeControl = true;
|
||||||
|
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, 0);
|
||||||
|
hwParse.findHardwareCommands<FamilyType>();
|
||||||
|
MI_BATCH_BUFFER_END *bbEnd = hwParse.getCommand<MI_BATCH_BUFFER_END>();
|
||||||
|
EXPECT_NE(nullptr, bbEnd);
|
||||||
|
|
||||||
|
bool foundFenceUpdate = false;
|
||||||
|
for (auto it = hwParse.pipeControlList.begin(); it != hwParse.pipeControlList.end(); it++) {
|
||||||
|
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
|
||||||
|
uint64_t data = pipeControl->getImmediateData();
|
||||||
|
if ((directSubmission.tagAddressSetValue == NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*pipeControl)) &&
|
||||||
|
(directSubmission.tagValueSetValue == data)) {
|
||||||
|
foundFenceUpdate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(foundFenceUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(WddmDirectSubmissionTest, givenRelaxedOrderingSchedulerRequiredWhenAskingForCmdsSizeThenReturnCorrectValue, IsAtLeastXeHpcCore) {
|
||||||
|
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||||
|
MockWddmDirectSubmission<FamilyType, Dispatcher> directSubmission(*device->getDefaultEngine().commandStreamReceiver);
|
||||||
|
|
||||||
|
size_t expectedBaseSemaphoreSectionSize = directSubmission.getSizePrefetchMitigation();
|
||||||
|
if (directSubmission.isDisablePrefetcherRequired) {
|
||||||
|
expectedBaseSemaphoreSectionSize += 2 * directSubmission.getSizeDisablePrefetcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
directSubmission.relaxedOrderingEnabled = true;
|
||||||
|
if (directSubmission.miMemFenceRequired) {
|
||||||
|
expectedBaseSemaphoreSectionSize += MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronizationForDirectSubmission(device->getRootDeviceEnvironment());
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQ(expectedBaseSemaphoreSectionSize + RelaxedOrderingHelper::DynamicSchedulerSizeAndOffsetSection<FamilyType>::totalSize, directSubmission.getSizeSemaphoreSection(true));
|
||||||
|
EXPECT_EQ(expectedBaseSemaphoreSectionSize + EncodeSemaphore<FamilyType>::getSizeMiSemaphoreWait(), directSubmission.getSizeSemaphoreSection(false));
|
||||||
|
|
||||||
|
size_t expectedBaseEndSize = Dispatcher::getSizeStopCommandBuffer() +
|
||||||
|
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
|
||||||
|
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
|
||||||
|
MemoryConstants::cacheLineSize;
|
||||||
|
if (directSubmission.disableMonitorFence) {
|
||||||
|
expectedBaseEndSize += 2 * Dispatcher::getSizeMonitorFence(device->getRootDeviceEnvironment());
|
||||||
|
}
|
||||||
|
EXPECT_EQ(expectedBaseEndSize + directSubmission.getSizeDispatchRelaxedOrderingQueueStall(), directSubmission.getSizeEnd(true));
|
||||||
|
EXPECT_EQ(expectedBaseEndSize, directSubmission.getSizeEnd(false));
|
||||||
|
}
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -22,8 +22,12 @@ struct MockWddmDirectSubmission : public WddmDirectSubmission<GfxFamily, Dispatc
|
|||||||
using BaseClass::detectGpuHang;
|
using BaseClass::detectGpuHang;
|
||||||
using BaseClass::disableMonitorFence;
|
using BaseClass::disableMonitorFence;
|
||||||
using BaseClass::dispatchMonitorFenceRequired;
|
using BaseClass::dispatchMonitorFenceRequired;
|
||||||
|
using BaseClass::getSizeDisablePrefetcher;
|
||||||
using BaseClass::getSizeDispatch;
|
using BaseClass::getSizeDispatch;
|
||||||
|
using BaseClass::getSizeDispatchRelaxedOrderingQueueStall;
|
||||||
|
using BaseClass::getSizeEnd;
|
||||||
using BaseClass::getSizeNewResourceHandler;
|
using BaseClass::getSizeNewResourceHandler;
|
||||||
|
using BaseClass::getSizePrefetchMitigation;
|
||||||
using BaseClass::getSizeSemaphoreSection;
|
using BaseClass::getSizeSemaphoreSection;
|
||||||
using BaseClass::getSizeSwitchRingBufferSection;
|
using BaseClass::getSizeSwitchRingBufferSection;
|
||||||
using BaseClass::getSizeSystemMemoryFenceAddress;
|
using BaseClass::getSizeSystemMemoryFenceAddress;
|
||||||
@@ -36,17 +40,20 @@ struct MockWddmDirectSubmission : public WddmDirectSubmission<GfxFamily, Dispatc
|
|||||||
using BaseClass::handleSwitchRingBuffers;
|
using BaseClass::handleSwitchRingBuffers;
|
||||||
using BaseClass::inputMonitorFenceDispatchRequirement;
|
using BaseClass::inputMonitorFenceDispatchRequirement;
|
||||||
using BaseClass::isCompleted;
|
using BaseClass::isCompleted;
|
||||||
|
using BaseClass::isDisablePrefetcherRequired;
|
||||||
using BaseClass::isNewResourceHandleNeeded;
|
using BaseClass::isNewResourceHandleNeeded;
|
||||||
using BaseClass::lastSubmittedThrottle;
|
using BaseClass::lastSubmittedThrottle;
|
||||||
using BaseClass::maxRingBufferCount;
|
using BaseClass::maxRingBufferCount;
|
||||||
using BaseClass::miMemFenceRequired;
|
using BaseClass::miMemFenceRequired;
|
||||||
using BaseClass::osContextWin;
|
using BaseClass::osContextWin;
|
||||||
using BaseClass::previousRingBuffer;
|
using BaseClass::previousRingBuffer;
|
||||||
|
using BaseClass::relaxedOrderingEnabled;
|
||||||
using BaseClass::ringBufferEndCompletionTagData;
|
using BaseClass::ringBufferEndCompletionTagData;
|
||||||
using BaseClass::ringBuffers;
|
using BaseClass::ringBuffers;
|
||||||
using BaseClass::ringCommandStream;
|
using BaseClass::ringCommandStream;
|
||||||
using BaseClass::ringFence;
|
using BaseClass::ringFence;
|
||||||
using BaseClass::ringStart;
|
using BaseClass::ringStart;
|
||||||
|
using BaseClass::rootDeviceEnvironment;
|
||||||
using BaseClass::semaphoreData;
|
using BaseClass::semaphoreData;
|
||||||
using BaseClass::semaphoreGpuVa;
|
using BaseClass::semaphoreGpuVa;
|
||||||
using BaseClass::semaphorePtr;
|
using BaseClass::semaphorePtr;
|
||||||
@@ -72,7 +79,18 @@ struct MockWddmDirectSubmission : public WddmDirectSubmission<GfxFamily, Dispatc
|
|||||||
ringBufferForCompletionFence = completionBufferIndex;
|
ringBufferForCompletionFence = completionBufferIndex;
|
||||||
BaseClass::updateTagValueImplForSwitchRingBuffer(completionBufferIndex);
|
BaseClass::updateTagValueImplForSwitchRingBuffer(completionBufferIndex);
|
||||||
}
|
}
|
||||||
|
void getTagAddressValue(TagData &tagData) override {
|
||||||
|
if (setTagAddressValue) {
|
||||||
|
tagData.tagAddress = tagAddressSetValue;
|
||||||
|
tagData.tagValue = tagValueSetValue;
|
||||||
|
} else {
|
||||||
|
BaseClass::getTagAddressValue(tagData);
|
||||||
|
}
|
||||||
|
}
|
||||||
uint32_t updateMonitorFenceValueForResidencyListCalled = 0u;
|
uint32_t updateMonitorFenceValueForResidencyListCalled = 0u;
|
||||||
uint32_t ringBufferForCompletionFence = 0u;
|
uint32_t ringBufferForCompletionFence = 0u;
|
||||||
|
bool setTagAddressValue = false;
|
||||||
|
uint64_t tagAddressSetValue = MemoryConstants::pageSize;
|
||||||
|
uint64_t tagValueSetValue = 1ull;
|
||||||
};
|
};
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
Reference in New Issue
Block a user