Skip reset of IPC events

This because they might have been imported after their status
having been already changed by the exporter.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2021-08-18 19:40:09 +00:00
committed by Compute-Runtime-Automation
parent aae4ce045d
commit 38e36d00af
5 changed files with 84 additions and 8 deletions

View File

@@ -431,11 +431,9 @@ ze_result_t ContextImp::openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
Device *device = this->devices.begin()->second;
auto neoDevice = device->getNEODevice();
NEO::osHandle osHandle = static_cast<NEO::osHandle>(handle);
const uint32_t eventAlignment = 4 * MemoryConstants::cacheLineSize;
uint32_t eventSize = static_cast<uint32_t>(alignUp(EventPacketsCount::eventPackets *
NEO::TimestampPackets<uint32_t>::getSinglePacketSize(),
eventAlignment));
auto &hwHelper = device->getHwHelper();
const uint32_t eventAlignment = static_cast<uint32_t>(hwHelper.getTimestampPacketAllocatorAlignment());
uint32_t eventSize = static_cast<uint32_t>(alignUp(EventPacketsCount::eventPackets * hwHelper.getSingleTimestampPacketSize(), eventAlignment));
size_t alignedSize = alignUp<size_t>(numEvents * eventSize, MemoryConstants::pageSize64k);
NEO::AllocationProperties unifiedMemoryProperties{neoDevice->getRootDeviceIndex(),
alignedSize,
@@ -460,6 +458,9 @@ ze_result_t ContextImp::openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
eventPool->eventPoolAllocations->addAllocation(alloc);
eventPool->eventPoolPtr = reinterpret_cast<void *>(alloc->getUnderlyingBuffer());
eventPool->devices.push_back(device);
eventPool->isImportedIpcPool = true;
eventPool->setEventSize(eventSize);
eventPool->setEventAlignment(eventAlignment);
*phEventPool = eventPool;

View File

@@ -67,6 +67,7 @@ struct Event : _ze_event_handle_t {
virtual size_t getGlobalEndOffset() const = 0;
virtual size_t getSinglePacketSize() const = 0;
virtual size_t getTimestampSizeInDw() const = 0;
virtual ze_result_t hostEventSetValue(uint32_t eventValue) = 0;
void *hostAddress = nullptr;
uint32_t kernelCount = 1u;
ze_event_scope_flags_t signalScope = 0u;
@@ -136,6 +137,7 @@ struct EventImp : public Event {
size_t getGlobalStartOffset() const override { return NEO::TimestampPackets<TagSizeT>::getGlobalStartOffset(); }
size_t getGlobalEndOffset() const override { return NEO::TimestampPackets<TagSizeT>::getGlobalEndOffset(); }
size_t getSinglePacketSize() const override { return NEO::TimestampPackets<TagSizeT>::getSinglePacketSize(); };
ze_result_t hostEventSetValue(uint32_t eventValue) override;
std::unique_ptr<KernelTimestampsData<TagSizeT>[]> kernelTimestampsData;
@@ -146,7 +148,6 @@ struct EventImp : public Event {
protected:
ze_result_t calculateProfilingData();
ze_result_t queryStatusKernelTimestamp();
ze_result_t hostEventSetValue(uint32_t eventValue);
ze_result_t hostEventSetValueTimestamps(TagSizeT eventVal);
void assignTimestampData(void *address);
};
@@ -169,6 +170,8 @@ struct EventPool : _ze_event_pool_handle_t {
virtual NEO::MultiGraphicsAllocation &getAllocation() { return *eventPoolAllocations; }
virtual uint32_t getEventSize() = 0;
virtual void setEventSize(uint32_t) = 0;
virtual void setEventAlignment(uint32_t) = 0;
bool isEventPoolTimestampFlagSet() {
if (NEO::DebugManager.flags.DisableTimestampEvents.get()) {
@@ -209,6 +212,8 @@ struct EventPoolImp : public EventPool {
ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override;
uint32_t getEventSize() override { return eventSize; }
void setEventSize(uint32_t size) override { eventSize = size; }
void setEventAlignment(uint32_t alignment) override { eventAlignment = alignment; }
size_t getNumEvents() { return numEvents; }
Device *getDevice() override { return devices[0]; }
@@ -217,6 +222,7 @@ struct EventPoolImp : public EventPool {
std::vector<Device *> devices;
ContextImp *context = nullptr;
size_t numEvents;
bool isImportedIpcPool = false;
protected:
uint32_t eventAlignment = 0;

View File

@@ -25,7 +25,13 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
event->signalScope = desc->signal;
event->waitScope = desc->wait;
event->csr = static_cast<DeviceImp *>(device)->neoDevice->getDefaultEngine().commandStreamReceiver;
event->reset();
EventPoolImp *EventPoolImp = static_cast<struct EventPoolImp *>(eventPool);
// do not reset even if it has been imported, since event pool
// might have been imported after events being already signaled
if (EventPoolImp->isImportedIpcPool == false) {
event->reset();
}
return event;
}