MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
GpuSorter.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "UniversalSorter.hpp"
5
6namespace MayaFlux::Yantra {
7
8/**
9 * @class GpuSorter
10 * @brief Concrete UniversalSorter that dispatches entirely via a
11 * GpuExecutionContext. CPU path is a hard error.
12 *
13 * @tparam InputType ComputeData type accepted.
14 * @tparam OutputType ComputeData type produced.
15 */
16template <ComputeData InputType = std::vector<Kakshya::DataVariant>,
17 ComputeData OutputType = InputType>
18class MAYAFLUX_API GpuSorter : public UniversalSorter<InputType, OutputType> {
19public:
22
23 /**
24 * @brief Construct with a configured GpuExecutionContext.
25 * @param executor Configured executor. Must not be null.
26 */
27 explicit GpuSorter(
28 std::shared_ptr<GpuExecutionContext<InputType, OutputType>> executor)
29 {
30 assert(executor && "GpuSorter: executor must not be null");
31 m_executor = executor;
32 this->set_gpu_backend(std::move(executor));
33 }
34
35 /**
36 * @brief Returns the attached GpuExecutionContext for further configuration.
37 */
38 [[nodiscard]] std::shared_ptr<GpuExecutionContext<InputType, OutputType>>
39 get_executor() const { return m_executor; }
40
41 [[nodiscard]] std::string get_sorter_name() const override
42 {
43 return "GpuSorter";
44 }
45
46 [[nodiscard]] SortingType get_sorting_type() const override
47 {
48 return SortingType::CUSTOM;
49 }
50
51protected:
53 {
54 error<std::runtime_error>(
55 Journal::Component::Yantra,
56 Journal::Context::BufferProcessing,
57 std::source_location::current(),
58 "GpuSorter: GPU unavailable and no CPU fallback provided");
59 }
60
61private:
62 std::shared_ptr<GpuExecutionContext<InputType, OutputType>> m_executor;
63};
64
65} // namespace MayaFlux::Yantra
Modern, digital-first universal sorting framework for Maya Flux.
Type-parameterised shell over GpuDispatchCore.
std::shared_ptr< GpuExecutionContext< InputType, OutputType > > m_executor
Definition GpuSorter.hpp:62
output_type sort_implementation(const input_type &) override
Pure virtual sorting implementation - derived classes implement this.
Definition GpuSorter.hpp:52
GpuSorter(std::shared_ptr< GpuExecutionContext< InputType, OutputType > > executor)
Construct with a configured GpuExecutionContext.
Definition GpuSorter.hpp:27
SortingType get_sorting_type() const override
Gets the sorting type category for this sorter.
Definition GpuSorter.hpp:46
std::shared_ptr< GpuExecutionContext< InputType, OutputType > > get_executor() const
Returns the attached GpuExecutionContext for further configuration.
Definition GpuSorter.hpp:39
std::string get_sorter_name() const override
Get sorter-specific name (derived classes override this)
Definition GpuSorter.hpp:41
Concrete UniversalSorter that dispatches entirely via a GpuExecutionContext.
Definition GpuSorter.hpp:18
Template-flexible sorter base with instance-defined I/O types.
SortingType
Categories of sorting operations for discovery and organization.
Input/Output container for computation pipeline data flow with structure preservation.
Definition DataIO.hpp:24