|
Uni20
Asynchronous tensor and runtime library.
|
Concepts and helpers for composing Async expressions. More...
#include "async.hpp"#include "async_task.hpp"#include "awaiters.hpp"#include "debug_scheduler.hpp"#include <uni20/common/trace.hpp>#include <concepts>#include <functional>#include <memory>#include <type_traits>#include <utility>Go to the source code of this file.
Namespaces | |
| namespace | uni20 |
| namespace | uni20::async |
| 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} ). | |
Concepts | |
| concept | uni20::async::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 | uni20::async::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 | uni20::async::emplace_buffer_awaitable |
| concept for a valid type that supports in-place construction via emplace(...) | |
| concept | uni20::async::emplace_buffer_awaitable_of |
| concept | uni20::async::read_buffer_awaitable_of |
concept for a valid type that behaves as a read buffer awaitable for type T. | |
| concept | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::async_reader |
An async_reader is satisfied if .read() returns an async read buffer. | |
| concept | uni20::async::async_writer |
An async_writer is satisfied if .write() returns a buffer supporting emplace(...). | |
| concept | uni20::async::async_reader_of |
| concept | uni20::async::async_writer_to |
Concept requiring an async writer that accepts values constructible from T. | |
| concept | uni20::async::async_movable_to |
| Concept for an Awaitable that yields a movable object that can be moved into T. | |
| concept | uni20::async::async_mutable_writer_of |
| concept | uni20::async::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 | uni20::async::async_like |
| Concept for a type that behaves like an asynchronous reader and writer (like Async<T>). | |
| concept | uni20::async::async_binary_applicable |
| Concept to determine if Op(T,U) is a candidate for forwarding for Async. | |
| concept | uni20::async::async_binary_assignable |
| concept for validating a binary operation true if the operation result can be emplaced into the writer output type. | |
| concept | uni20::async::is_async_compound_applicable |
Macros | |
| #define | UNI20_DEFINE_ASSIGN_OP(NAME, OP) |
| #define | UNI20_DEFINE_ASYNC_COMPOUND_OPERATOR(OPSYM, FUNCTOR) |
| #define | UNI20_DEFINE_BINARY_OP(OPNAME, OP) |
Typedefs | |
| template<typename T , typename U , typename Op > | |
| using | uni20::async::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 AsyncLike > | |
| using | uni20::async::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 | uni20::async::write_buffer_t = decltype(std::declval< AsyncLike & >().write()) |
Alias for the write-buffer type produced by write() on an lvalue. | |
Functions | |
| 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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::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 | uni20::async::async_move (WriteBuffer< T > lhs, U &&rhs) |
| template<typename T , typename U > requires read_buffer_awaitable_of<U, T> | |
| void | uni20::async::async_negate (WriteBuffer< T > lhs, U &&rhs) |
| Negate a source value asynchronously and write into a destination buffer. | |
| template<typename T > requires requires(T t) { -t; } | |
| auto | uni20::async::operator- (Async< T > const &x) |
| Unary negation overload for Async values. | |
Concepts and helpers for composing Async expressions.