MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::IntervalExtractor< InputType, OutputType > Class Template Reference

Finds where each score sequence is engaged, on the GPU, as a stream. More...

#include <IntervalExtractor.hpp>

Inheritance diagram for MayaFlux::Yantra::IntervalExtractor< InputType, OutputType >:
Collaboration diagram for MayaFlux::Yantra::IntervalExtractor< InputType, OutputType >:

Classes

struct  ChannelCall
struct  Outstanding

Public Types

using base_type = Extractor<InputType, OutputType>
using input_type = Datum<InputType>
using output_type = Datum<OutputType>
using supports = Supports<IntervalExtractorConfig>

Public Member Functions

void bind_scores (size_t channel, const GpuDispatchCore &source, uint32_t set, size_t binding)
 Read the scores of a channel from a device buffer instead of uploading them.
std::vector< IntervalBuffers > buffers () const
 Device views of the results of the latest call, one per channel.
std::optional< IntervalExtraction > collect ()
 The result of the outstanding submission, once it has completed.
ConfigRefs configs () const override
IntervalExtraction extract_intervals (const input_type &data)
 Type-safe interval extraction.
IntervalExtraction extract_intervals (const InputType &data)
IntervalExtraction extract_resident (std::span< const uint32_t > counts)
 Extraction over scores already on the device, waiting for the result.
ExtractionType get_extraction_type () const override
 IntervalExtractor (IntervalExtractorConfig config={})
 Construct an interval extractor from its settings.
bool pending () const
 True while a submission is outstanding and not yet collected.
bool ready () const
 True when nothing is outstanding or the outstanding submission has completed.
void reset ()
 Start a new stream: forget the detector state of every channel.
void share_recording (std::shared_ptr< GpuDispatchRecorder > recording)
 Append to a recording the caller shares with other work.
bool submit (const input_type &data)
 Record and submit an extraction without waiting for it.
bool submit (const InputType &data)
bool submit_resident (std::span< const uint32_t > counts)
 Record and submit an extraction over scores already on the device, without waiting.

Static Public Member Functions

static float fitness (const input_type &)
 One while a device is up, zero otherwise.

Static Public Attributes

static constexpr bool stateful = true
static constexpr Target target = targets::vulkan

Protected Member Functions

output_type extract_implementation (const input_type &input) override
std::string get_extractor_name () const override

Private Types

enum  Slot : uint32_t {
  Scores , Runs , Report , State ,
  SlotsPerChannel
}

Private Member Functions

void ensure_context () const
ChannelCall prepare_channel (size_t channel, std::span< const double > scores, bool resident, uint32_t resident_count, bool flush)
 Makes a column's buffers, uploads its scores and state, and counts the call.
ChannelIntervals read_channel (size_t channel, const ChannelCall &call) const
template<typename Columns>
std::vector< ChannelCall > record_all (const Columns &columns, const IntervalExtractorConfig &cfg)
std::vector< ChannelCall > record_resident (std::span< const uint32_t > counts, const IntervalExtractorConfig &cfg)
void record_scans (const std::vector< ChannelCall > &calls, const IntervalExtractorConfig &cfg)
 Records one scan per column that ran, each with its own settings.
void reset_state (size_t channels)

Static Private Member Functions

static size_t binding_of (size_t channel, Slot slot)
static void check_gate (uint32_t gate, size_t columns, size_t length)
static void check_settings (const IntervalScanSettings &settings, uint32_t length)
static bool gated_by_other (const IntervalScanSettings &settings, size_t channel)
static void validate_config (const IntervalExtractorConfig &cfg)

Private Attributes

std::unique_ptr< ShaderExecutionContext<> > m_context
std::vector< ChannelCall > m_last_calls
std::optional< Outstanding > m_outstanding
std::shared_ptr< GpuDispatchRecorder > m_recording
std::vector< bool > m_resident
std::vector< uint32_t > m_seen
std::vector< bool > m_started

Detailed Description

template<ComputeData InputType = Eigen::MatrixXd, ComputeData OutputType = std::vector<std::vector<double>>>
class MayaFlux::Yantra::IntervalExtractor< InputType, OutputType >

Finds where each score sequence is engaged, on the GPU, as a stream.

Every score depends on the state the previous one left, so one invocation reads a column's scores in order. Each column is its own scan with its own settings and its own state, and that state lives on the device and persists between calls, so successive calls continue one stream. The newest interval waits in the state until its successor closes, because its padded end depends on the gap that follows; set flush on the last call to release it. A flush ends the stream and the next call starts a new one. Call reset to start over without flushing.

The input is the matrix an analyzer returns, one score column per channel, so an analyzer such as VadAnalyzer or PhonemeAnalyzer chains into it directly. Other input types are instantiations of the same template.

It is on the vulkan target. Kinesis::Discrete::IntervalScanner is its CPU counterpart for scores in host memory and gives the same intervals, column by column. The output data is, per channel, the start and end of each completed interval in turn; the IntervalExtraction facet holds the same as pairs.

Definition at line 244 of file IntervalExtractor.hpp.


The documentation for this class was generated from the following file: