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

◆ interval_scan_stage()

DependencyStage MayaFlux::Yantra::interval_scan_stage ( const Kinesis::Discrete::IntervalScanConfig & config,
uint64_t scores,
uint64_t gate,
uint64_t state,
uint64_t runs,
uint64_t report,
uint32_t first_index,
uint32_t n,
bool flush )
inlinenodiscard

One interval_scan dispatch: continue a stream with n scores from device memory.

All buffers are float32 or uint32 and addressed by device address. The thresholds are rounded up to floats, so a float score compares exactly as it does in the host scanner. The state buffer persists between calls and is zeroed to start a stream. The first word of the report buffer counts the runs appended and must be zero before each dispatch; the rest is overwritten.

Parameters
configSettings. Its length, or when 0 first_sample plus the scores seen after this call, clamps padded ends.
scoresDevice address of the scores.
gateDevice address of the gate scores, one per score, or 0 for no gate.
stateDevice address of interval_scan_state_words words.
runsDevice address of interval_scan_runs_words(n) words, start and end pairs.
reportDevice address of interval_scan_report_words words.
first_indexScores already seen in this stream.
nScores in this call.
flushEnd the stream with this call.
Exceptions
std::invalid_argumentWhen the config is not valid.

Definition at line 131 of file IntervalScanStage.hpp.

134{
135 if (const std::string reason = Kinesis::Discrete::diagnose_interval_scan(config); !reason.empty()) {
137 std::source_location::current(), "{}", reason);
138 }
139 const auto seen_end = static_cast<uint64_t>(first_index) + n;
140 const IntervalScanPC pc {
141 .scores = scores,
142 .state = state,
143 .runs = runs,
144 .report = report,
145 .gate = gate,
146 .n = n,
147 .first_index = first_index,
148 .hop = config.hop,
149 .min_run = config.min_run,
150 .min_gap = config.min_gap,
151 .pad = config.padding,
152 .gap_at_limit = config.gap_at_limit,
153 .run_limit = config.max_run == 0 ? std::numeric_limits<uint32_t>::max() : config.max_run - config.hop - 2 * config.padding,
154 .flags = (config.use_longest_gap ? interval_scan_flag_longest : 0U)
155 | (flush ? interval_scan_flag_flush : 0U)
156 | (gate != 0 ? interval_scan_flag_gated : 0U)
157 | (config.emit_on_close ? interval_scan_flag_emit_on_close : 0U),
158 .total = config.length != 0 ? config.length : static_cast<uint32_t>(config.first_sample + seen_end * config.hop),
159 .first_sample = config.first_sample,
160 .enter = detail::interval_scan_ceil_float(config.enter),
161 .leave = detail::interval_scan_ceil_float(config.leave),
162 .gate_threshold = detail::interval_scan_ceil_float(config.gate_threshold),
163 };
164 return DependencyStage {
165 .config = GpuComputeConfig { .shader_path = interval_scan_shader, .workgroup_size = { 1, 1, 1 }, .push_constant_size = sizeof(IntervalScanPC) },
166 .stage_fn = [pc](GpuDispatchCore& core) { core.set_push_constants(pc); },
167 .explicit_groups = std::array<uint32_t, 3> { 1U, 1U, 1U },
168 };
169}
Non-template base that owns all type-independent GPU dispatch logic.
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::string diagnose_interval_scan(const IntervalScanConfig &config)
Why a config cannot be scanned.
constexpr uint32_t interval_scan_flag_emit_on_close
constexpr uint32_t interval_scan_flag_flush
Portal::Graphics::GpuComputeConfig GpuComputeConfig
constexpr uint32_t interval_scan_flag_longest
constexpr uint32_t interval_scan_flag_gated
constexpr const char * interval_scan_shader

References MayaFlux::Journal::ComputeMatrix, MayaFlux::Kinesis::Discrete::diagnose_interval_scan(), MayaFlux::Kinesis::Discrete::IntervalScanConfig::emit_on_close, MayaFlux::Kinesis::Discrete::IntervalScanConfig::enter, MayaFlux::Kinesis::Discrete::IntervalScanConfig::first_sample, MayaFlux::Kinesis::Discrete::IntervalScanConfig::gap_at_limit, MayaFlux::Kinesis::Discrete::IntervalScanConfig::gate_threshold, MayaFlux::Kinesis::Discrete::IntervalScanConfig::hop, MayaFlux::Yantra::detail::interval_scan_ceil_float(), interval_scan_flag_emit_on_close, interval_scan_flag_flush, interval_scan_flag_gated, interval_scan_flag_longest, interval_scan_shader, MayaFlux::Kinesis::Discrete::IntervalScanConfig::leave, MayaFlux::Kinesis::Discrete::IntervalScanConfig::length, MayaFlux::Kinesis::Discrete::IntervalScanConfig::max_run, MayaFlux::Kinesis::Discrete::IntervalScanConfig::min_gap, MayaFlux::Kinesis::Discrete::IntervalScanConfig::min_run, MayaFlux::Kinesis::Discrete::IntervalScanConfig::padding, MayaFlux::Kinesis::Discrete::IntervalScanConfig::use_longest_gap, and MayaFlux::Journal::Yantra.

Referenced by MayaFlux::Yantra::IntervalExtractor< Eigen::MatrixXd, std::vector< std::vector< double > > >::record_scans().

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