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

◆ calculate_dispatch_size()

std::array< uint32_t, 3 > MayaFlux::Yantra::GpuDispatchCore::calculate_dispatch_size ( size_t  total_elements,
const DataStructureInfo &  structure_info 
) const
protectedvirtual

Calculate workgroup dispatch counts from structure dimensions.

Reads SPATIAL_X/Y/Z roles for 2D/3D shaders; falls back to 1D element-count dispatch when no spatial dimensions exist.

Parameters
total_elementsFlat element count for the 1D fallback.
structure_infoDimension metadata.

Reimplemented in MayaFlux::Yantra::TextureExecutionContext.

Definition at line 213 of file GpuDispatchCore.cpp.

215{
216 uint64_t sz_x = 0, sz_y = 0, sz_z = 0;
217 for (const auto& dim : structure_info.dimensions) {
218 switch (dim.role) {
220 sz_x = dim.size;
221 break;
223 sz_y = dim.size;
224 break;
226 sz_z = dim.size;
227 break;
228 default:
229 break;
230 }
231 }
232
233 const auto& ws = m_gpu_config.workgroup_size;
234 if (sz_x > 0) {
235 return {
236 static_cast<uint32_t>((sz_x + ws[0] - 1) / ws[0]),
237 sz_y > 0 ? static_cast<uint32_t>((sz_y + ws[1] - 1) / ws[1]) : 1U,
238 sz_z > 0 ? static_cast<uint32_t>((sz_z + ws[2] - 1) / ws[2]) : 1U,
239 };
240 }
241
242 return { static_cast<uint32_t>((total_elements + ws[0] - 1) / ws[0]), 1U, 1U };
243}
@ SPATIAL_X
Spatial X axis (images, tensors)

References MayaFlux::Yantra::DataStructureInfo::dimensions, m_gpu_config, MayaFlux::Kakshya::DataDimension::SPATIAL_X, MayaFlux::Kakshya::DataDimension::SPATIAL_Y, MayaFlux::Kakshya::DataDimension::SPATIAL_Z, and MayaFlux::Portal::Graphics::GpuComputeConfig::workgroup_size.

Referenced by dispatch_core(), dispatch_core_async(), dispatch_core_chained(), dispatch_core_chained_indirect(), and prepare_dependency().

+ Here is the caller graph for this function: