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

◆ word_pair_map_stage() [1/3]

DependencyStage MayaFlux::Yantra::word_pair_map_stage ( WordPairExecutionContext & context,
const GpuComputeConfig & config,
Portal::Graphics::WordPairOp op,
size_t count,
const WordPairOperand & a,
const WordPairOperand & b,
uint32_t workgroup = 256 )
inlinenodiscard

The stage that applies the operation to count elements, each operand from the host or the device.

consumer.record_stages({ word_pair_map_stage(*consumer, config, WordPairOp::Div, count,
WordPairOperand::on_device(), divisors) });
DependencyStage word_pair_map_stage(WordPairExecutionContext &context, const GpuComputeConfig &config, Portal::Graphics::WordPairOp op, size_t count, uint32_t workgroup=256)
The stage that applies the operation to count elements whose operands are already on the device.
static WordPairOperand on_device()
The operand is already on the device.
Parameters
contextContext built with config.
configConfig of the spec the context was built from.
opOperation of the spec.
countElements to compute.
aFirst operand. A host operand must hold at least count elements.
bSecond operand, ignored for Sqrt. A host operand must hold at least count elements.
workgroupWorkgroup size of the spec.
Exceptions
std::invalid_argumentwhen a host operand holds fewer than count elements.

Definition at line 155 of file WordPairMap.hpp.

158{
159 const bool unary = word_pair_unary(op);
160 const auto check = [count](const WordPairOperand& operand) {
161 if (!operand.resident && operand.host.size() < count) {
163 std::source_location::current(),
164 "word_pair_map_stage: a host operand holds {} elements, {} are required", operand.host.size(), count);
165 }
166 };
167 check(a);
168 if (!unary) {
169 check(b);
170 }
171
172 auto stage = word_pair_map_stage(context, config, op, count, workgroup);
173 stage.stage_fn = [&context, a, b, unary, count, resident = std::move(stage.stage_fn)](GpuDispatchCore& core) {
174 if (!a.resident) {
175 context.stage_words(0, a.host.first(count));
176 }
177 if (!unary && !b.resident) {
178 context.stage_words(1, b.host.first(count));
179 }
180 resident(core);
181 };
182 return stage;
183}
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.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::vector< double > count(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sample count per window (as double for pipeline uniformity).
Definition Analysis.cpp:506
constexpr bool word_pair_unary(Portal::Graphics::WordPairOp op) noexcept
True for an operation that takes no second operand.
Where one operand of a WordPairMap stage comes from.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Yantra::WordPairOperand::host, MayaFlux::Yantra::WordPairOperand::resident, MayaFlux::Yantra::WordPairExecutionContext::stage_words(), word_pair_map_stage(), word_pair_unary(), and MayaFlux::Journal::Yantra.

Here is the call graph for this function: