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

◆ lagged_pair_stage() [1/2]

DependencyStage MayaFlux::Yantra::lagged_pair_stage ( WordPairExecutionContext & context,
const GpuComputeConfig & config,
const SegmentGeometry & geometry,
uint32_t first_lag,
uint32_t lag_count )
inlinenodiscard

The stage that sums every window at every lag in a range, over values already on the device.

The values are whatever binding 0 resolves to: a shared buffer of the context, or one imported from another context with import_shared. Nothing is staged from the host. Many passes over one input then share a single upload.

Parameters
contextContext built with config.
configConfig of the spec the context was built from.
geometryWindow length, stride, first offset and count. Every window must lie inside the values.
first_lagShortest lag.
lag_countNumber of consecutive lags.

Definition at line 68 of file LaggedPair.hpp.

71{
72 const auto length_bits = std::bit_cast<uint64_t>(static_cast<double>(geometry.length));
73 const std::array<uint32_t, 7> push {
74 geometry.length, geometry.stride, geometry.offset, first_lag, lag_count,
75 static_cast<uint32_t>(length_bits & 0xFFFFFFFFU), static_cast<uint32_t>(length_bits >> 32U)
76 };
77 const size_t result_bytes = static_cast<size_t>(geometry.count) * lag_count * sizeof(uint64_t);
78
79 return DependencyStage {
80 .config = config,
81 .stage_fn = [&context, result_bytes, push](GpuDispatchCore&) {
82 if (!context.shared_buffer_info(0, 1)) {
83 context.set_output_size(1, result_bytes);
84 }
85 context.set_push_constants(push);
86 },
87 .explicit_groups = std::array<uint32_t, 3> { lag_count, geometry.count, 1U },
88 };
89}
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 set_output_size(size_t index, size_t byte_size)
Declare the byte capacity of an output binding independently of input data.
void set_push_constants(const void *data, size_t bytes)
Set push constant data from a raw byte pointer.

References MayaFlux::Yantra::SegmentGeometry::count, MayaFlux::Yantra::SegmentGeometry::length, MayaFlux::Yantra::SegmentGeometry::offset, MayaFlux::Yantra::GpuDispatchCore::set_output_size(), MayaFlux::Yantra::GpuDispatchCore::set_push_constants(), MayaFlux::Yantra::GpuDispatchCore::shared_buffer_info(), and MayaFlux::Yantra::SegmentGeometry::stride.

Referenced by lagged_pair_stage(), and MayaFlux::Yantra::WaveformAnalyzer< std::vector< Kakshya::DataVariant >, Eigen::MatrixXd >::record_lagged().

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