|
Uni20
Asynchronous tensor and runtime library.
|
This represents the reverse-mode adjoint for functions of complex variables, assuming a real-valued scalar loss function ( L \colon \mathbb{C} \to \mathbb{R} ). More...
Classes | |
| struct | AllAwaiter |
| Awaitable that waits for all provided awaiters to complete. More... | |
| class | Async |
| Async<T> is a container for coroutine-safe asynchronous read/write. More... | |
| class | async_cancellation |
| Base class for cancellation-related async exceptions. More... | |
| struct | async_do_not_start_t |
| Tag type to construct an Async without starting the queue object. More... | |
| class | async_error |
| Base class for all async subsystem exceptions. More... | |
| class | async_state_error |
| Base class for invalid async state transitions or accesses. More... | |
| class | async_storage_missing |
| Thrown when Async storage metadata is missing unexpectedly. More... | |
| struct | async_value_type |
Strip Async<T> to T for assignment and expression type deduction. More... | |
| struct | async_value_type< Async< T > > |
| struct | async_value_type< ReverseValue< T > > |
| class | async_value_uninitialized |
| Thrown when an Async value is accessed before initialization. More... | |
| class | AsyncTask |
| Canonical host-oriented coroutine task type. More... | |
| class | AsyncTaskPromise |
| Promise type for ordinary AsyncTask coroutines. More... | |
| class | BasicTask |
| Move-only promise-neutral ownership claim for a Uni20 coroutine. More... | |
| class | buffer_cancelled |
| Raised when a buffer read path is cancelled intentionally. More... | |
| class | buffer_error |
| Base class for buffer-related failures. More... | |
| class | buffer_read_uninitialized |
| Raised when a reader attempts to access an uninitialized buffer. More... | |
| class | buffer_uninitialized |
| Base class for access to a buffer without a constructed value. More... | |
| class | buffer_write_uninitialized |
| Raised when a writer requests a mutable reference before construction. More... | |
| class | CudaDeviceAwaiter |
| Awaiter that establishes or changes a CUDA task's device affinity. More... | |
| class | CudaResourceAcquireAwaiter |
| CUDA-task awaiter for one provider resource from a fixed-capacity pool. More... | |
| class | CudaStreamAcquireAwaiter |
| CUDA-task awaiter for an actually-idle stream-pool lease. More... | |
| class | CudaTask |
| CUDA-constrained public task type used for typed initial admission. More... | |
| struct | CudaTaskAwaiterTag |
Marker base for awaiters that require a CudaTaskPromise handle. More... | |
| class | CudaTaskPromise |
| Promise type for CUDA-constrained CudaTask coroutines. More... | |
| class | DebugCudaScheduler |
| Configurable debug scheduler that admits ordinary and CUDA tasks. More... | |
| class | DebugScheduler |
| Single-threaded scheduler with configurable runnable-batch ordering. More... | |
| struct | DebugSchedulerOptions |
| Configuration for deterministic debug scheduling. More... | |
| class | Defer |
Move-only deferred writer helper for a single WriteBuffer<T>. More... | |
| class | EpochContext |
| class | EpochContextReader |
| RAII handle representing the writer of a value in an EpochContext. More... | |
| class | EpochContextWriter |
| RAII-scoped representation of a writer’s participation in an epoch. More... | |
| class | EpochQueue |
| Coordinates multiple epochs of read/write gates. More... | |
| class | FutureValue |
| Write-once async value wrapper that retains a pending write buffer. More... | |
| class | IAsyncScheduler |
Scheduler interface for initial AsyncTask submission and host-side progress. More... | |
| class | ICudaScheduler |
Scheduler interface for initial CudaTask admission. More... | |
| struct | is_async_alias |
| Identifies payload descriptors requiring shared async alias identity. More... | |
| class | IScheduler |
| Internal route for resuming an already-bound coroutine task. More... | |
| class | LightweightTaskBatch |
| Borrowed type-erased description of a synchronous lightweight task batch. More... | |
| class | NodeInfo |
| Records node information for DAG/debugging visualization. More... | |
| class | OwningReadAccessProxy |
Owning proxy returned by co_await read_buffer.transfer(). More... | |
| class | OwningReadAwaiter |
| Awaiter that transfers a read handle into an owning read proxy. More... | |
| class | OwningStorageAccessProxy |
| Owning proxy providing access to writer storage. More... | |
| class | OwningStorageAwaiter |
| Awaiter that yields an owning storage-access proxy. More... | |
| class | OwningTakeAwaiter |
| Awaiter that takes and releases a value from an owning writer. More... | |
| class | OwningWriteAccessProxy |
Owning proxy returned by co_await write_buffer.transfer(). More... | |
| class | OwningWriteAwaiter |
| Awaiter that transfers a writer handle into an owning write proxy. More... | |
| class | PropagateExceptionsAwaiter |
| Awaiter that registers explicit exception sinks and then resumes immediately. More... | |
| class | ReadBuffer |
| RAII handle for reading the value from an Async container at a given epoch. More... | |
| class | ReadMaybeAwaiter |
| Awaiter returning an optional owning read proxy. More... | |
| class | ReadMaybeAwaiter< T const & > |
| Awaiter returning pointer-or-null read access for lvalue buffers. More... | |
| class | ReadOrCancelAwaiter |
Awaiter returning owning read access or throwing task_cancelled. More... | |
| class | ReadOrCancelAwaiter< T const & > |
Awaiter returning borrowed read access or throwing task_cancelled. More... | |
| class | ReverseEpochQueue |
| Reverse-order epoch queue used by reverse-mode gradient accumulation. More... | |
| class | ReverseValue |
| Reverse-mode accumulation endpoint with staged input/output gradient channels. More... | |
| class | ScopedScheduler |
| RAII helper that temporarily overrides the global scheduler. More... | |
| class | shared_storage |
| A lightweight, thread-safe, reference-counted storage for a single object. More... | |
| class | StorageAwaiter |
| Awaiter returning direct access to a writer's shared storage object. More... | |
| class | TakeAwaiter |
| Awaiter that takes the writer value without releasing the writer epoch. More... | |
| class | TakeReleaseAwaiter |
| Awaiter that takes a value and immediately releases the writer epoch. More... | |
| class | task_cancelled |
| Raised when an AsyncTask is cancelled before completion. More... | |
| struct | TaskAwaiter |
| Forwarding awaiter that transfers one task ownership claim to an awaitable. More... | |
| class | TaskFactory |
| Factory for producing multiple BasicTask ownership claims for one coroutine. More... | |
| struct | TaskFactoryAwaiter |
| Forwarding awaiter that transfers shared task ownership through a TaskFactory. More... | |
| class | TaskHandle |
| Non-owning erased identity for one Uni20 coroutine frame. More... | |
| class | TaskPromiseBase |
| Shared non-polymorphic implementation for Uni20 task promises. More... | |
| struct | TaskRoute |
| Execution requirements used to validate a scheduler route. More... | |
| class | TbbCudaScheduler |
| Unified oneTBB scheduler with one host arena and one arena per CUDA device. More... | |
| struct | TbbCudaSchedulerOptions |
| Arena configuration for the unified host/CUDA TBB scheduler. More... | |
| class | TbbNumaScheduler |
| NUMA-aware scheduler that balances work across per-node TBB arenas. More... | |
| class | TbbScheduler |
| struct | TbbSchedulerBatchOptions |
| Runtime policy for synchronous lightweight batches executed by a TBB scheduler. More... | |
| struct | TryAwaiter |
| Awaiter wrapper that returns an optional result. More... | |
| struct | ValueAwaiter |
| Always-ready awaitable owning an immediate operation value. More... | |
| class | Var |
| class | WriteAccessProxy |
Non-owning proxy returned by co_await on an lvalue WriteBuffer<T>. More... | |
| class | WriteAssignProxy |
Assignment-only proxy returned by WriteBuffer::write(). More... | |
| class | WriteBuffer |
Exclusive mutable-access buffer for one Async<T> epoch. More... | |
Concepts | |
| concept | read_buffer_awaitable |
| concept for a valid type that behaves as a read buffer awaitable This requires that the awaiter has a value_type and await_resume() is available. | |
| concept | write_buffer_awaitable |
concept for a valid type that behaves as a write buffer awaitable This requires that value_type x; co_await a = x is valid. | |
| concept | emplace_buffer_awaitable |
| concept for a valid type that supports in-place construction via emplace(...) | |
| concept | emplace_buffer_awaitable_of |
| concept | read_buffer_awaitable_of |
concept for a valid type that behaves as a read buffer awaitable for type T. | |
| concept | write_buffer_awaitable_of |
concept for a valid type that behaves as a write buffer awaitable This requires that T x; co_await a = x is valid. | |
| concept | read_write_buffer_awaitable |
concept for a valid type that behaves as a write buffer that is also readable This requires that value_type x = co_await a; co_await a = x is valid | |
| concept | read_write_buffer_awaitable_of |
concept for a valid type that behaves as a write buffer that is also readable This requires that T x = co_await a; co_await a = x is valid | |
| concept | async_reader |
An async_reader is satisfied if .read() returns an async read buffer. | |
| concept | async_writer |
An async_writer is satisfied if .write() returns a buffer supporting emplace(...). | |
| concept | async_reader_of |
| concept | async_writer_to |
Concept requiring an async writer that accepts values constructible from T. | |
| concept | async_movable_to |
| Concept for an Awaitable that yields a movable object that can be moved into T. | |
| concept | async_mutable_writer_of |
| concept | async_read_writer |
| Concept for a type that behaves like an asynchronous writer that is also readable: it has a write() function that returns an awaiter that can be assigned from the nested value_type, and also read from. | |
| concept | async_like |
| Concept for a type that behaves like an asynchronous reader and writer (like Async<T>). | |
| concept | async_binary_applicable |
| Concept to determine if Op(T,U) is a candidate for forwarding for Async. | |
| concept | async_binary_assignable |
| concept for validating a binary operation true if the operation result can be emplaced into the writer output type. | |
| concept | is_async_compound_applicable |
| concept | TaskPromise |
| Promise concept accepted by Uni20 task machinery. | |
| concept | CudaTaskAwaitable |
| Identifies an explicitly opted-in CUDA task awaiter. | |
| concept | AwaitSuspendResult |
| Concept for the valid return types of await_suspend. | |
| concept | TaskAwaitable |
| Concept for awaitables that accept promise-neutral task ownership. | |
| concept | TaskFactoryChildAwaitable |
| Awaitable that can hold one ownership claim in a multi-input join. | |
| concept | TaskFactoryAwaitable |
| Concept for awaitables that support shared promise-neutral ownership. | |
| concept | HasMemberCoAwait |
Detects if T has a member operator co_await(). | |
| concept | HasFreeCoAwait |
Detects if a free operator co_await(t) exists. | |
| concept | exception_sink_buffer |
| Concept for buffers that can register explicit exception sinks. | |
Typedefs | |
| template<typename T , typename U , typename Op > | |
| using | async_binary_result_t = decltype(std::declval< Op >()(std::declval< async_value_t< T > >(), std::declval< async_value_t< U > >())) |
| Result type of applying binary op Op to async_value_t<T>, async_value_t | |
| template<typename T > | |
| using | async_value_t = typename async_value_type< std::remove_cvref_t< T > >::type |
Extract the underlying value type from an immediate value or Async<T>. | |
| template<typename T > | |
| using | OwningWriteProxy = OwningWriteAccessProxy< T > |
| Alias for the owning write access proxy type. | |
| template<typename AsyncLike > | |
| using | take_awaiter_t = decltype(std::declval< write_buffer_t< AsyncLike > & >().take()) |
Alias for the awaiter type returned by write_buffer_t::take(). | |
| template<typename AsyncLike > | |
| using | write_buffer_t = decltype(std::declval< AsyncLike & >().write()) |
Alias for the write-buffer type produced by write() on an lvalue. | |
| template<typename T > | |
| using | WriteAwaitProxy = WriteAccessProxy< T > |
| Alias for the non-owning write access proxy type. | |
| template<typename T > | |
| using | WriteProxy = WriteAssignProxy< T > |
| Alias for assignment-only writer proxy. | |
Enumerations | |
| enum class | DebugSchedulerOrder { fifo , reverse , random } |
Runnable-batch ordering policy for DebugScheduler. More... | |
| enum class | NodeValueState { Invalid , Unconstructed , Constructed } |
| Construction state reported for a debug DAG value node. More... | |
| enum class | TaskDomain { none , host , cuda } |
| Execution domain declared by a concrete Uni20 task promise. More... | |
Functions | |
| template<TaskFactoryChildAwaitable... Aw> requires ((!std::is_void_v<decltype(std::declval<Aw>().await_resume())> && ...)) | |
| auto | all (Aw &&... aw) noexcept |
| Build an awaitable that waits for all of the provided awaitables. | |
| template<typename T , typename U > | |
| AsyncTask | async_accumulate (ReadBuffer< T > a_, ReadBuffer< U > b_, WriteBuffer< T > out_) |
Compute out = a + b while tolerating cancellation of either input. | |
| template<typename T , typename U > | |
| AsyncTask | async_accumulate_minus (ReadBuffer< T > a_, ReadBuffer< U > b_, WriteBuffer< T > out_) |
Compute out = a - b while tolerating cancellation of either input. | |
| template<typename T , typename U > requires (detail::current_value_assignment_source<T, U> || (is_async_alias_v<T> && detail::async_alias_assignable_from<T, async_value_t<U> const&>)) | |
| void | async_assign (Async< T > &lhs, U &&rhs) |
| Assigns an Async or scalar value into an Async destination. | |
| template<typename T , typename U > requires (!is_async_alias_v<T> && read_buffer_awaitable_of<U, T> && detail::write_proxy_assignable_source<T, T>) | |
| void | async_assign (WriteBuffer< T > destination, U &&source) |
| Assign an awaitable value into an existing independent-value timeline. | |
| template<typename T , typename U > requires (is_async_alias_v<T> && detail::async_alias_assignment_awaitable<U, T>) | |
| void | async_assign (WriteBuffer< T > destination, U &&source) |
| Assign through an existing async alias descriptor. | |
| template<typename T , typename U > requires (!read_buffer_awaitable<std::remove_cvref_t<U>>) && (detail::current_value_assignment_source<T, U> || (is_async_alias_v<T> && detail::async_alias_assignable_from<T, async_value_t<U> const&>)) | |
| void | async_assign (WriteBuffer< T > lhs, U &&rhs) |
| Assigns an Async or scalar value into a write buffer destination. | |
| template<typename A , typename B , async_writer Writer, typename Op > requires async_binary_applicable<A, B, Op> | |
| void | async_binary_op (Writer &out, A &&a, B &&b, Op op) |
| Launch a coroutine computing result = op(a, b) | |
| template<typename T , typename U , typename Op > | |
| void | async_compound_op (Async< T > &lhs, U &&rhs, Op op) |
Launch a coroutine applying an in-place operation op(lhs, rhs). | |
| template<typename T , typename U > requires (!is_async_alias_v<T> && detail::async_source<U> && std::constructible_from<T, async_value_t<U> const&>) | |
| void | async_initialize (Async< T > &destination, U &&source) |
| Initialize a fresh independent async value from another async source. | |
| template<typename T , typename U > requires (!is_async_alias_v<T> && detail::async_initialization_awaitable<U, T>) | |
| void | async_initialize (WriteBuffer< T > destination, U &&source) |
| Initialize empty independent-value storage from an awaitable source. | |
| template<typename T , typename U > requires (!is_async_alias_v<T>) | |
| void | async_move (Async< T > &lhs, U &&rhs) |
| Move-assign from a source expression into an Async destination. | |
| template<typename T , typename U > requires (!is_async_alias_v<T>) && async_mutable_writer_of<U, T> && async_movable_to<U, T> | |
| void | async_move (WriteBuffer< T > lhs, U &&rhs) |
| template<typename T , typename U > requires (!is_async_alias_v<T>) && (!async_writer<std::remove_cvref_t<U>>) && std::constructible_from<T, U&&> | |
| void | async_move (WriteBuffer< T > lhs, U &&rhs) |
| template<typename T , typename U > requires read_buffer_awaitable_of<U, T> | |
| void | async_negate (WriteBuffer< T > lhs, U &&rhs) |
| Negate a source value asynchronously and write into a destination buffer. | |
| template<typename T > | |
| void | async_print (std::string Format, Async< T > x) |
| Schedules a formatted print once an async value is ready. | |
| template<typename T > | |
| void | async_read (std::string Prompt, Async< T > &x) |
Schedules reading a value from std::cin into an async slot. | |
| template<typename T > | |
| AsyncTask | co_conj (ReadBuffer< T > in, WriteBuffer< T > out) |
| Coroutine implementation of complex conjugation over async buffers. | |
| template<typename T > | |
| AsyncTask | co_cos (ReadBuffer< T > in, WriteBuffer< T > out) |
Coroutine implementation of cos over async buffers. | |
| template<typename T > | |
| AsyncTask | co_herm (ReadBuffer< T > in, WriteBuffer< T > out) |
| Coroutine implementation of Hermitian conjugation over async buffers. | |
| template<typename T > | |
| AsyncTask | co_imag (ReadBuffer< T > in, WriteBuffer< uni20::make_real_t< T > > out) |
| Coroutine implementation of imaginary-part extraction over async buffers. | |
| template<typename T > | |
| AsyncTask | co_real (ReadBuffer< T > in, WriteBuffer< uni20::make_real_t< T > > out) |
| Coroutine implementation of real-part extraction over async buffers. | |
| template<typename T > | |
| AsyncTask | co_sin (ReadBuffer< T > in, WriteBuffer< T > out) |
Coroutine implementation of sin over async buffers. | |
| template<typename T > | |
| Async< T > | conj (Async< T > const &x) |
| Schedules asynchronous conjugation. | |
| template<uni20::TensorView Tensor> requires uni20::Complex<uni20::tensor_element_t<Tensor>> | |
| auto | conj (Async< Tensor > const &tensor) |
| Return a lazy conjugating alias of an async complex tensor. | |
| template<uni20::TensorView Tensor> requires (!uni20::Complex<uni20::tensor_element_t<Tensor>>) | |
| auto | conj (Async< Tensor > const &tensor) |
| Return a lazy read-only identity alias of an async real tensor. | |
| template<typename T > | |
| Async< T > | cos (Async< T > const &x) |
| Schedules asynchronous cosine evaluation. | |
| template<typename T > | |
| Var< T > | cos (Var< T > x) |
Computes cos(x) and wires reverse-mode accumulation for the input gradient. | |
| CudaTaskPromise & | cuda_promise (TaskHandle handle) noexcept |
| Narrow an erased task promise after verifying that it is CUDA-specific. | |
| template<typename T > | |
| Defer (Async< T > &) -> Defer< T > | |
CTAD guide for constructing Defer<T> from Async<T>&. | |
| template<typename T > | |
| Defer< T > | defer_write (Async< T > &a) |
| Create a deferred writer helper for an Async value. | |
| template<class Function > requires std::invocable<Function&, std::size_t> | |
| void | execute_batch (std::size_t size, Function &&function) |
| Execute a synchronous lightweight batch on the global scheduler. | |
| constexpr std::string_view | format_as (uni20::async::EpochContext::Phase p) |
| template<typename U > | |
| decltype(auto) | get_awaiter (U &&u) noexcept |
for an awaitable a, return the actual Awaitable object returned by co_await | |
| IAsyncScheduler * | get_global_scheduler () |
| Returns the currently-installed process-wide scheduler. | |
| template<typename T > | |
| Async< T > | herm (Async< T > const &x) |
| Schedules asynchronous Hermitian conjugation. | |
| template<typename T > | |
| Async< uni20::make_real_t< T > > | imag (Async< T > const &x) |
| Schedules asynchronous imaginary-part extraction. | |
| template<typename T > | |
| Var< uni20::make_real_t< T > > | imag (Var< T > z) |
| Computes the imaginary part and propagates gradient to a complex source. | |
| template<typename Alias , typename Parent , typename... Args> | |
| Async< Alias > | make_async_alias (Async< Parent > const &parent, Args &&... args) |
| Construct an async alias that retains a parent value and shares its epoch queue. | |
| template<typename Alias , typename Parent , typename... Args> | |
| Async< Alias > | make_async_alias_from_parent (Async< Parent > &parent, Args &&... args) |
| Construct an async alias from a mutable parent descriptor. | |
| template<typename Alias , typename Parent , typename... Args> | |
| Async< Alias > | make_async_alias_from_parent (Async< Parent > const &parent, Args &&... args) |
| Construct a read-only async alias from a parent descriptor. | |
| template<typename T , typename... Args> | |
| shared_storage< T > | make_shared_storage (Args &&... args) |
| Create a new shared_storage<T> with T(args...) in-place. | |
| template<typename T , typename Owner , typename... Args> | |
| shared_storage< T > | make_shared_storage_alias (shared_storage< Owner > const &owner, Args &&... args) |
| Create storage for a value that keeps another storage value alive. | |
| template<typename T > | |
| shared_storage< T > | make_unconstructed_shared_storage () |
| Create a new shared_storage<T> with an unconstructed T. | |
| template<typename T > | |
| Var< T > | operator* (T x, Var< T > y) |
Computes x * y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator* (Var< T > x, T y) |
Computes x * y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator* (Var< T > x, Var< T > y) |
Computes x * y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator+ (T x, Var< T > y) |
Computes x + y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator+ (Var< T > x, T y) |
Computes x + y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator+ (Var< T > x, Var< T > y) |
Computes x + y with reverse-mode gradient propagation. | |
| template<typename T > requires requires(T t) { -t; } | |
| auto | operator- (Async< T > const &x) |
| Unary negation overload for Async values. | |
| template<typename T > | |
| Var< T > | operator- (T x, Var< T > y) |
Computes x - y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator- (Var< T > x, T y) |
Computes x - y with reverse-mode gradient propagation. | |
| template<typename T > | |
| Var< T > | operator- (Var< T > x, Var< T > y) |
Computes x - y with reverse-mode gradient propagation. | |
| template<typename T > | |
| void | ProcessCoroutineArgument (TaskPromiseBase *promise, ReadBuffer< T > const &x) |
| Register coroutine debug dependencies for a read-buffer argument. | |
| template<typename T > | |
| void | ProcessCoroutineArgument (TaskPromiseBase *promise, T const &value) |
| Process a coroutine argument for debug metadata (default no-op). | |
| template<typename T > | |
| void | ProcessCoroutineArgument (TaskPromiseBase *promise, WriteBuffer< T > const &x) |
| Register coroutine debug dependencies and exception sink for a write-buffer argument. | |
| template<exception_sink_buffer... Buffers> | |
| auto | propagate_exceptions_to (Buffers &... buffers) |
| Register buffers that should receive unhandled coroutine exceptions. | |
| void | propagate_unhandled_writer_exception (EpochContext *epoch, std::exception_ptr eptr) noexcept |
| Inject an unhandled writer-side coroutine exception into an epoch. | |
| template<typename T > | |
| ReadBuffer< T > | read (Async< T > const &a) |
| Convenience helper that forwards to Async<T>::read(). | |
| template<typename T > | |
| ReadBuffer< T > | read (ReverseValue< T > const &x) |
| Free-function read adapter for ReverseValue. | |
| template<typename T > requires detail::AsyncReadProvider<T> | |
| decltype(auto) | read (T &&value) |
| Obtain the read awaiter exposed by an async-like value. | |
| template<typename T > requires (!detail::AsyncReadProvider<T>) | |
| auto | read (T &&value) -> ValueAwaiter< std::remove_cvref_t< T > > |
| Wrap an immediate value in an always-ready read awaiter. | |
| template<typename T > | |
| Async< uni20::make_real_t< T > > | real (Async< T > const &x) |
| Schedules asynchronous real-part extraction. | |
| template<typename T > | |
| Var< uni20::make_real_t< T > > | real (Var< T > z) |
| Computes the real part and propagates gradient to a complex source. | |
| template<typename T > | |
| ReadBuffer< T > && | release (ReadBuffer< T > &&in) |
| Adaptor for forwarding an rvalue ReadBuffer into an await expression. | |
| template<typename T > | |
| ReadBuffer< T > && | release (ReadBuffer< T > &in) |
| Adaptor for transferring ReadBuffer ownership into an await expression. | |
| void | reset_global_scheduler () |
| Restores the process-wide scheduler to the default debug scheduler. | |
| template<uni20::MutableStridedTensorView Tensor, std::integral... Extents> requires uni20::detail::CanonicalReshapeLayout<typename uni20::tensor_mdspec_t<Tensor>::layout_type> | |
| auto | reshape_view (Async< Tensor > &tensor, Extents... requested_extents) |
| Return a mutable structural reshape alias of an async tensor. | |
| template<uni20::StridedTensorView Tensor, std::integral... Extents> requires uni20::detail::CanonicalReshapeLayout<typename uni20::tensor_mdspec_t<Tensor>::layout_type> | |
| auto | reshape_view (Async< Tensor > const &tensor, Extents... requested_extents) |
| Return a read-only structural reshape alias of an async tensor. | |
| template<uni20::MutableStridedTensorView Tensor, std::integral... Extents> | |
| auto | reshape_view_left (Async< Tensor > &tensor, Extents... requested_extents) |
| Return a mutable column-major structural reshape alias. | |
| template<uni20::StridedTensorView Tensor, std::integral... Extents> | |
| auto | reshape_view_left (Async< Tensor > const &tensor, Extents... requested_extents) |
| Return a read-only column-major structural reshape alias. | |
| template<uni20::MutableStridedTensorView Tensor, std::integral... Extents> | |
| auto | reshape_view_right (Async< Tensor > &tensor, Extents... requested_extents) |
| Return a mutable row-major structural reshape alias. | |
| template<uni20::StridedTensorView Tensor, std::integral... Extents> | |
| auto | reshape_view_right (Async< Tensor > const &tensor, Extents... requested_extents) |
| Return a read-only row-major structural reshape alias. | |
| void | schedule (AsyncTask &&task) |
| Schedule a task on the currently configured global scheduler. | |
| void | schedule (CudaTask &&task) |
| Schedule a CUDA task on the currently configured global scheduler. | |
| void | schedule (CudaTask &&task, int device) |
| Schedule a CUDA task with initial device affinity. | |
| void | set_global_scheduler (IAsyncScheduler *sched) |
| Sets the process-wide scheduler used by async helpers. | |
| template<typename T > | |
| Async< T > | sin (Async< T > const &x) |
| Schedules asynchronous sine evaluation. | |
| template<typename T > | |
| Var< T > | sin (Var< T > x) |
Computes sin(x) and wires reverse-mode accumulation for the input gradient. | |
| TaskRoute | task_route (TaskHandle handle) noexcept |
| Return the current scheduling requirements recorded by a task. | |
| template<typename Aw > | |
| constexpr auto | try_await (Aw &&aw) noexcept |
| Build a non-blocking awaiter from an rvalue awaitable. | |
| template<typename Aw > | |
| constexpr auto | try_await (Aw &aw) noexcept |
Build a non-blocking awaiter that returns optional<T> instead of suspending. | |
| template<typename T > | |
| WriteBuffer< T > | write (Async< T > &a) |
| Convenience helper that forwards to Async<T>::write(). | |
| template<typename T , typename Value > | |
| auto | write_to (WriteBuffer< T > &&buffer, Value value) |
| Create a coroutine awaiter that writes a value to a WriteBuffer<T>. | |
Variables | |
| constexpr async_do_not_start_t | async_do_not_start {} |
| Tag constant to construct an Async without starting the queue object. | |
| template<typename T > | |
| constexpr bool | is_async_alias_v = is_async_alias<std::remove_cvref_t<T>>::value |
True when T is an owner-bound async alias descriptor. | |
This represents the reverse-mode adjoint for functions of complex variables, assuming a real-valued scalar loss function ( L \colon \mathbb{C} \to \mathbb{R} ).
Only the Wirtinger derivative with respect to ( z^* ) is propagated:
\[ \bar{z} := \frac{\partial L}{\partial z^*} \]
For an intermediate variable ( f(z) ), the chain rule is:
\[ \frac{\partial L}{\partial z^*} = \frac{\partial L}{\partial f} \cdot \frac{\partial f}{\partial z^*} + \frac{\partial L}{\partial f^*} \cdot \frac{\partial f^*}{\partial z^*} \]
Under the real-valued loss assumption:
\[ \frac{\partial L}{\partial f^*} = \overline{ \left( \frac{\partial L}{\partial f} \right) }, \quad \frac{\partial f^*}{\partial z^*} = \overline{ \left( \frac{\partial f}{\partial z} \right) } \]
so the full gradient becomes:
\[ \frac{\partial L}{\partial z^*} = \frac{\partial L}{\partial f} \cdot \frac{\partial f}{\partial z^*} + \overline{ \left( \frac{\partial L}{\partial f} \cdot \frac{\partial f}{\partial z} \right) } \]
grad, and all reverse-mode propagation targets the Wirtinger ( \partial / \partial z^* ) direction. | using uni20::async::async_value_t = typedef typename async_value_type<std::remove_cvref_t<T> >::type |
Extract the underlying value type from an immediate value or Async<T>.
| using uni20::async::OwningWriteProxy = typedef OwningWriteAccessProxy<T> |
Alias for the owning write access proxy type.
| using uni20::async::WriteAwaitProxy = typedef WriteAccessProxy<T> |
Alias for the non-owning write access proxy type.
| using uni20::async::WriteProxy = typedef WriteAssignProxy<T> |
Alias for assignment-only writer proxy.
|
strong |
Runnable-batch ordering policy for DebugScheduler.
| Enumerator | |
|---|---|
| fifo | Execute each runnable batch in submission order. |
| reverse | Execute each runnable batch in reverse submission order. |
| random | Execute each runnable batch in seeded pseudo-random order. |
|
strong |
|
strong |
|
noexcept |
Build an awaitable that waits for all of the provided awaitables.
| aw | Awaitable arguments. |
co_await. | AsyncTask uni20::async::async_accumulate | ( | ReadBuffer< T > | a_, |
| ReadBuffer< U > | b_, | ||
| WriteBuffer< T > | out_ | ||
| ) |
Compute out = a + b while tolerating cancellation of either input.
| T | Left/output value type. |
| U | Right input value type. |
| a_ | Left input read buffer. |
| b_ | Right input read buffer. |
| out_ | Output write buffer. |
| AsyncTask uni20::async::async_accumulate_minus | ( | ReadBuffer< T > | a_, |
| ReadBuffer< U > | b_, | ||
| WriteBuffer< T > | out_ | ||
| ) |
Compute out = a - b while tolerating cancellation of either input.
| T | Left/output value type. |
| U | Right input value type. |
| a_ | Left input read buffer. |
| b_ | Right input read buffer. |
| out_ | Output write buffer. |
| void uni20::async::async_assign | ( | WriteBuffer< T > | destination, |
| U && | source | ||
| ) |
Assign through an existing async alias descriptor.
The destination descriptor, lifetime owner, and epoch queue remain intact. The write proxy invokes the alias's ADL customization.
| void uni20::async::async_assign | ( | WriteBuffer< T > | lhs, |
| U && | rhs | ||
| ) |
Assigns an Async or scalar value into a write buffer destination.
| T | Destination value type. |
| U | Source type (scalar or Async-like). |
| lhs | Destination write buffer. |
| rhs | Source expression. |
| void uni20::async::async_move | ( | WriteBuffer< T > | lhs, |
| U && | rhs | ||
| ) |
| void uni20::async::async_print | ( | std::string | Format, |
| Async< T > | x | ||
| ) |
Schedules a formatted print once an async value is ready.
| T | Value type. |
| Format | fmt-style format string. |
| x | Async value to print. |
| void uni20::async::async_read | ( | std::string | Prompt, |
| Async< T > & | x | ||
| ) |
Schedules reading a value from std::cin into an async slot.
| T | Value type. |
| Prompt | Prompt text printed before reading. |
| x | Async destination value. |
| AsyncTask uni20::async::co_conj | ( | ReadBuffer< T > | in, |
| WriteBuffer< T > | out | ||
| ) |
Coroutine implementation of complex conjugation over async buffers.
| T | Value type. |
| in | Input read buffer. |
| out | Output write buffer. |
| AsyncTask uni20::async::co_cos | ( | ReadBuffer< T > | in, |
| WriteBuffer< T > | out | ||
| ) |
Coroutine implementation of cos over async buffers.
| T | Value type. |
| in | Input read buffer. |
| out | Output write buffer. |
| AsyncTask uni20::async::co_herm | ( | ReadBuffer< T > | in, |
| WriteBuffer< T > | out | ||
| ) |
Coroutine implementation of Hermitian conjugation over async buffers.
| T | Value type. |
| in | Input read buffer. |
| out | Output write buffer. |
| AsyncTask uni20::async::co_imag | ( | ReadBuffer< T > | in, |
| WriteBuffer< uni20::make_real_t< T > > | out | ||
| ) |
Coroutine implementation of imaginary-part extraction over async buffers.
| T | Value type. |
| in | Input read buffer. |
| out | Output write buffer. |
| AsyncTask uni20::async::co_real | ( | ReadBuffer< T > | in, |
| WriteBuffer< uni20::make_real_t< T > > | out | ||
| ) |
Coroutine implementation of real-part extraction over async buffers.
| T | Value type. |
| in | Input read buffer. |
| out | Output write buffer. |
| AsyncTask uni20::async::co_sin | ( | ReadBuffer< T > | in, |
| WriteBuffer< T > | out | ||
| ) |
Coroutine implementation of sin over async buffers.
| T | Value type. |
| in | Input read buffer. |
| out | Output write buffer. |
Schedules asynchronous conjugation.
| T | Value type. |
| x | Input async value. |
conj(x). Return a lazy conjugating alias of an async complex tensor.
The result retains the parent tensor storage and shares its exact epoch queue. Awaiting the alias therefore observes the same causal timeline as awaiting the parent. Default precision is read from that parent epoch rather than copied when the alias is created.
Return a lazy read-only identity alias of an async real tensor.
Schedules asynchronous cosine evaluation.
| T | Value type. |
| x | Input async value. |
cos(x). Computes cos(x) and wires reverse-mode accumulation for the input gradient.
| T | Value type. |
| x | Input variable. |
cos(x).
|
inlinenoexcept |
Narrow an erased task promise after verifying that it is CUDA-specific.
| handle | Erased task identity produced from its original typed coroutine handle. |
| uni20::async::Defer | ( | Async< T > & | ) | -> Defer< T > |
| void uni20::async::execute_batch | ( | std::size_t | size, |
| Function && | function | ||
| ) |
Execute a synchronous lightweight batch on the global scheduler.
| Function | Callable accepting one std::size_t index. |
| size | Number of work items. |
| function | Work-item callable borrowed until the call returns. |
|
constexpr |
|
noexcept |
for an awaitable a, return the actual Awaitable object returned by co_await
| U | Awaitable or awaiter type. |
| u | The object to transform. |
|
inline |
Returns the currently-installed process-wide scheduler.
Schedules asynchronous Hermitian conjugation.
| T | Value type. |
| x | Input async value. |
herm(x). | Async< uni20::make_real_t< T > > uni20::async::imag | ( | Async< T > const & | x | ) |
Schedules asynchronous imaginary-part extraction.
| T | Value type. |
| x | Input async value. |
imag(x). | Var< uni20::make_real_t< T > > uni20::async::imag | ( | Var< T > | z | ) |
Computes the imaginary part and propagates gradient to a complex source.
| T | Complex-like value type. |
| z | Input variable. |
imag(z). | Async< Alias > uni20::async::make_async_alias | ( | Async< Parent > const & | parent, |
| Args &&... | args | ||
| ) |
Construct an async alias that retains a parent value and shares its epoch queue.
| Async< Alias > uni20::async::make_async_alias_from_parent | ( | Async< Parent > & | parent, |
| Args &&... | args | ||
| ) |
Construct an async alias from a mutable parent descriptor.
The alias constructor receives the address reserved for the parent value followed by args. The address may identify unconstructed storage and must not be dereferenced before the shared epoch is readable.
| Async< Alias > uni20::async::make_async_alias_from_parent | ( | Async< Parent > const & | parent, |
| Args &&... | args | ||
| ) |
Construct a read-only async alias from a parent descriptor.
|
inline |
Create a new shared_storage<T> with T(args...) in-place.
| T | Stored value type. |
| Args | Constructor argument types. |
| args | Constructor arguments forwarded to T. |
shared_storage<T> with a constructed value.
|
inline |
Create storage for a value that keeps another storage value alive.
The alias has its own local strong count. Its control block retains one reference to owner, which is released after the alias value is destroyed. Copies of the alias increment only the local count.
| T | Alias value type. |
| Owner | Lifetime-owner value type. |
| Args | Alias constructor argument types. |
| owner | Storage whose lifetime must cover the alias value. |
| args | Arguments forwarded to the alias value constructor. |
|
inline |
Create a new shared_storage<T> with an unconstructed T.
Computes x * y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left scalar operand. |
| y | Right input variable. |
x * y. Computes x * y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left input variable. |
| y | Right scalar operand. |
x * y. Computes x * y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left input variable. |
| y | Right input variable. |
x * y. Computes x + y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left scalar operand. |
| y | Right input variable. |
x + y. Computes x + y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left input variable. |
| y | Right scalar operand. |
x + y. Computes x + y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left input variable. |
| y | Right input variable. |
x + y. Computes x - y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left scalar operand. |
| y | Right input variable. |
x - y. Computes x - y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left input variable. |
| y | Right scalar operand. |
x - y. Computes x - y with reverse-mode gradient propagation.
| T | Value type. |
| x | Left input variable. |
| y | Right input variable. |
x - y. | void uni20::async::ProcessCoroutineArgument | ( | TaskPromiseBase * | promise, |
| ReadBuffer< T > const & | x | ||
| ) |
Register coroutine debug dependencies for a read-buffer argument.
| T | Stored value type. |
| promise | Promise collecting dependency metadata. |
| x | Read buffer argument. |
| void uni20::async::ProcessCoroutineArgument | ( | TaskPromiseBase * | promise, |
| T const & | value | ||
| ) |
Process a coroutine argument for debug metadata (default no-op).
| T | Argument type. |
| promise | Promise receiving metadata. |
| value | Argument ignored by default. |
| void uni20::async::ProcessCoroutineArgument | ( | TaskPromiseBase * | promise, |
| WriteBuffer< T > const & | x | ||
| ) |
Register coroutine debug dependencies and exception sink for a write-buffer argument.
| T | Stored value type. |
| promise | Promise collecting dependency metadata. |
| x | Write buffer argument. |
| auto uni20::async::propagate_exceptions_to | ( | Buffers &... | buffers | ) |
Register buffers that should receive unhandled coroutine exceptions.
The registration remains active for as long as each buffer object remains alive.
|
inlinenoexcept |
Inject an unhandled writer-side coroutine exception into an epoch.
| epoch | Target epoch context associated with a writer buffer. |
| eptr | Exception captured by the coroutine promise. |
| ReadBuffer< T > uni20::async::read | ( | Async< T > const & | a | ) |
Convenience helper that forwards to Async<T>::read().
| T | Stored value type. |
| a | Async container providing the read buffer. |
| ReadBuffer< T > uni20::async::read | ( | ReverseValue< T > const & | x | ) |
Free-function read adapter for ReverseValue.
| T | Stored value type. |
| x | Reverse value. |
| decltype(auto) uni20::async::read | ( | T && | value | ) |
Obtain the read awaiter exposed by an async-like value.
| auto uni20::async::read | ( | T && | value | ) | -> ValueAwaiter<std::remove_cvref_t<T>> |
Wrap an immediate value in an always-ready read awaiter.
| Async< uni20::make_real_t< T > > uni20::async::real | ( | Async< T > const & | x | ) |
Schedules asynchronous real-part extraction.
| T | Value type. |
| x | Input async value. |
real(x). | Var< uni20::make_real_t< T > > uni20::async::real | ( | Var< T > | z | ) |
Computes the real part and propagates gradient to a complex source.
| T | Complex-like value type. |
| z | Input variable. |
real(z). | ReadBuffer< T > && uni20::async::release | ( | ReadBuffer< T > && | in | ) |
Adaptor for forwarding an rvalue ReadBuffer into an await expression.
This is a synonym for std::move.
| ReadBuffer< T > && uni20::async::release | ( | ReadBuffer< T > & | in | ) |
Adaptor for transferring ReadBuffer ownership into an await expression.
This is a synonym for std::move.
|
inline |
Restores the process-wide scheduler to the default debug scheduler.
| auto uni20::async::reshape_view | ( | Async< Tensor > & | tensor, |
| Extents... | requested_extents | ||
| ) |
Return a mutable structural reshape alias of an async tensor.
The descriptor retains the parent storage and shares its exact epoch queue. Shape and layout validation occurs when the shared parent epoch first becomes readable. Default precision follows the parent state observed by each operation through the alias.
| auto uni20::async::reshape_view | ( | Async< Tensor > const & | tensor, |
| Extents... | requested_extents | ||
| ) |
Return a read-only structural reshape alias of an async tensor.
| auto uni20::async::reshape_view_left | ( | Async< Tensor > & | tensor, |
| Extents... | requested_extents | ||
| ) |
Return a mutable column-major structural reshape alias.
| auto uni20::async::reshape_view_left | ( | Async< Tensor > const & | tensor, |
| Extents... | requested_extents | ||
| ) |
Return a read-only column-major structural reshape alias.
| auto uni20::async::reshape_view_right | ( | Async< Tensor > & | tensor, |
| Extents... | requested_extents | ||
| ) |
Return a mutable row-major structural reshape alias.
| auto uni20::async::reshape_view_right | ( | Async< Tensor > const & | tensor, |
| Extents... | requested_extents | ||
| ) |
Return a read-only row-major structural reshape alias.
|
inline |
Schedule a task on the currently configured global scheduler.
| task | Task to schedule. |
|
inline |
Schedule a CUDA task on the currently configured global scheduler.
The installed scheduler must implement CUDA task admission.
| task | CUDA task to schedule without establishing device affinity. |
|
inline |
Schedule a CUDA task with initial device affinity.
Initial admission to the correct device avoids a later scheduler migration when the task first selects that device.
| task | CUDA task to schedule. |
| device | CUDA runtime device ordinal. |
|
inline |
Sets the process-wide scheduler used by async helpers.
| sched | Scheduler pointer to install. |
Schedules asynchronous sine evaluation.
| T | Value type. |
| x | Input async value. |
sin(x). Computes sin(x) and wires reverse-mode accumulation for the input gradient.
| T | Value type. |
| x | Input variable. |
sin(x).
|
inlinenoexcept |
Return the current scheduling requirements recorded by a task.
|
constexprnoexcept |
Build a non-blocking awaiter from an rvalue awaitable.
| Aw | Awaitable type. |
| aw | Awaitable value moved into the try-await wrapper. |
TryAwaiter that owns the awaitable value.
|
constexprnoexcept |
Build a non-blocking awaiter that returns optional<T> instead of suspending.
If you pass an lvalue awaiter, it’s stored by reference. If you pass a prvalue awaiter (e.g. a proxy type you’ve designed), it’s stored by value. Exceptions from the readiness probe or result extraction propagate normally.
Example:
| aw | An awaitable (must outlive the coroutine for references). |
TryAwaiter wrapper around the supplied awaitable. | WriteBuffer< T > uni20::async::write | ( | Async< T > & | a | ) |
Convenience helper that forwards to Async<T>::write().
| T | Stored value type. |
| a | Async container providing the write buffer. |
| auto uni20::async::write_to | ( | WriteBuffer< T > && | buffer, |
| Value | value | ||
| ) |
Create a coroutine awaiter that writes a value to a WriteBuffer<T>.
Constructs an awaitable object that can be co_awaited to write a given value into an Async<T> via its WriteBuffer. Ensures lifetime safety and correct causal ordering when the buffer is a temporary.
| buffer | A WriteBuffer<T>, moved into the coroutine. |
| value | The value to assign, moved into the awaiter frame. |
|
inlineconstexpr |
Tag constant to construct an Async without starting the queue object.
|
inlineconstexpr |
True when T is an owner-bound async alias descriptor.