katgpucbf.queue_item module

Provide QueueItem.

class katgpucbf.queue_item.QueueItem(timestamp: int = 0)[source]

Bases: object

Queue Item for use in synchronisation between command queues.

Derived classes will have allocated memory regions associated with them, appropriately sized for input or output data. Actions (whether kernel executions or copies to or from the device) for these memory regions are initiated, and then an event marker is added to the list in some variation of this manner:

my_item.add_marker(command_queue)

The item can then be passed through a queue to the next stage in the program, which waits for the operations to be complete using enqueue_wait_for_events() or async_wait_for_events(). This indicates that the operation is complete and the next thing can be done with whatever data is in that region of memory.

add_marker(command_queue: AbstractCommandQueue) AbstractEvent[source]

Indicate that previous work on command_queue uses this item.

Future calls to enqueue_wait_for_events() or async_wait_for_events() will wait for all work issued to command_queue up to this point.

The associated event is returned.

async async_wait_for_events() None[source]

Wait for all events in the list of events to be complete.

enqueue_wait_for_events(command_queue: AbstractCommandQueue) None[source]

Block execution of a command queue until all of this item’s events are finished.

Future work enqueued to command_queue will be sequenced after any work associated with the stored events.

property events: tuple[AbstractEvent, ...]

Get a copy of the currently registered events.

reset(timestamp: int = 0) None[source]

Reset the item’s timestamp.

Subclasses should override this to reset other state. It is called by the constructor so it can also be used for initialisation.

timestamp: int

Timestamp of the item.