One reduction per segment, as one dispatch of the SegmentedReduction template.
More...
|
| std::vector< double > | reduce (std::span< const double > values, const SegmentGeometry &geometry) |
| | Reduce every segment.
|
| | SegmentedReductionContext (Portal::Graphics::KernelOp combine, Portal::Graphics::ReductionMap map=Portal::Graphics::ReductionMap::Identity, uint32_t workgroup=256) |
| void | stage (const SegmentGeometry &geometry) |
| | Stage the geometry for values that are already on the device.
|
| void | stage (std::span< const double > values, const SegmentGeometry &geometry) |
| | Stage values and geometry for the next dispatch without running it.
|
| std::vector< double > | decode_primary (const GpuChannelResult &result) const |
| | Decode a dispatch result, as returned by an asynchronous collect, to doubles.
|
| std::vector< double > | download_words (size_t binding, size_t count) |
| | Read a binding back as doubles after a recorded stage.
|
| bool | order_keyed () const noexcept |
| std::span< const double > | primary_values () const noexcept |
| | The primary output of the last dispatch decoded to doubles.
|
| std::span< const uint32_t > | primary_words () const noexcept |
| | The primary output of the last dispatch as 32-bit words, empty if it produced none.
|
| void | stage_words (uint32_t binding, std::span< const double > values, size_t padded_count=0, bool complement=false) |
| | Encode values and stage them as the data of a binding.
|
| | WordPairExecutionContext (GpuComputeConfig config, std::vector< GpuBufferBinding > bindings, bool order_key, std::string name="WordPairExecutionContext") |
| GpuChannelResult | collect_result () |
| | Collect the result of the last async dispatch.
|
| Portal::Graphics::FenceID | dispatch_async (const input_type &input) |
| | Dispatch asynchronously and return a fence for polling.
|
| output_type | execute (const input_type &input, const ExecutionContext &ctx) override |
| | Injects multipass configuration into the context before dispatch when set_multipass() has been called.
|
| template<typename T> |
| ShaderExecutionContext & | in_out (const std::vector< T > &data, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Add an INPUT_OUTPUT binding, inferring the next available binding index.
|
| ShaderExecutionContext & | in_out (GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Declare an INPUT_OUTPUT binding at an explicit index without pre-staging data.
|
| template<typename T> |
| ShaderExecutionContext & | in_out (uint32_t binding, const std::vector< T > &data, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Add an INPUT_OUTPUT binding at an explicit index.
|
| ShaderExecutionContext & | in_out (uint32_t binding, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Declare an INPUT_OUTPUT binding without pre-staging data.
|
| template<typename T> |
| ShaderExecutionContext & | input (const std::vector< T > &data, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Add an INPUT binding, inferring the next available binding index.
|
| template<typename T> |
| ShaderExecutionContext & | input (uint32_t binding, const std::vector< T > &data, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Add an INPUT binding at an explicit index.
|
| ShaderExecutionContext & | output (size_t byte_size, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Add an OUTPUT binding, inferring the next available binding index.
|
| ShaderExecutionContext & | output (uint32_t binding, size_t byte_size, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32) |
| | Add an OUTPUT binding at an explicit index.
|
| template<typename T> |
| ShaderExecutionContext & | push (const T &data) |
| | Set push constants from a trivially copyable struct or value.
|
| ShaderExecutionContext & | set_multipass (uint32_t pass_count, std::function< void(uint32_t, void *)> pc_updater) |
| | Configure multi-pass (CHAINED) dispatch.
|
| void | set_skip_readback (uint32_t binding, bool skip) |
| | Set or clear skip_auto_readback for a binding by index.
|
| | ShaderExecutionContext (GpuComputeConfig config, std::vector< GpuBufferBinding > bindings={}, std::string name="ShaderExecutionContext", bool compute_isolated=true) |
| | Construct with shader config and optional pre-built binding list.
|
| | GpuExecutionContext (const GpuExecutionContext &)=delete |
| | GpuExecutionContext (GpuComputeConfig config, bool compute_isolated=true) |
| | GpuExecutionContext (GpuExecutionContext &&)=delete |
| GpuExecutionContext & | operator= (const GpuExecutionContext &)=delete |
| GpuExecutionContext & | operator= (GpuExecutionContext &&)=delete |
| | ~GpuExecutionContext () override=default |
| const std::string & | dispatch_key () const |
| | The key used for this context's GpuResourceManager unit.
|
| void | download_binding (size_t index, void *dest, size_t byte_size) |
| | Read back a specific binding into a caller-provided destination.
|
| void | download_shared (uint32_t set, size_t binding_index, void *dest, size_t byte_size) |
| bool | ensure_gpu_ready () |
| | Ensure GPU resources are initialised.
|
| void | ensure_shared_buffer (uint32_t set, size_t binding_index, size_t element_count, GpuBufferBinding::ElementType element_type, Portal::Graphics::BufferUsageHint usage_hint=Portal::Graphics::BufferUsageHint::COMPUTE_STORAGE) |
| | Ensure a shared storage buffer of at least element_count elements exists at (set, binding_index).
|
| void | fill_shared (uint32_t set, size_t binding_index, uint32_t value) |
| | Fill the whole shared buffer at (set, binding_index) with one 32-bit value, in order with the recorded dispatches.
|
| std::shared_ptr< Core::VKImage > | get_output_image (size_t binding_index) const |
| | Return the image registered at an IMAGE_STORAGE output binding.
|
| | GpuDispatchCore (const GpuDispatchCore &)=delete |
| | GpuDispatchCore (GpuComputeConfig config, bool compute_isolated=true) |
| | GpuDispatchCore (GpuDispatchCore &&)=delete |
| void | import_shared (uint32_t set, size_t binding_index, const GpuDispatchCore &source, uint32_t source_set, size_t source_binding_index, GpuBufferBinding::ElementType element_type) |
| | Resolve a binding of this context to a shared buffer owned by another context.
|
| bool | is_gpu_ready () const |
| | Query GPU readiness without attempting initialisation.
|
| GpuDispatchCore & | operator= (const GpuDispatchCore &)=delete |
| GpuDispatchCore & | operator= (GpuDispatchCore &&)=delete |
| void | record_stages (const std::vector< DependencyStage > &stages) |
| | Stage and record each stage in order, one dispatch per stage.
|
| template<typename T> |
| void | set_binding_data (size_t index, const std::vector< T > &data) |
| template<typename T> |
| void | set_binding_data (size_t index, std::span< const T > data) |
| | Pre-stage typed data for a specific binding slot, bypassing the default channel-flattening path in prepare_gpu_inputs.
|
| void | set_output_size (size_t index, size_t byte_size) |
| | Declare the byte capacity of an output binding independently of input data.
|
| template<typename T> |
| void | set_push_constants (const T &data) |
| | Typed convenience wrapper for set_push_constants(const void*, size_t).
|
| void | set_push_constants (const void *data, size_t bytes) |
| | Set push constant data from a raw byte pointer.
|
| void | set_recording (std::shared_ptr< GpuDispatchRecorder > recording) |
| | Append this context's work to a recording shared with other contexts.
|
| uint64_t | shared_buffer_address (uint32_t set, size_t binding_index) const |
| | Device address of the shared buffer at (set, binding_index), or zero when absent.
|
| Portal::Graphics::GpuBufferHandle | shared_buffer_handle (uint32_t set, size_t binding_index) const |
| | Non-owning view of the shared buffer at (set, binding_index).
|
| std::optional< SharedBufferInfo > | shared_buffer_info (uint32_t set, size_t binding_index) const |
| | What the shared buffer at (set, binding_index) declares, or nothing when absent.
|
| void | stage_image_at (size_t binding_index, std::shared_ptr< Core::VKImage > image, GpuBufferBinding::ElementType kind, vk::Sampler sampler=nullptr) |
| | Register a VKImage at an explicit binding index.
|
| void | swap_shader (GpuComputeConfig config) |
| | Switch which shader subsequent dispatch_core calls target.
|
| void | upload_shared_raw (uint32_t set, size_t binding_index, const uint8_t *data, size_t byte_size) |
| virtual | ~GpuDispatchCore ()=default |
|
| std::array< uint32_t, 3 > | calculate_dispatch_size (size_t, const DataStructureInfo &) const override |
| | One workgroup per segment.
|
| output_type | collect_gpu_outputs (const GpuChannelResult &raw, const std::vector< std::vector< double > > &, const DataStructureInfo &) override |
| | Keeps the primary output as words; the context returns no Datum.
|
| std::vector< GpuBufferBinding > | declare_buffer_bindings () const override |
| | Returns the binding list declared via constructor or fluent API.
|
| virtual std::pair< std::vector< std::vector< double > >, DataStructureInfo > | extract_inputs (const input_type &input) |
| | Extract channel data and structure metadata from the input Datum.
|
| GpuChannelResult | dispatch_core (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info) |
| | Full single-pass dispatch.
|
| Portal::Graphics::FenceID | dispatch_core_async (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info) |
| | Non-blocking variant of dispatch_core.
|
| GpuChannelResult | dispatch_core_chained (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info, const ExecutionContext &ctx) |
| | Multi-pass (chained) dispatch.
|
| GpuChannelResult | dispatch_core_chained_indirect (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info, const ExecutionContext &ctx) |
| | Multi-pass dispatch where a GPU-resident indirect buffer gates each pass's workgroup count instead of a fixed pass_count.
|
| size_t | find_first_output_index () const |
| void | flatten_channels_to_staging (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info) |
| | Flatten planar double channels into m_staging_floats.
|
| void | flatten_native_variants_to_staging (const std::vector< Kakshya::DataVariant > &variants, const DataStructureInfo &structure_info) |
| | Flatten native-typed DataVariant channels into m_native_staging_bytes without any conversion.
|
| const GpuComputeConfig & | gpu_config () const |
| size_t | largest_binding_data_element_count () const |
| size_t | last_effective_element_count () const |
| | Effective element count used by the last dispatch_core or dispatch_core_async call.
|
| virtual void | on_before_gpu_dispatch (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info) |
| | Called immediately before dispatch.
|
| virtual void | prepare_gpu_inputs (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info) |
| | Marshal channel data into GPU input buffers.
|
| void | readback_aux (GpuChannelResult &result) |
| | Read back all OUTPUT bindings that have explicit size overrides into the aux map of a GpuChannelResult.
|
| std::vector< float > | readback_primary (size_t float_count) |
| | Read back the primary output buffer into a float vector.
|
| void | stage_native_bytes (Kakshya::GpuDataFormat format, const void *data, size_t byte_size) |
| | Stage raw input bytes of one element type for the next dispatch.
|
| void | stage_passthrough (size_t binding_index, const void *data, size_t byte_size) |
| | Stage raw bytes for a PASSTHROUGH binding before dispatch.
|
One reduction per segment, as one dispatch of the SegmentedReduction template.
Values are staged as word pairs and combined by the template's emulated IEEE double arithmetic, so a result agrees with a CPU reduction up to the order the partial results are combined in. The map is applied to each value before the combine. Max and Min follow the library order key, where every NaN is the largest. An empty segment yields the combine's identity: zero for Sum, negative infinity for Max, NaN for Min.
Definition at line 26 of file SegmentedReductionContext.hpp.