```ts
export function renderDataSize(total: number): string {
  if (!Number.isInteger(total) || total < 0) {
    throw new Error("Invalid input: count must be a non-negative integer.");
  }

  const ladder: [string, number][] = [
    ["GiB", 1024 ** 3],
    ["MiB", 1024 ** 2],
    ["KiB", 1024],
    ["B", 1],
  ];
  const parts: string[] = [];
  let rest = total;

  for (const [suffix, size] of ladder) {
    if (rest >= size) {
      const count = Math.floor(rest / size);
      parts.push(`${count}${suffix}`);
      rest -= count * size;
    }
  }

  return parts.join(" ") || "0B";
}
```