refactor: Remove not necessary code

Related-To: NEO-13003

- remove additionalPacketsInUse as getPacketsUsed is sufficient
- simplify clearTimestampTagData to pass node to clear

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan 2025-05-16 01:34:16 +00:00 committed by Compute-Runtime-Automation
parent 0a096f1d50
commit 4f77a581b9
6 changed files with 7 additions and 57 deletions

View File

@ -697,7 +697,7 @@ void Event::resetInOrderTimestampNode(NEO::TagNodeBase *newNode, uint32_t partit
inOrderTimestampNode.push_back(newNode);
if (NEO::debugManager.flags.ClearStandaloneInOrderTimestampAllocation.get() != 0) {
clearTimestampTagData(partitionCount, true, nullptr);
clearTimestampTagData(partitionCount, inOrderTimestampNode.back());
}
}
}
@ -724,7 +724,7 @@ void Event::resetAdditionalTimestampNode(NEO::TagNodeBase *newNode, uint32_t par
}
additionalTimestampNode.push_back(newNode);
clearTimestampTagData(partitionCount, false, newNode);
clearTimestampTagData(partitionCount, newNode);
}
NEO::GraphicsAllocation *Event::getExternalCounterAllocationFromAddress(uint64_t *address) const {

View File

@ -161,7 +161,6 @@ struct Event : _ze_event_handle_t {
virtual void resetKernelCountAndPacketUsedCount() = 0;
void *getHostAddress() const;
virtual void setPacketsInUse(uint32_t value) = 0;
virtual void setAdditionalPacketsInUse(uint32_t value) = 0;
uint32_t getCurrKernelDataIndex() const { return kernelCount - 1; }
MOCKABLE_VIRTUAL void setGpuStartTimestamp();
MOCKABLE_VIRTUAL void setGpuEndTimestamp();
@ -350,7 +349,7 @@ struct Event : _ze_event_handle_t {
void unsetCmdQueue();
void releaseTempInOrderTimestampNodes();
virtual void clearTimestampTagData(uint32_t partitionCount, bool latestInorderData, NEO::TagNodeBase *newNode) = 0;
virtual void clearTimestampTagData(uint32_t partitionCount, NEO::TagNodeBase *newNode) = 0;
EventPool *eventPool = nullptr;

View File

@ -18,12 +18,9 @@ class KernelEventCompletionData : public NEO::TimestampPackets<TagSizeT, NEO::Ti
public:
uint32_t getPacketsUsed() const { return packetsUsed; }
void setPacketsUsed(uint32_t value) { packetsUsed = value; }
uint32_t getAdditionalPacketsUsed() const { return additionalPacketsUsed; }
void setAdditionalPacketsUsed(uint32_t value) { additionalPacketsUsed = value; }
protected:
uint32_t packetsUsed = 1;
uint32_t additionalPacketsUsed = 0;
};
template <typename TagSizeT>
@ -55,7 +52,6 @@ struct EventImp : public Event {
uint32_t getPacketsInUse() const override;
uint32_t getPacketsUsedInLastKernel() override;
void setPacketsInUse(uint32_t value) override;
void setAdditionalPacketsInUse(uint32_t value) override;
ze_result_t hostEventSetValue(State eventState) override;
std::unique_ptr<KernelEventCompletionData<TagSizeT>[]> kernelEventCompletionData;
@ -76,7 +72,7 @@ struct EventImp : public Event {
ze_result_t queryCounterBasedEventStatus();
void handleSuccessfulHostSynchronization();
MOCKABLE_VIRTUAL ze_result_t hostEventSetValueTimestamps(State eventState);
void clearTimestampTagData(uint32_t partitionCount, bool latestInorderData, NEO::TagNodeBase *newNode) override;
void clearTimestampTagData(uint32_t partitionCount, NEO::TagNodeBase *newNode) override;
MOCKABLE_VIRTUAL void assignKernelEventCompletionData(void *address);
void setRemainingPackets(TagSizeT eventVal, uint64_t nextPacketGpuVa, void *nextPacketAddress, uint32_t packetsAlreadySet);
void getSynchronizedKernelTimestamps(ze_synchronized_timestamp_result_ext_t *pSynchronizedTimestampsBuffer,

View File

@ -228,11 +228,8 @@ ze_result_t EventImp<TagSizeT>::calculateProfilingData() {
}
template <typename TagSizeT>
void EventImp<TagSizeT>::clearTimestampTagData(uint32_t partitionCount, bool latestInorderData, NEO::TagNodeBase *newNode) {
void EventImp<TagSizeT>::clearTimestampTagData(uint32_t partitionCount, NEO::TagNodeBase *newNode) {
auto node = newNode;
if (latestInorderData) {
node = inOrderTimestampNode.back();
}
auto hostAddress = node->getCpuBase();
auto deviceAddress = node->getGpuAddress();
@ -269,7 +266,7 @@ void EventImp<TagSizeT>::assignKernelEventCompletionData(void *address) {
// Account for additional timestamp nodes
uint32_t remainingPackets = 0;
if (!additionalTimestampNode.empty()) {
remainingPackets = kernelEventCompletionData[i].getAdditionalPacketsUsed();
remainingPackets = kernelEventCompletionData[i].getPacketsUsed();
if (inOrderIncrementValue > 0) {
remainingPackets *= static_cast<uint32_t>(additionalTimestampNode.size());
}
@ -1089,11 +1086,6 @@ void EventImp<TagSizeT>::setPacketsInUse(uint32_t value) {
kernelEventCompletionData[getCurrKernelDataIndex()].setPacketsUsed(value);
}
template <typename TagSizeT>
void EventImp<TagSizeT>::setAdditionalPacketsInUse(uint32_t value) {
kernelEventCompletionData[getCurrKernelDataIndex()].setAdditionalPacketsUsed(value);
}
template <typename TagSizeT>
void EventImp<TagSizeT>::resetKernelCountAndPacketUsedCount() {
for (auto i = 0u; i < this->kernelCount; i++) {

View File

@ -191,13 +191,12 @@ class MockEvent : public ::L0::Event {
ze_result_t hostEventSetValue(State eventState) override {
return ZE_RESULT_SUCCESS;
}
void clearTimestampTagData(uint32_t partitionCount, bool latestInorderData, NEO::TagNodeBase *newNode) override {}
void clearTimestampTagData(uint32_t partitionCount, NEO::TagNodeBase *newNode) override {}
uint32_t getPacketsUsedInLastKernel() override { return 1; }
uint32_t getPacketsInUse() const override { return 1; }
void resetPackets(bool resetAllPackets) override {}
void resetKernelCountAndPacketUsedCount() override {}
void setPacketsInUse(uint32_t value) override {}
void setAdditionalPacketsInUse(uint32_t value) override {}
uint64_t getPacketAddress(L0::Device *) override { return 0; }
void setGpuStartTimestamp() override {}
void setGpuEndTimestamp() override {}

View File

@ -3484,42 +3484,6 @@ TEST_F(EventTests, givenRegularEventUseMultiplePacketsWhenHostSignalThenExpectAl
}
}
TEST_F(EventTests, givenRegularEventWithoutAdditionalPacketsThenGetAdditionalPacketsRetursZero) {
eventDesc.index = 0;
eventDesc.signal = 0;
eventDesc.wait = 0;
auto event = std::unique_ptr<L0::EventImp<uint32_t>>(static_cast<L0::EventImp<uint32_t> *>(L0::Event::create<uint32_t>(eventPool.get(),
&eventDesc,
device)));
ASSERT_NE(event, nullptr);
uint32_t *hostAddr = static_cast<uint32_t *>(event->getCompletionFieldHostAddress());
EXPECT_EQ(*hostAddr, Event::STATE_INITIAL);
EXPECT_EQ(1u, event->getPacketsInUse());
event->setAdditionalPacketsInUse(0u);
EXPECT_EQ(event->kernelEventCompletionData[0].getAdditionalPacketsUsed(), 0u);
}
TEST_F(EventTests, givenRegularEventUseOneAdditionalPacketsThenGetAdditionalPacketsRetursOne) {
eventDesc.index = 0;
eventDesc.signal = 0;
eventDesc.wait = 0;
auto event = std::unique_ptr<L0::EventImp<uint32_t>>(static_cast<L0::EventImp<uint32_t> *>(L0::Event::create<uint32_t>(eventPool.get(),
&eventDesc,
device)));
ASSERT_NE(event, nullptr);
uint32_t *hostAddr = static_cast<uint32_t *>(event->getCompletionFieldHostAddress());
EXPECT_EQ(*hostAddr, Event::STATE_INITIAL);
EXPECT_EQ(1u, event->getPacketsInUse());
event->setAdditionalPacketsInUse(1u);
EXPECT_EQ(event->kernelEventCompletionData[0].getAdditionalPacketsUsed(), 1u);
}
TEST_F(EventUsedPacketSignalTests, givenEventUseMultiplePacketsWhenHostSignalThenExpectAllPacketsAreSignaled) {
eventDesc.index = 0;
eventDesc.signal = 0;