mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
feature: disallow reset/signal calls on in-order Events
Related-To: NEO-8145 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8042df8bb4
commit
1054d166e2
@@ -493,6 +493,10 @@ template <GFXCORE_FAMILY gfxCoreFamily>
|
|||||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_handle_t hEvent) {
|
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_handle_t hEvent) {
|
||||||
auto event = Event::fromHandle(hEvent);
|
auto event = Event::fromHandle(hEvent);
|
||||||
|
|
||||||
|
if (event->isInOrderExecEvent()) {
|
||||||
|
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
NEO::Device *neoDevice = device->getNEODevice();
|
NEO::Device *neoDevice = device->getNEODevice();
|
||||||
uint32_t callId = 0;
|
uint32_t callId = 0;
|
||||||
if (NEO::DebugManager.flags.EnableSWTags.get()) {
|
if (NEO::DebugManager.flags.EnableSWTags.get()) {
|
||||||
|
|||||||
@@ -386,10 +386,6 @@ void Event::setIsCompleted() {
|
|||||||
unsetCmdQueue();
|
unsetCmdQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::freeInOrderExecAllocation() {
|
|
||||||
inOrderExecInfo.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Event::updateInOrderExecState(std::shared_ptr<InOrderExecInfo> &newInOrderExecInfo, uint64_t signalValue, uint32_t allocationOffset) {
|
void Event::updateInOrderExecState(std::shared_ptr<InOrderExecInfo> &newInOrderExecInfo, uint64_t signalValue, uint32_t allocationOffset) {
|
||||||
if (this->inOrderExecInfo.get() != newInOrderExecInfo.get()) {
|
if (this->inOrderExecInfo.get() != newInOrderExecInfo.get()) {
|
||||||
inOrderExecInfo = newInOrderExecInfo;
|
inOrderExecInfo = newInOrderExecInfo;
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ struct Event : _ze_event_handle_t {
|
|||||||
Event(EventPool *eventPool, int index, Device *device) : device(device), eventPool(eventPool), index(index) {}
|
Event(EventPool *eventPool, int index, Device *device) : device(device), eventPool(eventPool), index(index) {}
|
||||||
|
|
||||||
void unsetCmdQueue();
|
void unsetCmdQueue();
|
||||||
void freeInOrderExecAllocation();
|
|
||||||
|
|
||||||
uint64_t globalStartTS = 1;
|
uint64_t globalStartTS = 1;
|
||||||
uint64_t globalEndTS = 1;
|
uint64_t globalEndTS = 1;
|
||||||
|
|||||||
@@ -373,6 +373,10 @@ ze_result_t EventImp<TagSizeT>::hostEventSetValue(TagSizeT eventVal) {
|
|||||||
|
|
||||||
template <typename TagSizeT>
|
template <typename TagSizeT>
|
||||||
ze_result_t EventImp<TagSizeT>::hostSignal() {
|
ze_result_t EventImp<TagSizeT>::hostSignal() {
|
||||||
|
if (this->isInOrderExecEvent()) {
|
||||||
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
}
|
||||||
|
|
||||||
auto status = hostEventSetValue(Event::STATE_SIGNALED);
|
auto status = hostEventSetValue(Event::STATE_SIGNALED);
|
||||||
if (status == ZE_RESULT_SUCCESS) {
|
if (status == ZE_RESULT_SUCCESS) {
|
||||||
this->setIsCompleted();
|
this->setIsCompleted();
|
||||||
@@ -467,6 +471,10 @@ ze_result_t EventImp<TagSizeT>::hostSynchronize(uint64_t timeout) {
|
|||||||
|
|
||||||
template <typename TagSizeT>
|
template <typename TagSizeT>
|
||||||
ze_result_t EventImp<TagSizeT>::reset() {
|
ze_result_t EventImp<TagSizeT>::reset() {
|
||||||
|
if (this->isInOrderExecEvent()) {
|
||||||
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (NEO::DebugManager.flags.SynchronizeEventBeforeReset.get() != -1) {
|
if (NEO::DebugManager.flags.SynchronizeEventBeforeReset.get() != -1) {
|
||||||
if (NEO::DebugManager.flags.SynchronizeEventBeforeReset.get() == 2 && queryStatus() != ZE_RESULT_SUCCESS) {
|
if (NEO::DebugManager.flags.SynchronizeEventBeforeReset.get() == 2 && queryStatus() != ZE_RESULT_SUCCESS) {
|
||||||
printf("\nzeEventHostReset: Event %p not ready. Calling zeEventHostSynchronize.", this);
|
printf("\nzeEventHostReset: Event %p not ready. Calling zeEventHostSynchronize.", this);
|
||||||
@@ -474,12 +482,7 @@ ze_result_t EventImp<TagSizeT>::reset() {
|
|||||||
|
|
||||||
hostSynchronize(std::numeric_limits<uint64_t>::max());
|
hostSynchronize(std::numeric_limits<uint64_t>::max());
|
||||||
}
|
}
|
||||||
if (inOrderExecEvent) {
|
|
||||||
freeInOrderExecAllocation();
|
|
||||||
|
|
||||||
inOrderExecSignalValue = 0;
|
|
||||||
inOrderAllocationOffset = 0;
|
|
||||||
}
|
|
||||||
unsetCmdQueue();
|
unsetCmdQueue();
|
||||||
this->resetCompletionStatus();
|
this->resetCompletionStatus();
|
||||||
this->resetDeviceCompletionData(false);
|
this->resetDeviceCompletionData(false);
|
||||||
|
|||||||
@@ -949,7 +949,7 @@ HWTEST2_F(InOrderCmdListTests, givenDebugFlagSetWhenEventHostSyncCalledThenCallW
|
|||||||
EXPECT_EQ(2u, ultCsr->waitUserFenecParams.callCount);
|
EXPECT_EQ(2u, ultCsr->waitUserFenecParams.callCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenResetEventCalledThenResetEventState, IsAtLeastXeHpCore) {
|
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenHostResetOrSignalEventCalledThenReturnError, IsAtLeastSkl) {
|
||||||
auto immCmdList = createImmCmdList<gfxCoreFamily>();
|
auto immCmdList = createImmCmdList<gfxCoreFamily>();
|
||||||
|
|
||||||
auto eventPool = createEvents<FamilyType>(3, false);
|
auto eventPool = createEvents<FamilyType>(3, false);
|
||||||
@@ -964,11 +964,21 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenResetEventCalledThenResetEven
|
|||||||
EXPECT_EQ(events[0]->inOrderAllocationOffset, 0u);
|
EXPECT_EQ(events[0]->inOrderAllocationOffset, 0u);
|
||||||
|
|
||||||
events[0]->inOrderAllocationOffset = 123;
|
events[0]->inOrderAllocationOffset = 123;
|
||||||
events[0]->reset();
|
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, events[0]->reset());
|
||||||
|
|
||||||
EXPECT_EQ(events[0]->inOrderExecSignalValue, 0u);
|
EXPECT_EQ(events[0]->inOrderExecSignalValue, immCmdList->inOrderExecInfo->inOrderDependencyCounter);
|
||||||
EXPECT_EQ(events[0]->inOrderExecInfo, nullptr);
|
EXPECT_EQ(events[0]->inOrderExecInfo.get(), immCmdList->inOrderExecInfo.get());
|
||||||
EXPECT_EQ(events[0]->inOrderAllocationOffset, 0u);
|
EXPECT_EQ(events[0]->inOrderAllocationOffset, 123u);
|
||||||
|
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, events[0]->hostSignal());
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(InOrderCmdListTests, givenInOrderEventWhenAppendEventResetCalledThenReturnError, IsAtLeastSkl) {
|
||||||
|
auto immCmdList = createImmCmdList<gfxCoreFamily>();
|
||||||
|
|
||||||
|
auto eventPool = createEvents<FamilyType>(3, false);
|
||||||
|
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, immCmdList->appendEventReset(events[0]->toHandle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventThenDontSetInOrderParams, IsAtLeastSkl) {
|
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWheUsingRegularEventThenDontSetInOrderParams, IsAtLeastSkl) {
|
||||||
@@ -1263,20 +1273,6 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenWaitingForRegularEventFromPre
|
|||||||
EXPECT_EQ(cmdList.end(), itor);
|
EXPECT_EQ(cmdList.end(), itor);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenWaitingForEventFromAfterResetThenDontSkip, IsAtLeastXeHpCore) {
|
|
||||||
auto immCmdList = createImmCmdList<gfxCoreFamily>();
|
|
||||||
|
|
||||||
auto eventPool = createEvents<FamilyType>(1, false);
|
|
||||||
auto eventHandle = events[0]->toHandle();
|
|
||||||
|
|
||||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, eventHandle, 0, nullptr, launchParams, false);
|
|
||||||
events[0]->reset();
|
|
||||||
|
|
||||||
auto retValue = immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 1, &eventHandle, launchParams, false);
|
|
||||||
|
|
||||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, retValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(InOrderCmdListTests, givenInOrderEventModeWhenSubmittingThenProgramSemaphoreOnlyForExternalEvent, IsAtLeastXeHpCore) {
|
HWTEST2_F(InOrderCmdListTests, givenInOrderEventModeWhenSubmittingThenProgramSemaphoreOnlyForExternalEvent, IsAtLeastXeHpCore) {
|
||||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||||
|
|
||||||
@@ -2017,6 +2013,7 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingNonKernelAppendThe
|
|||||||
auto cmdStream = immCmdList->getCmdContainer().getCommandStream();
|
auto cmdStream = immCmdList->getCmdContainer().getCommandStream();
|
||||||
|
|
||||||
auto eventPool = createEvents<FamilyType>(1, true);
|
auto eventPool = createEvents<FamilyType>(1, true);
|
||||||
|
events[0]->inOrderExecEvent = false;
|
||||||
|
|
||||||
uint64_t inOrderSyncVa = immCmdList->inOrderExecInfo->inOrderDependencyCounterAllocation.getGpuAddress();
|
uint64_t inOrderSyncVa = immCmdList->inOrderExecInfo->inOrderDependencyCounterAllocation.getGpuAddress();
|
||||||
|
|
||||||
@@ -2122,6 +2119,7 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderRegularCmdListWhenProgrammingNonKerne
|
|||||||
auto cmdStream = regularCmdList->getCmdContainer().getCommandStream();
|
auto cmdStream = regularCmdList->getCmdContainer().getCommandStream();
|
||||||
|
|
||||||
auto eventPool = createEvents<FamilyType>(1, true);
|
auto eventPool = createEvents<FamilyType>(1, true);
|
||||||
|
events[0]->inOrderExecEvent = false;
|
||||||
|
|
||||||
uint8_t ptr[64] = {};
|
uint8_t ptr[64] = {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user