2020-03-06 11:09:57 +01:00
|
|
|
/*
|
2023-01-02 09:56:45 +00:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2020-03-06 11:09:57 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-09-15 09:33:12 +02:00
|
|
|
#include "shared/source/helpers/timestamp_packet.h"
|
|
|
|
|
|
2020-07-29 02:45:54 -07:00
|
|
|
#include <level_zero/ze_api.h>
|
2020-03-06 11:09:57 +01:00
|
|
|
|
2022-05-21 18:53:47 +00:00
|
|
|
#include <bitset>
|
2021-12-03 19:46:19 +00:00
|
|
|
#include <limits>
|
|
|
|
|
|
2020-03-06 11:09:57 +01:00
|
|
|
struct _ze_event_handle_t {};
|
|
|
|
|
|
|
|
|
|
struct _ze_event_pool_handle_t {};
|
|
|
|
|
|
2022-12-20 04:30:24 +00:00
|
|
|
namespace NEO {
|
|
|
|
|
struct RootDeviceEnvironment;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 11:09:57 +01:00
|
|
|
namespace L0 {
|
|
|
|
|
typedef uint64_t FlushStamp;
|
|
|
|
|
struct EventPool;
|
2020-07-09 14:21:33 +02:00
|
|
|
struct MetricStreamer;
|
2022-06-03 08:50:35 +00:00
|
|
|
struct ContextImp;
|
|
|
|
|
struct Context;
|
|
|
|
|
struct DriverHandle;
|
2022-10-27 11:40:44 +00:00
|
|
|
struct DriverHandleImp;
|
2022-06-03 08:50:35 +00:00
|
|
|
struct Device;
|
2020-03-06 11:09:57 +01:00
|
|
|
|
2023-01-16 16:53:05 +00:00
|
|
|
#pragma pack(1)
|
|
|
|
|
struct IpcEventPoolData {
|
|
|
|
|
uint64_t handle = 0;
|
|
|
|
|
size_t numEvents = 0;
|
|
|
|
|
uint32_t rootDeviceIndex = 0;
|
|
|
|
|
bool isDeviceEventPoolAllocation = false;
|
|
|
|
|
bool isHostVisibleEventPoolAllocation = false;
|
|
|
|
|
};
|
|
|
|
|
#pragma pack()
|
|
|
|
|
static_assert(sizeof(IpcEventPoolData) <= ZE_MAX_IPC_HANDLE_SIZE, "IpcEventPoolData is bigger than ZE_MAX_IPC_HANDLE_SIZE");
|
|
|
|
|
|
2021-04-14 18:13:17 +00:00
|
|
|
namespace EventPacketsCount {
|
2022-12-08 14:23:49 +00:00
|
|
|
inline constexpr uint32_t maxKernelSplit = 3;
|
|
|
|
|
inline constexpr uint32_t eventPackets = maxKernelSplit * NEO ::TimestampPacketSizeControl::preferredPacketCount;
|
2021-04-14 18:13:17 +00:00
|
|
|
} // namespace EventPacketsCount
|
|
|
|
|
|
2020-03-06 11:09:57 +01:00
|
|
|
struct Event : _ze_event_handle_t {
|
|
|
|
|
virtual ~Event() = default;
|
|
|
|
|
virtual ze_result_t destroy();
|
|
|
|
|
virtual ze_result_t hostSignal() = 0;
|
2020-07-29 02:45:54 -07:00
|
|
|
virtual ze_result_t hostSynchronize(uint64_t timeout) = 0;
|
2020-03-06 11:09:57 +01:00
|
|
|
virtual ze_result_t queryStatus() = 0;
|
|
|
|
|
virtual ze_result_t reset() = 0;
|
2020-07-29 14:25:20 +02:00
|
|
|
virtual ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) = 0;
|
2021-08-05 06:50:38 +00:00
|
|
|
virtual ze_result_t queryTimestampsExp(Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) = 0;
|
2020-04-08 12:44:14 -07:00
|
|
|
enum State : uint32_t {
|
2020-03-06 11:09:57 +01:00
|
|
|
STATE_SIGNALED = 0u,
|
2022-12-07 15:49:14 +00:00
|
|
|
HOST_CACHING_DISABLED_PERMANENT = std::numeric_limits<uint32_t>::max() - 2,
|
2022-11-22 15:12:44 +00:00
|
|
|
HOST_CACHING_DISABLED = std::numeric_limits<uint32_t>::max() - 1,
|
2021-12-03 19:46:19 +00:00
|
|
|
STATE_CLEARED = std::numeric_limits<uint32_t>::max(),
|
2020-03-06 11:09:57 +01:00
|
|
|
STATE_INITIAL = STATE_CLEARED
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-18 11:31:17 +00:00
|
|
|
template <typename TagSizeT>
|
2020-03-06 11:09:57 +01:00
|
|
|
static Event *create(EventPool *eventPool, const ze_event_desc_t *desc, Device *device);
|
|
|
|
|
|
|
|
|
|
static Event *fromHandle(ze_event_handle_t handle) { return static_cast<Event *>(handle); }
|
|
|
|
|
|
|
|
|
|
inline ze_event_handle_t toHandle() { return this; }
|
|
|
|
|
|
2023-01-12 09:24:14 +00:00
|
|
|
MOCKABLE_VIRTUAL NEO::GraphicsAllocation &getAllocation(Device *device) const;
|
2020-03-06 11:09:57 +01:00
|
|
|
|
2023-01-12 09:24:14 +00:00
|
|
|
MOCKABLE_VIRTUAL uint64_t getGpuAddress(Device *device) const;
|
2022-10-27 11:40:44 +00:00
|
|
|
virtual uint32_t getPacketsInUse() const = 0;
|
2022-04-17 01:13:30 +00:00
|
|
|
virtual uint32_t getPacketsUsedInLastKernel() = 0;
|
2021-05-18 11:31:17 +00:00
|
|
|
virtual uint64_t getPacketAddress(Device *device) = 0;
|
2023-01-12 09:24:14 +00:00
|
|
|
MOCKABLE_VIRTUAL void resetPackets(bool resetAllPackets);
|
2022-10-27 22:14:39 +00:00
|
|
|
virtual void resetKernelCountAndPacketUsedCount() = 0;
|
2023-01-12 09:24:14 +00:00
|
|
|
void *getHostAddress() const { return hostAddress; }
|
2021-05-18 11:31:17 +00:00
|
|
|
virtual void setPacketsInUse(uint32_t value) = 0;
|
2021-04-14 18:13:17 +00:00
|
|
|
uint32_t getCurrKernelDataIndex() const { return kernelCount - 1; }
|
2023-01-12 09:24:14 +00:00
|
|
|
MOCKABLE_VIRTUAL void setGpuStartTimestamp();
|
|
|
|
|
MOCKABLE_VIRTUAL void setGpuEndTimestamp();
|
|
|
|
|
size_t getCompletionFieldOffset() const {
|
2023-01-11 18:16:20 +00:00
|
|
|
return this->isUsingContextEndOffset() ? this->getContextEndOffset() : 0;
|
|
|
|
|
}
|
2023-01-12 09:24:14 +00:00
|
|
|
uint64_t getCompletionFieldGpuAddress(Device *device) const {
|
2023-01-11 18:16:20 +00:00
|
|
|
return this->getGpuAddress(device) + getCompletionFieldOffset();
|
|
|
|
|
}
|
2023-01-12 09:24:14 +00:00
|
|
|
void *getCompletionFieldHostAddress() const {
|
2023-01-11 18:16:20 +00:00
|
|
|
return ptrOffset(getHostAddress(), getCompletionFieldOffset());
|
|
|
|
|
}
|
2021-12-08 11:12:14 +00:00
|
|
|
size_t getContextStartOffset() const {
|
|
|
|
|
return contextStartOffset;
|
|
|
|
|
}
|
|
|
|
|
size_t getContextEndOffset() const {
|
|
|
|
|
return contextEndOffset;
|
|
|
|
|
}
|
|
|
|
|
size_t getGlobalStartOffset() const {
|
|
|
|
|
return globalStartOffset;
|
|
|
|
|
}
|
|
|
|
|
size_t getGlobalEndOffset() const {
|
|
|
|
|
return globalEndOffset;
|
|
|
|
|
}
|
|
|
|
|
size_t getSinglePacketSize() const {
|
|
|
|
|
return singlePacketSize;
|
|
|
|
|
}
|
|
|
|
|
size_t getTimestampSizeInDw() const {
|
|
|
|
|
return timestampSizeInDw;
|
|
|
|
|
}
|
|
|
|
|
void setEventTimestampFlag(bool timestampFlag) {
|
|
|
|
|
isTimestampEvent = timestampFlag;
|
|
|
|
|
}
|
2022-03-29 14:46:15 +00:00
|
|
|
bool isEventTimestampFlagSet() const {
|
|
|
|
|
return isTimestampEvent;
|
|
|
|
|
}
|
2022-04-04 19:07:08 +00:00
|
|
|
void setUsingContextEndOffset(bool usingContextEndOffset) {
|
|
|
|
|
this->usingContextEndOffset = usingContextEndOffset;
|
2022-03-29 14:46:15 +00:00
|
|
|
}
|
2022-04-04 19:07:08 +00:00
|
|
|
bool isUsingContextEndOffset() const {
|
|
|
|
|
return isTimestampEvent || usingContextEndOffset;
|
2022-03-29 14:46:15 +00:00
|
|
|
}
|
2022-09-29 17:12:22 +00:00
|
|
|
void setCsr(NEO::CommandStreamReceiver *csr) {
|
|
|
|
|
this->csr = csr;
|
|
|
|
|
}
|
2021-12-08 11:12:14 +00:00
|
|
|
|
2022-04-08 18:48:45 +00:00
|
|
|
void increaseKernelCount() {
|
|
|
|
|
kernelCount++;
|
2022-10-27 11:40:44 +00:00
|
|
|
UNRECOVERABLE_IF(kernelCount > maxKernelCount);
|
2022-04-08 18:48:45 +00:00
|
|
|
}
|
|
|
|
|
uint32_t getKernelCount() const {
|
|
|
|
|
return kernelCount;
|
|
|
|
|
}
|
|
|
|
|
void zeroKernelCount() {
|
|
|
|
|
kernelCount = 0;
|
|
|
|
|
}
|
2022-05-21 18:53:47 +00:00
|
|
|
bool getL3FlushForCurrenKernel() {
|
|
|
|
|
return l3FlushAppliedOnKernel.test(kernelCount - 1);
|
|
|
|
|
}
|
|
|
|
|
void setL3FlushForCurrentKernel() {
|
|
|
|
|
l3FlushAppliedOnKernel.set(kernelCount - 1);
|
|
|
|
|
}
|
2022-04-08 18:48:45 +00:00
|
|
|
|
2022-12-07 15:49:14 +00:00
|
|
|
void resetCompletionStatus() {
|
|
|
|
|
if (this->isCompleted.load() != HOST_CACHING_DISABLED_PERMANENT) {
|
|
|
|
|
this->isCompleted.store(STATE_CLEARED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void disableHostCaching(bool disableFromRegularList) {
|
|
|
|
|
this->isCompleted.store(disableFromRegularList ? HOST_CACHING_DISABLED_PERMANENT : HOST_CACHING_DISABLED);
|
2022-11-22 15:12:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setIsCompleted() {
|
2022-12-07 15:49:14 +00:00
|
|
|
if (this->isCompleted.load() == STATE_CLEARED) {
|
2022-11-22 15:12:44 +00:00
|
|
|
this->isCompleted = STATE_SIGNALED;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isAlreadyCompleted() {
|
|
|
|
|
return this->isCompleted == STATE_SIGNALED;
|
2022-09-12 13:37:02 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-27 11:40:44 +00:00
|
|
|
uint32_t getMaxPacketsCount() const {
|
|
|
|
|
return maxPacketCount;
|
|
|
|
|
}
|
|
|
|
|
void setMaxKernelCount(uint32_t value) {
|
|
|
|
|
maxKernelCount = value;
|
|
|
|
|
}
|
|
|
|
|
uint32_t getMaxKernelCount() const {
|
|
|
|
|
return maxKernelCount;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-12 14:21:51 +00:00
|
|
|
uint64_t globalStartTS = 1;
|
|
|
|
|
uint64_t globalEndTS = 1;
|
|
|
|
|
uint64_t contextStartTS = 1;
|
|
|
|
|
uint64_t contextEndTS = 1;
|
2022-03-29 14:46:15 +00:00
|
|
|
std::chrono::microseconds gpuHangCheckPeriod{500'000};
|
2020-09-15 09:33:12 +02:00
|
|
|
|
2020-07-09 14:21:33 +02:00
|
|
|
// Metric streamer instance associated with the event.
|
|
|
|
|
MetricStreamer *metricStreamer = nullptr;
|
2020-04-21 15:10:00 +00:00
|
|
|
NEO::CommandStreamReceiver *csr = nullptr;
|
2021-12-08 11:12:14 +00:00
|
|
|
void *hostAddress = nullptr;
|
2023-01-12 09:24:14 +00:00
|
|
|
Device *device = nullptr;
|
|
|
|
|
EventPool *eventPool = nullptr;
|
2020-04-21 15:10:00 +00:00
|
|
|
|
2021-12-08 11:12:14 +00:00
|
|
|
ze_event_scope_flags_t signalScope = 0u;
|
|
|
|
|
ze_event_scope_flags_t waitScope = 0u;
|
2021-06-09 20:15:59 +00:00
|
|
|
|
2023-01-12 09:24:14 +00:00
|
|
|
int index = 0;
|
|
|
|
|
|
2020-03-06 11:09:57 +01:00
|
|
|
protected:
|
2023-01-12 09:24:14 +00:00
|
|
|
Event(EventPool *eventPool, int index, Device *device) : device(device), eventPool(eventPool), index(index) {}
|
2022-05-21 18:53:47 +00:00
|
|
|
std::bitset<EventPacketsCount::maxKernelSplit> l3FlushAppliedOnKernel;
|
|
|
|
|
|
2021-12-08 11:12:14 +00:00
|
|
|
size_t contextStartOffset = 0u;
|
|
|
|
|
size_t contextEndOffset = 0u;
|
|
|
|
|
size_t globalStartOffset = 0u;
|
|
|
|
|
size_t globalEndOffset = 0u;
|
|
|
|
|
size_t timestampSizeInDw = 0u;
|
|
|
|
|
size_t singlePacketSize = 0u;
|
2022-04-04 19:07:08 +00:00
|
|
|
size_t eventPoolOffset = 0u;
|
2022-04-08 18:48:45 +00:00
|
|
|
|
2022-09-20 09:32:33 +00:00
|
|
|
size_t cpuStartTimestamp = 0u;
|
|
|
|
|
size_t gpuStartTimestamp = 0u;
|
|
|
|
|
size_t gpuEndTimestamp = 0u;
|
|
|
|
|
|
2022-10-27 11:40:44 +00:00
|
|
|
uint32_t maxKernelCount = 0;
|
2022-04-08 18:48:45 +00:00
|
|
|
uint32_t kernelCount = 1u;
|
2022-10-27 11:40:44 +00:00
|
|
|
uint32_t maxPacketCount = 0;
|
2022-10-27 11:40:44 +00:00
|
|
|
uint32_t totalEventSize = 0;
|
2022-04-08 18:48:45 +00:00
|
|
|
|
2023-01-12 14:21:51 +00:00
|
|
|
std::atomic<State> isCompleted{STATE_INITIAL};
|
|
|
|
|
|
2021-06-09 20:15:59 +00:00
|
|
|
bool isTimestampEvent = false;
|
2022-04-04 19:07:08 +00:00
|
|
|
bool usingContextEndOffset = false;
|
2022-10-27 11:40:44 +00:00
|
|
|
bool signalAllEventPackets = false;
|
2020-03-06 11:09:57 +01:00
|
|
|
};
|
|
|
|
|
|
2021-07-22 15:27:05 +00:00
|
|
|
template <typename TagSizeT>
|
2021-10-06 19:05:16 +00:00
|
|
|
class KernelEventCompletionData : public NEO::TimestampPackets<TagSizeT> {
|
2021-07-22 15:27:05 +00:00
|
|
|
public:
|
|
|
|
|
uint32_t getPacketsUsed() const { return packetsUsed; }
|
|
|
|
|
void setPacketsUsed(uint32_t value) { packetsUsed = value; }
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
uint32_t packetsUsed = 1;
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-18 11:31:17 +00:00
|
|
|
template <typename TagSizeT>
|
2020-09-03 09:06:11 +02:00
|
|
|
struct EventImp : public Event {
|
2021-07-22 15:27:05 +00:00
|
|
|
|
2022-11-25 10:44:10 +00:00
|
|
|
EventImp(EventPool *eventPool, int index, Device *device, bool downloadAllocationRequired)
|
2023-01-12 09:24:14 +00:00
|
|
|
: Event(eventPool, index, device), downloadAllocationRequired(downloadAllocationRequired) {
|
2021-12-08 11:12:14 +00:00
|
|
|
contextStartOffset = NEO::TimestampPackets<TagSizeT>::getContextStartOffset();
|
|
|
|
|
contextEndOffset = NEO::TimestampPackets<TagSizeT>::getContextEndOffset();
|
|
|
|
|
globalStartOffset = NEO::TimestampPackets<TagSizeT>::getGlobalStartOffset();
|
|
|
|
|
globalEndOffset = NEO::TimestampPackets<TagSizeT>::getGlobalEndOffset();
|
2022-10-27 11:40:44 +00:00
|
|
|
timestampSizeInDw = (sizeof(TagSizeT) / sizeof(uint32_t));
|
2021-12-08 11:12:14 +00:00
|
|
|
singlePacketSize = NEO::TimestampPackets<TagSizeT>::getSinglePacketSize();
|
|
|
|
|
}
|
2020-09-03 09:06:11 +02:00
|
|
|
|
|
|
|
|
~EventImp() override {}
|
|
|
|
|
|
|
|
|
|
ze_result_t hostSignal() override;
|
|
|
|
|
|
|
|
|
|
ze_result_t hostSynchronize(uint64_t timeout) override;
|
|
|
|
|
|
|
|
|
|
ze_result_t queryStatus() override;
|
|
|
|
|
|
|
|
|
|
ze_result_t reset() override;
|
|
|
|
|
|
|
|
|
|
ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) override;
|
2021-08-05 06:50:38 +00:00
|
|
|
ze_result_t queryTimestampsExp(Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) override;
|
2020-09-03 09:06:11 +02:00
|
|
|
|
2022-10-27 22:14:39 +00:00
|
|
|
void resetDeviceCompletionData(bool resetAllPackets);
|
|
|
|
|
void resetKernelCountAndPacketUsedCount() override;
|
|
|
|
|
|
2021-05-18 11:31:17 +00:00
|
|
|
uint64_t getPacketAddress(Device *device) override;
|
2022-10-27 11:40:44 +00:00
|
|
|
uint32_t getPacketsInUse() const override;
|
2022-04-17 01:13:30 +00:00
|
|
|
uint32_t getPacketsUsedInLastKernel() override;
|
2021-05-18 11:31:17 +00:00
|
|
|
void setPacketsInUse(uint32_t value) override;
|
|
|
|
|
|
2021-10-06 19:05:16 +00:00
|
|
|
std::unique_ptr<KernelEventCompletionData<TagSizeT>[]> kernelEventCompletionData;
|
2021-05-18 11:31:17 +00:00
|
|
|
|
2022-11-25 10:44:10 +00:00
|
|
|
const bool downloadAllocationRequired = false;
|
2020-09-03 09:06:11 +02:00
|
|
|
|
|
|
|
|
protected:
|
2020-09-15 09:33:12 +02:00
|
|
|
ze_result_t calculateProfilingData();
|
2022-04-08 18:48:45 +00:00
|
|
|
ze_result_t queryStatusEventPackets();
|
2022-09-14 09:24:47 +00:00
|
|
|
MOCKABLE_VIRTUAL ze_result_t hostEventSetValue(TagSizeT eventValue);
|
2021-05-18 11:31:17 +00:00
|
|
|
ze_result_t hostEventSetValueTimestamps(TagSizeT eventVal);
|
2022-09-14 09:24:47 +00:00
|
|
|
MOCKABLE_VIRTUAL void assignKernelEventCompletionData(void *address);
|
2022-10-27 11:40:44 +00:00
|
|
|
void setRemainingPackets(TagSizeT eventVal, void *nextPacketAddress, uint32_t packetsAlreadySet);
|
2020-09-03 09:06:11 +02:00
|
|
|
};
|
|
|
|
|
|
2020-03-06 11:09:57 +01:00
|
|
|
struct EventPool : _ze_event_pool_handle_t {
|
2021-11-09 14:44:11 +00:00
|
|
|
static EventPool *create(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices, const ze_event_pool_desc_t *desc, ze_result_t &result);
|
2020-03-06 11:09:57 +01:00
|
|
|
virtual ~EventPool() = default;
|
|
|
|
|
virtual ze_result_t destroy() = 0;
|
2023-01-16 16:53:05 +00:00
|
|
|
virtual ze_result_t getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle) = 0;
|
2020-03-06 11:09:57 +01:00
|
|
|
virtual ze_result_t closeIpcHandle() = 0;
|
|
|
|
|
virtual ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) = 0;
|
|
|
|
|
virtual Device *getDevice() = 0;
|
|
|
|
|
|
|
|
|
|
static EventPool *fromHandle(ze_event_pool_handle_t handle) {
|
|
|
|
|
return static_cast<EventPool *>(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline ze_event_pool_handle_t toHandle() { return this; }
|
|
|
|
|
|
2020-10-13 17:23:09 -07:00
|
|
|
virtual NEO::MultiGraphicsAllocation &getAllocation() { return *eventPoolAllocations; }
|
2020-03-06 11:09:57 +01:00
|
|
|
|
2022-10-27 11:40:44 +00:00
|
|
|
uint32_t getEventSize() const { return eventSize; }
|
|
|
|
|
void setEventSize(uint32_t size) { eventSize = size; }
|
|
|
|
|
void setEventAlignment(uint32_t alignment) { eventAlignment = alignment; }
|
|
|
|
|
size_t getNumEvents() const { return numEvents; }
|
|
|
|
|
uint32_t getEventMaxPackets() const { return eventPackets; }
|
|
|
|
|
size_t getEventPoolSize() const { return eventPoolSize; }
|
2020-03-06 11:09:57 +01:00
|
|
|
|
2023-01-16 15:30:27 +00:00
|
|
|
bool isEventPoolTimestampFlagSet();
|
2021-06-09 20:15:59 +00:00
|
|
|
|
|
|
|
|
bool isEventPoolDeviceAllocationFlagSet() {
|
|
|
|
|
if (!(eventPoolFlags & ZE_EVENT_POOL_FLAG_HOST_VISIBLE)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2020-03-06 11:09:57 +01:00
|
|
|
|
2022-12-13 18:50:36 +00:00
|
|
|
uint32_t getMaxKernelCount() const {
|
|
|
|
|
return maxKernelCount;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-07 15:41:43 +00:00
|
|
|
std::unique_ptr<NEO::MultiGraphicsAllocation> eventPoolAllocations;
|
2021-06-09 20:15:59 +00:00
|
|
|
ze_event_pool_flags_t eventPoolFlags;
|
2022-12-15 08:15:18 -08:00
|
|
|
bool isDeviceEventPoolAllocation = false;
|
|
|
|
|
bool isHostVisibleEventPoolAllocation = false;
|
2022-10-27 11:40:44 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
EventPool() = default;
|
|
|
|
|
EventPool(size_t numEvents) : numEvents(numEvents) {}
|
|
|
|
|
|
|
|
|
|
size_t numEvents = 1;
|
|
|
|
|
size_t eventPoolSize = 0;
|
|
|
|
|
uint32_t eventAlignment = 0;
|
|
|
|
|
uint32_t eventSize = 0;
|
|
|
|
|
uint32_t eventPackets = 0;
|
2022-12-13 18:50:36 +00:00
|
|
|
uint32_t maxKernelCount = 0;
|
2020-10-13 17:23:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct EventPoolImp : public EventPool {
|
2022-10-27 11:40:44 +00:00
|
|
|
EventPoolImp(const ze_event_pool_desc_t *desc) : EventPool(desc->count) {
|
2021-06-09 20:15:59 +00:00
|
|
|
eventPoolFlags = desc->flags;
|
2020-10-13 17:23:09 -07:00
|
|
|
}
|
|
|
|
|
|
2021-05-18 16:28:14 +00:00
|
|
|
ze_result_t initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices);
|
2020-10-13 17:23:09 -07:00
|
|
|
|
2022-05-09 17:40:30 +00:00
|
|
|
~EventPoolImp() override;
|
2020-10-13 17:23:09 -07:00
|
|
|
|
|
|
|
|
ze_result_t destroy() override;
|
|
|
|
|
|
2023-01-16 16:53:05 +00:00
|
|
|
ze_result_t getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle) override;
|
2020-10-13 17:23:09 -07:00
|
|
|
|
|
|
|
|
ze_result_t closeIpcHandle() override;
|
|
|
|
|
|
|
|
|
|
ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override;
|
|
|
|
|
|
2022-12-20 04:30:24 +00:00
|
|
|
void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment);
|
2020-10-13 17:23:09 -07:00
|
|
|
|
|
|
|
|
Device *getDevice() override { return devices[0]; }
|
|
|
|
|
|
|
|
|
|
std::vector<Device *> devices;
|
2022-10-27 11:40:44 +00:00
|
|
|
void *eventPoolPtr = nullptr;
|
2021-05-24 06:14:30 +00:00
|
|
|
ContextImp *context = nullptr;
|
2021-08-18 19:40:09 +00:00
|
|
|
bool isImportedIpcPool = false;
|
2022-08-03 14:06:59 -07:00
|
|
|
bool isShareableEventMemory = false;
|
2020-03-06 11:09:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace L0
|