fix: set correct initial DirectSubmission fence value

Related-To: HSD-18039278676

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-07-19 08:42:23 +00:00
committed by Compute-Runtime-Automation
parent 85c8c09990
commit 4fc37f9afd
4 changed files with 22 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,6 +15,7 @@ DirectSubmissionInputParams::DirectSubmissionInputParams(const CommandStreamRece
globalFenceAllocation = commandStreamReceiver.getGlobalFenceAllocation();
workPartitionAllocation = commandStreamReceiver.getWorkPartitionAllocation();
completionFenceAllocation = commandStreamReceiver.getTagAllocation();
initialCompletionFenceValue = commandStreamReceiver.peekLatestSentTaskCount();
}
} // namespace NEO

View File

@@ -68,6 +68,7 @@ struct DirectSubmissionInputParams : NonCopyableClass {
const GraphicsAllocation *globalFenceAllocation = nullptr;
GraphicsAllocation *workPartitionAllocation = nullptr;
GraphicsAllocation *completionFenceAllocation = nullptr;
TaskCountType initialCompletionFenceValue = 0;
const uint32_t rootDeviceIndex;
};

View File

@@ -28,6 +28,7 @@ template <typename GfxFamily, typename Dispatcher>
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(const DirectSubmissionInputParams &inputParams)
: DirectSubmissionHw<GfxFamily, Dispatcher>(inputParams) {
this->completionFenceValue = inputParams.initialCompletionFenceValue;
if (debugManager.flags.OverrideUserFenceStartValue.get() != -1) {
this->completionFenceValue = static_cast<decltype(completionFenceValue)>(debugManager.flags.OverrideUserFenceStartValue.get());
}

View File

@@ -204,6 +204,24 @@ HWTEST_F(DrmDirectSubmissionTest, givenDebugFlagSetWhenInitializingThenOverrideF
EXPECT_EQ(fenceStartValue, directSubmission.completionFenceValue);
}
HWTEST_F(DrmDirectSubmissionTest, givenLatestSentTaskCountWhenInitializingThenSetStartValue) {
DebugManagerStateRestore restorer;
TaskCountType fenceStartValue = 1234;
debugManager.flags.EnableDrmCompletionFence.set(1);
auto &commandStreamReceiver = device->getUltCommandStreamReceiver<FamilyType>();
commandStreamReceiver.latestSentTaskCount = fenceStartValue;
auto drm = executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>();
ASSERT_TRUE(drm->completionFenceSupport());
MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> directSubmission(commandStreamReceiver);
EXPECT_EQ(fenceStartValue, directSubmission.completionFenceValue);
}
HWTEST_F(DrmDirectSubmissionTest, givenNoCompletionFenceSupportWhenGettingCompletionFencePointerThenNullptrIsReturned) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableDrmCompletionFence.set(0);