ggml_vulkan_split_row_ranges: Compute tensor-parallel row-split ranges

View source: R/vulkan.R

ggml_vulkan_split_row_rangesR Documentation

Compute tensor-parallel row-split ranges

Description

Pure arithmetic helper for the Vulkan tensor-parallel split buffer type: given a number of tensor rows and a per-device weight vector, returns the half-open row range [row_low, row_high) owned by each device. Row boundaries are rounded down to a fixed granularity, and the last device always covers up to nrows, so the ranges are contiguous, non-overlapping and cover every row exactly once.

Usage

ggml_vulkan_split_row_ranges(nrows, n_devices, weights = NULL)

Arguments

nrows

Number of rows in the tensor (integer).

n_devices

Number of devices to split across (integer, >= 1).

weights

Optional numeric vector of length n_devices giving the relative share of rows per device. NULL (default) splits evenly.

Details

This touches no GPU and is exposed mainly to verify the split logic. It is the math behind row-split tensor parallelism (a weight matrix distributed across several GPUs), independent of any actual multi-GPU allocation.

Value

A named list with row_low and row_high: numeric vectors of length n_devices holding 0-based, half-open row ranges.

Examples


if (ggml_vulkan_available()) {
  # 4096 rows across 2 devices, evenly
  ggml_vulkan_split_row_ranges(4096L, 2L)
  # weighted 3:1
  ggml_vulkan_split_row_ranges(4096L, 2L, weights = c(3, 1))
}


ggmlR documentation built on July 14, 2026, 1:08 a.m.