Skip to main content

Module gpu_sort

Module gpu_sort 

Source
Expand description

GPU-style parallel sorting algorithms (CPU simulation).

This module provides GPU-pattern algorithms for sorting and related operations on f32/u32 data:

  • Bitonic sort (power-of-2 padded)
  • LSD radix sort for u32 and f32
  • Exclusive prefix sum (Blelloch scan style)
  • Parallel histogram
  • Counting sort
  • Morton Z-order sort for 3-D point clouds
  • GpuSortBuffer — key+value buffer with sort_pairs
  • Parallel merge

Structs§

GpuSortBuffer
A buffer abstraction that holds parallel key and value arrays.

Functions§

bitonic_sort
Sort a Vecf32` in ascending order using the bitonic sort algorithm.
bitonic_sort_by_key
Sort a VecTby theu32key returned bykey_fn`.
counting_sort
Counting sort for u32 values bounded by max_val (inclusive).
histogram
Compute a histogram of data into n_bins equal-width bins over \[min_val, max_val).
morton_sort_3d
Sort 3-D f32 points by their Morton Z-order (space-filling curve) code.
parallel_merge
Merge two sorted f32 slices into a new sorted Vecf32`.
prefix_sum
Exclusive prefix sum (Blelloch scan) for u32 values.
radix_sort_f32
Sort f32 values by reinterpreting bits and flipping the sign bit for negatives so that the full IEEE 754 ordering maps to unsigned integer order.
radix_sort_u32
LSD radix sort for u32 using 4 passes of 8-bit digits.