mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
When terminate task do not pass timestamps
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7364288ed9
commit
38ace23f72
@@ -40,6 +40,7 @@ CommandMapUnmap::CommandMapUnmap(MapOperationType operationType, MemObj &memObj,
|
||||
|
||||
CompletionStamp &CommandMapUnmap::submit(uint32_t taskLevel, bool terminated) {
|
||||
if (terminated) {
|
||||
this->terminated = true;
|
||||
memObj.decRefInternal();
|
||||
return completionStamp;
|
||||
}
|
||||
@@ -131,6 +132,7 @@ CommandComputeKernel::~CommandComputeKernel() {
|
||||
|
||||
CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminated) {
|
||||
if (terminated) {
|
||||
this->terminated = true;
|
||||
for (auto surface : surfaces) {
|
||||
delete surface;
|
||||
}
|
||||
@@ -348,6 +350,7 @@ void CommandWithoutKernel::dispatchBlitOperation() {
|
||||
|
||||
CompletionStamp &CommandWithoutKernel::submit(uint32_t taskLevel, bool terminated) {
|
||||
if (terminated) {
|
||||
this->terminated = true;
|
||||
return completionStamp;
|
||||
}
|
||||
|
||||
@@ -472,8 +475,26 @@ void Command::setTimestampPacketNode(TimestampPacketContainer ¤t, Timestam
|
||||
}
|
||||
|
||||
Command::~Command() {
|
||||
if (commandQueue.getDeferredTimestampPackets() && timestampPacketDependencies.get()) {
|
||||
timestampPacketDependencies->moveNodesToNewContainer(*commandQueue.getDeferredTimestampPackets());
|
||||
if (terminated) {
|
||||
if (commandQueue.getTimestampPacketContainer()) {
|
||||
std::array<uint32_t, 8u> timestampData;
|
||||
timestampData.fill(std::numeric_limits<uint32_t>::max());
|
||||
if (currentTimestampPacketNodes.get()) {
|
||||
for (auto &node : currentTimestampPacketNodes->peekNodes()) {
|
||||
for (const auto &cmdQueueNode : commandQueue.getTimestampPacketContainer()->peekNodes()) {
|
||||
if (node == cmdQueueNode) {
|
||||
for (uint32_t i = 0; i < node->getPacketsUsed(); i++) {
|
||||
node->assignDataToAllTimestamps(i, timestampData.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (commandQueue.getDeferredTimestampPackets() && timestampPacketDependencies.get()) {
|
||||
timestampPacketDependencies->moveNodesToNewContainer(*commandQueue.getDeferredTimestampPackets());
|
||||
}
|
||||
}
|
||||
|
||||
for (cl_event &eventFromWaitList : eventsWaitlist) {
|
||||
|
||||
@@ -104,6 +104,7 @@ class Command : public IFNode<Command> {
|
||||
CompletionStamp completionStamp = {};
|
||||
|
||||
protected:
|
||||
bool terminated = false;
|
||||
CommandQueue &commandQueue;
|
||||
std::unique_ptr<KernelOperation> kernelOperation;
|
||||
std::unique_ptr<TimestampPacketContainer> currentTimestampPacketNodes;
|
||||
|
||||
@@ -943,6 +943,69 @@ HWTEST_TEMPLATED_F(BlitAuxTranslationTests, givenCacheFlushRequiredWhenHandlingD
|
||||
device->getMemoryManager()->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(BlitAuxTranslationTests, givenTerminatedLatestEnqueuedTaskWhenHandlingDependenciesForBlockedEnqueueThenDoNotPutAllNodesToDeferredListAndSetTimestampData) {
|
||||
DebugManager.flags.ForceCacheFlushForBcs.set(1);
|
||||
|
||||
auto gfxAllocation = createGfxAllocation(1, true);
|
||||
setMockKernelArgs(std::array<GraphicsAllocation *, 1>{{gfxAllocation}});
|
||||
|
||||
TimestampPacketContainer *deferredTimestampPackets = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get())->deferredTimestampPackets.get();
|
||||
TimestampPacketContainer *timestampPacketContainer = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get())->timestampPacketContainer.get();
|
||||
|
||||
UserEvent userEvent;
|
||||
cl_event waitlist[] = {&userEvent};
|
||||
|
||||
commandQueue->enqueueKernel(mockKernel->mockKernel, 1, nullptr, gws, nullptr, 1, waitlist, nullptr);
|
||||
|
||||
EXPECT_EQ(0u, deferredTimestampPackets->peekNodes().size());
|
||||
|
||||
userEvent.setStatus(-1);
|
||||
|
||||
EXPECT_FALSE(commandQueue->isQueueBlocked());
|
||||
|
||||
EXPECT_EQ(0u, deferredTimestampPackets->peekNodes().size());
|
||||
EXPECT_EQ(timestampPacketContainer->peekNodes()[0]->getContextEndValue(0u), 0xffffffff);
|
||||
|
||||
device->getMemoryManager()->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(BlitAuxTranslationTests, givenTerminatedTaskWhenHandlingDependenciesForBlockedEnqueueThenDoNotPutAllNodesToDeferredListAndDoNotSetTimestampData) {
|
||||
DebugManager.flags.ForceCacheFlushForBcs.set(1);
|
||||
|
||||
auto gfxAllocation = createGfxAllocation(1, true);
|
||||
setMockKernelArgs(std::array<GraphicsAllocation *, 1>{{gfxAllocation}});
|
||||
|
||||
TimestampPacketContainer *deferredTimestampPackets = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get())->deferredTimestampPackets.get();
|
||||
TimestampPacketContainer *timestampPacketContainer = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get())->timestampPacketContainer.get();
|
||||
|
||||
UserEvent userEvent;
|
||||
[[maybe_unused]] UserEvent *ue = &userEvent;
|
||||
cl_event waitlist[] = {&userEvent};
|
||||
UserEvent userEvent1;
|
||||
[[maybe_unused]] UserEvent *ue1 = &userEvent1;
|
||||
cl_event waitlist1[] = {&userEvent1};
|
||||
|
||||
commandQueue->enqueueKernel(mockKernel->mockKernel, 1, nullptr, gws, nullptr, 1, waitlist, nullptr);
|
||||
commandQueue->enqueueKernel(mockKernel->mockKernel, 1, nullptr, gws, nullptr, 1, waitlist1, nullptr);
|
||||
|
||||
EXPECT_EQ(0u, deferredTimestampPackets->peekNodes().size());
|
||||
|
||||
userEvent.setStatus(-1);
|
||||
|
||||
EXPECT_EQ(0u, deferredTimestampPackets->peekNodes().size());
|
||||
EXPECT_EQ(1u, timestampPacketContainer->peekNodes().size());
|
||||
EXPECT_EQ(timestampPacketContainer->peekNodes()[0]->getContextEndValue(0u), 1u);
|
||||
|
||||
userEvent1.setStatus(-1);
|
||||
|
||||
EXPECT_FALSE(commandQueue->isQueueBlocked());
|
||||
EXPECT_EQ(0u, deferredTimestampPackets->peekNodes().size());
|
||||
EXPECT_EQ(1u, timestampPacketContainer->peekNodes().size());
|
||||
EXPECT_EQ(timestampPacketContainer->peekNodes()[0]->getContextEndValue(0u), 0xffffffff);
|
||||
|
||||
device->getMemoryManager()->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
using BlitEnqueueWithNoTimestampPacketTests = BlitEnqueueTests<0>;
|
||||
|
||||
HWTEST_TEMPLATED_F(BlitEnqueueWithNoTimestampPacketTests, givenNoTimestampPacketsWritewhenEnqueueingBlitOperationThenEnginesAreSynchronized) {
|
||||
|
||||
Reference in New Issue
Block a user