You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/core/PROG.rst
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1612,6 +1612,7 @@ Key features
1612
1612
- ${x}EventHostSignal is not allowed. Can be signaled only from in-order command list
1613
1613
- No need to wait for completion before reusing/destroying
1614
1614
- CB Event doesn't own any memory allocations. Can be reused/destroyed with low cost. Timestamp allocation is also handled internally by the Driver
1615
+
- A CB Event's device association is not fixed at creation. It re-associates with the signaling device on each signal operation. See `Device association`_.
1615
1616
- IPC sharing is one-directional. IPC CB Event opened in different process can be used only for waiting. If original Event state is changed (for example by next append call) and second process needs to see that update, IPC handle must be opened again.
1616
1617
- Regular command list (known as recorded or non-immediate) is a special use case for CB Events. Will be described in separate section
1617
1618
- When Event is reset (assigned as signal event to new append call), new timestamp data storage is provided implicitly. User can immediately query new data, without handling the completion
@@ -1634,6 +1635,21 @@ Regular Event rely on memory state controlled by the user (explicit Reset calls)
1634
1635
1635
1636
${x}EventHostSynchronize(event1, UINT32_MAX); // wait for counter=Y on memory CL3_alloc
1636
1637
1638
+
Device association
1639
+
^^^^^^^^^^^^^^^^^^^
1640
+
Unlike Regular Events, a CB Event's device association is not fixed by the device passed to ${x}EventCounterBasedCreate. Its association follows the latest signaling point:
1641
+
1642
+
- After creation, the Event is associated with the device passed to ${x}EventCounterBasedCreate. This initial association does not restrict on which device the Event may later be signaled.
1643
+
- When the Event is passed as a signal event to an append call, it drops its previous tracking point and re-associates with the device on which that command list was created. The Event may be signaled on any device, regardless of the device used to create it or the device that signaled it previously. No peer-to-peer access between the previous and the new signaling device is required.
1644
+
- Waiting on the Event (for example ${x}CommandListAppendWaitOnEvents) does not change its association. The waiting device must have peer-to-peer access to the device that last had the Event enqueued for signaling (or, if the Event has not been enqueued for signaling yet, the device it is currently associated with).
1645
+
1646
+
.. parsed-literal::
1647
+
${x}EventCounterBasedCreate(context, deviceA, &desc, &event); // associated with deviceA
1648
+
${x}CommandListAppendSignalEvent(cmdListDeviceB, event); // re-associates with deviceB (no P2P deviceA<->deviceB required)
1649
+
${x}CommandListAppendWaitOnEvents(cmdListDeviceC, 1, &event); // deviceC must have P2P access to deviceB
1650
+
1651
+
This is also the basis for IPC sharing: an opened IPC CB Event tracks the signaling device and can be waited on from any device that has peer-to-peer access to it.
1652
+
1637
1653
IPC sharing
1638
1654
^^^^^^^^^^^
1639
1655
As mentioned previously, signaling CB Event replaces its state. This is why IPC sharing is one-directional. Opened event can be used only for waiting/querying (on host and GPU).
Copy file name to clipboardExpand all lines: scripts/core/event.yml
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -492,7 +492,8 @@ analogue:
492
492
- "**clSetUserEventStatus**"
493
493
- vkCmdSetEvent
494
494
details:
495
-
- "The application must ensure the events are accessible by the device on which the command list was created."
495
+
- "The application must ensure the events are accessible by the device on which the command list was created. This requirement does not apply to counter-based events."
496
+
- "For counter-based events, the event may be signaled on any device, regardless of the device used to create the event. When a counter-based event is passed for signaling, it drops its previous tracking point and re-associates with the device on which the command list was created, tracking the new signaling point. No peer-to-peer access between the previously associated device and the new signaling device is required."
496
497
- "The duration of an event created from an event pool that was created using $X_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or $X_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flags is undefined. However, for consistency and orthogonality the event will report correctly as signaled when used by other event API functionality."
497
498
- "The application must ensure the command list and events were created on the same context."
498
499
- "The application must **not** call this function from simultaneous threads with the same command list handle."
@@ -513,6 +514,7 @@ class: $xCommandList
513
514
name: AppendWaitOnEvents
514
515
details:
515
516
- "The application must ensure the events are accessible by the device on which the command list was created."
517
+
- "For counter-based events, the device on which the command list was created must have peer-to-peer access to the device that last signaled the event. Unlike signaling, waiting on a counter-based event does not re-associate it with another device."
516
518
- "The application must ensure the command list and events were created on the same context."
517
519
- "The application must **not** call this function from simultaneous threads with the same command list handle."
518
520
- "The implementation of this function should be lock-free."
0 commit comments