dpctl.SyclQueue.memset_async

SyclQueue.memset_async(mem, val, count=0, dEvents=None)

Fill USM allocation mem with the byte value val asynchronously.

Internally, this dispatches sycl::queue::memset. The operation is byte-wise: count bytes are set, each to the same value val.

Note

The returned event does not keep mem alive. Keep mem alive until the event completes, otherwise its USM allocation may be freed mid-operation, causing a use-after-free.

Parameters:
  • mem – Destination USM allocation, an instance of dpctl.memory._Memory.

  • val (int) – Value to fill mem with. Following sycl::queue::memset, it is interpreted as an unsigned char, i.e. only the least significant byte is used.

  • count (int, optional) – Number of bytes to fill. If 0 or greater than the size of mem, the whole allocation is filled. Default: 0.

  • dEvents (List[dpctl.SyclEvent], optional) – Events that this operation depends on.

Returns:

Event associated with the memset operation.

Return type:

dpctl.SyclEvent

Raises:
  • TypeError – If mem is not an instance of dpctl.memory._Memory, or dEvents is not a sequence of dpctl.SyclEvent.

  • OverflowError – If val does not fit in a C int or count is negative.

  • RuntimeError – If the memset operation encountered an error.