fix: reset timestamps when userEvent is terminated
Related-To: NEO-14448 Signed-off-by: Andrzej Koska <andrzej.koska@intel.com>
This commit is contained in:
parent
5bab1c3f60
commit
41c0546c45
|
@ -675,6 +675,14 @@ void Event::submitCommand(bool abortTasks) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto &complStamp = cmdToProcess->submit(taskLevel, abortTasks);
|
auto &complStamp = cmdToProcess->submit(taskLevel, abortTasks);
|
||||||
|
if (abortTasks) {
|
||||||
|
if (timestampPacketContainer.get() != nullptr) {
|
||||||
|
const auto ×tamps = timestampPacketContainer->peekNodes();
|
||||||
|
for (auto i = 0u; i < timestamps.size(); i++) {
|
||||||
|
timestamps[i]->markAsAborted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (profilingCpuPath && this->isProfilingEnabled()) {
|
if (profilingCpuPath && this->isProfilingEnabled()) {
|
||||||
setEndTimeStamp();
|
setEndTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -420,6 +420,39 @@ HWTEST_F(CommandQueueHwTest, GivenNonEmptyQueueOnBlockingWhenMappingBufferThenWi
|
||||||
clReleaseEvent(gatingEvent);
|
clReleaseEvent(gatingEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandQueueHwTest, GivenFillBufferBlockedOnUserEventWhenEventIsAbortedThenClearTimestamps, IsAtLeastXeHpCore) {
|
||||||
|
CommandQueueHw<FamilyType> cmdQ(context, pCmdQ->getDevice().getSpecializedDevice<ClDevice>(), 0, false);
|
||||||
|
|
||||||
|
auto buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
||||||
|
uint32_t pattern = 0xf0f1f2f3;
|
||||||
|
|
||||||
|
auto clUserEvent = clCreateUserEvent(context, nullptr);
|
||||||
|
cl_event clWaitingEvent;
|
||||||
|
auto retVal = clEnqueueFillBuffer(&cmdQ, buffer, &pattern, sizeof(pattern), 0, sizeof(pattern), 1, &clUserEvent, &clWaitingEvent);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
auto waitingEvent = castToObject<Event>(clWaitingEvent);
|
||||||
|
|
||||||
|
clSetUserEventStatus(clUserEvent, CL_INVALID_VALUE);
|
||||||
|
cmdQ.finish();
|
||||||
|
|
||||||
|
auto timestampPacketNodes = waitingEvent->getTimestampPacketNodes();
|
||||||
|
ASSERT_NE(timestampPacketNodes, nullptr);
|
||||||
|
const auto ×tamps = timestampPacketNodes->peekNodes();
|
||||||
|
for (const auto &node : timestamps) {
|
||||||
|
for (uint32_t i = 0; i < node->getPacketsUsed(); i++) {
|
||||||
|
EXPECT_EQ(0ULL, node->getContextStartValue(i));
|
||||||
|
EXPECT_EQ(0ULL, node->getContextEndValue(i));
|
||||||
|
EXPECT_EQ(0ULL, node->getGlobalStartValue(i));
|
||||||
|
EXPECT_EQ(0ULL, node->getGlobalEndValue(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clReleaseMemObject(buffer);
|
||||||
|
clReleaseEvent(clUserEvent);
|
||||||
|
clReleaseEvent(clWaitingEvent);
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST_F(CommandQueueHwTest, GivenEventsWaitlistOnBlockingWhenMappingBufferThenWillWaitForEvents) {
|
HWTEST_F(CommandQueueHwTest, GivenEventsWaitlistOnBlockingWhenMappingBufferThenWillWaitForEvents) {
|
||||||
struct MockEvent : UserEvent {
|
struct MockEvent : UserEvent {
|
||||||
MockEvent(Context *ctx, uint32_t updateCountBeforeCompleted)
|
MockEvent(Context *ctx, uint32_t updateCountBeforeCompleted)
|
||||||
|
|
|
@ -47,6 +47,8 @@ class TagNodeBase : public NonCopyableAndNonMovableClass {
|
||||||
|
|
||||||
virtual void initialize() = 0;
|
virtual void initialize() = 0;
|
||||||
|
|
||||||
|
virtual void markAsAborted() = 0;
|
||||||
|
|
||||||
bool canBeReleased() const;
|
bool canBeReleased() const;
|
||||||
|
|
||||||
virtual void *getCpuBase() const = 0;
|
virtual void *getCpuBase() const = 0;
|
||||||
|
@ -115,6 +117,10 @@ class TagNode : public TagNodeBase, public IDNode<TagNode<TagType>> {
|
||||||
|
|
||||||
void *getCpuBase() const override { return tagForCpuAccess; }
|
void *getCpuBase() const override { return tagForCpuAccess; }
|
||||||
|
|
||||||
|
void markAsAborted() override {
|
||||||
|
tagForCpuAccess->initialize(0);
|
||||||
|
}
|
||||||
|
|
||||||
void assignDataToAllTimestamps(uint32_t packetIndex, const void *source) override;
|
void assignDataToAllTimestamps(uint32_t packetIndex, const void *source) override;
|
||||||
|
|
||||||
size_t getGlobalStartOffset() const override;
|
size_t getGlobalStartOffset() const override;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022-2023 Intel Corporation
|
* Copyright (C) 2022-2025 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -199,6 +199,31 @@ HWTEST_F(TimestampPacketTests, whenNewTagIsTakenThenReinitialize) {
|
||||||
EXPECT_EQ(1u, firstNode->getPacketsUsed());
|
EXPECT_EQ(1u, firstNode->getPacketsUsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(TimestampPacketTests, GivenTagNodeWhenCallMarkAsAbortedThenClearTimestamps) {
|
||||||
|
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||||
|
MockMemoryManager memoryManager(executionEnvironment);
|
||||||
|
MockTagAllocator<MockTimestampPackets32> allocator(0, &memoryManager, 1);
|
||||||
|
|
||||||
|
using MockNode = TagNode<MockTimestampPackets32>;
|
||||||
|
|
||||||
|
auto firstNode = static_cast<MockNode *>(allocator.getTag());
|
||||||
|
auto initValue = 1u;
|
||||||
|
for (auto &packet : firstNode->tagForCpuAccess->packets) {
|
||||||
|
packet.contextStart = initValue;
|
||||||
|
packet.globalStart = initValue;
|
||||||
|
packet.contextEnd = initValue;
|
||||||
|
packet.globalEnd = initValue;
|
||||||
|
}
|
||||||
|
firstNode->markAsAborted();
|
||||||
|
|
||||||
|
for (const auto &packet : firstNode->tagForCpuAccess->packets) {
|
||||||
|
EXPECT_EQ(0u, packet.contextStart);
|
||||||
|
EXPECT_EQ(0u, packet.globalStart);
|
||||||
|
EXPECT_EQ(0u, packet.contextEnd);
|
||||||
|
EXPECT_EQ(0u, packet.globalEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(TimestampPacketTests, whenObjectIsCreatedThenInitializeAllStamps) {
|
TEST_F(TimestampPacketTests, whenObjectIsCreatedThenInitializeAllStamps) {
|
||||||
MockTimestampPackets32 timestampPacketStorage;
|
MockTimestampPackets32 timestampPacketStorage;
|
||||||
EXPECT_EQ(TimestampPacketConstants::preferredPacketCount * sizeof(timestampPacketStorage.packets[0]), sizeof(timestampPacketStorage.packets));
|
EXPECT_EQ(TimestampPacketConstants::preferredPacketCount * sizeof(timestampPacketStorage.packets[0]), sizeof(timestampPacketStorage.packets));
|
||||||
|
|
Loading…
Reference in New Issue