18 int partition_start = 0;
19 int partition_end = num_values;
22#ifndef __KERNEL_METAL__
28 partition_start = partition_size * local_id;
29 partition_end =
min(num_values, partition_start + partition_size);
32 for (
int i = partition_start; i < partition_end; i++) {
35 prefix_sum[local_id] = total;
41 const int new_offset = offset + prefix_sum[i];
42 prefix_sum[i] = offset;
48 offset = prefix_sum[local_id];
58 for (
int i = partition_start; i < partition_end; i++) {
59 const int new_offset = offset + counter[i];
60 prefix_sum[i] = offset;