Skip to main content

Module elementwise

Module elementwise 

Source
Expand description

Elementwise op family — unified plan-based API.

Phase 3 of the baracuda-kernels comprehensive plan: every PyTorch torch.<op> and JAX jax.numpy.<op> / jax.lax.<op> for elementwise / shape / layout primitives lives here.

Today this module hosts the trailblazer dispatcher BinaryPlan — one Plan type per op category (unary / binary / ternary / gated / shape-layout), each parameterized on the scalar element type T and the tensor rank N. The op identity within a category is a runtime enum field on the descriptor (e.g. [BinaryKind]), dispatching to per-(op, dtype) kernel SKUs in baracuda-kernels-sys — exactly the shape used by the GEMM family’s crate::EpilogueKind.

Future modules: unary (categories B + B’), ternary (category D), gated (category C’), shape_layout (category N).

Re-exports§

pub use affine::AffineArgs;
pub use affine::AffineDescriptor;
pub use affine::AffinePlan;
pub use binary::BinaryArgs;
pub use binary::BinaryDescriptor;
pub use binary::BinaryPlan;
pub use cast::CastArgs;
pub use cast::CastDescriptor;
pub use cast::CastPlan;
pub use cast_subbyte::CastSubByteArgs;
pub use cast_subbyte::CastSubByteDescriptor;
pub use cast_subbyte::CastSubBytePlan;
pub use binary_backward::BinaryBackwardArgs;
pub use binary_backward::BinaryBackwardDescriptor;
pub use binary_backward::BinaryBackwardPlan;
pub use binary_cmp::BinaryCmpArgs;
pub use binary_cmp::BinaryCmpDescriptor;
pub use binary_cmp::BinaryCmpPlan;
pub use binary_param::BinaryParamArgs;
pub use binary_param::BinaryParamDescriptor;
pub use binary_param::BinaryParamPlan;
pub use binary_param_backward::BinaryParamBackwardArgs;
pub use binary_param_backward::BinaryParamBackwardDescriptor;
pub use binary_param_backward::BinaryParamBackwardPlan;
pub use gated_activation::GatedActivationArgs;
pub use gated_activation::GatedActivationDescriptor;
pub use gated_activation::GatedActivationPlan;
pub use gated_activation_backward::GatedActivationBackwardArgs;
pub use gated_activation_backward::GatedActivationBackwardDescriptor;
pub use gated_activation_backward::GatedActivationBackwardPlan;
pub use prelu::PReluArgs;
pub use prelu::PReluDescriptor;
pub use prelu::PReluPlan;
pub use prelu_backward::PReluBackwardArgs;
pub use prelu_backward::PReluBackwardDescriptor;
pub use prelu_backward::PReluBackwardPlan;
pub use ternary::TernaryArgs;
pub use ternary::TernaryDescriptor;
pub use ternary::TernaryPlan;
pub use ternary_backward::TernaryBackwardArgs;
pub use ternary_backward::TernaryBackwardDescriptor;
pub use ternary_backward::TernaryBackwardPlan;
pub use unary::UnaryArgs;
pub use unary::UnaryDescriptor;
pub use unary::UnaryPlan;
pub use unary_backward::UnaryBackwardArgs;
pub use unary_backward::UnaryBackwardDescriptor;
pub use unary_backward::UnaryBackwardPlan;
pub use unary_param::UnaryParamArgs;
pub use unary_param::UnaryParamDescriptor;
pub use unary_param::UnaryParamPlan;
pub use unary_param_backward::UnaryParamBackwardArgs;
pub use unary_param_backward::UnaryParamBackwardDescriptor;
pub use unary_param_backward::UnaryParamBackwardPlan;
pub use where_backward::WhereBackwardArgs;
pub use where_backward::WhereBackwardDescriptor;
pub use where_backward::WhereBackwardPlan;
pub use where_op::WhereArgs;
pub use where_op::WhereDescriptor;
pub use where_op::WherePlan;

Modules§

affine
Affine plan — fused y[i] = a * x[i] + b with scalar a, b.
binary
Binary elementwise plan.
binary_backward
Backward plan for the binary elementwise family.
binary_cmp
Binary comparison plan.
binary_param
Parameterized binary elementwise plan.
binary_param_backward
Backward plan for the parameterized binary elementwise family.
cast
Cast plan — heterogeneous dtype conversion (y = (TOut) x).
cast_subbyte
Sub-byte / non-arithmetic cast plan — sibling of crate::CastPlan.
gated_activation
Gated-activation forward plan (Phase 3 Category C′).
gated_activation_backward
Gated-activation backward plan (Phase 3 Category C′).
prelu
PReLU FW plan — Milestone 5.3.
prelu_backward
PReLU BW plan — Milestone 5.3.
ternary
Ternary elementwise plan.
ternary_backward
Backward plan for the ternary elementwise family.
unary
Unary elementwise plan.
unary_backward
Backward plan for the unary elementwise family.
unary_param
Parameterized unary elementwise plan.
unary_param_backward
Backward plan for the parameterized unary elementwise family.
where_backward
Heterogeneous-dtype ternary BW plan: where_backward(cond, dy).
where_op
Heterogeneous-dtype ternary plan: where(cond, a, b).