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

◆ windowed_kernel_workgroup

uint32_t MayaFlux::Yantra::windowed_kernel_workgroup = 64
inlineconstexpr

Where a windowed kernel is written against.

The kernel runs once per window of a float sequence. Window w covers window_length samples starting at offset + w * stride. It is either a GLSL body, wrapped by windowed_kernel_config, or a whole .comp file that follows the same layout. Both run in float32, the usual precision of GLSL and not the library's double, so results agree with a double reference only to float precision.

Layout, set 0: bindings 0 to inputs - 1 are the samples (float, read), then the parameters (float, read; one zero when none are given), then the results (float, written; outputs values per window, window major). With one input the bindings are 0, 1 and 2. The push constants are uints: window_length, stride, offset, window_count and outputs, then a stride and an offset for each further input. The window length is shared by every input.

A body sees those names, the first input as samples with sample_at(window, k), the further inputs as samples2 to samples4 with sample2_at to sample4_at and their stride2, offset2 and so on, window_base (the first sample of the first input's window) and result_base (the first result of the window). The kernel must write every result it declares.

With one lane the workgroup is 64 and each invocation runs one window: the window index is i, and windows past window_count return before the body runs.

With lanes of 2 or more, a power of two up to 1024, one workgroup runs one window and its lanes share the window's work. The body sees window, lane and lanes, and these functions, which every lane of the window must call together, outside any branch that some lanes skip:

float lane_reduce_sum(float v) the sum of v over the lanes, in a fixed order float lane_reduce_max(float v) the largest v float lane_reduce_min(float v) the smallest v uint lane_first(bool condition) the lowest lane whose condition holds, or lanes when none

Every lane receives the result. Only one lane should write the results, for example lane 0. The index of a maximum is lane_first(v == lane_reduce_max(v)). A .comp file follows the same bindings and push constants, with a workgroup of lanes, or 64 for one lane, and a group count of window_count for lanes of 2 or more.

Definition at line 68 of file WindowedKernelAnalyzer.hpp.

Referenced by MayaFlux::Yantra::WindowedKernelShape::groups(), and MayaFlux::Yantra::WindowedKernelShape::workgroup().