#[non_exhaustive]#[repr(u16)]pub enum ScanKind {
Cumsum = 0,
Cumprod = 1,
Cummax = 2,
Cummin = 3,
LogCumsumExp = 4,
}Expand description
Scan (associative prefix) op discriminant — category F from the comprehensive plan.
Stored as u16 in crate::KernelSku::op when
category == OpCategory::Scan. Output shape equals input shape —
scans are length-preserving along the scan axis (in contrast with
reductions, which collapse the axis to size 1). Inclusive scan by
default (PyTorch convention: y[i] = op(x[0], x[1], …, x[i])).
Direction is controlled by the descriptor’s reverse flag.
Today wired: {Cumsum} × {f32, f16, bf16, f64} (FW + BW) as the
scan trailblazer. Cumprod / Cummax / Cummin land in fanout;
LogCumsumExp and the JAX-style generic associative_scan are
reserved-but-deferred (numerics / generic-functor work).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Cumsum = 0
y[i] = Σ_{j ≤ i} x[j] — inclusive prefix sum.
Cumprod = 1
y[i] = ∏_{j ≤ i} x[j] — inclusive prefix product.
Cummax = 2
y[i] = max(x[0..=i]) — running maximum.
Cummin = 3
y[i] = min(x[0..=i]) — running minimum.
LogCumsumExp = 4
y[i] = log(Σ_{j ≤ i} exp(x[j])) — numerically stable (running
max subtraction). Reserved.