16namespace detail::cuda_reference
19template <
class Scalar>
async::CudaTask co_copy_submission(CopyPlan<Scalar> plan)
21 auto& resources = plan.output_buffer->resources();
22 co_await uni20::cuda::set_device(resources.device());
23 auto stream =
co_await uni20::cuda::acquire_stream(resources.streams());
24 enqueue_device_copy(plan, stream);
29template <
class OutputMdspan,
class InputMdspan>
30 requires(SupportedCopyMdspans<OutputMdspan, InputMdspan> && is_raw_cuda_mdspec<OutputMdspan> &&
31 is_supported_cuda_mdspan<InputMdspan>)
32auto try_make_copy_task(OutputMdspan& output, InputMdspan& input) -> KernelTaskAttempt<async::CudaTask>
34 auto preparation = prepare_copy(output, input);
37 return KernelTaskAttempt<async::CudaTask>{preparation.attempt};
40 int const device = preparation.output_buffer->device().ordinal();
41 auto task = co_copy_submission(std::move(preparation));
43 return KernelTaskAttempt<async::CudaTask>{std::move(task)};
48template <uni20::MutableMdspecLike OutputMdspan, uni20::MdspecLike InputMdspan>
49 requires(detail::cuda_reference::SupportedCopyMdspans<OutputMdspan, InputMdspan> &&
50 detail::cuda_reference::is_raw_cuda_mdspec<OutputMdspan> &&
51 detail::cuda_reference::is_supported_cuda_mdspan<InputMdspan>)
55 return detail::cuda_reference::try_make_copy_task(output, input);
void bind_device(int device)
Bind the CUDA device before the coroutine starts.
Definition async_task_promise.hpp:673
CUDA-constrained public task type used for typed initial admission.
Definition cuda_task.hpp:14
Runtime backend attempt optionally carrying a deferred kernel task.
Definition kernel_task.hpp:31
CUDA-specific awaiters for device and runtime resource scheduling.
Defines the CUDA task admission type and scheduler interface.
Deferred task result for an optional coroutine kernel implementation.
CUDA runtime backend for contiguous Tensor transfers.
CudaTaskPromise & cuda_promise(TaskHandle handle) noexcept
Narrow an erased task promise after verifying that it is CUDA-specific.
Definition async_task_promise.hpp:707
stream
Selects the ordinary display stream for a message.
Definition display.hpp:25
Definition linalg/async.hpp:28
constexpr bool kernel_attempt_succeeded(KernelAttempt attempt) noexcept
Return whether a backend performed the operation.
Definition kernel_attempt.hpp:40
auto try_make_kernel_task(CublasBackend, gemm_op const &, OutputMdspan &output, Scalar const &alpha, LhsMdspan &lhs, RhsMdspan &rhs, Scalar const &beta) -> KernelTaskAttempt< async::CudaTask >
Prepare asynchronous cuBLAS work from normalized mdspecs.
Definition gemm_task.hpp:59
Backend value for generic CUDA runtime kernels and transfers.
Definition backend_selector.hpp:48
Accessor-respecting element copy operation tag.
Definition operation_tags.hpp:33