mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Disable state caching if used on regular cmd list
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
41a80072b9
commit
637c4e5621
@@ -400,7 +400,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_hand
|
||||
packetsToReset = event->getMaxPacketsCount();
|
||||
}
|
||||
event->resetPackets(false);
|
||||
event->resetCompletionStatus(true);
|
||||
event->disableHostCaching(this->cmdListType == CommandList::CommandListType::TYPE_REGULAR);
|
||||
commandContainer.addToResidencyContainer(&event->getAllocation(this->device));
|
||||
const auto &hwInfo = this->device->getHwInfo();
|
||||
if (isCopyOnly()) {
|
||||
|
||||
@@ -45,6 +45,7 @@ struct Event : _ze_event_handle_t {
|
||||
virtual ze_result_t queryTimestampsExp(Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) = 0;
|
||||
enum State : uint32_t {
|
||||
STATE_SIGNALED = 0u,
|
||||
HOST_CACHING_DISABLED_PERMANENT = std::numeric_limits<uint32_t>::max() - 2,
|
||||
HOST_CACHING_DISABLED = std::numeric_limits<uint32_t>::max() - 1,
|
||||
STATE_CLEARED = std::numeric_limits<uint32_t>::max(),
|
||||
STATE_INITIAL = STATE_CLEARED
|
||||
@@ -122,12 +123,18 @@ struct Event : _ze_event_handle_t {
|
||||
l3FlushAppliedOnKernel.set(kernelCount - 1);
|
||||
}
|
||||
|
||||
void resetCompletionStatus(bool disableHostSideStatusCaching) {
|
||||
this->isCompleted.store(disableHostSideStatusCaching ? HOST_CACHING_DISABLED : STATE_CLEARED);
|
||||
void resetCompletionStatus() {
|
||||
if (this->isCompleted.load() != HOST_CACHING_DISABLED_PERMANENT) {
|
||||
this->isCompleted.store(STATE_CLEARED);
|
||||
}
|
||||
}
|
||||
|
||||
void disableHostCaching(bool disableFromRegularList) {
|
||||
this->isCompleted.store(disableFromRegularList ? HOST_CACHING_DISABLED_PERMANENT : HOST_CACHING_DISABLED);
|
||||
}
|
||||
|
||||
void setIsCompleted() {
|
||||
if (this->isCompleted.load() != HOST_CACHING_DISABLED) {
|
||||
if (this->isCompleted.load() == STATE_CLEARED) {
|
||||
this->isCompleted = STATE_SIGNALED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ ze_result_t EventImp<TagSizeT>::hostSynchronize(uint64_t timeout) {
|
||||
|
||||
template <typename TagSizeT>
|
||||
ze_result_t EventImp<TagSizeT>::reset() {
|
||||
this->resetCompletionStatus(false);
|
||||
this->resetCompletionStatus();
|
||||
this->resetDeviceCompletionData(false);
|
||||
this->l3FlushAppliedOnKernel.reset();
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
||||
@@ -200,10 +200,22 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenAppendingEventResetThenEve
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenAppendingEventResetThenIsCompletedFlagDisabled) {
|
||||
HWTEST_F(CommandListAppendEventReset, givenRegularCmdlistWhenAppendingEventResetThenHostBufferCachingDisabledPermanently) {
|
||||
MockEvent event;
|
||||
event.isCompleted = MockEvent::STATE_SIGNALED;
|
||||
auto result = commandList->appendEventReset(event.toHandle());
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ASSERT_EQ(MockEvent::HOST_CACHING_DISABLED_PERMANENT, event.isCompleted);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListAppendEventReset, givenImmediateCmdlistWhenAppendingEventResetThenHostBufferCachingDisabled) {
|
||||
MockEvent event;
|
||||
event.isCompleted = MockEvent::STATE_SIGNALED;
|
||||
|
||||
commandList->cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
|
||||
auto result = commandList->appendEventReset(event.toHandle());
|
||||
commandList->cmdListType = CommandList::CommandListType::TYPE_REGULAR;
|
||||
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ASSERT_EQ(MockEvent::HOST_CACHING_DISABLED, event.isCompleted);
|
||||
}
|
||||
@@ -223,6 +235,26 @@ HWTEST_F(CommandListAppendEventReset, WhenIsCompletedDisabledThenDontSetStateSig
|
||||
EXPECT_FALSE(event->isAlreadyCompleted());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListAppendEventReset, givenRegularCommandListWhenHostCachingDisabledThenDisablePermanently) {
|
||||
auto result = commandList->appendEventReset(event->toHandle());
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_FALSE(event->isAlreadyCompleted());
|
||||
event->reset();
|
||||
event->hostSignal();
|
||||
EXPECT_FALSE(event->isAlreadyCompleted());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListAppendEventReset, givenRegulatCommandListWhenHostCachingDisabledThenEnableAfterCpuReset) {
|
||||
commandList->cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
|
||||
commandList->appendEventReset(event->toHandle());
|
||||
commandList->cmdListType = CommandList::CommandListType::TYPE_REGULAR;
|
||||
|
||||
EXPECT_FALSE(event->isAlreadyCompleted());
|
||||
event->reset();
|
||||
event->hostSignal();
|
||||
EXPECT_TRUE(event->isAlreadyCompleted());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendEventReset, givenImmediateCmdlistWhenAppendingEventResetThenCommandsAreExecuted, IsAtLeastSkl) {
|
||||
const ze_command_queue_desc_t desc = {};
|
||||
bool internalEngine = true;
|
||||
|
||||
@@ -2573,7 +2573,7 @@ struct EventDynamicPacketUseFixture : public DeviceFixture {
|
||||
|
||||
result = event->queryStatus();
|
||||
EXPECT_EQ(ZE_RESULT_NOT_READY, result);
|
||||
event->resetCompletionStatus(false);
|
||||
event->resetCompletionStatus();
|
||||
|
||||
event->hostSignal();
|
||||
|
||||
@@ -2590,7 +2590,7 @@ struct EventDynamicPacketUseFixture : public DeviceFixture {
|
||||
|
||||
result = event->queryStatus();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
event->resetCompletionStatus(false);
|
||||
event->resetCompletionStatus();
|
||||
|
||||
remainingPacketsAddress = ptrOffset(eventHostAddress, (usedPackets * packetSize));
|
||||
if (event->isUsingContextEndOffset()) {
|
||||
@@ -2603,13 +2603,13 @@ struct EventDynamicPacketUseFixture : public DeviceFixture {
|
||||
|
||||
result = event->queryStatus();
|
||||
EXPECT_EQ(queryRetAfterPartialReset, result);
|
||||
event->resetCompletionStatus(false);
|
||||
event->resetCompletionStatus();
|
||||
|
||||
*completionField = Event::STATE_SIGNALED;
|
||||
|
||||
result = event->queryStatus();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
event->resetCompletionStatus(false);
|
||||
event->resetCompletionStatus();
|
||||
}
|
||||
|
||||
event->reset();
|
||||
|
||||
Reference in New Issue
Block a user