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

◆ Impl()

MayaFlux::Yantra::HubertPhonemeModel::Impl::Impl ( const Kakshya::TensorSet & weights,
std::shared_ptr< GpuDispatchRecorder > shared )
inline

Definition at line 238 of file HubertPhonemeModel.cpp.

239 : recording(shared ? std::move(shared) : std::make_shared<GpuDispatchRecorder>(true))
240 , context(std::make_unique<ShaderExecutionContext<>>(
241 GpuComputeConfig { .shader_path = TensorKernels::conv1d_shader, .workgroup_size = { TensorKernels::element_workgroup, 1, 1 }, .push_constant_size = sizeof(TensorKernels::Conv1dPC) }))
242 {
243 context->set_recording(recording);
244 if (!context->ensure_gpu_ready()) {
246 std::source_location::current(), "HubertPhonemeModel needs a graphics device and none is available");
247 }
248
249 front = pack(weights, front_specs());
251 front.values = std::vector<float> {};
252
253 for (uint32_t block = 0; block < k_blocks; ++block) {
254 blocks[block] = pack(weights, block_specs(block));
255 TensorKernels::upload_packed_weights(*context, 0, WeightsBlock0 + block, blocks[block]);
256 blocks[block].values = std::vector<float> {};
257 }
258
259 const auto folded = fold_position_weights(pack(weights, position_specs()));
260 context->ensure_shared_buffer(0, WeightsPosition, folded.size(), GpuBufferBinding::ElementType::FLOAT32,
262 context->upload_shared_raw(0, WeightsPosition, reinterpret_cast<const uint8_t*>(folded.data()), folded.size() * sizeof(float));
263 }
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
@ COMPUTE
Storage buffer for compute shaders (device-local).
constexpr const char * conv1d_shader
Definition Layouts.hpp:24
constexpr uint32_t element_workgroup
Invocations per workgroup of the element-wise kernels.
Definition Layouts.hpp:15
void upload_packed_weights(GpuDispatchCore &context, uint32_t set, size_t binding, const PackedWeights &packed)
Allocate a shared buffer on a context and fill it with packed weights.
Portal::Graphics::GpuComputeConfig GpuComputeConfig
enum MayaFlux::Portal::Graphics::GpuBufferBinding::ElementType FLOAT32
std::unique_ptr< ShaderExecutionContext<> > context
std::shared_ptr< GpuDispatchRecorder > recording
std::array< TensorKernels::PackedWeights, k_blocks > blocks

References context, MayaFlux::Yantra::TensorKernels::element_workgroup, and recording.