MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ dispatch_core_chained_indirect()

GpuChannelResult MayaFlux::Yantra::GpuDispatchCore::dispatch_core_chained_indirect ( const std::vector< std::vector< double > > &  channels,
const DataStructureInfo structure_info,
const ExecutionContext ctx 
)
protected

Multi-pass dispatch where a GPU-resident indirect buffer gates each pass's workgroup count instead of a fixed pass_count.

Calls dispatch_batched_indirect on GpuResourceManager and reads back once after all passes.

Parameters
channelsExtracted double channels.
structure_infoDimension/modality metadata.
ctxExecutionContext carrying pass_count, pc_updater, and indirect_dispatch_binding.
Returns
GpuChannelResult containing primary float readback and aux buffers.

Definition at line 294 of file GpuDispatchCore.cpp.

298{
299 on_before_gpu_dispatch(channels, structure_info);
300 prepare_gpu_inputs(channels, structure_info);
301
303 if (!ensure_gpu_ready()) {
304 error<std::runtime_error>(Journal::Component::Yantra,
306 std::source_location::current(),
307 "GpuDispatchCore: dispatch_core_chained_indirect GPU initialisation failed");
308 }
309
311
312 const size_t effective = m_staging_floats.empty()
314 : m_staging_floats.size();
315 const auto groups = calculate_dispatch_size(effective, structure_info);
316
317 const auto indirect_it = std::ranges::find_if(m_bindings, [](const auto& b) {
319 });
320 if (indirect_it == m_bindings.end()) {
321 error<std::runtime_error>(Journal::Component::Yantra, Journal::Context::Runtime,
322 std::source_location::current(),
323 "GpuDispatchCore: dispatch_core_chained_indirect requires a binding with usage_hint INDIRECT");
324 }
325
327 dispatch_key(), indirect_it->set, indirect_it->binding, groups, m_bindings,
329
330 GpuChannelResult result;
331 result.primary = readback_primary(effective);
332 readback_aux(result);
333 return result;
334}
size_t b
void readback_aux(GpuChannelResult &result)
Read back all OUTPUT bindings that have explicit size overrides into the aux map of a GpuChannelResul...
virtual std::array< uint32_t, 3 > calculate_dispatch_size(size_t total_elements, const DataStructureInfo &structure_info) const
Calculate workgroup dispatch counts from structure dimensions.
const std::string & dispatch_key() const
The key used for this context's GpuResourceManager unit.
std::vector< GpuBufferBinding > m_bindings
bool ensure_gpu_ready()
Ensure GPU resources are initialised.
virtual void prepare_gpu_inputs(const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
Marshal channel data into GPU input buffers.
virtual void on_before_gpu_dispatch(const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
Called immediately before dispatch.
std::vector< float > readback_primary(size_t float_count)
Read back the primary output buffer into a float vector.
virtual std::vector< GpuBufferBinding > declare_buffer_bindings() const
Declare the storage buffers the shader expects.
void dispatch_batched_indirect(const std::string &key, uint32_t indirect_set, size_t indirect_binding, const std::array< uint32_t, 3 > &groups, const std::vector< GpuBufferBinding > &bindings, size_t push_constant_size, const ExecutionContext &ctx)
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Runtime
General runtime operations (default fallback)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
@ INDIRECT
Indirect draw/dispatch buffer (device-local)

References b, bind_all_descriptors(), MayaFlux::Journal::BufferProcessing, calculate_dispatch_size(), declare_buffer_bindings(), MayaFlux::Yantra::GpuResourceManager::dispatch_batched_indirect(), dispatch_key(), ensure_gpu_ready(), MayaFlux::Portal::Graphics::INDIRECT, largest_binding_data_element_count(), m_bindings, m_gpu_config, m_resources, m_staging_floats, on_before_gpu_dispatch(), prepare_gpu_inputs(), MayaFlux::Yantra::GpuChannelResult::primary, MayaFlux::Portal::Graphics::GpuComputeConfig::push_constant_size, readback_aux(), readback_primary(), MayaFlux::Journal::Runtime, and MayaFlux::Journal::Yantra.

Referenced by MayaFlux::Yantra::GpuExecutionContext< InputType, OutputType >::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: