fix: disable fence wait if not supported on given CSR type

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2024-12-02 14:34:42 +00:00 committed by Compute-Runtime-Automation
parent d8a4f92856
commit 9629ab3cc3
7 changed files with 13 additions and 3 deletions

View File

@ -651,7 +651,7 @@ ze_result_t EventImp<TagSizeT>::hostSynchronize(uint64_t timeout) {
waitStartTime = std::chrono::high_resolution_clock::now();
lastHangCheckTime = waitStartTime;
const bool fenceWait = isKmdWaitModeEnabled() && isCounterBased() && !this->tbxMode;
const bool fenceWait = isKmdWaitModeEnabled() && isCounterBased() && csrs[0]->waitUserFenceSupported();
do {
if (fenceWait) {

View File

@ -370,6 +370,7 @@ HWTEST2_F(InOrderCmdListTests, givenDebugFlagSetWhenEventHostSyncCalledThenCallW
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ultCsr->isUserFenceWaitSupported = true;
ultCsr->waitUserFenceParams.forceRetStatusEnabled = true;
ultCsr->waitUserFenceParams.forceRetStatusValue = false;
EXPECT_EQ(0u, ultCsr->waitUserFenceParams.callCount);
@ -581,7 +582,7 @@ HWTEST2_F(InOrderCmdListTests, givenUserInterruptEventWhenWaitingThenWaitForUser
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[1]->toHandle(), 0, nullptr, launchParams, false);
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ultCsr->isUserFenceWaitSupported = true;
ultCsr->waitUserFenceParams.forceRetStatusEnabled = true;
EXPECT_EQ(0u, ultCsr->waitUserFenceParams.callCount);
@ -606,6 +607,8 @@ HWTEST2_F(InOrderCmdListTests, givenUserInterruptEventAndTbxModeWhenWaitingThenD
ultCsr->waitUserFenceParams.forceRetStatusEnabled = true;
ultCsr->commandStreamReceiverType = CommandStreamReceiverType::tbx;
EXPECT_FALSE(ultCsr->waitUserFenceSupported());
auto eventPool = createEvents<FamilyType>(2, false);
events[0]->enableKmdWaitMode();
events[0]->enableInterruptMode();
@ -642,7 +645,7 @@ HWTEST2_F(InOrderCmdListTests, givenUserInterruptEventWhenWaitingThenPassCorrect
duplicatedStorageImmCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[1]->toHandle(), 0, nullptr, launchParams, false);
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ultCsr->isUserFenceWaitSupported = true;
ultCsr->waitUserFenceParams.forceRetStatusEnabled = true;
EXPECT_EQ(0u, ultCsr->waitUserFenceParams.callCount);

View File

@ -519,6 +519,7 @@ class CommandStreamReceiver {
bool isRecyclingTagForHeapStorageRequired() const { return heapStorageRequiresRecyclingTag; }
virtual bool waitUserFenceSupported() { return false; }
virtual bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId, GraphicsAllocation *allocForInterruptWait) { return false; }
void setPrimaryCsr(CommandStreamReceiver *primaryCsr) {
this->primaryCsr = primaryCsr;

View File

@ -64,6 +64,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
SubmissionStatus printBOsForSubmit(ResidencyContainer &allocationsForResidency, GraphicsAllocation &cmdBufferAllocation);
bool waitUserFenceSupported() override { return isUserFenceWaitActive(); }
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId, GraphicsAllocation *allocForInterruptWait) override;
using CommandStreamReceiver::pageTableManager;

View File

@ -530,6 +530,8 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
return BaseClass::waitUserFence(waitValue, hostAddress, timeout, userInterrupt, externalInterruptId, allocForInterruptWait);
}
bool waitUserFenceSupported() override { return isUserFenceWaitSupported; }
void unblockPagingFenceSemaphore(uint64_t pagingFenceValue) override {
this->pagingFenceValueToUnblock = pagingFenceValue;
BaseClass::unblockPagingFenceSemaphore(pagingFenceValue);
@ -619,6 +621,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
bool stopDirectSubmissionCalled = false;
bool stopDirectSubmissionCalledBlocking = false;
bool registeredDcFlushForDcFlushMitigation = false;
bool isUserFenceWaitSupported = false;
};
} // namespace NEO

View File

@ -121,6 +121,7 @@ TEST_F(CommandStreamReceiverTest, givenCsrWhenGettingCompletionAddressThenUnderl
TEST_F(CommandStreamReceiverTest, givenBaseCsrWhenCallingWaitUserFenceThenReturnFalse) {
EXPECT_FALSE(commandStreamReceiver->waitUserFence(1, commandStreamReceiver->getCompletionAddress(), -1, false, InterruptId::notUsed, nullptr));
EXPECT_FALSE(commandStreamReceiver->waitUserFenceSupported());
}
HWTEST_F(CommandStreamReceiverTest, WhenCreatingCsrThenDefaultValuesAreSet) {

View File

@ -233,6 +233,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenExternalInterrupt
testDrmCsr->useUserFenceWait = true;
testDrmCsr->activePartitions = 2u;
EXPECT_NE(0u, testDrmCsr->immWritePostSyncWriteOffset);
EXPECT_TRUE(testDrmCsr->waitUserFenceSupported());
auto rootExecEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
auto &gfxCoreHelper = rootExecEnvironment->getHelper<GfxCoreHelper>();