XPU Streams#
XPU streams provide a mechanism for asynchronous execution of operations on Intel GPUs. Like CUDA streams, operations queued to the same stream execute in order, while operations on different streams can execute concurrently.
XPUStream#
-
class XPUStream#
-
Public Functions
-
inline explicit XPUStream(Stream stream)#
Construct a XPUStream from a Stream.
This construction is checked, and will raise an error if the Stream is not, in fact, a XPU stream.
-
inline operator sycl::queue&() const#
Implicit conversion to sycl::queue&.
-
inline operator sycl::queue*() const#
Implicit conversion to sycl::queue*.
-
inline operator Stream() const#
Implicit conversion to Stream (a.k.a., forget that the stream is a XPU stream).
-
inline DeviceType device_type() const#
Get the XPU device type that this stream is associated with.
-
inline DeviceIndex device_index() const#
Get the XPU device index that this stream is associated with.
-
inline Device device() const#
Get the full Device that this stream is associated with.
The Device is guaranteed to be a XPU device.
-
inline StreamId id() const#
Return the stream ID corresponding to this particular stream.
StreamId is a int64_t representation generated by its type and index.
-
inline bool query() const#
Return true if all enqueued tasks in this stream have been completed, otherwise return false.
-
inline void synchronize() const#
Performs a blocking wait for the completion of all enqueued tasks in this stream.
-
int priority() const#
Return the priority that this stream is associated with.
Lower numbers represent higher priority.
-
sycl::queue &queue() const#
Explicit conversion to sycl::queue&.
-
inline explicit XPUStream(Stream stream)#
Example:
#include <c10/xpu/XPUStream.h>
// Get the current XPU stream
auto stream = c10::xpu::getCurrentXPUStream();
// Create a new stream from the pool
auto new_stream = c10::xpu::getStreamFromPool();
// Synchronize
stream.synchronize();
Acquiring XPU Streams#
-
XPUStream c10::xpu::getCurrentXPUStream(DeviceIndex device = -1)#
Get the current XPU stream, for the passed XPU device, or for the current device if no device index is passed.
Stream Synchronization#
-
void c10::xpu::syncStreamsOnDevice(DeviceIndex device = -1)#
Block all reserved SYCL queues in the stream pools on the device, and wait for their synchronizations.