Skip to content

Commit ff67943

Browse files
feature: extend external CB alloc capabilities
Related-To: NEO-13971 Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 2451727 commit ff67943

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

level_zero/doc/experimental_extensions/COUNTER_BASED_EVENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SPDX-License-Identifier: MIT
1111
* [Overview](#Overview)
1212
* [Creation](#Creation)
1313
* [External storage](#External-storage)
14+
* [Aggregated event](#Aggregated-event)
1415
* [Obtaining counter memory and value](#Obtaining-counter-memory-and-value)
1516
* [IPC sharing](#IPC-sharing)
1617
* [Regular command list](#Regular-command-list)
@@ -98,6 +99,19 @@ User may optionally specify externally managed counter allocation and value. Thi
9899
- User is responsible for updating both memory locations to >= `completionValue` to signal Event completion
99100
- Signaling such event, replaces the state (as described previously)
100101
102+
# Aggregated event
103+
Aggregated event is a special use case for CB Events. It can be signaled from multiple append calls, but waiting requires only one memory compare operation.
104+
It can be created by passing `zex_counter_based_event_external_storage_properties_t` as extension of `zex_counter_based_event_desc_t`.
105+
106+
**Requirements:**
107+
- This extension cannot be used with "external storage" extension
108+
- User must ensure device allocation (`deviceAddress`) residency. It must be accessible by GPU
109+
- Driver will use `deviceAddress` for host synchronization as USM allocation. It must be accessible by CPU
110+
- Signaling such event, will not replace its state (as described previously). It can be passed to multiple append calls and each append will increment the storage by `incrementValue` (atomically) on GPU
111+
- Using aggregated event as dependency, requires only one memory compare operation against final value: `completionValue` >= `*deviceAddress`
112+
- Device storage is under Users control. It may be reset manually if needed
113+
- Profiling is not possible if producers originate on different GPUs (different timestamp domains)
114+
101115
# Obtaining counter memory and value
102116
User may obtain counter memory location and value. For example, waiting for completion outside the L0 Driver.
103117
If Event state is replaced by new append call or `zeCommandQueueExecuteCommandLists` that signals such Event, below API must be called again to obtain new data.

level_zero/include/level_zero/driver_experimental/zex_common.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022-2024 Intel Corporation
2+
* Copyright (C) 2022-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -209,6 +209,17 @@ typedef struct _zex_counter_based_event_external_sync_alloc_properties_t {
209209
uint64_t completionValue; ///< [in] completion value for external synchronization allocation
210210
} zex_counter_based_event_external_sync_alloc_properties_t;
211211

212+
///////////////////////////////////////////////////////////////////////////////
213+
/// @brief Initial Counter Based Event synchronization parameters. This structure may be
214+
/// passed as pNext member of ::zex_counter_based_event_desc_t.
215+
typedef struct _zex_counter_based_event_external_storage_properties_t {
216+
ze_structure_type_t stype; ///< [in] type of this structure
217+
const void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
218+
uint64_t *deviceAddress; ///< [in] device address that would be updated with atomic_add upon signaling of this event, must be device USM memory
219+
uint64_t incrementValue; ///< [in] value which would by atomically added upon each completion
220+
uint64_t completionValue; ///< [in] final completion value, when value under deviceAddress is equal or greater then this value then event is considered as completed
221+
} zex_counter_based_event_external_storage_properties_t;
222+
212223
#if defined(__cplusplus)
213224
} // extern "C"
214225
#endif

0 commit comments

Comments
 (0)