26template <
class BackendSelector, uni20::AsyncTensorOutput OutputTensor, uni20::RankedTensorView<2> InputTensor,
31 auto output_awaiter = uni20::detail::mutable_async_tensor_awaiter(output);
32 auto awaited =
co_await async::all(output_awaiter, input, time);
33 decltype(
auto) output_value = uni20::detail::mutable_async_tensor_value<OutputTensor>(std::get<0>(awaited));
34 auto const& input_value = std::get<1>(awaited);
35 using time_type = std::remove_cvref_t<decltype(std::get<2>(awaited))>;
36 time_type
const time_value = std::get<2>(awaited);
40 co_await co_dispatch_kernel(selector, matrix_exponential_op{}, output_descriptor, input_descriptor, time_value);
44template <
class BackendSelector, uni20::AsyncTensorOutput OutputTensor, uni20::RankedTensorView<2> InputTensor,
50 "async matrix exponential output must not share an epoch queue with its input");
51 auto task = co_matrix_exponential(std::move(selector), output.
write(), input.
read(), std::move(time));
52 task.debug_name(
"matrix_exponential");
63 requires(TimeScalar&& time) {
async::read(std::forward<TimeScalar>(time)); }
67 detail::schedule_async_matrix_exponential(std::move(selector), output, input,
72template <uni20::AsyncTensorOutput OutputTensor, uni20::RankedTensorView<2> InputTensor,
class TimeScalar>
74 requires(TimeScalar&& time) {
async::read(std::forward<TimeScalar>(time)); }
78 matrix_exponential(std::move(selector), output, input, std::forward<TimeScalar>(time));
The Async<T> container: coroutineāsafe asynchronous read/write.
Coroutine-aware kernel dispatch with an ordinary blocking fallback.
Utilities for awaiting on Async<T>: co_await overload, all(), try_await().
Canonical host-oriented coroutine task type.
Definition async_task.hpp:196
Async<T> is a container for coroutine-safe asynchronous read/write.
Definition async/async.hpp:93
ReadBuffer< T > read() const
Begin an asynchronous read of the value.
Definition async/async.hpp:339
EpochQueue const & queue() const
Inspect the shared epoch queue.
Definition async/async.hpp:423
WriteBuffer< T > write()
Begin exclusive asynchronous access to the payload.
Definition async/async.hpp:346
RAII handle for reading the value from an Async container at a given epoch.
Definition buffers.hpp:53
Exclusive mutable-access buffer for one Async<T> epoch.
Definition buffers.hpp:859
Mutable Tensor output supported by async operation wrappers.
Definition linalg/async/concepts.hpp:25
MutableTensorView with a specified static rank.
Definition tensor/concepts.hpp:166
TensorView whose readable mdspec has a specified static rank.
Definition tensor/concepts.hpp:149
Coroutine scheduler for AsyncTask.
Shared output capabilities for Async Tensor operation wrappers.
void schedule(AsyncTask &&task)
Schedule a task on the currently configured global scheduler.
Definition debug_scheduler.hpp:237
auto all(Aw &&... aw) noexcept
Build an awaitable that waits for all of the provided awaitables.
Definition awaiters.hpp:200
ReadBuffer< T > read(Async< T > const &a)
Convenience helper that forwards to Async<T>::read().
Definition async/async.hpp:540
Definition linalg/async.hpp:28
async::AsyncTask co_dispatch_kernel(BackendSelector selector, Op op, Args &... args)
Dispatch a kernel from a coroutine without requiring coroutine wrappers for blocking backends.
Definition async/dispatch.hpp:106
void matrix_exponential(BackendSelector selector, async::Async< OutputTensor > &output, async::Async< InputTensor > const &input, TimeScalar &&time)
Schedule fixed-output matrix exponentiation through an explicit selector.
Definition async/matrix_exponential.hpp:64
constexpr decltype(auto) mdspec_of(Tensor &tensor) noexcept(noexcept(tensor.mdspec()))
Return a tensor's immediate or descriptor-backed multidimensional metadata.
Definition tensor/concepts.hpp:50
Fixed-output dense matrix exponential operation.
Dense matrix exponential operation tag.
Definition operation_tags.hpp:202
#define ERROR_IF(cond,...)
Definition trace.hpp:389