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

◆ lagged_pair_stage() [2/2]

DependencyStage MayaFlux::Yantra::lagged_pair_stage ( WordPairExecutionContext & context,
const GpuComputeConfig & config,
std::span< const double > values,
const SegmentGeometry & geometry,
uint32_t first_lag,
uint32_t lag_count )
inlinenodiscard

The stage that sums every window at every lag in a range.

One workgroup runs per lag and window, so the lag count and the window count are each limited to the device's maximum workgroup count, 65535 at least. The result is geometry.count * lag_count doubles, window major.

const auto spec = lagged_pair_spec(PairMap::Product, true);
const auto config = config_from_spec(spec);
WordPairExecutionContext context(config, bindings_from_spec(spec), false, "LaggedPair");
context.record_stages({ lagged_pair_stage(context, config, values, geometry, 0, 64) });
const auto sums = context.download_words(1, geometry.count * 64);
Shader context whose numeric input is staged as a uvec2 per double.
Portal::Graphics::ShaderSpec lagged_pair_spec(Portal::Graphics::PairMap map, bool centred, uint32_t workgroup=256)
The spec of a LaggedPair kernel.
DependencyStage lagged_pair_stage(WordPairExecutionContext &context, const GpuComputeConfig &config, const SegmentGeometry &geometry, uint32_t first_lag, uint32_t lag_count)
The stage that sums every window at every lag in a range, over values already on the device.
GpuComputeConfig config_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuComputeConfig from a ShaderSpec.
std::vector< GpuBufferBinding > bindings_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuBufferBinding list from a ShaderSpec.
Parameters
contextContext built with config.
configConfig of the spec the context was built from.
valuesDoubles the windows index into. Every window must lie inside it.
geometryWindow length, stride, first offset and count.
first_lagShortest lag.
lag_countNumber of consecutive lags.

Definition at line 113 of file LaggedPair.hpp.

116{
117 auto stage = lagged_pair_stage(context, config, geometry, first_lag, lag_count);
118 stage.stage_fn = [&context, values, resident = std::move(stage.stage_fn)](GpuDispatchCore& core) {
119 context.stage_words(0, values);
120 resident(core);
121 };
122 return stage;
123}
Non-template base that owns all type-independent GPU dispatch logic.
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.

References lagged_pair_stage(), and MayaFlux::Yantra::WordPairExecutionContext::stage_words().

Here is the call graph for this function: