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

◆ word_pair_map_stage() [3/3]

DependencyStage MayaFlux::Yantra::word_pair_map_stage ( WordPairExecutionContext & context,
const GpuComputeConfig & config,
Portal::Graphics::WordPairOp op,
std::span< const double > a,
std::span< const double > b,
uint32_t workgroup = 256 )
inlinenodiscard

The stage that applies the operation to every element of two host sequences.

The element count is the length of a, or the shorter of a and b for a binary operation. The result is that many doubles.

const auto spec = word_pair_map_spec(WordPairOp::Div);
const auto config = config_from_spec(spec);
WordPairExecutionContext context(config, bindings_from_spec(spec), false, "WordPairMap");
context.record_stages({ word_pair_map_stage(context, config, WordPairOp::Div, numerators, denominators) });
const auto quotients = context.download_words(2, numerators.size());
Shader context whose numeric input is staged as a uvec2 per double.
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.
Portal::Graphics::ShaderSpec word_pair_map_spec(Portal::Graphics::WordPairOp op, uint32_t workgroup=256)
The spec of a WordPairMap kernel.
GpuComputeConfig config_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuComputeConfig from a ShaderSpec.
std::vector< GpuBufferBinding > bindings_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuBufferBinding list from a ShaderSpec.
Parameters
contextContext built with config.
configConfig of the spec the context was built from.
opOperation of the spec.
aFirst operand of every element.
bSecond operand of every element, ignored for Sqrt.
workgroupWorkgroup size of the spec.

Definition at line 206 of file WordPairMap.hpp.

209{
210 const bool unary = word_pair_unary(op);
211 const size_t count = unary ? a.size() : std::min(a.size(), b.size());
212
213 return word_pair_map_stage(context, config, op, count, WordPairOperand(a), WordPairOperand(b), workgroup);
214}
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 word_pair_map_stage(), and word_pair_unary().

Here is the call graph for this function: