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

◆ upload_packed_weights()

void MayaFlux::Yantra::TensorKernels::upload_packed_weights ( GpuDispatchCore & context,
uint32_t set,
size_t binding,
const PackedWeights & packed )
inline

Allocate a shared buffer on a context and fill it with packed weights.

Parameters
contextThe context whose shared buffer holds the weights.
setDescriptor set of the buffer.
bindingBinding of the buffer.
packedThe weights. The buffer is device local, so it is read by the kernels and not from the host.

Definition at line 135 of file Yantra/Executors/TensorKernels/Weights.hpp.

136{
137 if (packed.values.empty()) {
138 return;
139 }
140 context.ensure_shared_buffer(set, binding, packed.values.size(), GpuBufferBinding::ElementType::FLOAT32,
142 context.upload_shared_raw(set, binding, reinterpret_cast<const uint8_t*>(packed.values.data()),
143 packed.values.size() * sizeof(float));
144}
void ensure_shared_buffer(uint32_t set, size_t binding_index, size_t element_count, GpuBufferBinding::ElementType element_type, Portal::Graphics::BufferUsageHint usage_hint=Portal::Graphics::BufferUsageHint::COMPUTE_STORAGE)
Ensure a shared storage buffer of at least element_count elements exists at (set, binding_index).
void upload_shared_raw(uint32_t set, size_t binding_index, const uint8_t *data, size_t byte_size)
@ COMPUTE
Storage buffer for compute shaders (device-local).
enum MayaFlux::Portal::Graphics::GpuBufferBinding::ElementType FLOAT32

References MayaFlux::Portal::Graphics::COMPUTE, MayaFlux::Yantra::GpuDispatchCore::ensure_shared_buffer(), MayaFlux::Portal::Graphics::GpuBufferBinding::FLOAT32, MayaFlux::Yantra::GpuDispatchCore::upload_shared_raw(), and MayaFlux::Yantra::TensorKernels::PackedWeights::values.

Here is the call graph for this function: