wgblas
    Preparing search index...
    • Calculates the number of workgroups to dispatch, clamped to the device's maxComputeWorkgroupsPerDimension limit (default 65535 across most devices).

      ONLY for shaders whose kernel is a grid-stride loop driven by num_workgroups — those re-walk the whole domain regardless of how many workgroups actually launch, so clamping costs a little parallelism and nothing else. A shader that indexes straight off workgroup_id or global_invocation_id silently drops every row past the clamp; those must use requireWorkgroups / requireWorkgroupCount instead.

      • 1D (pass only rows): returns a single count for dispatchWorkgroups(n).
      • 2D (pass both rows and cols): returns { x, y } for dispatchWorkgroups(x, y). rows maps to the y dimension and cols maps to the x dimension.

      Parameters

      • device: any
      • rows: number

        row count (1D: element count)

      • Optionalcols: number

        column count; omit for a 1D dispatch

      Returns number | { x: number; y: number }

      GPUSupportedLimits (maxComputeWorkgroupsPerDimension)