feature: add graph flag to cb event

Related-To: NEO-15375

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2025-08-19 13:34:12 +00:00
committed by Compute-Runtime-Automation
parent fd610f7a7b
commit fdb66be0d8
6 changed files with 29 additions and 4 deletions

View File

@@ -58,6 +58,7 @@ zexCounterBasedEventCreate2(ze_context_handle_t hContext, ze_device_handle_t hDe
const bool ipcFlag = !!(counterBasedEventDesc->flags & ZEX_COUNTER_BASED_EVENT_FLAG_IPC);
const bool timestampFlag = !!(counterBasedEventDesc->flags & ZEX_COUNTER_BASED_EVENT_FLAG_KERNEL_TIMESTAMP);
const bool mappedTimestampFlag = !!(counterBasedEventDesc->flags & ZEX_COUNTER_BASED_EVENT_FLAG_KERNEL_MAPPED_TIMESTAMP);
const bool graphExternalEvent = !!(counterBasedEventDesc->flags & ZEX_COUNTER_BASED_EVENT_FLAG_GRAPH_EXTERNAL_EVENT);
uint32_t inputCbFlags = counterBasedEventDesc->flags & supportedBasedFlags;
if (inputCbFlags == 0) {
@@ -88,6 +89,7 @@ zexCounterBasedEventCreate2(ze_context_handle_t hContext, ze_device_handle_t hDe
.kernelMappedTsPoolFlag = mappedTimestampFlag,
.importedIpcPool = false,
.ipcPool = ipcFlag,
.graphExternalEvent = graphExternalEvent,
};
ze_result_t result = ZE_RESULT_SUCCESS;

View File

@@ -102,6 +102,7 @@ struct EventDescriptor {
bool kernelMappedTsPoolFlag = false;
bool importedIpcPool = false;
bool ipcPool = false;
bool graphExternalEvent = false;
};
struct Event : _ze_event_handle_t {
@@ -362,6 +363,10 @@ struct Event : _ze_event_handle_t {
this->optimizedCbEvent = value;
}
bool isGraphExternalEvent() const {
return this->graphExternalEvent;
}
protected:
Event(int index, Device *device) : device(device), index(index) {}
@@ -373,7 +378,10 @@ struct Event : _ze_event_handle_t {
void releaseTempInOrderTimestampNodes();
virtual void clearTimestampTagData(uint32_t partitionCount, NEO::TagNodeBase *newNode) = 0;
static const uint64_t completionTimeoutMs;
EventPool *eventPool = nullptr;
CommandList *recordedSignalFrom = nullptr;
uint64_t timestampRefreshIntervalInNanoSec = 0;
@@ -442,10 +450,7 @@ struct Event : _ze_event_handle_t {
bool reportEmptyCbEventAsReady = true;
bool isEventOnBarrierOptimized = false;
bool optimizedCbEvent = false;
static const uint64_t completionTimeoutMs;
CommandList *recordedSignalFrom = nullptr;
bool graphExternalEvent = false;
};
struct EventPool : _ze_event_pool_handle_t {

View File

@@ -115,6 +115,7 @@ Event *Event::create(const EventDescriptor &eventDescriptor, Device *device, ze_
if (result != ZE_RESULT_SUCCESS) {
return nullptr;
}
event->graphExternalEvent = eventDescriptor.graphExternalEvent;
return event.release();
}
@@ -135,6 +136,7 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
.kernelMappedTsPoolFlag = eventPool->isEventPoolKernelMappedTsFlagSet(),
.importedIpcPool = eventPool->getImportedIpcPool(),
.ipcPool = eventPool->isIpcPoolFlagSet(),
.graphExternalEvent = false,
};
if (eventPool->getCounterBasedFlags() != 0) {

View File

@@ -126,6 +126,7 @@ struct InOrderCmdListFixture : public ::Test<ModuleFixture> {
.kernelMappedTsPoolFlag = false,
.importedIpcPool = false,
.ipcPool = false,
.graphExternalEvent = false,
};
standaloneCbEventStorage.push_back(1);

View File

@@ -5189,6 +5189,19 @@ TEST_F(EventTests, givenNullDescriptorWhenCreatingCbEvent2ThenEventWithNoProfili
zeEventDestroy(handle);
}
TEST_F(EventTests, givenDescriptorWithGraphFlagWhenCreatingCbEvent2ThenEventWithGraphFlagIsCreated) {
ze_event_handle_t handle = nullptr;
zex_counter_based_event_desc_t desc = {ZEX_STRUCTURE_COUNTER_BASED_EVENT_DESC};
desc.flags = static_cast<uint32_t>(ZEX_COUNTER_BASED_EVENT_FLAG_GRAPH_EXTERNAL_EVENT);
EXPECT_EQ(ZE_RESULT_SUCCESS, zexCounterBasedEventCreate2(context, device, &desc, &handle));
auto eventObj = Event::fromHandle(handle);
EXPECT_TRUE(eventObj->isCounterBasedExplicitlyEnabled());
EXPECT_TRUE(eventObj->isGraphExternalEvent());
zeEventDestroy(handle);
}
TEST_F(EventTests, givenInvalidExtensionArgumentWhenCreatingEventThenDoNotAbortAndReturnErrorCode) {
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;

View File

@@ -178,6 +178,8 @@ typedef enum _zex_counter_based_event_exp_flag_t {
ZEX_COUNTER_BASED_EVENT_FLAG_KERNEL_TIMESTAMP = ZE_BIT(4), ///< Event contains kernel timestamps
ZEX_COUNTER_BASED_EVENT_FLAG_KERNEL_MAPPED_TIMESTAMP = ZE_BIT(5), ///< Event contains kernel timestamps synchronized to host time domain.
///< Cannot be combined with::ZEX_COUNTER_BASED_EVENT_FLAG_KERNEL_TIMESTAMP
ZEX_COUNTER_BASED_EVENT_FLAG_GRAPH_EXTERNAL_EVENT = ZE_BIT(6), ///< Event when is used in graph record & replay, can be used outside
///< recorded graph for synchronization (using as wait event or for host synchronization)
ZEX_COUNTER_BASED_EVENT_FLAG_FORCE_UINT32 = 0x7fffffff
} zex_counter_based_event_exp_flag_t;