36 std::vector<GpuBufferBinding> bindings,
38 std::string name =
"WordPairExecutionContext")
53 void stage_words(uint32_t binding, std::span<const double> values,
size_t padded_count = 0,
bool complement =
false)
81 const auto* bytes =
reinterpret_cast<const uint8_t*
>(result.
primary.data());
97 [[nodiscard]] std::vector<double>
download_words(
size_t binding,
size_t count)
102 std::vector<uint8_t> bytes(count *
sizeof(uint64_t));
117 const std::vector<std::vector<double>>& ,
120 const size_t count = raw.
primary.size();
122 const auto* src =
reinterpret_cast<const uint8_t*
>(raw.
primary.data());
123 for (
size_t i = 0; i < count; ++i) {
void download_binding(size_t index, void *dest, size_t byte_size)
Read back a specific binding into a caller-provided destination.
void download_shared(uint32_t set, size_t binding_index, void *dest, size_t byte_size)
std::optional< SharedBufferInfo > shared_buffer_info(uint32_t set, size_t binding_index) const
What the shared buffer at (set, binding_index) declares, or nothing when absent.
void set_binding_data(size_t index, std::span< const T > data)
Pre-stage typed data for a specific binding slot, bypassing the default channel-flattening path in pr...
static std::vector< double > decode_word_pairs(std::span< const uint8_t > bytes)
Decode little-endian 64-bit words as IEEE 754 doubles.
static std::vector< uint8_t > encode_word_pairs(std::span< const double > values, size_t padded_words=0, bool order_key=false, bool complement=false)
Encode doubles as little-endian 64-bit words, two 32-bit lanes each.
ShaderExecutionContext(GpuComputeConfig config, std::vector< GpuBufferBinding > bindings={}, std::string name="ShaderExecutionContext", bool compute_isolated=true)
Construct with shader config and optional pre-built binding list.
typename GpuExecutionContext< InputType, OutputType >::output_type output_type
std::vector< double > m_primary_values
std::vector< double > download_words(size_t binding, size_t count)
Read a binding back as doubles after a recorded stage.
std::vector< double > decode_primary(const GpuChannelResult &result) const
Decode a dispatch result, as returned by an asynchronous collect, to doubles.
bool order_keyed() const noexcept
output_type collect_gpu_outputs(const GpuChannelResult &raw, const std::vector< std::vector< double > > &, const DataStructureInfo &) override
Keeps the primary output as words; the context returns no Datum.
WordPairExecutionContext(GpuComputeConfig config, std::vector< GpuBufferBinding > bindings, bool order_key, std::string name="WordPairExecutionContext")
std::span< const double > primary_values() const noexcept
The primary output of the last dispatch decoded to doubles.
std::vector< uint32_t > m_primary_words
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.
std::span< const uint32_t > primary_words() const noexcept
The primary output of the last dispatch as 32-bit words, empty if it produced none.
uint32_t load_le_u32(const uint8_t *src) noexcept
Load a uint32 from four little-endian bytes.
Plain-data description of the compute shader to dispatch.
Dimensions, modality, source type, and optional Composite field schema.
std::vector< float > primary
Erased output of a GPU dispatch: reconstructed float data plus any raw auxiliary outputs keyed by bin...