Skip to main content

Module sort

Module sort 

Source
Expand description

Sorting / order-statistics op family — Category O.

Phase 9 of the baracuda-kernels comprehensive plan. Ships the block-bitonic trailblazer family:

Saved-indices contract for sort / msort / topk / kthvalue BW. The FW emits both sorted values AND sorted indices in a single launch (FW Args carry values and indices as required outputs). BW Args receive the saved indices verbatim — no recomputation at BW time. The Plan’s selector pegs the indices dtype to i32 across every kernel SKU in this family.

Re-exports§

pub use argsort::ArgsortArgs;
pub use argsort::ArgsortDescriptor;
pub use argsort::ArgsortPlan;
pub use bincount::BincountArgs;
pub use bincount::BincountDescriptor;
pub use bincount::BincountPlan;
pub use histogram::HistogramArgs;
pub use histogram::HistogramDescriptor;
pub use histogram::HistogramPlan;
pub use histogramdd::HistogramddArgs;
pub use histogramdd::HistogramddDescriptor;
pub use histogramdd::HistogramddPlan;
pub use kthvalue::KthvalueArgs;
pub use kthvalue::KthvalueDescriptor;
pub use kthvalue::KthvaluePlan;
pub use kthvalue_backward::KthvalueBackwardArgs;
pub use kthvalue_backward::KthvalueBackwardDescriptor;
pub use kthvalue_backward::KthvalueBackwardPlan;
pub use msort::MsortArgs;
pub use msort::MsortBackwardArgs;
pub use msort::MsortBackwardDescriptor;
pub use msort::MsortBackwardPlan;
pub use msort::MsortDescriptor;
pub use msort::MsortPlan;
pub use searchsorted::SearchsortedArgs;
pub use searchsorted::SearchsortedDescriptor;
pub use searchsorted::SearchsortedPlan;
pub use sort::SortArgs;
pub use sort::SortDescriptor;
pub use sort::SortPlan;
pub use sort_backward::SortBackwardArgs;
pub use sort_backward::SortBackwardDescriptor;
pub use sort_backward::SortBackwardPlan;
pub use topk::TopkArgs;
pub use topk::TopkDescriptor;
pub use topk::TopkPlan;
pub use topk_backward::TopkBackwardArgs;
pub use topk_backward::TopkBackwardDescriptor;
pub use topk_backward::TopkBackwardPlan;
pub use unique::UniqueArgs;
pub use unique::UniqueDescriptor;
pub use unique::UniquePlan;
pub use unique_consecutive::UniqueConsecutiveArgs;
pub use unique_consecutive::UniqueConsecutiveDescriptor;
pub use unique_consecutive::UniqueConsecutivePlan;

Modules§

argsort
argsort plan — sorted indices only (no values output).
bincount
bincount plan — count occurrences of each integer in x.
histogram
histogram plan — 1-D uniform-bin atomic-accumulating histogram.
histogramdd
histogramdd plan — N-D histogram. Reserved for follow-up.
kthvalue
kthvalue plan — returns the k-th smallest value + its index along the last dimension.
kthvalue_backward
kthvalue_backward plan — scatter the scalar dy[batch] back to the saved-index position in dx[batch, row_len].
msort
msort (stable sort) plan + BW.
searchsorted
searchsorted plan — per-query binary search in a 1-D sorted array.
sort
sort plan — Category O trailblazer.
sort_backward
sort_backward plan — scatter dy via the saved indices.
topk
topk plan — block-bitonic top-k select.
topk_backward
topk_backward plan — scatter k-wide dy into row_len-wide dx via the saved indices. Launcher zeros dx first.
unique
unique plan — sort + consecutive-dedup composition.
unique_consecutive
unique_consecutive plan — emit one cell per run-start in each row.

Constants§

SORT_MAX_ROW
Maximum supported row_len in the block-bitonic trailblazer. Must match MAX_ROW in baracuda_sort.cuh.
TOPK_MAX_K
Maximum supported k in the block-bitonic topk trailblazer. Must match MAX_K in baracuda_topk.cuh.