dpctl.SyclQueue.fill_async

SyclQueue.fill_async(dest, value, count, dEvents=None, dtype='u1')

Fill dest with count copies of value asynchronously.

Internally, this dispatches sycl::queue::fill, which sets each of the count elements of dest to value. The number of bytes written is count multiplied by the size of dtype. The default dtype of "u1" (a single byte) makes the default a byte-wise fill, analogous to memset.

Note

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

Parameters:
  • dest (dpctl.memory._Memory) – Destination USM allocation to fill.

  • value (int, float, complex) – Value used to fill dest. It is reinterpreted according to dtype: integral dtype values expect a Python integer, "f4" and "f8" expect a Python float, and "c8" and "c16" expect a Python complex.

  • count (int) – Number of elements to fill.

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

  • dtype (str, optional) – Data type string of the fill elements. Determines the element size and how value is interpreted. Defaults to "u1" (one byte per element). Supported types: i1, u1, i2, u2, i4, u4, i8, u8, f4, f8, c8, c16.

Returns:

Event associated with the fill operation.

Return type:

dpctl.SyclEvent

Raises:
  • TypeError – If dest is not a dpctl.memory._Memory USM allocation, or dEvents is not a sequence of dpctl.SyclEvent.

  • ValueError – If dtype is unrecognized, or value cannot be represented as dtype.

  • OverflowError – If count is negative.

  • RuntimeError – If the fill operation encountered an error.