pub struct KeyValueSorter { /* private fields */ }Expand description
Performs a stable LSD radix sort of KeyValue items by key on a wgpu device.
Implementations§
Source§impl KeyValueSorter
impl KeyValueSorter
Sourcepub fn new(device: &Device, queue: &Queue) -> Self
pub fn new(device: &Device, queue: &Queue) -> Self
Creates a sorter that submits work through an existing wgpu device and queue.
Sourcepub fn new_for_adapter(
device: &Device,
queue: &Queue,
adapter_info: &AdapterInfo,
) -> Self
pub fn new_for_adapter( device: &Device, queue: &Queue, adapter_info: &AdapterInfo, ) -> Self
Creates a sorter specialized for the supplied adapter when a measured fast path is available.
Discrete NVIDIA Vulkan adapters with 32-wide subgroups use the 8-bit radix kernel. Other NVIDIA Vulkan devices use the 4-bit kernel, and all remaining adapters use the portable 2-bit kernel.
Sourcepub fn from_context(ctx: &Context) -> Self
pub fn from_context(ctx: &Context) -> Self
Creates a sorter from the crate’s optional convenience context.
Sourcepub async fn sort(&mut self, input: &[KeyValue]) -> Result<Vec<KeyValue>, Error>
pub async fn sort(&mut self, input: &[KeyValue]) -> Result<Vec<KeyValue>, Error>
Uploads items, stably sorts them by key, and downloads the result.
Sourcepub fn sort_gpu_to_gpu(
&mut self,
input: &Buffer,
output: &Buffer,
num_items: u32,
) -> Result<(), Error>
pub fn sort_gpu_to_gpu( &mut self, input: &Buffer, output: &Buffer, num_items: u32, ) -> Result<(), Error>
Stably sorts caller-owned GPU buffers and submits the work immediately.
Sourcepub async fn profile_sort_gpu_to_gpu(
&mut self,
input: &Buffer,
output: &Buffer,
num_items: u32,
) -> Result<GpuProfile, Error>
pub async fn profile_sort_gpu_to_gpu( &mut self, input: &Buffer, output: &Buffer, num_items: u32, ) -> Result<GpuProfile, Error>
Profiles a stable GPU-buffer key-value radix sort using GPU timestamps.
Sourcepub fn record_sort(
&mut self,
encoder: &mut CommandEncoder,
input: &Buffer,
output: &Buffer,
num_items: u32,
) -> Result<(), Error>
pub fn record_sort( &mut self, encoder: &mut CommandEncoder, input: &Buffer, output: &Buffer, num_items: u32, ) -> Result<(), Error>
Records a stable GPU key-value radix sort without submitting or waiting.