Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Public Member Functions | Friends | List of all members
uni20::cuda::StreamPool Class Reference

Device-local pool whose streams become available only after their queued work completes. More...

#include <runtime.hpp>

Classes

struct  Config
 Configuration for a device-local idle-stream pool. More...
 
class  Impl
 

Public Member Functions

Stream acquire ()
 Block until one actually idle stream can be leased.
 
std::optional< Stream > acquire_or_enqueue (detail::StreamWaiter &waiter) noexcept
 Register an internal awaiter unless a stream is immediately available.
 
int device () const noexcept
 Return the device served by this pool.
 
std::size_t idle_stream_count () const noexcept
 Return the number of streams whose prior work has completed.
 
std::size_t leased_stream_count () const noexcept
 Return the number of streams currently held by submitters.
 
StreamPool & operator= (StreamPool const &)=delete
 
std::size_t pending_stream_count () const noexcept
 Return the number of streams awaiting device completion.
 
std::size_t size () const noexcept
 Return the total number of stream slots.
 
 StreamPool (Config config)
 Create stream_count streams for one CUDA device.
 
 StreamPool (StreamPool const &)=delete
 
void synchronize ()
 Synchronize every stream and process all queued pool-return callbacks.
 
std::optional< Stream > try_acquire ()
 Try to lease one actually idle stream without waiting.
 
 ~StreamPool ()
 

Friends

class Stream::State
 

Detailed Description

Device-local pool whose streams become available only after their queued work completes.

The pool must outlive every Stream handle acquired from it.

Constructor & Destructor Documentation

◆ StreamPool() [1/2]

uni20::cuda::StreamPool::StreamPool ( Config  config)
explicit

Create stream_count streams for one CUDA device.

◆ StreamPool() [2/2]

uni20::cuda::StreamPool::StreamPool ( StreamPool const &  )
delete

◆ ~StreamPool()

uni20::cuda::StreamPool::~StreamPool ( )
default

Member Function Documentation

◆ acquire()

Stream uni20::cuda::StreamPool::acquire ( )

Block until one actually idle stream can be leased.

Pool-return CUDA callbacks notify blocked callers directly; no scheduler participation is required.

◆ acquire_or_enqueue()

std::optional< Stream > uni20::cuda::StreamPool::acquire_or_enqueue ( detail::StreamWaiter &  waiter)
noexcept

Register an internal awaiter unless a stream is immediately available.

◆ device()

int uni20::cuda::StreamPool::device ( ) const
noexcept

Return the device served by this pool.

◆ idle_stream_count()

std::size_t uni20::cuda::StreamPool::idle_stream_count ( ) const
noexcept

Return the number of streams whose prior work has completed.

◆ leased_stream_count()

std::size_t uni20::cuda::StreamPool::leased_stream_count ( ) const
noexcept

Return the number of streams currently held by submitters.

◆ operator=()

StreamPool & uni20::cuda::StreamPool::operator= ( StreamPool const &  )
delete

◆ pending_stream_count()

std::size_t uni20::cuda::StreamPool::pending_stream_count ( ) const
noexcept

Return the number of streams awaiting device completion.

◆ size()

std::size_t uni20::cuda::StreamPool::size ( ) const
noexcept

Return the total number of stream slots.

◆ synchronize()

void uni20::cuda::StreamPool::synchronize ( )

Synchronize every stream and process all queued pool-return callbacks.

◆ try_acquire()

std::optional< Stream > uni20::cuda::StreamPool::try_acquire ( )

Try to lease one actually idle stream without waiting.

Friends And Related Symbol Documentation

◆ Stream::State

friend class Stream::State
friend

The documentation for this class was generated from the following files: