mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Kmd notify improvements [3/n]: Fix sporadic in ULT
Change-Id: I1e326e7514d4d7d14cb1051b50105cbc418e325c
This commit is contained in:
committed by
sys_ocldev
parent
ef1f5a03a2
commit
93cb7be091
@@ -82,6 +82,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||||||
PIPE_CONTROL *addPipeControlCmd(LinearStream &commandStream);
|
PIPE_CONTROL *addPipeControlCmd(LinearStream &commandStream);
|
||||||
|
|
||||||
uint64_t getScratchPatchAddress();
|
uint64_t getScratchPatchAddress();
|
||||||
|
MOCKABLE_VIRTUAL void updateLastWaitForCompletionTimestamp();
|
||||||
|
|
||||||
static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate);
|
static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate);
|
||||||
|
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFal
|
|||||||
UNRECOVERABLE_IF(*getTagAddress() < taskCountToWait);
|
UNRECOVERABLE_IF(*getTagAddress() < taskCountToWait);
|
||||||
|
|
||||||
if (kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits) {
|
if (kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits) {
|
||||||
lastWaitForCompletionTimestamp = std::chrono::high_resolution_clock::now();
|
updateLastWaitForCompletionTimestamp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,4 +631,9 @@ template <typename GfxFamily>
|
|||||||
size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForMediaSampler(bool mediaSamplerRequired) const {
|
size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForMediaSampler(bool mediaSamplerRequired) const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
void CommandStreamReceiverHw<GfxFamily>::updateLastWaitForCompletionTimestamp() {
|
||||||
|
lastWaitForCompletionTimestamp = std::chrono::high_resolution_clock::now();
|
||||||
|
}
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|||||||
@@ -190,22 +190,33 @@ HWTEST_F(KmdNotifyTests, givenQuickSleepRequestWhenItsSporadicWaitOptimizationIs
|
|||||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, true);
|
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenInitializedThenUpdateWaitTimestamp) {
|
template <typename Family>
|
||||||
overrideKmdNotifyParams(true, 3, true, 2, true, 1);
|
struct MyCsrWithTimestampCheck : public UltCommandStreamReceiver<Family> {
|
||||||
auto csr = new UltCommandStreamReceiver<FamilyType>(localHwInfo);
|
MyCsrWithTimestampCheck(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<Family>(hwInfo) {}
|
||||||
device->resetCommandStreamReceiver(csr);
|
void updateLastWaitForCompletionTimestamp() override {
|
||||||
EXPECT_NE(0, csr->lastWaitForCompletionTimestamp.time_since_epoch().count());
|
updateLastWaitForCompletionTimestampCalled++;
|
||||||
}
|
};
|
||||||
|
uint32_t updateLastWaitForCompletionTimestampCalled = 0u;
|
||||||
|
};
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenWaitCalledThenUpdateWaitTimestamp) {
|
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenWaitCalledThenUpdateWaitTimestamp) {
|
||||||
overrideKmdNotifyParams(true, 3, true, 2, true, 1);
|
overrideKmdNotifyParams(true, 3, true, 2, true, 1);
|
||||||
auto csr = new UltCommandStreamReceiver<FamilyType>(localHwInfo);
|
|
||||||
|
auto csr = new MyCsrWithTimestampCheck<FamilyType>(localHwInfo);
|
||||||
|
EXPECT_NE(0, csr->lastWaitForCompletionTimestamp.time_since_epoch().count());
|
||||||
device->resetCommandStreamReceiver(csr);
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
auto initialTime = csr->lastWaitForCompletionTimestamp.time_since_epoch().count();
|
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false);
|
||||||
|
EXPECT_EQ(1u, csr->updateLastWaitForCompletionTimestampCalled);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWithDisabledSporadicWaitOptimizationWhenWaitCalledThenDontUpdateWaitTimestamp) {
|
||||||
|
overrideKmdNotifyParams(true, 3, true, 2, false, 0);
|
||||||
|
|
||||||
|
auto csr = new MyCsrWithTimestampCheck<FamilyType>(localHwInfo);
|
||||||
|
EXPECT_EQ(0, csr->lastWaitForCompletionTimestamp.time_since_epoch().count());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false);
|
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false);
|
||||||
|
EXPECT_EQ(0u, csr->updateLastWaitForCompletionTimestampCalled);
|
||||||
auto updatedTime = csr->lastWaitForCompletionTimestamp.time_since_epoch().count();
|
|
||||||
EXPECT_NE(initialTime, updatedTime);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user