pub struct SortPlan<T: Element> { /* private fields */ }Expand description
sort plan.
sort(x, dim=last, descending) — returns sorted values AND
sorted indices along the last axis (PyTorch torch.sort).
When to use: forward row-wise sort. Pair with
SortBackwardPlan for autograd; for
indices-only output use ArgsortPlan.
Dtypes: {f32, f64, i32, i64}; indices always i32.
Shape limits: rank-2 [batch, row_len]; row_len ≤ 1024
(one CUDA block per row, bitonic network in shared memory).
Larger rows return Unsupported — tile-radix follow-up reserved.
Workspace: none.
Precision guarantee: deterministic, bit-stable. Block-bitonic is a fixed comparator network — no atomics, no reductions.
Saved-indices contract: FW emits both values and indices
in a single launch. BW reads the saved indices verbatim; callers
must retain indices for autograd.
Implementations§
Source§impl<T: Element> SortPlan<T>
impl<T: Element> SortPlan<T>
Sourcepub fn select(
_stream: &Stream,
desc: &SortDescriptor,
_pref: PlanPreference,
) -> Result<Self>
pub fn select( _stream: &Stream, desc: &SortDescriptor, _pref: PlanPreference, ) -> Result<Self>
Pick a kernel for desc.
Sourcepub fn can_implement(&self, args: &SortArgs<'_, T>) -> Result<()>
pub fn can_implement(&self, args: &SortArgs<'_, T>) -> Result<()>
Validate args.
Sourcepub fn workspace_size(&self) -> usize
pub fn workspace_size(&self) -> usize
Workspace size in bytes.
Sourcepub fn precision_guarantee(&self) -> PrecisionGuarantee
pub fn precision_guarantee(&self) -> PrecisionGuarantee
Numerical guarantees for this plan’s kernel.