|
| 1 | +<% |
| 2 | +import re |
| 3 | +from templates import helper as th |
| 4 | +%><% |
| 5 | + OneApi=tags['$OneApi'] |
| 6 | + x=tags['$x'] |
| 7 | + X=x.upper() |
| 8 | +%> |
| 9 | +:orphan: |
| 10 | + |
| 11 | +.. _ZE_experimental_event_pool_counter_based: |
| 12 | + |
| 13 | +===================================== |
| 14 | + Counter-Based Event Pools Extension |
| 15 | +===================================== |
| 16 | + |
| 17 | +API |
| 18 | +---- |
| 19 | + |
| 20 | +* Enumerations |
| 21 | + |
| 22 | + * ${x}_event_pool_counter_based_exp_flags_t |
| 23 | + * ${x}_event_pool_counter_based_exp_version_t |
| 24 | + |
| 25 | +* Structures |
| 26 | + |
| 27 | + * ${x}_event_pool_counter_based_exp_desc_t |
| 28 | + |
| 29 | +Counter-Based Events |
| 30 | +~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 31 | + |
| 32 | +By default, events in Level Zero contains one of two states: signaled or not signaled. |
| 33 | +Signaling of an event, as well as resetting its state, can be done from either host or |
| 34 | +device. |
| 35 | + |
| 36 | +Another way of tracking the state of an event is by using a counter, which is incremented |
| 37 | +every time a task has completed in the device. Using a counter-based event may provide |
| 38 | +Level Zero driver implementations with the opportunity for both functional and performance |
| 39 | +optimizations. |
| 40 | + |
| 41 | +The following recommendations and restrictions apply to counter-based events: |
| 42 | + |
| 43 | +- Counter-based events can be used only with in-orders lists, whether those are regular or immediate. |
| 44 | +- Counter-based events must not be reset, i.e., a call to ${x}EventHostReset or ${x}CommandListAppendEventReset |
| 45 | + is not allowed. |
| 46 | +- Counter-based events must not be signaled from host, i.e., a call to ${x}EventHostSignal is not allowed. |
| 47 | +- Counter-based events may be reused multiple times without a need for reset. |
| 48 | +- Counter-based events may be used on multiple command lists. |
| 49 | +- Querying a counter-based event queries only the last saved counter value from the last command list that incremented it, |
| 50 | + i.e., a signaled counter-based event always represents the completion of the last call to which it was passed as signal event. |
| 51 | +- Synchronizing on a counter-based event waits only for the last saved counter value from the last command list that incremented it. |
| 52 | +- A counter-based event may be passed as signaling event for a new append call without needing to wait for the signaling of |
| 53 | + the last call where it was used. |
| 54 | + |
| 55 | +Counter-based events can be created by passing ${x}_event_pool_counter_based_exp_desc_t to ${x}EventPoolCreate |
| 56 | +as pNext member of ${x}_event_pool_desc_t. |
| 57 | + |
| 58 | +.. parsed-literal:: |
| 59 | +
|
| 60 | + uint32_t numEvents = 2; |
| 61 | + ${x}_event_pool_handle_t eventPool = {}; |
| 62 | + ${x}_event_pool_desc_t eventPoolDesc = {${X}_STRUCTURE_TYPE_EVENT_POOL_DESC}; |
| 63 | + eventPoolDesc.count = numEvents; |
| 64 | +
|
| 65 | + ${x}_event_pool_counter_based_exp_desc_t counterBasedDesc = {${X}_STRUCTURE_TYPE_COUNTER_BASED_EVENT_POOL_EXP_DESC}; |
| 66 | + counterBasedDesc.flags = ${X}_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE; |
| 67 | + eventPoolDesc.pNext = &counterBasedDesc; |
| 68 | +
|
| 69 | + ${x}_result_t = zeEventPoolCreate(context, &eventPoolDesc, 1, &device, &eventPool)); |
0 commit comments